[libgetdata] 01/01: upstream release 0.10.0

Alastair McKinstry mckinstry at moszumanska.debian.org
Wed May 3 10:35:13 UTC 2017


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

mckinstry pushed a commit to tag upstreamn/0.10.0
in repository libgetdata.

commit 8ba32bf5b1c9f0a10998b62cef6c1ecdf11816ce
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Wed May 3 11:34:44 2017 +0100

    upstream release 0.10.0
---
 ChangeLog                                    | 1131 +++-
 Makefile.am                                  |    9 +-
 Makefile.in                                  |   11 +-
 NEWS                                         |  419 +-
 README                                       |  171 +-
 TODO                                         |    2 -
 bindings/Makefile.am                         |    4 +-
 bindings/Makefile.in                         |    8 +-
 bindings/cxx/Makefile.am                     |    9 +-
 bindings/cxx/Makefile.in                     |   21 +-
 bindings/cxx/dirfile.cpp                     |   56 +-
 bindings/cxx/entry.cpp                       |    6 +
 bindings/cxx/fragment.cpp                    |   17 +-
 bindings/cxx/getdata/dirfile.h               |   30 +-
 bindings/cxx/getdata/entry.h                 |    6 +-
 bindings/cxx/getdata/fragment.h              |    5 +
 bindings/cxx/getdata/indirentry.h            |   52 +
 bindings/cxx/getdata/mplexentry.h            |    2 +-
 bindings/cxx/getdata/phaseentry.h            |    6 +-
 bindings/cxx/getdata/sarrayentry.h           |   50 +
 bindings/cxx/getdata/sindirentry.h           |   52 +
 bindings/cxx/getdata/types.h                 |    8 +-
 bindings/cxx/indirentry.cpp                  |   52 +
 bindings/cxx/phaseentry.cpp                  |    4 +-
 bindings/cxx/sarrayentry.cpp                 |   40 +
 bindings/cxx/sindirentry.cpp                 |   52 +
 bindings/cxx/test/Makefile.in                |    2 +
 bindings/cxx/test/big_test.cpp               |  389 +-
 bindings/f77/Makefile.in                     |    2 +
 bindings/f77/fgetdata.c                      |  631 ++-
 bindings/f77/fgetdata.h                      |  152 +-
 bindings/f77/getdata.f.in                    |   57 +
 bindings/f77/getdata.f90.in                  |  325 +-
 bindings/f77/test/Makefile.in                |    2 +
 bindings/f77/test/big_test.f                 |  417 +-
 bindings/f77/test/big_test95.f90             |  327 +-
 bindings/idl/Makefile.in                     |    2 +
 bindings/idl/getdata.c                       |  450 +-
 bindings/idl/test/Makefile.in                |    2 +
 bindings/idl/test/big_test.pro               |  231 +-
 bindings/make_parameters.c                   |   12 +
 bindings/matlab/Makefile.am                  |   51 +-
 bindings/matlab/Makefile.in                  |   53 +-
 bindings/matlab/doc.tail                     |    2 +-
 bindings/matlab/gd_add_indir.m               |   39 +
 bindings/matlab/gd_add_sarray.c              |   60 +
 bindings/matlab/gd_add_sindir.m              |   39 +
 bindings/matlab/gd_alter_indir.m             |   39 +
 bindings/matlab/gd_alter_sarray.m            |   39 +
 bindings/matlab/gd_alter_sindir.m            |   39 +
 bindings/matlab/gd_entry_list.c              |    4 +-
 bindings/matlab/gd_error_string.c            |    4 +-
 bindings/matlab/gd_field_list.m              |    4 +-
 bindings/matlab/gd_field_list_by_type.m      |    4 +-
 bindings/matlab/gd_fragment_affixes.c        |    6 +-
 bindings/matlab/gd_fragment_namespace.c      |   60 +
 bindings/matlab/gd_get_sarray.c              |   62 +
 bindings/matlab/gd_get_sarray_slice.c        |   63 +
 bindings/matlab/gd_getdata.c                 |   17 +-
 bindings/matlab/gd_include.c                 |   36 +-
 bindings/matlab/gd_include_affix.c           |   71 +
 bindings/matlab/gd_invalid_dirfile.c         |    4 +-
 bindings/matlab/gd_linterp_tablename.c       |    6 +-
 bindings/matlab/gd_madd_indir.m              |   38 +
 bindings/matlab/gd_madd_sarray.c             |   60 +
 bindings/matlab/gd_madd_sindir.m             |   38 +
 bindings/matlab/gd_match_entries.c           |   73 +
 bindings/matlab/gd_matlab.h                  |    5 +-
 bindings/matlab/gd_mfield_list.m             |    4 +-
 bindings/matlab/gd_mfield_list_by_type.m     |    4 +-
 bindings/matlab/gd_msarrays.c                |   59 +
 bindings/matlab/gd_mvector_list.m            |    4 +-
 bindings/matlab/gd_nentries.c                |   12 +-
 bindings/matlab/gd_nfields.m                 |    4 +-
 bindings/matlab/gd_nfields_by_type.m         |    4 +-
 bindings/matlab/gd_nmfields.m                |    4 +-
 bindings/matlab/gd_nmfields_by_type.m        |    4 +-
 bindings/matlab/gd_nmvectors.m               |    4 +-
 bindings/matlab/gd_nvectors.m                |    4 +-
 bindings/matlab/gd_open.c                    |    4 +-
 bindings/matlab/gd_put_sarray.m              |   31 +
 bindings/matlab/gd_put_sarray_slice.c        |   59 +
 bindings/matlab/gd_raw_filename.c            |    6 +-
 bindings/matlab/gd_sarrays.c                 |   55 +
 bindings/matlab/gd_strtok.c                  |    4 +-
 bindings/matlab/gd_vector_list.m             |    4 +-
 bindings/matlab/getdata_constants.m          |   96 +-
 bindings/matlab/matlab.c                     |   75 +-
 bindings/matlab/test/Makefile.in             |    2 +
 bindings/matlab/test/big_test.m              |  350 +-
 bindings/perl/GetData.pm.in                  |   39 +-
 bindings/perl/Makefile.in                    |    2 +
 bindings/perl/simple_funcs.pl                |    4 +-
 bindings/perl/simple_funcs.xsin              |   29 +-
 bindings/perl/src/GetData.xs                 |  622 ++-
 bindings/perl/src/Makefile.PL.in             |    2 -
 bindings/perl/src/typemap                    |   37 +-
 bindings/perl/t/big_test.t                   |  301 +-
 bindings/php/Makefile.in                     |    2 +
 bindings/php/getdata.c                       |  556 +-
 bindings/php/test/Makefile.in                |    2 +
 bindings/php/test/big_test.php               |  284 +-
 bindings/python/Makefile.in                  |    2 +
 bindings/python/gdpy_intern.h                |    2 +-
 bindings/python/pydirfile.c                  |  505 +-
 bindings/python/pyentry.c                    |  156 +-
 bindings/python/pyfragment.c                 |   80 +-
 bindings/python/pygetdata.c                  |  109 +-
 bindings/python/test/Makefile.in             |    2 +
 bindings/python/test/big_test.py             |  286 +-
 configure                                    |  345 +-
 configure.ac                                 |  133 +-
 doc/Makefile.in                              |    2 +
 doc/README.cxx                               |    5 +-
 doc/README.f77                               |   61 +-
 doc/README.f95                               |   36 +-
 doc/README.idl                               |   39 +-
 doc/README.python                            |    5 +-
 m4/perl.m4                                   |   22 +-
 m4/version.m4                                |   20 +-
 man/GD_SIZE.3                                |  126 +-
 man/Makefile.am                              |   84 +-
 man/Makefile.in                              |  101 +-
 man/dirfile-encoding.5                       |    7 +-
 man/dirfile-format.5                         |  586 ++-
 man/dirfile.5                                |   52 +-
 man/gd_add.3                                 |  310 +-
 man/gd_add_alias.3                           |  182 +-
 man/gd_add_bit.3                             |  363 +-
 man/gd_add_spec.3                            |  239 +-
 man/gd_alias_target.3                        |  140 +-
 man/gd_aliases.3                             |  139 +-
 man/gd_alloc_funcs.3                         |  164 +
 man/gd_alter_affixes.3                       |  205 +-
 man/gd_alter_bit.3                           |  355 +-
 man/gd_alter_encoding.3.in                   |  153 -
 man/gd_alter_encoding.3in.in                 |  162 +
 man/gd_alter_endianness.3.in                 |  167 -
 man/gd_alter_endianness.3in.in               |  174 +
 man/gd_alter_entry.3                         |  320 +-
 man/gd_alter_frameoffset.3.in                |  146 -
 man/gd_alter_frameoffset.3in.in              |  151 +
 man/gd_alter_protection.3                    |  172 +-
 man/gd_alter_spec.3                          |  224 +-
 man/gd_array_len.3                           |  174 +-
 man/gd_bof.3                                 |  197 +-
 man/gd_bof64.3                               |  115 +-
 man/gd_carrays.3                             |  253 +-
 man/gd_cbopen.3                              |  731 ---
 man/gd_close.3                               |  219 +-
 man/gd_constants.3                           |  226 +-
 man/gd_delete.3                              |  204 +-
 man/gd_desync.3                              |  193 +-
 man/gd_dirfile_standards.3                   |  183 +-
 man/gd_dirfilename.3                         |  134 +-
 man/gd_encoding.3                            |  158 +-
 man/gd_encoding_support.3                    |  131 +-
 man/gd_endianness.3                          |  167 +-
 man/gd_entry.3                               |  749 +--
 man/gd_entry_list.3                          |  231 +-
 man/gd_entry_type.3                          |  159 +-
 man/gd_eof.3                                 |  213 +-
 man/gd_eof64.3                               |  117 +-
 man/gd_error.3                               |  195 +-
 man/gd_error_count.3                         |  112 +-
 man/gd_error_string.3                        |   73 -
 man/gd_flags.3                               |  137 +-
 man/gd_flush.3                               |  195 +-
 man/gd_fragment_affixes.3                    |  171 +-
 man/gd_fragment_index.3                      |  158 +-
 man/gd_fragment_namespace.3                  |  187 +
 man/gd_fragmentname.3                        |  156 +-
 man/gd_framenum_subset.3                     |  199 +-
 man/gd_framenum_subset64.3                   |  115 +-
 man/gd_frameoffset.3                         |  148 +-
 man/gd_frameoffset64.3                       |  121 +-
 man/gd_free_entry_strings.3                  |  148 +-
 man/gd_get_carray_slice.3                    |  271 +-
 man/gd_get_sarray_slice.3                    |  222 +
 man/gd_get_string.3                          |  233 +-
 man/gd_getdata.3                             |  456 +-
 man/gd_getdata64.3                           |  117 +-
 man/gd_hidden.3                              |  175 +-
 man/gd_hide.3                                |  180 +-
 man/gd_include.3                             |  424 ++
 man/gd_include_affix.3                       |  354 --
 man/gd_invalid_dirfile.3                     |  127 +-
 man/gd_linterp_tablename.3                   |  165 +-
 man/gd_madd_bit.3                            |  351 +-
 man/gd_match_entries.3                       |  361 ++
 man/gd_mcarrays.3                            |  147 -
 man/gd_metaflush.3                           |  160 +-
 man/gd_move.3                                |  204 +-
 man/gd_mplex_lookback.3                      |  110 +-
 man/gd_mstrings.3                            |   98 -
 man/gd_naliases.3                            |  138 +-
 man/gd_native_type.3                         |  233 +-
 man/gd_nentries.3                            |  228 +-
 man/gd_nfragments.3                          |  139 +-
 man/gd_nframes.3                             |  172 +-
 man/gd_nframes64.3                           |  115 +-
 man/gd_open.3                                |  817 +++
 man/gd_parent_fragment.3                     |  144 +-
 man/gd_parser_callback.3                     |  119 +-
 man/gd_protection.3                          |  158 +-
 man/gd_put_carray_slice.3                    |  273 +-
 man/gd_put_sarray_slice.3                    |  223 +
 man/gd_put_string.3                          |  216 +-
 man/gd_putdata.3                             |  323 +-
 man/gd_putdata64.3                           |  120 +-
 man/gd_raw_filename.3                        |  172 +-
 man/gd_reference.3                           |  150 +-
 man/gd_rename.3                              |  196 +-
 man/gd_rewrite_fragment.3                    |  153 +-
 man/gd_sarrays.3                             |  205 +
 man/gd_seek.3                                |  235 +-
 man/gd_seek64.3                              |  118 +-
 man/gd_spf.3                                 |  167 +-
 man/gd_strings.3                             |  211 +-
 man/gd_strtok.3                              |  164 +-
 man/gd_tell.3                                |  170 +-
 man/gd_tell64.3                              |  120 +-
 man/gd_uninclude.3                           |  185 +-
 man/gd_validate.3                            |  157 +-
 man/gd_verbose_prefix.3                      |  141 +-
 man/header.tmac                              |   75 +
 src/Makefile.am                              |   12 +-
 src/Makefile.in                              |   35 +-
 src/add.c                                    | 1517 +++---
 src/ascii.c                                  |   17 +-
 src/bzip.c                                   |   63 +-
 src/close.c                                  |   64 +-
 src/common.c                                 |  412 +-
 src/compat.c                                 |   33 +-
 src/constant.c                               |  185 +-
 src/del.c                                    |  229 +-
 src/encoding.c                               |   74 +-
 src/endian.c                                 |   41 +-
 src/entry.c                                  |  522 +-
 src/errors.c                                 |   26 +-
 src/field_list.c                             |  465 +-
 src/flac.c                                   |   90 +-
 src/flimits.c                                |  161 +-
 src/flush.c                                  |  564 +-
 src/fragment.c                               |  782 ++-
 src/gd_config.h.in                           |   33 +-
 src/getdata.c                                |  397 +-
 src/getdata.h.in                             |  346 +-
 src/globals.c                                |   67 +-
 src/gzip.c                                   |   50 +-
 src/include.c                                |  473 +-
 src/index.c                                  |   23 +-
 src/internal.h                               |  196 +-
 src/iopos.c                                  |  221 +-
 src/legacy.c                                 |   30 +-
 src/lzma.c                                   |  145 +-
 src/mod.c                                    |  500 +-
 src/move.c                                   |   99 +-
 src/name.c                                   | 1423 ++---
 src/native.c                                 |   75 +-
 src/nfields.c                                |   53 +-
 src/nframes.c                                |   28 +-
 src/open.c                                   |  160 +-
 src/parse.c                                  |  514 +-
 src/protect.c                                |   55 +-
 src/putdata.c                                |   92 +-
 src/sie.c                                    |    8 +-
 src/spf.c                                    |   22 +-
 src/string.c                                 |  174 +-
 src/types.c                                  |   26 +-
 src/zzip.c                                   |    2 +-
 test/Makefile.am                             |  578 ++-
 test/Makefile.in                             | 7189 +++++++++++++++++++++-----
 test/add_affix.c                             |   14 +-
 test/add_alias_index.c                       |   44 +
 test/add_alias_name.c                        |   44 +
 test/add_alias_ns.c                          |   57 +
 test/add_alias_prot.c                        |   45 +
 test/add_alias_rdonly.c                      |   47 +
 test/add_bit_inaff.c                         |   46 +
 test/add_carray_entry.c                      |   67 +
 test/add_carray_type.c                       |   44 +
 test/add_clincom_nfields.c                   |   51 +
 test/add_code.c                              |    8 +-
 test/add_const_type.c                        |   52 +
 test/add_cpolynom.c                          |   28 +-
 test/add_cpolynom_order.c                    |   51 +
 test/add_divide_inaff1.c                     |   46 +
 test/add_divide_inaff2.c                     |   46 +
 test/add_dot10.c                             |   75 +
 test/add_dot5.c                              |    1 -
 test/add_duplicate.c                         |   18 +-
 test/add_indir.c                             |   61 +
 test/add_lincom_nfields2.c                   |   49 +
 test/add_linterp_inaff.c                     |   46 +
 test/add_meta_parent.c                       |   51 +
 test/add_mplex_inaff.c                       |   50 +
 test/add_mplex_period.c                      |   42 +
 test/add_name_len.c                          |   50 +
 test/add_ns.c                                |   50 +
 test/add_ns_frag.c                           |   54 +
 test/add_ns_frag2.c                          |   54 +
 test/add_phase_inaff.c                       |   46 +
 test/add_polynom.c                           |   22 +-
 test/add_polynom_inaff.c                     |   46 +
 test/add_polynom_order.c                     |   44 +
 test/add_polynom_order2.c                    |   50 +
 test/add_protect.c                           |   18 +-
 test/add_raw_prot.c                          |   46 +
 test/add_raw_sub.c                           |   27 +-
 test/add_rdonly.c                            |   18 +-
 test/add_recip_inaff.c                       |   46 +
 test/add_sarray.c                            |   72 +
 test/add_sarray_dup.c                        |   43 +
 test/add_sarray_nil.c                        |   71 +
 test/add_sindir.c                            |   57 +
 test/add_spec_affix.c                        |   52 +
 test/add_spec_index.c                        |   47 +
 test/add_spec_nil.c                          |   41 +
 test/add_spec_prot.c                         |   48 +
 test/add_spec_raw_autoenc.c                  |   51 +
 test/add_spec_raw_prot.c                     |   48 +
 test/add_spec_raw_unkenc.c                   |   51 +
 test/add_string_affix.c                      |   14 +-
 test/add_string_dup.c                        |   41 +
 test/add_string_entry.c                      |   60 +
 test/add_window_inaff.c                      |   52 +
 test/alias_list.c                            |   24 +-
 test/alias_list_alias.c                      |   24 +-
 test/alias_list_missing.c                    |   22 +-
 test/alias_num.c                             |   24 +-
 test/alias_num_alias.c                       |   24 +-
 test/alias_num_missing.c                     |   22 +-
 test/alias_target.c                          |   11 +-
 test/alias_target_alias.c                    |   11 +-
 test/alias_target_missing.c                  |   11 +-
 test/alloc_affix.c                           |   80 +
 test/alloc_callback.c                        |   68 +
 test/alloc_clear.c                           |  100 +
 test/alloc_entry.c                           |  132 +
 test/alloc_tok.c                             |   67 +
 test/alter_bit_bitnum.c                      |   29 +-
 test/alter_bit_in.c                          |   52 +
 test/alter_bit_numbits.c                     |   29 +-
 test/alter_bit_scalar.c                      |   60 +
 test/alter_carray_len.c                      |   20 +-
 test/alter_carray_type.c                     |   50 +-
 test/alter_clincom.c                         |   33 +-
 test/alter_clincom_32.c                      |   62 +
 test/alter_clincom_nfields.c                 |   49 +
 test/alter_clincom_nfields_code.c            |   44 +
 test/alter_clincom_null.c                    |   59 +
 test/alter_code.c                            |   48 +
 test/alter_const.c                           |   20 +-
 test/alter_const_c2r.c                       |   20 +-
 test/alter_const_r2c.c                       |   20 +-
 test/alter_const_r2r.c                       |   20 +-
 test/alter_const_type.c                      |   47 +
 test/alter_cpolynom.c                        |   33 +-
 test/alter_cpolynom_null.c                   |   25 +-
 test/alter_cpolynom_ord.c                    |   48 +
 test/alter_cpolynom_ord_code.c               |   42 +
 test/alter_crecip.c                          |   33 +-
 test/alter_crecip89.c                        |   33 +-
 test/alter_crecip89_null.c                   |   33 +-
 test/alter_crecip_zero.c                     |   33 +-
 test/alter_divide.c                          |   33 +-
 test/alter_divide_in.c                       |   54 +
 test/alter_entry.c                           |   28 +-
 test/alter_entry_affix.c                     |   26 +-
 test/alter_entry_entype.c                    |   53 +
 test/alter_entry_hidden.c                    |   20 +-
 test/alter_entry_lincom.c                    |   19 +-
 test/alter_entry_lincom_nfields.c            |   53 +
 test/alter_entry_recode.c                    |   27 +-
 test/alter_entry_recode_recalc.c             |   34 +-
 test/alter_entry_sarray.c                    |   62 +
 test/alter_entry_scalar1.c                   |   19 +-
 test/alter_entry_scalar2a.c                  |   23 +-
 test/alter_entry_scalar2n.c                  |   28 +-
 test/alter_entry_scalar3.c                   |   19 +-
 test/alter_entry_scalar3c.c                  |   11 +-
 test/alter_entry_scalar3i.c                  |   19 +-
 test/alter_entry_scalar3r.c                  |   11 +-
 test/alter_entry_scalar4.c                   |   19 +-
 test/alter_entry_scalar_amb.c                |   21 +-
 test/alter_index.c                           |   17 +-
 test/alter_indir.c                           |   55 +
 test/alter_lincom_23.c                       |   33 +-
 test/alter_lincom_32.c                       |   33 +-
 test/alter_lincom_affix.c                    |   39 +-
 test/alter_lincom_input.c                    |   33 +-
 test/alter_lincom_nfields.c                  |   49 +
 test/alter_lincom_nfields_code.c             |   44 +
 test/alter_lincom_offset.c                   |   33 +-
 test/alter_lincom_scalar.c                   |   64 +
 test/alter_lincom_slope.c                    |   33 +-
 test/alter_linterp.c                         |   41 +-
 test/alter_linterp_in.c                      |   56 +
 test/alter_linterp_move.c                    |   41 +-
 test/alter_mplex.c                           |   35 +-
 test/alter_mplex_in.c                        |   53 +
 test/alter_mplex_scalar.c                    |   70 +
 test/alter_mspec.c                           |   29 +-
 test/alter_mspec_affix.c                     |   26 +-
 test/alter_multiply.c                        |   33 +-
 test/alter_phase.c                           |   29 +-
 test/alter_phase_in.c                        |   53 +
 test/alter_phase_scalar.c                    |   65 +
 test/alter_polynom_coeff.c                   |   34 +-
 test/alter_polynom_input.c                   |   33 +-
 test/alter_polynom_ord.c                     |   33 +-
 test/alter_polynom_ord2.c                    |   48 +
 test/alter_polynom_ord_code.c                |   42 +
 test/alter_polynom_scalar.c                  |   62 +
 test/alter_prot.c                            |   48 +
 test/alter_raw_prot.c                        |   50 +
 test/alter_raw_spf.c                         |   27 +-
 test/alter_raw_spf_type.c                    |  108 +
 test/alter_raw_type.c                        |   48 +-
 test/alter_rdonly.c                          |   48 +
 test/alter_recip.c                           |   33 +-
 test/alter_recip_scalar.c                    |   57 +
 test/alter_recip_zero.c                      |   33 +-
 test/alter_sarray.c                          |   58 +
 test/alter_sarray_nop.c                      |   49 +
 test/alter_sbit.c                            |   55 +
 test/alter_scalar_affix.c                    |   34 +-
 test/alter_sindir.c                          |   55 +
 test/alter_spec.c                            |   27 +-
 test/alter_spec_affix.c                      |   26 +-
 test/alter_spec_code.c                       |   43 +
 test/alter_spec_format.c                     |   46 +
 test/alter_spec_meta.c                       |   29 +-
 test/alter_spec_nil.c                        |   43 +
 test/alter_spec_polynom.c                    |   20 +-
 test/alter_spec_prot.c                       |   45 +
 test/alter_spec_rdonly.c                     |   45 +
 test/alter_window.c                          |   29 +-
 test/alter_window_in.c                       |   54 +
 test/alter_window_op.c                       |   69 +
 test/alter_window_scalar.c                   |   65 +
 test/ascii_complex128.c                      |   26 +
 test/ascii_complex64.c                       |   26 +
 test/ascii_float32.c                         |   26 +
 test/ascii_float64.c                         |   26 +
 test/ascii_get.c                             |   19 +-
 test/ascii_get_complex.c                     |   19 +-
 test/ascii_get_get.c                         |   19 +-
 test/ascii_get_here.c                        |   11 +-
 test/ascii_get_sub.c                         |   27 +-
 test/ascii_int16.c                           |   26 +
 test/ascii_int32.c                           |   26 +
 test/ascii_int64.c                           |   26 +
 test/ascii_int8.c                            |   26 +
 test/ascii_nframes.c                         |   16 +-
 test/ascii_put.c                             |   20 +-
 test/ascii_put_here.c                        |   20 +-
 test/ascii_seek.c                            |   11 +-
 test/ascii_seek_far.c                        |   11 +-
 test/ascii_sync.c                            |   20 +-
 test/ascii_uint16.c                          |   26 +
 test/ascii_uint32.c                          |   26 +
 test/ascii_uint64.c                          |   26 +
 test/ascii_uint8.c                           |   26 +
 test/bof.c                                   |   23 +-
 test/bof_bit.c                               |   30 +-
 test/bof_bit_code.c                          |   46 +
 test/bof_code.c                              |   46 +
 test/bof_const.c                             |   46 +
 test/bof_index.c                             |   23 +-
 test/bof_lincom.c                            |   35 +-
 test/bof_lincom_code.c                       |   58 +
 test/bof_phase.c                             |   41 +-
 test/bof_phase_code.c                        |   46 +
 test/bof_phase_neg.c                         |   41 +-
 test/bof_recurse.c                           |   45 +
 test/bzip_add.c                              |   55 +-
 test/bzip_complex128.c                       |   30 +
 test/bzip_complex64.c                        |   30 +
 test/bzip_del.c                              |   34 +
 test/bzip_enoent.c                           |   33 +
 test/bzip_float32.c                          |   30 +
 test/bzip_float64.c                          |   30 +
 test/bzip_get.c                              |   29 +-
 test/bzip_get_cont.c                         |   31 +
 test/bzip_get_far.c                          |   20 +-
 test/bzip_get_get.c                          |   20 +-
 test/bzip_get_get2.c                         |   20 +-
 test/bzip_get_put.c                          |    9 +-
 test/bzip_int16.c                            |   30 +
 test/bzip_int32.c                            |   30 +
 test/bzip_int64.c                            |   30 +
 test/bzip_int8.c                             |   30 +
 test/bzip_move_from.c                        |  109 +-
 test/bzip_move_to.c                          |    9 +-
 test/bzip_nframes.c                          |   73 +-
 test/bzip_put.c                              |    9 +-
 test/bzip_put_back.c                         |    9 +-
 test/bzip_put_endian.c                       |   20 +-
 test/bzip_put_get.c                          |   11 +-
 test/bzip_put_offs.c                         |   31 +
 test/bzip_put_pad.c                          |    9 +-
 test/bzip_put_sub.c                          |   17 +-
 test/bzip_seek.c                             |   60 +-
 test/bzip_seek_far.c                         |   20 +-
 test/bzip_sync.c                             |    9 +-
 test/bzip_uint16.c                           |   30 +
 test/bzip_uint32.c                           |   30 +
 test/bzip_uint64.c                           |   30 +
 test/bzip_uint8.c                            |   30 +
 test/calist.c                                |   66 +
 test/calist0.c                               |   49 +
 test/calist_free.c                           |   76 +
 test/calist_hidden.c                         |   65 +
 test/calist_long.c                           |   80 +
 test/calist_meta.c                           |   66 +
 test/calist_meta0.c                          |   52 +
 test/calist_meta_free.c                      |   77 +
 test/calist_meta_hidden.c                    |   65 +
 test/calist_meta_meta.c                      |   56 +
 test/calist_meta_parent.c                    |   46 +
 test/calist_null.c                           |   64 +
 test/close_close.c                           |   12 +-
 test/close_discard.c                         |   13 +-
 test/convert_complex128_complex64.c          |   37 +-
 test/convert_complex128_float64.c            |   20 +-
 test/convert_complex128_int64.c              |   19 +-
 test/convert_complex128_uint64.c             |   19 +-
 test/convert_complex64_complex128.c          |   36 +-
 test/convert_complex64_float64.c             |   20 +-
 test/convert_complex64_int64.c               |   19 +-
 test/convert_complex64_uint64.c              |   19 +-
 test/convert_float32_complex128.c            |   29 +-
 test/convert_float32_complex64.c             |   29 +-
 test/convert_float32_float64.c               |   29 +-
 test/convert_float32_int16.c                 |   28 +-
 test/convert_float32_int32.c                 |   28 +-
 test/convert_float32_int64.c                 |   28 +-
 test/convert_float32_int8.c                  |   28 +-
 test/convert_float32_uint16.c                |   28 +-
 test/convert_float32_uint32.c                |   28 +-
 test/convert_float32_uint64.c                |   28 +-
 test/convert_float32_uint8.c                 |   28 +-
 test/convert_float64_complex128.c            |   29 +-
 test/convert_float64_complex64.c             |   29 +-
 test/convert_float64_float32.c               |   29 +-
 test/convert_float64_int16.c                 |   28 +-
 test/convert_float64_int32.c                 |   28 +-
 test/convert_float64_int64.c                 |   42 +-
 test/convert_float64_int8.c                  |   28 +-
 test/convert_float64_uint16.c                |   28 +-
 test/convert_float64_uint32.c                |   28 +-
 test/convert_float64_uint64.c                |   28 +-
 test/convert_float64_uint8.c                 |   28 +-
 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                   |   28 +-
 test/convert_int16_int64.c                   |   28 +-
 test/convert_int16_int8.c                    |   28 +-
 test/convert_int16_uint16.c                  |   28 +-
 test/convert_int16_uint32.c                  |   28 +-
 test/convert_int16_uint64.c                  |   28 +-
 test/convert_int16_uint8.c                   |   28 +-
 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                   |   28 +-
 test/convert_int32_int64.c                   |   28 +-
 test/convert_int32_int8.c                    |   28 +-
 test/convert_int32_uint16.c                  |   28 +-
 test/convert_int32_uint32.c                  |   28 +-
 test/convert_int32_uint64.c                  |   28 +-
 test/convert_int32_uint8.c                   |   28 +-
 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                   |   28 +-
 test/convert_int64_int32.c                   |   28 +-
 test/convert_int64_int8.c                    |   28 +-
 test/convert_int64_uint16.c                  |   28 +-
 test/convert_int64_uint32.c                  |   28 +-
 test/convert_int64_uint64.c                  |   28 +-
 test/convert_int64_uint8.c                   |   28 +-
 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                    |   28 +-
 test/convert_int8_int32.c                    |   28 +-
 test/convert_int8_int64.c                    |   28 +-
 test/convert_int8_uint16.c                   |   28 +-
 test/convert_int8_uint32.c                   |   28 +-
 test/convert_int8_uint64.c                   |   28 +-
 test/convert_int8_uint8.c                    |   28 +-
 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                  |   28 +-
 test/convert_uint16_int32.c                  |   28 +-
 test/convert_uint16_int64.c                  |   28 +-
 test/convert_uint16_int8.c                   |   28 +-
 test/convert_uint16_uint32.c                 |   28 +-
 test/convert_uint16_uint64.c                 |   28 +-
 test/convert_uint16_uint8.c                  |   28 +-
 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                  |   28 +-
 test/convert_uint32_int32.c                  |   28 +-
 test/convert_uint32_int64.c                  |   28 +-
 test/convert_uint32_int8.c                   |   28 +-
 test/convert_uint32_uint16.c                 |   28 +-
 test/convert_uint32_uint64.c                 |   28 +-
 test/convert_uint32_uint8.c                  |   28 +-
 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                  |   28 +-
 test/convert_uint64_int32.c                  |   28 +-
 test/convert_uint64_int64.c                  |   28 +-
 test/convert_uint64_int8.c                   |   28 +-
 test/convert_uint64_uint16.c                 |   28 +-
 test/convert_uint64_uint32.c                 |   28 +-
 test/convert_uint64_uint8.c                  |   28 +-
 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                   |   28 +-
 test/convert_uint8_int32.c                   |   28 +-
 test/convert_uint8_int64.c                   |   28 +-
 test/convert_uint8_int8.c                    |   28 +-
 test/convert_uint8_uint16.c                  |   29 +-
 test/convert_uint8_uint32.c                  |   29 +-
 test/convert_uint8_uint64.c                  |   29 +-
 test/creat_excl.c                            |   12 +-
 test/creat_rdonly_exists.c                   |   13 +-
 test/cvlist.c                                |   27 +-
 test/cvlist_array.c                          |   77 -
 test/cvlist_array0.c                         |   61 -
 test/cvlist_array_free.c                     |   87 -
 test/cvlist_array_hidden.c                   |   67 -
 test/cvlist_array_meta.c                     |   78 -
 test/cvlist_array_meta0.c                    |   64 -
 test/cvlist_array_meta_free.c                |   88 -
 test/cvlist_array_meta_hidden.c              |   68 -
 test/cvlist_array_null.c                     |   66 -
 test/cvlist_hidden.c                         |   24 +-
 test/cvlist_long.c                           |   76 +
 test/cvlist_meta.c                           |   29 +-
 test/cvlist_meta0.c                          |   25 +-
 test/cvlist_meta_code.c                      |   49 +
 test/cvlist_meta_hidden.c                    |   22 +-
 test/cvlist_meta_parent.c                    |   46 +
 test/cvlist_null.c                           |   20 +-
 test/del_alias.c                             |   24 +-
 test/del_alias_dangle.c                      |   54 +
 test/del_alias_target.c                      |   49 +
 test/del_bad_code.c                          |    4 +-
 test/del_carray.c                            |   31 +-
 test/del_carray_deref.c                      |   23 +-
 test/del_const.c                             |   31 +-
 test/del_const_deref.c                       |   12 +-
 test/del_const_force.c                       |   23 +-
 test/del_data.c                              |   27 +-
 test/del_data_enoent.c                       |   19 +-
 test/del_data_open.c                         |   27 +-
 test/del_data_prot.c                         |   46 +
 test/del_del.c                               |   26 +-
 test/del_derived.c                           |   27 +-
 test/del_derived_after.c                     |   11 +-
 test/del_derived_force.c                     |   19 +-
 test/del_divide.c                            |   60 +
 test/del_meta.c                              |   39 +-
 test/del_meta_force.c                        |   31 +-
 test/del_prot.c                              |   44 +
 test/del_rdonly.c                            |   44 +
 test/del_ref.c                               |   33 +-
 test/desync.c                                |   12 +-
 test/desync_flush.c                          |   12 +-
 test/desync_path.c                           |   18 +-
 test/desync_reopen.c                         |   21 +-
 test/desync_reopen_inv.c                     |   36 +-
 test/dfes_bit.c                              |   18 +-
 test/dfes_divide.c                           |   17 +-
 test/dfes_lincom.c                           |   17 +-
 test/dfes_linterp.c                          |   17 +-
 test/dfes_multiply.c                         |   17 +-
 test/dfes_phase.c                            |   17 +-
 test/dfes_raw.c                              |   17 +-
 test/dfes_recip.c                            |   17 +-
 test/elist_alias.c                           |   25 +-
 test/elist_hidden.c                          |   19 +-
 test/elist_noalias.c                         |   19 +-
 test/elist_parent.c                          |   44 +
 test/elist_parent2.c                         |   47 +
 test/elist_scalar.c                          |   17 +-
 test/elist_type.c                            |   44 +
 test/enc_add.c                               |   77 +
 test/enc_complex128.c                        |   69 +
 test/enc_complex64.c                         |   69 +
 test/enc_del.c                               |   80 +
 test/enc_enoent.c                            |   60 +
 test/enc_float32.c                           |   75 +
 test/enc_float64.c                           |   74 +
 test/enc_get_cont.c                          |   84 +
 test/enc_int16.c                             |   66 +
 test/enc_int32.c                             |   66 +
 test/enc_int64.c                             |   66 +
 test/enc_int8.c                              |   66 +
 test/enc_move_from.c                         |  116 +
 test/enc_nframes.c                           |   74 +
 test/enc_put_offs.c                          |   90 +
 test/enc_seek.c                              |   72 +
 test/enc_uint16.c                            |   66 +
 test/enc_uint32.c                            |   66 +
 test/enc_uint64.c                            |   66 +
 test/enc_uint8.c                             |   66 +
 test/encode_alter.c                          |   26 +-
 test/encode_alter_all.c                      |   33 +-
 test/encode_alter_open.c                     |   26 +-
 test/encode_get.c                            |   28 +-
 test/encode_recode.c                         |   29 +-
 test/encode_recode_open.c                    |   29 +-
 test/encode_support.c                        |   22 +-
 test/endian_alter.c                          |   27 +-
 test/endian_alter_all.c                      |   33 +-
 test/endian_alter_arg.c                      |   50 +
 test/endian_alter_dprot.c                    |   51 +
 test/endian_alter_fprot.c                    |   51 +
 test/endian_alter_index.c                    |   50 +
 test/endian_alter_rdonly.c                   |   50 +
 test/endian_alter_sie.c                      |   18 +-
 test/endian_get.c                            |   17 +-
 test/endian_index.c                          |   48 +
 test/endian_move.c                           |   27 +-
 test/entry_bad_code.c                        |   25 +-
 test/entry_bit.c                             |   19 +-
 test/entry_bit_scalar.c                      |   26 +-
 test/entry_divide.c                          |   18 +-
 test/entry_invalid.c                         |   12 +-
 test/entry_lincom.c                          |   19 +-
 test/entry_lincom_scalar.c                   |   33 +-
 test/entry_linterp.c                         |   18 +-
 test/entry_mplex.c                           |   11 +-
 test/entry_mplex_scalar.c                    |   18 +-
 test/entry_multiply.c                        |   18 +-
 test/entry_phase.c                           |   18 +-
 test/entry_phase_scalar.c                    |   19 +-
 test/entry_polynom.c                         |   17 +-
 test/entry_polynom_scalar.c                  |   31 +-
 test/entry_raw.c                             |   18 +-
 test/entry_raw_scalar.c                      |   19 +-
 test/entry_raw_scalar_code.c                 |   18 +-
 test/entry_raw_scalar_type.c                 |   18 +-
 test/entry_recip.c                           |   19 +-
 test/entry_scalar_repr.c                     |   27 +-
 test/entry_type.c                            |   18 +-
 test/entry_type_alias.c                      |   16 +-
 test/entry_window.c                          |   18 +-
 test/entry_window_scalar.c                   |   19 +-
 test/eof.c                                   |   16 +-
 test/eof_bit.c                               |   16 +-
 test/eof_bit_code.c                          |   46 +
 test/eof_const.c                             |   46 +
 test/eof_index.c                             |   40 +-
 test/eof_lincom.c                            |   25 +-
 test/eof_lincom_code.c                       |   58 +
 test/eof_phase.c                             |   16 +-
 test/eof_phase_code.c                        |   46 +
 test/eof_phase_neg.c                         |   16 +-
 test/eof_recurse.c                           |   45 +
 test/error.c                                 |   12 +-
 test/error_num.c                             |   11 +-
 test/error_short.c                           |   12 +-
 test/error_verbose.c                         |   76 +-
 test/error_verbose_prefix.c                  |   88 +-
 test/file.c                                  |   27 +-
 test/file_code.c                             |   27 +-
 test/file_type.c                             |   27 +-
 test/flac_add.c                              |   55 +-
 test/flac_complex128.c                       |   30 +
 test/flac_complex64.c                        |   30 +
 test/flac_del.c                              |   34 +
 test/flac_enoent.c                           |   33 +
 test/flac_float32.c                          |   30 +
 test/flac_float64.c                          |   30 +
 test/flac_get_big.c                          |   32 +-
 test/flac_get_cont.c                         |   39 +
 test/flac_get_far.c                          |   26 +-
 test/flac_get_get.c                          |   26 +-
 test/flac_get_get2.c                         |   26 +-
 test/flac_get_int64.c                        |   34 +-
 test/flac_get_int8.c                         |   26 +-
 test/flac_get_little.c                       |   32 +-
 test/flac_get_long.c                         |   31 +-
 test/flac_int16.c                            |   30 +
 test/flac_int32.c                            |   30 +
 test/flac_int64.c                            |   30 +
 test/flac_int8.c                             |   30 +
 test/flac_move_from.c                        |   44 +
 test/flac_nframes.c                          |   76 +-
 test/flac_put_big.c                          |   26 +-
 test/flac_put_complex128.c                   |    4 +-
 test/flac_put_float64.c                      |    4 +-
 test/flac_put_int32.c                        |    4 +-
 test/flac_put_little.c                       |   27 +-
 test/flac_put_offs.c                         |   31 +
 test/flac_seek.c                             |   69 +-
 test/flac_seek_far.c                         |   28 +-
 test/flac_sync.c                             |   19 +-
 test/flac_uint16.c                           |   30 +
 test/flac_uint32.c                           |   30 +
 test/flac_uint64.c                           |   30 +
 test/flac_uint8.c                            |   30 +
 test/flist.c                                 |   26 +-
 test/flist0.c                                |   14 +-
 test/flist2.c                                |   26 +-
 test/flist_hidden.c                          |   20 +-
 test/flist_meta.c                            |   28 +-
 test/flist_meta2.c                           |   28 +-
 test/flist_meta_hidden.c                     |   22 +-
 test/flist_type.c                            |   28 +-
 test/flist_type_hidden.c                     |   22 +-
 test/flist_type_meta.c                       |   30 +-
 test/flist_type_meta_hidden.c                |   24 +-
 test/flush_all.c                             |   17 +-
 test/flush_bad_code.c                        |   18 +-
 test/flush_flush.c                           |   17 +-
 test/flush_lincom.c                          |   26 +-
 test/flush_lincom1.c                         |   22 +-
 test/flush_mult.c                            |   24 +-
 test/flush_raw_close.c                       |   17 +-
 test/flush_recurse.c                         |   45 +
 test/flush_ref.c                             |   76 -
 test/flush_sync.c                            |   17 +-
 test/foffs_alter.c                           |   28 +-
 test/foffs_alter_all.c                       |   32 +-
 test/foffs_alter_dprot.c                     |   51 +
 test/foffs_alter_fprot.c                     |   51 +
 test/foffs_alter_index.c                     |   50 +
 test/foffs_alter_range.c                     |   50 +
 test/foffs_alter_rdonly.c                    |   50 +
 test/foffs_get.c                             |   27 +-
 test/foffs_index.c                           |   48 +
 test/foffs_move.c                            |   28 +-
 test/fragment_affix.c                        |   17 +-
 test/fragment_affix_alter.c                  |   17 +-
 test/fragment_affix_alter2.c                 |   23 +-
 test/fragment_affix_alter_code.c             |   27 +-
 test/fragment_affix_alter_dotpx.c            |   67 +
 test/fragment_affix_alter_index.c            |   46 +
 test/fragment_affix_alter_nons.c             |   67 +
 test/fragment_affix_alter_nop.c              |   17 +-
 test/fragment_affix_alter_ns.c               |   67 +
 test/fragment_affix_alter_pns.c              |   70 +
 test/fragment_affix_dup.c                    |   35 +-
 test/fragment_affix_index.c                  |   50 +
 test/fragment_affix_ns.c                     |   55 +
 test/fragment_index.c                        |   24 +-
 test/fragment_index_alias.c                  |   17 +-
 test/fragment_name.c                         |   25 +-
 test/fragment_name_oor.c                     |   25 +-
 test/fragment_ndotdots.c                     |   55 +
 test/fragment_ndots.c                        |   55 +
 test/fragment_ns.c                           |   52 +
 test/fragment_ns0.c                          |   49 +
 test/fragment_ns_add.c                       |   55 +
 test/fragment_ns_add0.c                      |   52 +
 test/fragment_ns_alter.c                     |   55 +
 test/fragment_ns_alter_nop.c                 |   55 +
 test/fragment_ns_alter_pdel.c                |   57 +
 test/fragment_ns_del.c                       |   55 +
 test/fragment_ns_dot.c                       |   55 +
 test/fragment_ns_dotdot.c                    |   52 +
 test/fragment_ns_dotns.c                     |   55 +
 test/fragment_ns_nsdot.c                     |   55 +
 test/fragment_num.c                          |   17 +-
 test/fragment_parent.c                       |   23 +-
 test/fragment_parent_index.c                 |   46 +
 test/fragment_parent_root.c                  |   46 +
 test/get64.c                                 |   27 +-
 test/get_affix.c                             |   34 +-
 test/get_bad_code.c                          |   19 +-
 test/get_bit.c                               |   27 +-
 test/get_carray.c                            |   21 +-
 test/get_carray_bad.c                        |   46 +
 test/get_carray_c2r.c                        |   19 +-
 test/get_carray_len.c                        |   61 -
 test/get_carray_slice.c                      |   19 +-
 test/get_carray_slice_bounds.c               |   49 +
 test/get_carray_slice_type.c                 |   46 +
 test/get_carray_type.c                       |   46 +
 test/get_char.c                              |   27 +-
 test/get_clincom.c                           |   27 +-
 test/get_complex128.c                        |   35 +-
 test/get_complex64.c                         |   35 +-
 test/get_const.c                             |   19 +-
 test/get_const_bad.c                         |   47 +
 test/get_const_carray.c                      |   16 +-
 test/get_const_complex.c                     |   19 +-
 test/get_const_repr.c                        |   19 +-
 test/get_const_reprz.c                       |   80 +
 test/get_cpolynom.c                          |   27 +-
 test/get_cpolynom1.c                         |   27 +-
 test/get_cpolynom_int.c                      |   27 +-
 test/get_dim.c                               |   18 +-
 test/get_dimin.c                             |   50 +
 test/get_divide.c                            |   32 +-
 test/get_divide_ccin.c                       |   23 +-
 test/get_divide_code.c                       |   61 +
 test/get_divide_crin.c                       |   23 +-
 test/get_divide_crinr.c                      |   23 +-
 test/get_divide_rcin.c                       |   23 +-
 test/get_divide_s.c                          |   34 +-
 test/get_dot.c                               |   55 +
 test/get_endian16.c                          |   21 +-
 test/get_endian32.c                          |   21 +-
 test/get_endian64.c                          |   21 +-
 test/get_endian8.c                           |   21 +-
 test/get_endian_complex128_arm.c             |   19 +-
 test/get_endian_complex128_big.c             |   19 +-
 test/get_endian_complex128_little.c          |   19 +-
 test/get_endian_complex64_arm.c              |   19 +-
 test/get_endian_complex64_big.c              |   19 +-
 test/get_endian_complex64_little.c           |   19 +-
 test/get_endian_float32_arm.c                |   19 +-
 test/get_endian_float32_big.c                |   19 +-
 test/get_endian_float32_little.c             |   19 +-
 test/get_endian_float64_arm.c                |   19 +-
 test/get_endian_float64_big.c                |   19 +-
 test/get_endian_float64_little.c             |   19 +-
 test/get_ff.c                                |   27 +-
 test/get_float32.c                           |   28 +-
 test/get_float64.c                           |   28 +-
 test/get_foffs.c                             |   27 +-
 test/get_foffs2.c                            |   27 +-
 test/get_fs.c                                |   27 +-
 test/get_here.c                              |   27 +-
 test/get_here_foffs.c                        |   27 +-
 test/get_heres.c                             |   27 +-
 test/get_index_complex.c                     |   13 +-
 test/get_index_type.c                        |   87 +
 test/get_indir.c                             |   59 +
 test/get_indir_typein.c                      |   55 +
 test/get_int16.c                             |   28 +-
 test/get_int32.c                             |   28 +-
 test/get_int64.c                             |   28 +-
 test/get_int8.c                              |   27 +-
 test/get_lincom1.c                           |   27 +-
 test/get_lincom2.c                           |   27 +-
 test/get_lincom2s.c                          |   34 +-
 test/get_lincom3.c                           |   27 +-
 test/get_lincom3s.c                          |   34 +-
 test/get_lincom_code.c                       |   68 +
 test/get_lincom_mdt.c                        |   27 +-
 test/get_lincom_noin.c                       |   18 +-
 test/get_lincom_non.c                        |   27 +-
 test/get_lincom_null.c                       |   27 +-
 test/get_lincom_spf.c                        |   39 +-
 test/get_linterp.c                           |   28 +-
 test/get_linterp1.c                          |   28 +-
 test/get_linterp_abs.c                       |   22 +-
 test/get_linterp_complex.c                   |   28 +-
 test/get_linterp_empty.c                     |   25 +-
 test/get_linterp_nodir.c                     |   25 +-
 test/get_linterp_noin.c                      |   19 +-
 test/get_linterp_notab.c                     |   28 +-
 test/get_linterp_sort.c                      |   28 +-
 test/get_mplex.c                             |   35 +-
 test/get_mplex_bof.c                         |   35 +-
 test/get_mplex_complex.c                     |   16 +-
 test/get_mplex_lb.c                          |   35 +-
 test/get_mplex_lball.c                       |   37 +-
 test/get_mplex_nolb.c                        |   35 +-
 test/get_mplex_s.c                           |   32 +-
 test/get_mplex_saved.c                       |   35 +-
 test/get_multiply.c                          |   27 +-
 test/get_multiply_ccin.c                     |   16 +-
 test/get_multiply_code.c                     |   61 +
 test/get_multiply_crin.c                     |   16 +-
 test/get_multiply_crinr.c                    |   16 +-
 test/get_multiply_noin.c                     |   27 +-
 test/get_multiply_rcin.c                     |   16 +-
 test/get_multiply_s.c                        |   34 +-
 test/get_neg.c                               |   18 +-
 test/get_none.c                              |   27 +-
 test/get_nonexistent.c                       |   18 +-
 test/get_null.c                              |   27 +-
 test/get_off64.c                             |   27 +-
 test/get_phase.c                             |   28 +-
 test/get_phase_affix.c                       |   33 +-
 test/get_polynom.c                           |   28 +-
 test/get_polynom_cmpin.c                     |   22 +-
 test/get_polynom_noin.c                      |   18 +-
 test/get_range.c                             |   20 +-
 test/get_recip.c                             |   32 +-
 test/get_recip_cmpin.c                       |   65 +
 test/get_recip_const.c                       |   34 +-
 test/get_recurse.c                           |   23 +-
 test/get_reprz.c                             |   83 +
 test/get_rofs.c                              |   27 +-
 test/get_sarray.c                            |   56 +
 test/get_sarray_bad.c                        |   46 +
 test/get_sarray_slice.c                      |   56 +
 test/get_sarray_slice_bounds.c               |   49 +
 test/get_sarray_slice_type.c                 |   46 +
 test/get_sarray_type.c                       |   46 +
 test/get_sbit.c                              |   27 +-
 test/get_sf.c                                |   27 +-
 test/get_sindir.c                            |   64 +
 test/get_sindir_code.c                       |   61 +
 test/get_sindir_neg.c                        |   55 +
 test/get_sindir_none.c                       |   55 +
 test/get_sindir_null.c                       |   55 +
 test/get_sindir_reprz.c                      |   85 +
 test/get_sindir_type.c                       |   56 +
 test/get_sindir_typein.c                     |   55 +
 test/get_ss.c                                |   27 +-
 test/get_string.c                            |   19 +-
 test/get_type.c                              |   27 +-
 test/get_uint16.c                            |   28 +-
 test/get_uint32.c                            |   29 +-
 test/get_uint64.c                            |   29 +-
 test/get_window.c                            |   28 +-
 test/get_window_clr.c                        |   28 +-
 test/get_window_complex.c                    |   22 +-
 test/get_window_ge.c                         |   28 +-
 test/get_window_gt.c                         |   28 +-
 test/get_window_le.c                         |   28 +-
 test/get_window_lt.c                         |   28 +-
 test/get_window_ne.c                         |   28 +-
 test/get_window_s.c                          |   34 +-
 test/get_window_set.c                        |   28 +-
 test/get_zero.c                              |   28 +-
 test/get_zero_complex.c                      |   28 +-
 test/get_zero_float.c                        |   28 +-
 test/global_flags.c                          |   15 +-
 test/global_name.c                           |   20 +-
 test/global_ref.c                            |   60 -
 test/global_ref_empty.c                      |   61 -
 test/global_ref_set.c                        |   62 -
 test/gzip_add.c                              |   63 +-
 test/gzip_complex128.c                       |   30 +
 test/gzip_complex64.c                        |   30 +
 test/gzip_del.c                              |   68 +-
 test/gzip_enoent.c                           |   33 +
 test/gzip_float32.c                          |   30 +
 test/gzip_float64.c                          |   30 +
 test/gzip_get.c                              |   29 +-
 test/gzip_get_cont.c                         |   31 +
 test/gzip_get_far.c                          |   20 +-
 test/gzip_get_get.c                          |   29 +-
 test/gzip_get_get2.c                         |   29 +-
 test/gzip_get_put.c                          |   18 +-
 test/gzip_int16.c                            |   30 +
 test/gzip_int32.c                            |   30 +
 test/gzip_int64.c                            |   30 +
 test/gzip_int8.c                             |   30 +
 test/gzip_move_from.c                        |  110 +-
 test/gzip_move_to.c                          |   14 +-
 test/gzip_nframes.c                          |   70 +-
 test/gzip_put.c                              |   18 +-
 test/gzip_put_back.c                         |   18 +-
 test/gzip_put_endian.c                       |   27 +-
 test/gzip_put_get.c                          |   20 +-
 test/gzip_put_offs.c                         |   31 +
 test/gzip_put_pad.c                          |    9 +-
 test/gzip_put_sub.c                          |   26 +-
 test/gzip_seek.c                             |   64 +-
 test/gzip_seek_far.c                         |   22 +-
 test/gzip_sync.c                             |   18 +-
 test/gzip_uint16.c                           |   30 +
 test/gzip_uint32.c                           |   30 +
 test/gzip_uint64.c                           |   30 +
 test/gzip_uint8.c                            |   30 +
 test/header_complex.c                        |   21 +-
 test/header_off64t.c                         |   11 +-
 test/hide.c                                  |   11 +-
 test/hide_bad.c                              |    4 +-
 test/hide_hidden.c                           |   18 +-
 test/hide_hidden_bad.c                       |    4 +-
 test/hide_unhide.c                           |   11 +-
 test/hide_unhide_bad.c                       |    4 +-
 test/include_accmode.c                       |   11 +-
 test/include_affix.c                         |   17 +-
 test/include_affix_ns.c                      |   50 +
 test/include_auto.c                          |   25 +-
 test/include_cb.c                            |   25 +-
 test/include_creat.c                         |   11 +-
 test/include_format.c                        |   70 +
 test/include_ignore.c                        |   25 +-
 test/include_include.c                       |   24 +-
 test/include_index.c                         |   18 +-
 test/include_invalid.c                       |   18 +-
 test/include_ndotdots.c                      |   47 +
 test/include_ndots.c                         |   50 +
 test/include_nonexistent.c                   |   18 +-
 test/include_ns.c                            |   50 +
 test/include_ns_dot.c                        |   50 +
 test/include_ns_dotdot.c                     |   50 +
 test/include_ns_dotns.c                      |   53 +
 test/include_ns_nil.c                        |   50 +
 test/include_ns_null.c                       |   50 +
 test/include_ns_prefix.c                     |   64 +
 test/include_pc.c                            |   25 +-
 test/include_prot.c                          |   50 +
 test/include_ref.c                           |   25 +-
 test/include_ref_code.c                      |   70 +
 test/include_ref_type.c                      |   70 +
 test/include_sub.c                           |   30 +-
 test/include_syntax.c                        |   25 +-
 test/index_domain.c                          |   18 +-
 test/index_empty.c                           |   49 +
 test/index_index.c                           |   18 +-
 test/index_one.c                             |   52 +
 test/index_range.c                           |   18 +-
 test/index_reprz.c                           |   75 +
 test/index_s.c                               |   18 +-
 test/index_scalar.c                          |   49 +
 test/index_subset.c                          |   18 +-
 test/legacy_error.c                          |    6 +-
 test/legacy_estring.c                        |   27 +-
 test/legacy_format.c                         |   67 +-
 test/legacy_get.c                            |   27 +-
 test/legacy_get_put.c                        |   28 +-
 test/legacy_get_rofs.c                       |   31 +-
 test/legacy_nframes.c                        |   16 +-
 test/legacy_nonexistent.c                    |   11 +-
 test/legacy_put.c                            |   17 +-
 test/legacy_spf.c                            |   18 +-
 test/len_bad.c                               |   48 +
 test/len_carray.c                            |   50 +
 test/len_const.c                             |   48 +
 test/len_sarray.c                            |   49 +
 test/len_string.c                            |   48 +
 test/len_type.c                              |   48 +
 test/lzma_enoent.c                           |   33 +
 test/lzma_get.c                              |   20 +-
 test/lzma_nframes.c                          |   71 +-
 test/lzma_put.c                              |   20 +-
 test/lzma_xz_add.c                           |   55 +-
 test/lzma_xz_complex128.c                    |   30 +
 test/lzma_xz_complex64.c                     |   30 +
 test/lzma_xz_del.c                           |   34 +
 test/lzma_xz_float32.c                       |   30 +
 test/lzma_xz_float64.c                       |   30 +
 test/lzma_xz_get.c                           |   20 +-
 test/lzma_xz_get_cont.c                      |   31 +
 test/lzma_xz_get_far.c                       |   20 +-
 test/lzma_xz_get_get.c                       |   20 +-
 test/lzma_xz_get_get2.c                      |   20 +-
 test/lzma_xz_get_put.c                       |    9 +-
 test/lzma_xz_int16.c                         |   30 +
 test/lzma_xz_int32.c                         |   30 +
 test/lzma_xz_int64.c                         |   30 +
 test/lzma_xz_int8.c                          |   30 +
 test/lzma_xz_move_from.c                     |   36 +
 test/lzma_xz_move_to.c                       |    9 +-
 test/lzma_xz_nframes.c                       |   71 +-
 test/lzma_xz_offs_clear.c                    |   61 +
 test/lzma_xz_put.c                           |    9 +-
 test/lzma_xz_put_back.c                      |    9 +-
 test/lzma_xz_put_endian.c                    |   20 +-
 test/lzma_xz_put_get.c                       |   11 +-
 test/lzma_xz_put_offs.c                      |   31 +
 test/lzma_xz_put_pad.c                       |    9 +-
 test/lzma_xz_seek.c                          |   59 +-
 test/lzma_xz_seek_far.c                      |   20 +-
 test/lzma_xz_sync.c                          |    9 +-
 test/lzma_xz_uint16.c                        |   30 +
 test/lzma_xz_uint32.c                        |   30 +
 test/lzma_xz_uint64.c                        |   30 +
 test/lzma_xz_uint8.c                         |   30 +
 test/madd_affix.c                            |   14 +-
 test/madd_alias_alias.c                      |   48 +
 test/madd_alias_subsub.c                     |   48 +
 test/madd_aliasmeta.c                        |   44 +
 test/madd_clincom_nfields.c                  |   55 +
 test/madd_cpolynom_order.c                   |   53 +
 test/madd_indir.c                            |   56 +
 test/madd_lincom_nfields.c                   |   46 +
 test/madd_parent_bad.c                       |   53 +
 test/madd_polynom_order.c                    |   45 +
 test/madd_raw.c                              |   54 +
 test/madd_sarray.c                           |   71 +
 test/madd_sarray_dup.c                       |   46 +
 test/madd_sindir.c                           |   56 +
 test/madd_spec_parent.c                      |   42 +
 test/madd_string_dup.c                       |   44 +
 test/madd_subsub.c                           |   57 +
 test/match_fragment.c                        |   60 +
 test/match_pcre.c                            |   69 +
 test/match_pcre_bad.c                        |   65 +
 test/match_pcre_caseless.c                   |   69 +
 test/match_pcre_ext.c                        |   69 +
 test/match_pcre_js.c                         |   70 +
 test/match_pcre_utf8.c                       |   67 +
 test/match_regex.c                           |   69 +
 test/match_regex_bad.c                       |   64 +
 test/match_regex_ext.c                       |   66 +
 test/match_regex_icase.c                     |   69 +
 test/{flush_meta.c => mflush.c}              |    0
 test/mflush_affix.c                          |   95 +
 test/{flush_amb_code.c => mflush_amb_code.c} |    0
 test/mflush_carray.c                         |   54 +
 test/{flush_hex.c => mflush_hex.c}           |    0
 test/mflush_indir.c                          |   60 +
 test/mflush_mplex.c                          |   62 +
 test/mflush_ns.c                             |   58 +
 test/mflush_pretty.c                         |   56 +
 test/mflush_prot.c                           |   78 +
 test/mflush_ref.c                            |   61 +
 test/mflush_repr.c                           |   68 +
 test/mflush_repr9.c                          |   73 +
 test/mflush_reprz.c                          |   70 +
 test/mflush_sindir.c                         |   60 +
 test/{flush_spec.c => mflush_spec.c}         |    0
 test/{flush_string.c => mflush_string.c}     |    0
 test/mflush_type.c                           |   74 +
 test/mflush_type4.c                          |   67 +
 test/mflush_windop.c                         |   73 +
 test/move_affix.c                            |   28 +-
 test/move_affix_dup.c                        |   29 +-
 test/move_affix_meta.c                       |   36 +-
 test/move_affix_updb.c                       |   37 +-
 test/move_alias.c                            |   22 +-
 test/move_code.c                             |   48 +
 test/move_data_enc_ar.c                      |   25 +-
 test/move_data_enc_ra.c                      |   35 +-
 test/move_data_enc_un.c                      |   53 +
 test/move_data_endian.c                      |   42 +-
 test/move_data_foffs.c                       |   34 +-
 test/move_data_foffs_neg.c                   |   40 +-
 test/move_data_nop.c                         |   33 +-
 test/move_data_prot.c                        |   57 +
 test/move_entype.c                           |   48 +
 test/move_index.c                            |   41 +-
 test/move_meta.c                             |   29 +-
 test/move_move.c                             |   25 +-
 test/move_nop.c                              |   45 +
 test/move_ns.c                               |   49 +
 test/move_nsns.c                             |   51 +
 test/move_protect.c                          |   28 +-
 test/move_rdonly.c                           |   48 +
 test/move_subdir.c                           |   32 +-
 test/move_unkenc.c                           |   51 +
 test/name_affix.c                            |   19 +-
 test/name_affix_bad.c                        |   19 +-
 test/name_alias.c                            |   50 +-
 test/name_code.c                             |   43 +
 test/name_dangle.c                           |   45 +-
 test/name_dot10.c                            |   56 +
 test/name_dot5.c                             |   24 +-
 test/name_dot5r.c                            |   29 +-
 test/name_dot9.c                             |   21 +-
 test/name_dup.c                              |   13 +-
 test/name_index.c                            |   43 +
 test/name_meta.c                             |   30 +-
 test/name_meta2.c                            |  120 +
 test/name_move.c                             |   24 +-
 test/name_move_alias.c                       |   24 +-
 test/name_name.c                             |   45 +-
 test/name_ns.c                               |   49 +
 test/name_ns2.c                              |   49 +
 test/name_nsdot.c                            |   49 +
 test/name_prot.c                             |   46 +
 test/name_rdonly.c                           |   46 +
 test/name_updb.c                             |   24 +-
 test/name_updb_affix.c                       |   28 +-
 test/name_updb_alias.c                       |   26 +-
 test/name_updb_carray.c                      |   23 +-
 test/name_updb_const.c                       |   39 +-
 test/name_updb_const_alias.c                 |   22 +-
 test/name_updb_sarray.c                      |   58 +
 test/native_bit.c                            |   16 +-
 test/native_code.c                           |   46 +
 test/native_const.c                          |   11 +-
 test/native_lincom.c                         |   16 +-
 test/native_lincom_cmpin.c                   |   16 +-
 test/native_lincom_cmpscal.c                 |   16 +-
 test/native_linterp.c                        |   14 +-
 test/native_linterp_cmp.c                    |   14 +-
 test/native_mult.c                           |   16 +-
 test/native_mult1.c                          |   18 +-
 test/native_mult2.c                          |   18 +-
 test/native_phase.c                          |   16 +-
 test/native_polynom.c                        |   16 +-
 test/native_polynom_cmpin.c                  |   16 +-
 test/native_polynom_cmpscal.c                |   16 +-
 test/native_raw.c                            |   11 +-
 test/native_recip.c                          |   16 +-
 test/native_recip_cmpin.c                    |   16 +-
 test/native_recip_cmpscal.c                  |   16 +-
 test/native_recurse.c                        |   49 +
 test/native_reprz.c                          |   72 +
 test/native_sbit.c                           |   16 +-
 test/native_string.c                         |   13 +-
 test/nentries_alias.c                        |   32 +-
 test/nentries_entype.c                       |   47 +
 test/nentries_hidden.c                       |   30 +-
 test/nentries_noalias.c                      |   48 +-
 test/nentries_scalar.c                       |   48 +-
 test/nfields_hidden.c                        |   24 +-
 test/nfields_nfields.c                       |   31 +-
 test/nfields_type.c                          |   31 +-
 test/nfields_type_hidden.c                   |   24 +-
 test/nfields_vector.c                        |   24 +-
 test/nfields_vector_hidden.c                 |   24 +-
 test/nframes64.c                             |   16 +-
 test/nframes_empty.c                         |   12 +-
 test/nframes_invalid.c                       |   13 +-
 test/nframes_nframes.c                       |   16 +-
 test/nframes_off64.c                         |   16 +-
 test/nframes_spf.c                           |   12 +-
 test/nmeta.c                                 |   31 +-
 test/nmeta_hidden.c                          |   24 +-
 test/nmeta_parent.c                          |   31 +-
 test/nmeta_parent_meta.c                     |   50 +
 test/nmeta_type.c                            |   31 +-
 test/nmeta_type_hidden.c                     |   24 +-
 test/nmeta_type_parent.c                     |   31 +-
 test/nmeta_vectors.c                         |   31 +-
 test/nmeta_vectors_del.c                     |   31 +-
 test/nmeta_vectors_hidden.c                  |   24 +-
 test/nmeta_vectors_parent.c                  |   31 +-
 test/open_abs.c                              |   12 +-
 test/open_cb_abort.c                         |   26 +-
 test/open_cb_cont.c                          |   25 +-
 test/open_cb_ignore.c                        |   18 +-
 test/open_cb_invalid.c                       |   26 +-
 test/open_cb_rescan.c                        |   19 +-
 test/open_cb_rescan_alloc.c                  |   19 +-
 test/open_eaccess.c                          |   13 +-
 test/open_notdirfile.c                       |   10 +-
 test/open_open.c                             |   12 +-
 test/open_rofs.c                             |   25 +-
 test/open_sym_al.c                           |   12 +-
 test/open_sym_at.c                           |   12 +-
 test/open_sym_c.c                            |   12 +-
 test/open_sym_cl.c                           |   12 +-
 test/open_sym_ct.c                           |   12 +-
 test/open_sym_d.c                            |   10 +-
 test/open_sym_l.c                            |   11 +-
 test/open_sym_p.c                            |   12 +-
 test/open_sym_pl.c                           |   12 +-
 test/open_sym_pt.c                           |   12 +-
 test/parse_alias.c                           |   11 +-
 test/parse_alias_code.c                      |   16 +-
 test/parse_alias_dup.c                       |   18 +-
 test/parse_alias_loop.c                      |   75 +
 test/parse_alias_meta.c                      |   18 +-
 test/parse_alias_missing.c                   |   11 +-
 test/parse_alias_ncols.c                     |   44 +
 test/parse_badline.c                         |   18 +-
 test/parse_bit.c                             |   18 +-
 test/parse_bit4.c                            |   18 +-
 test/parse_bit_bitnum.c                      |   18 +-
 test/parse_bit_bitsize.c                     |   18 +-
 test/parse_bit_ncols.c                       |   18 +-
 test/parse_bit_numbits.c                     |   18 +-
 test/parse_bit_scalar.c                      |   18 +-
 test/parse_carray.c                          |   18 +-
 test/parse_carray_long.c                     |   18 +-
 test/parse_carray_ncols.c                    |   44 +
 test/parse_carray_type.c                     |   44 +
 test/parse_const.c                           |   18 +-
 test/parse_const_complex.c                   |   18 +-
 test/parse_const_ncols.c                     |   23 +-
 test/parse_const_type.c                      |   44 +
 test/parse_divide.c                          |   18 +-
 test/parse_double.c                          |   29 +-
 test/parse_duplicate.c                       |   18 +-
 test/parse_duplicate_ignore.c                |   18 +-
 test/parse_endian_bad.c                      |   18 +-
 test/parse_endian_bad2.c                     |   44 +
 test/parse_endian_big.c                      |   18 +-
 test/parse_endian_force.c                    |   18 +-
 test/parse_endian_little.c                   |   18 +-
 test/parse_endian_slash.c                    |   18 +-
 test/parse_eol.c                             |   18 +-
 test/parse_esc.c                             |   49 +
 test/parse_foffs.c                           |   18 +-
 test/parse_foffs_include.c                   |   30 +-
 test/parse_foffs_slash.c                     |   18 +-
 test/parse_hex.c                             |   25 +-
 test/parse_hidden.c                          |   11 +-
 test/parse_hidden_field.c                    |   11 +-
 test/parse_hidden_frag.c                     |   46 +
 test/parse_hidden_meta.c                     |   18 +-
 test/parse_huge.c                            |   70 +
 test/parse_include.c                         |   24 +-
 test/parse_include_absolute.c                |   17 +-
 test/parse_include_absrel.c                  |   23 +-
 test/parse_include_affix_bad.c               |   29 +-
 test/parse_include_affix_ref.c               |   29 +-
 test/parse_include_dir.c                     |   21 +-
 test/parse_include_loop.c                    |   18 +-
 test/parse_include_nodir.c                   |   44 +
 test/parse_include_nonexistent.c             |   18 +-
 test/parse_include_ns.c                      |   50 +
 test/parse_include_ns2.c                     |   55 +
 test/parse_include_nsabs.c                   |   51 +
 test/parse_include_nsinh.c                   |   54 +
 test/parse_include_nspop.c                   |   52 +
 test/parse_include_nsrabs.c                  |   54 +
 test/parse_include_nsrainh.c                 |   57 +
 test/parse_include_nsrinh.c                  |   57 +
 test/parse_include_nsroot.c                  |   51 +
 test/parse_include_prefix.c                  |   17 +-
 test/parse_include_prefix_dup.c              |   17 +-
 test/parse_include_preprefix.c               |   23 +-
 test/parse_include_ref.c                     |   31 +-
 test/parse_include_relabs.c                  |   24 +-
 test/parse_include_relrel.c                  |   33 +-
 test/parse_include_slash.c                   |   24 +-
 test/parse_include_suffix.c                  |   17 +-
 test/parse_include_sufsuffix.c               |   23 +-
 test/parse_index.c                           |   18 +-
 test/parse_indir.c                           |   44 +
 test/parse_lincom.c                          |   18 +-
 test/parse_lincom_ncols1.c                   |   18 +-
 test/parse_lincom_ncols2.c                   |   18 +-
 test/parse_lincom_nfields.c                  |   18 +-
 test/parse_lincom_nofields.c                 |   18 +-
 test/parse_lincom_non.c                      |   18 +-
 test/parse_lincom_non_ncols.c                |   18 +-
 test/parse_lincom_scalar.c                   |   23 +-
 test/parse_linterp.c                         |   18 +-
 test/parse_linterp_ncols.c                   |   18 +-
 test/parse_literal_cmpbad.c                  |   18 +-
 test/parse_literal_fltcmp.c                  |   18 +-
 test/parse_literal_fltcmp0.c                 |   18 +-
 test/parse_literal_intcmp.c                  |   18 +-
 test/parse_literal_intcmp0.c                 |   18 +-
 test/parse_literal_uintcmp.c                 |   18 +-
 test/parse_literal_uintcmp0.c                |   18 +-
 test/parse_malias.c                          |   18 +-
 test/parse_malias_dup.c                      |   20 +-
 test/parse_malias_meta.c                     |   21 +-
 test/parse_meta.c                            |   23 +-
 test/parse_meta_affix.c                      |   22 +-
 test/parse_meta_alias.c                      |   25 +-
 test/parse_meta_frag.c                       |   24 +-
 test/parse_meta_implicit.c                   |   23 +-
 test/parse_meta_implicit2.c                  |   23 +-
 test/parse_meta_implicit_affix.c             |   22 +-
 test/parse_meta_index.c                      |   19 +-
 test/parse_meta_index2.c                     |   23 +-
 test/parse_meta_jump.c                       |   20 +-
 test/parse_meta_malias.c                     |   20 +-
 test/parse_meta_meta.c                       |   18 +-
 test/parse_meta_ncols.c                      |   44 +
 test/parse_meta_parent.c                     |   18 +-
 test/parse_meta_raw.c                        |   23 +-
 test/parse_mplex.c                           |   11 +-
 test/parse_mplex_ncols.c                     |   11 +-
 test/parse_mplex_neg.c                       |   44 +
 test/parse_mplex_nomax.c                     |   11 +-
 test/parse_mplex_scalar.c                    |   11 +-
 test/parse_multiply.c                        |   18 +-
 test/parse_multiply_ncols.c                  |   18 +-
 test/parse_name.c                            |   18 +-
 test/parse_name_dot.c                        |   25 +-
 test/parse_name_ext.c                        |   19 +-
 test/parse_name_pedantic.c                   |   55 -
 test/parse_ncols.c                           |   18 +-
 test/parse_ns.c                              |   44 +
 test/parse_ns_dot.c                          |   44 +
 test/parse_ns_dotdot.c                       |   44 +
 test/parse_ns_dotdotns.c                     |   44 +
 test/parse_ns_dotns.c                        |   44 +
 test/parse_ns_include.c                      |   55 +
 test/parse_ns_include_ns.c                   |   55 +
 test/parse_ns_ndotdots.c                     |   44 +
 test/parse_ns_ndots.c                        |   44 +
 test/parse_ns_nsdot.c                        |   44 +
 test/parse_ns_nsdotdot.c                     |   44 +
 test/parse_nsf.c                             |   48 +
 test/parse_nsf_abs.c                         |   52 +
 test/parse_nsf_alias.c                       |   51 +
 test/parse_nsf_dot.c                         |   48 +
 test/parse_nsf_hide.c                        |   53 +
 test/parse_nsf_index.c                       |   51 +
 test/parse_nsf_meta.c                        |   52 +
 test/parse_nsf_meta2.c                       |   52 +
 test/parse_nsf_ref.c                         |   54 +
 test/parse_nsf_refabs.c                      |   55 +
 test/parse_nsf_root.c                        |   52 +
 test/parse_nsf_sub.c                         |   52 +
 test/parse_octal_zero.c                      |   18 +-
 test/parse_phase.c                           |   18 +-
 test/parse_phase_ncols.c                     |   18 +-
 test/parse_phase_scalar.c                    |   18 +-
 test/parse_polynom.c                         |   18 +-
 test/parse_polynom_ncols1.c                  |   18 +-
 test/parse_polynom_ncols2.c                  |   18 +-
 test/parse_polynom_scalar.c                  |   23 +-
 test/parse_protect_all.c                     |   18 +-
 test/parse_protect_bad.c                     |   18 +-
 test/parse_protect_data.c                    |   18 +-
 test/parse_protect_format.c                  |   18 +-
 test/parse_protect_none.c                    |   18 +-
 test/parse_quote.c                           |   18 +-
 test/parse_quote_mismatch.c                  |   18 +-
 test/parse_raw.c                             |   18 +-
 test/parse_raw_char.c                        |   18 +-
 test/parse_raw_char_bad.c                    |   18 +-
 test/parse_raw_ncols.c                       |   18 +-
 test/parse_raw_scalar.c                      |   18 +-
 test/parse_raw_spf.c                         |   18 +-
 test/parse_raw_type.c                        |   18 +-
 test/parse_recip.c                           |   18 +-
 test/parse_recip_ncols.c                     |   44 +
 test/parse_ref.c                             |   18 +-
 test/parse_ref_nonexistent.c                 |   18 +-
 test/parse_ref_type.c                        |   48 +
 test/parse_sarray.c                          |   45 +
 test/parse_sarray_long.c                     |   45 +
 test/parse_sarray_ncols.c                    |   44 +
 test/parse_sbit.c                            |   18 +-
 test/parse_scalar1.c                         |   18 +-
 test/parse_scalar2.c                         |   18 +-
 test/parse_scalar_repr.c                     |   18 +-
 test/parse_sindir.c                          |   44 +
 test/parse_sort.c                            |   84 +-
 test/parse_string.c                          |   18 +-
 test/parse_string_ncols.c                    |   18 +-
 test/parse_string_null.c                     |   18 +-
 test/parse_utf8.c                            |   18 +-
 test/parse_utf8_invalid.c                    |   18 +-
 test/parse_utf8_zero.c                       |   18 +-
 test/parse_version.c                         |   19 +-
 test/parse_version_89.c                      |   24 +-
 test/parse_version_98.c                      |   24 +-
 test/parse_version_include.c                 |   24 +-
 test/parse_version_p8.c                      |   22 +-
 test/parse_version_p9.c                      |   22 +-
 test/parse_version_permissive.c              |   19 +-
 test/parse_version_slash.c                   |   19 +-
 test/parse_whitespace.c                      |   18 +-
 test/parse_window.c                          |   18 +-
 test/parse_window_ncols.c                    |   18 +-
 test/parse_window_op.c                       |   45 +-
 test/parse_window_scalar.c                   |   18 +-
 test/protect_alter.c                         |   28 +-
 test/protect_alter_all.c                     |   32 +-
 test/protect_alter_arg.c                     |   44 +
 test/protect_alter_index.c                   |   47 +
 test/protect_alter_rdonly.c                  |   47 +
 test/protect_get.c                           |   27 +-
 test/protect_index.c                         |   47 +
 test/put64.c                                 |   17 +-
 test/put_bad_code.c                          |   18 +-
 test/put_bit.c                               |   18 +-
 test/put_bit_repr.c                          |   52 +
 test/put_bof.c                               |   19 +-
 test/put_carray_bad.c                        |   49 +
 test/put_carray_bounds.c                     |   49 +
 test/put_carray_rdonly.c                     |   46 +
 test/put_carray_type.c                       |   49 +
 test/put_char.c                              |   19 +-
 test/put_clincom1.c                          |   17 +-
 test/put_complex128.c                        |   19 +-
 test/put_complex64.c                         |   19 +-
 test/put_const_protect.c                     |   27 +-
 test/put_cpolynom.c                          |   22 +-
 test/put_crecip.c                            |   17 +-
 test/put_divide.c                            |   19 +-
 test/put_endian16.c                          |   13 +-
 test/put_endian32.c                          |   13 +-
 test/put_endian64.c                          |   13 +-
 test/put_endian8.c                           |   13 +-
 test/put_endian_complex128_arm.c             |   18 +-
 test/put_endian_complex128_big.c             |   18 +-
 test/put_endian_complex128_little.c          |   18 +-
 test/put_endian_complex64_arm.c              |   18 +-
 test/put_endian_complex64_big.c              |   18 +-
 test/put_endian_complex64_little.c           |   18 +-
 test/put_endian_float32_arm.c                |   18 +-
 test/put_endian_float32_big.c                |   18 +-
 test/put_endian_float32_little.c             |   18 +-
 test/put_endian_float64_arm.c                |   18 +-
 test/put_endian_float64_big.c                |   18 +-
 test/put_endian_float64_little.c             |   18 +-
 test/put_ff.c                                |   17 +-
 test/put_float32.c                           |   18 +-
 test/put_float64.c                           |   18 +-
 test/put_foffs.c                             |   18 +-
 test/put_fs.c                                |   17 +-
 test/put_here.c                              |   17 +-
 test/put_heres.c                             |   17 +-
 test/put_indir.c                             |   64 +
 test/put_int16.c                             |   17 +-
 test/put_int32.c                             |   17 +-
 test/put_int64.c                             |   17 +-
 test/put_int8.c                              |   17 +-
 test/put_lincom1.c                           |   17 +-
 test/put_lincom2.c                           |   19 +-
 test/put_lincom_noin.c                       |   33 +-
 test/put_lincom_repr.c                       |   52 +
 test/put_linterp.c                           |   18 +-
 test/put_linterp_cmp.c                       |   63 +
 test/put_linterp_noin.c                      |   20 +-
 test/put_linterp_nomono.c                    |   20 +-
 test/put_linterp_notab.c                     |   19 +-
 test/put_linterp_repr.c                      |   63 +
 test/put_linterp_reverse.c                   |   18 +-
 test/put_mplex.c                             |   33 +-
 test/put_mplex_complex.c                     |   16 +-
 test/put_mplex_repr.c                        |   52 +
 test/put_multiply.c                          |   19 +-
 test/put_neg.c                               |   54 +
 test/put_null.c                              |   19 +-
 test/put_off64.c                             |   17 +-
 test/put_phase.c                             |   17 +-
 test/put_phase_noin.c                        |   19 +-
 test/put_phase_repr.c                        |   52 +
 test/put_polynom1.c                          |   17 +-
 test/put_polynom2.c                          |   19 +-
 test/put_polynom_noin.c                      |   19 +-
 test/put_polynom_repr.c                      |   52 +
 test/put_protect.c                           |   19 +-
 test/put_range.c                             |   19 +-
 test/put_rdonly.c                            |   18 +-
 test/put_recip.c                             |   17 +-
 test/put_recip_repr.c                        |   52 +
 test/put_recurse.c                           |   28 +-
 test/put_repr.c                              |   21 +-
 test/put_rofs.c                              |   19 +-
 test/put_sarray.c                            |   55 +
 test/put_sarray_bad.c                        |   49 +
 test/put_sarray_bounds.c                     |   49 +
 test/put_sarray_rdonly.c                     |   46 +
 test/put_sarray_slice.c                      |   56 +
 test/put_sarray_type.c                       |   49 +
 test/put_sbit.c                              |   18 +-
 test/put_scalar.c                            |   48 +
 test/put_sf.c                                |   17 +-
 test/put_sindir.c                            |   64 +
 test/put_ss.c                                |   17 +-
 test/put_string.c                            |   20 +-
 test/put_string_protect.c                    |   25 +-
 test/put_string_type.c                       |   47 +
 test/put_sub.c                               |   25 +-
 test/put_type.c                              |   19 +-
 test/put_uint16.c                            |   18 +-
 test/put_uint32.c                            |   17 +-
 test/put_uint64.c                            |   17 +-
 test/put_window.c                            |   19 +-
 test/put_zero.c                              |   18 +-
 test/ref.c                                   |   41 +-
 test/ref_empty.c                             |   49 +
 test/ref_get.c                               |   48 +
 test/ref_none.c                              |   39 +-
 test/ref_set.c                               |   52 +
 test/ref_set_code.c                          |   49 +
 test/ref_set_prot.c                          |   52 +
 test/ref_set_rdonly.c                        |   49 +
 test/ref_set_type.c                          |   49 +
 test/ref_two.c                               |   42 +-
 test/repr_a.c                                |   49 +-
 test/repr_bad.c                              |   27 +-
 test/repr_float32.c                          |   38 +-
 test/repr_float64.c                          |   38 +-
 test/repr_i.c                                |   43 +-
 test/repr_int16.c                            |   38 +-
 test/repr_int32.c                            |   37 +-
 test/repr_int64.c                            |   37 +-
 test/repr_int8.c                             |   37 +-
 test/repr_m.c                                |   42 +-
 test/repr_r.c                                |   43 +-
 test/repr_real_a.c                           |   31 +-
 test/repr_real_i.c                           |   27 +-
 test/repr_real_m.c                           |   29 +-
 test/repr_real_r.c                           |   29 +-
 test/repr_uint16.c                           |   37 +-
 test/repr_uint32.c                           |   37 +-
 test/repr_uint64.c                           |   37 +-
 test/repr_uint8.c                            |   37 +-
 test/salist.c                                |   74 +
 test/salist0.c                               |   49 +
 test/salist_hidden.c                         |   70 +
 test/salist_long.c                           |   88 +
 test/salist_meta.c                           |   74 +
 test/salist_meta0.c                          |   49 +
 test/salist_meta_free.c                      |   86 +
 test/salist_meta_hidden.c                    |   69 +
 test/salist_meta_meta.c                      |   56 +
 test/salist_meta_parent.c                    |   46 +
 test/seek64.c                                |   27 +-
 test/seek_arg.c                              |   43 +
 test/seek_code.c                             |   49 +
 test/seek_cur.c                              |   27 +-
 test/seek_dim.c                              |   46 +
 test/seek_end.c                              |   27 +-
 test/seek_far.c                              |   27 +-
 test/seek_foffs.c                            |   27 +-
 test/seek_foffs2.c                           |   16 +-
 test/seek_index_end.c                        |   43 +
 test/seek_lincom.c                           |   27 +-
 test/seek_mplex.c                            |   48 +
 test/seek_mult.c                             |   27 +-
 test/seek_neg.c                              |   34 +-
 test/seek_phase.c                            |   25 +-
 test/seek_range.c                            |   24 +-
 test/seek_range2.c                           |   23 +-
 test/seek_range_end.c                        |   49 +
 test/seek_recurse.c                          |   49 +
 test/seek_set.c                              |   27 +-
 test/seek_sub.c                              |   35 +-
 test/sie_err_open.c                          |   62 +
 test/sie_get_big.c                           |   11 +-
 test/sie_get_header.c                        |   11 +-
 test/sie_get_little.c                        |   11 +-
 test/sie_move_from.c                         |   11 +-
 test/sie_move_to.c                           |   11 +-
 test/sie_nframes_big.c                       |   11 +-
 test/sie_nframes_little.c                    |   11 +-
 test/sie_put_append.c                        |   11 +-
 test/sie_put_append2.c                       |   11 +-
 test/sie_put_back.c                          |   11 +-
 test/sie_put_big.c                           |   11 +-
 test/sie_put_header.c                        |   11 +-
 test/sie_put_little.c                        |   11 +-
 test/sie_put_pad.c                           |   11 +-
 test/sie_put_pad0.c                          |   11 +-
 test/sie_put_trunc.c                         |   11 +-
 test/sie_put_trunc2.c                        |   11 +-
 test/sie_put_trunc_nf.c                      |   13 +-
 test/sie_seek.c                              |   11 +-
 test/sie_seek_far.c                          |   11 +-
 test/sie_sync.c                              |   11 +-
 test/slim_get.c                              |   29 +-
 test/slim_nframes.c                          |   26 +-
 test/slim_seek.c                             |   20 +-
 test/slim_seek_far.c                         |   20 +-
 test/spf_alias.c                             |   11 +-
 test/spf_alias_meta.c                        |   18 +-
 test/spf_alias_missing.c                     |   11 +-
 test/spf_const.c                             |   48 +
 test/spf_divide.c                            |   25 +-
 test/spf_lincom.c                            |   25 +-
 test/spf_multiply.c                          |   25 +-
 test/spf_polynom.c                           |   23 +-
 test/spf_raw.c                               |   18 +-
 test/spf_recip.c                             |   23 +-
 test/spf_recurse.c                           |   23 +-
 test/svlist.c                                |   28 +-
 test/svlist0.c                               |   19 +-
 test/svlist2.c                               |   28 +-
 test/svlist_hidden.c                         |   24 +-
 test/svlist_long.c                           |   85 +
 test/svlist_meta.c                           |   30 +-
 test/svlist_meta0.c                          |   24 +-
 test/svlist_meta_hidden.c                    |   24 +-
 test/svlist_meta_meta.c                      |   54 +
 test/svlist_meta_parent.c                    |   46 +
 test/table.c                                 |   18 +-
 test/table_code.c                            |   18 +-
 test/table_type.c                            |   18 +-
 test/tell.c                                  |   27 +-
 test/tell64.c                                |   27 +-
 test/tell_code.c                             |   57 +
 test/tell_dim.c                              |   48 +
 test/tell_multi_div.c                        |   52 +
 test/tell_multi_lincom.c                     |   58 +
 test/tell_multidiv.c                         |   70 -
 test/tell_recurse.c                          |   51 +
 test/tell_sub.c                              |   35 +-
 test/test.h                                  |   68 +-
 test/trunc.c                                 |   13 +-
 test/trunc_dir.c                             |   15 +-
 test/trunc_rdonly.c                          |   13 +-
 test/trunc_rofs.c                            |   19 +-
 test/trunc_truncsub.c                        |   15 +-
 test/unclude.c                               |   31 +-
 test/unclude_del.c                           |   31 +-
 test/unclude_index.c                         |   45 +
 test/unclude_keep.c                          |   71 +
 test/unclude_move.c                          |   31 +-
 test/unclude_open.c                          |   40 +-
 test/unclude_prot.c                          |   60 +
 test/unclude_rdonly.c                        |   56 +
 test/valid_reprz.c                           |   71 +
 test/version_0.c                             |   28 +-
 test/version_0_write.c                       |   19 +-
 test/version_1.c                             |   28 +-
 test/version_1_write.c                       |   19 +-
 test/version_2.c                             |   35 +-
 test/version_2_write.c                       |   26 +-
 test/version_3.c                             |   25 +-
 test/version_3_write.c                       |   17 +-
 test/version_4.c                             |   25 +-
 test/version_4_write.c                       |   17 +-
 test/version_5.c                             |   43 +-
 test/version_5_strict.c                      |   43 +-
 test/version_5_write.c                       |   28 +-
 test/version_6.c                             |   28 +-
 test/version_6_strict.c                      |   47 +-
 test/version_6_write.c                       |   20 +-
 test/version_7.c                             |   28 +-
 test/version_7_strict.c                      |   42 +-
 test/version_7_write.c                       |   19 +-
 test/version_8.c                             |   37 +-
 test/version_8_strict.c                      |   38 +-
 test/version_8_write.c                       |   28 +-
 test/version_9.c                             |   37 +-
 test/version_9_strict.c                      |   57 +-
 test/version_9_write.c                       |   67 +-
 test/vlist.c                                 |   22 +-
 test/vlist_alias.c                           |   32 +-
 test/vlist_hidden.c                          |   22 +-
 test/vlist_meta.c                            |   24 +-
 test/vlist_meta_hidden.c                     |   24 +-
 test/zzip_data.c                             |   25 +-
 test/zzip_get.c                              |   20 +-
 test/zzip_get_get.c                          |   20 +-
 test/zzip_nframes.c                          |   33 +-
 test/zzip_seek.c                             |   20 +-
 test/zzip_seek_far.c                         |   20 +-
 test/zzslim_get.c                            |   25 +-
 test/zzslim_nframes.c                        |   28 +-
 test/zzslim_seek.c                           |   25 +-
 test/zzslim_seek_far.c                       |   25 +-
 util/Makefile.in                             |    2 +
 util/checkdirfile.c                          |   23 +-
 1835 files changed, 68440 insertions(+), 33833 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2996414..d77133b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,1123 @@
+2017-01-26   D. V. Wiebe <getdata at ketiltrout.net> svn:1153
+	GetData-0.10.0 released.
+
+2017-01-25   D. V. Wiebe <getdata at ketiltrout.net> svn:1148
+	* src/encoding.c: Better values for GD_INT_FUNCS when USE_<foo> is not
+	defined.
+
+	* test/enc_seek.c: Replace accidental USE_FLAC with USE_ENC.
+
+2017-01-21   D. V. Wiebe <getdata at ketiltrout.net> svn:1146
+	* test/error_verbose.c test/error_verbose_prefix.c: Use an anonymous pipe
+	instead of a named fifo.
+	* configure.ac: Look for dup2, kill and pipe instead of mkfifo.
+
+2017-01-20   D. V. Wiebe <getdata at ketiltrout.net> svn:1145
+	* src/getdata.c (_GD_DoRaw): Don't assume malloc(0) returns NULL.
+
+	* test/alter_entry_sarray.c: zero E.flags;
+
+2017-01-20   D. V. Wiebe <getdata at ketiltrout.net> svn:1144
+	* src/close.c (_GD_FreeD): Free D->regex_list.
+
+2017-01-20   D. V. Wiebe <getdata at ketiltrout.net> svn:1143
+	GetData-0.10.0rc2:
+
+	* README, README.win,: Update.
+
+	* bindings/perl/src/typemap [INPUT] (T_DIRFILE): Don't leak the struct
+	gdp_dirfile_t pointer.
+	* bindings/perl/src/typemap [INPUT] (T_GDP_DIRFILE): Added to handle struct
+	gdp_dirfile_t *.
+	* bindings/perl/src/GetData.xs (DESTROY parser_callback close discard): Accept
+	struct gdp_dirfile_t argument explicitly, rather than implcitly via the
+	T_DIRFILE typemap.
+
+	* bindings/perl/src/typemap [OUTPUT] (T_GDP_DIRFILE): Replaced the OUTPUT
+	T_DIRFILE.
+	* bindings/perl/src/GetData.xs (open invalid_dirfile): Change return type to
+	struct gdp_dirfile *.
+
+	* src/field_list.c (gd_match_entries): Properly NULL D->regex_list if n == 0.
+
+2017-01-19   D. V. Wiebe <getdata at ketiltrout.net> svn:1141,1142
+	* test/legacy_get_rofs.c: Unbreak after chainsawing.
+	* test/test.h (rmdirfile): Check system return value.
+
+	* src/field_list.c (gd_match_entries): Suppress compiler warning.
+
+	* util/checkdirfile.c (main): Fix printf.
+
+2017-01-19   D. V. Wiebe <getdata at ketiltrout.net> svn:1140
+	GetData-0.10.0rc1.
+
+2017-01-19   D. V. Wiebe <getdata at ketiltrout.net> svn:1136
+	* test/flac_get_int64.c: Correct.
+
+2017-01-19   D. V. Wiebe <getdata at ketiltrout.net> svn:1135
+	* src/encoding.c: set GD_EF_SWAP instead of GD_EF_ECOR for flac.
+	* src/flac.c (_GD_FlacDecodeCallback _GD_FlacWrite): Ensure non-native
+	endianness channelisation occurs in the right order.
+	* src/flac.c (_GD_FlacOpen _GD_FlacSize): The size parameter is no longer
+	unused; pass it to _GD_FlacDoOpen.
+	* src/flac.c (_GD_FlacDoOpen): Record the value of swap.
+	* test/flac_get_big.c test/flac_get_cont.c test/flac_get_far.c
+	test/flac_get_get.c test/flac_get_get2.c test/flac_get_int64.c
+	test/flac_get_int8.c test/flac_get_little.c test/flac_get_long.c
+	test/flac_move_from.c test/flac_put_big.c test/flac_put_little.c
+	test/flac_seek.c test/flac_seek_far.c test/flac_sync.c: Test endianness
+	correctly.
+
+	* src/lzma.c (_GD_LzmaRead): Deal with a trailing partial sample in the
+	returned LZMA data.
+	* src/lzma.c (_GD_LzmaReady): Read more data when we have less than one
+	full sample.
+	* src/lzma.c (_GD_LzmaClear): Handle a trailing partial sample.
+
+	* test/enc_complex128.c test/enc_complex64.c test/enc_float32.c
+	test/enc_float64.c test/enc_int16.c test/enc_int32.c test/enc_int64.c
+	test/enc_int8.c test/enc_put_offs.c test/enc_uint16.c test/enc_uint32.c
+	test/enc_uint64.c test/enc_uint8.c: Don't accidentally read out of bounds.
+	Remove unnecessary mkdir() calls.
+
+	* test/error_verbose.c test/error_verbose_prefix.c: Use waitpid instead of
+	wait.
+
+	* test/include_ns_dotns.c: Correct test.
+
+2017-01-17   D. V. Wiebe <getdata at ketiltrout.net> svn:1134
+	* bindings/cxx/getdata/entry.h: replace gd_shift_t with gd_int64_t.
+	* src/field_list.c (_GD_Constants): char *fl;
+	* src/field_list.c (gd_match_entries): Fix GD_NO_REGEX case.
+	* src/getdata.c (_GD_IndirData): Fix carray pointer arithmetic.
+	* src/internal.h: Fix ssize_t definition on WIN32/WIN64.  Define __func__
+	if needed.
+
+	* test/add_spec_affix.c: Check e1.
+	* test/cvlist_meta_meta.c: Deleted.
+
+	* test/vlist.c test/include_ns_dotns.c: Fix test.
+	* test/parse_esc.c: Use '\x1B' instead of '\e'.
+
+	* test/test.h (MAKEDATAFILE): Use O_BINARY.
+
+2017-01-16   D. V. Wiebe <getdata at ketiltrout.net> svn:1132
+	* bindings/python/pyentry.c (gdpy_entry_geta): Fix self->E->EN access.
+	* src/common.c (INVERTC): Fix non-C99 case.
+	* test/add_name_len.c test/alter_polynom_scalar.c: ANSI C fixes.
+	* test/parse_ns_par.c: Deleted.
+	* util/checkdirfile.c: Include inttypes.h if present.
+
+2016-12-25   D. V. Wiebe <getdata at ketiltrout.net> svn:1130,1131
+	* configure.ac: Add --disable-util.  Remove --enable-assert.  Locate
+	regex libraries.
+
+	* src/internal.h: Deprecate gd_shift_t.
+	* src/add.c (gd_add_phase gd_madd_phase): Replace gd_shift_t with
+	gd_int64_t.
+
+	* src/field_list.c (_GD_EntryList gd_entry_list) src/nfields.c (_GD_NEntries
+	gd_nentries: Remove fragment.
+	* util/checkdirfile.c: Updated.
+
+	* src/internal.h: Add regex_list to struct gd_dirfile_.
+	* src/field_list.c (gd_compile_regex gd_compile_pcre gd_match_entries):
+	Added.
+	* src/errors.c: Add GD_E_UNSUPPORTED:GD_E_SUPPORT_REGEX,
+	GD_E_ARGUMENT:GD_E_ARG_REGEX, GD_E_ARGUMENT:GD_E_ARG_PCRE.
+	* src/getdata.h.in: Add GD_REGEX_PCRE, GD_REGEX_EXTENDED, GD_REGEX_ICASE,
+	GD_REGEX_CASELESS, GD_REGEX_JAVASCRIPT, GD_REGEX_UNICODE.
+
+	* src/internal.h: Remove unused alias_list from struct gd_flist_.
+
+	* test/add_spec_affix.c: Reimplemented.
+	* test/elist_alias.c test/elist_hidden.c test/elist_noalias.c
+	test/elist_parent.c test/elist_parent2.c test/elist_scalar.c
+	test/elist_type.c test/nentries_alias.c test/nentries_entype.c
+	test/nentries_hidden.c test/nentries_noalias.c test/nentries_scalar.c:
+	Updated.
+	* test/match_fragment.c: Moved from test/elist_fragment.c and updated.
+	* test/match_pcre.c test/match_pcre_bad.c test/match_pcre_caseless.c
+	test/match_pcre_ext.c test/match_pcre_js.c test/match_pcre_utf8.c
+	test/match_regex.c test/match_regex_bad.c test/match_regex_ext.c
+	test/match_regex_icase.c: Added.
+	* test/nentries_fragment.c: Deleted.
+
+	* man/gd_mstrings.3: Merged into man/gd_strings.3.
+	* man/*.3in: moved from *.3
+	* man/header.tmac: Added.
+
+	* bindings/make_parameters.c: Add GD_REGEX_* flags.
+	* bindings/cxx/dirfile.cpp (Dirfile::NEntries Dirfile::EntryList)
+	bindings/f77/fgetdata.c (GDNENT GDENTX GDENTN) bindings/f77/getdata.f90.in
+	(fgd_nentries fgd_entry_name_max fgd_entry_list)
+	bindings/matlab/gd_entry_list.c bindings/matlab/gd_field_list.m
+	bindings/matlab/gd_field_list_by_type.m bindings/matlab/gd_mfield_list.m
+	bindings/matlab/gd_mfield_list_by_type.m bindings/matlab/gd_mvector_list.m
+	bindings/matlab/gd_nentries.c bindings/matlab/gd_nfields.m
+	bindings/matlab/gd_nfields_by_type.m bindings/matlab/gd_nmfields.m
+	bindings/matlab/gd_nmfields_by_type.m bindings/matlab/gd_nmvectors.m
+	bindings/matlab/gd_nvectors.m bindings/matlab/gd_vector_list.m
+	bindings/perl/src/GetData.xs (entry_list) bindings/php/getdata.c
+	(gd_entry_list gd_nentries) bindings/python/pydirfile.c
+	(gdpy_dirfile_nentries gdpy_dirfile_entrylist): Remove fragment parameter.
+	* bindings/idl/getdata.c (gdidl_get_field_list): Support gd_match_entries().
+	* bindings/cxx/dirfile.cpp (Dirfile::MatchEntries) bindings/f77/fgetdata.c
+	(GDMATX GDMATN GDNMAT) bindings/f77/getdata.f90.in (fgd_match_entries_max
+	fgd_match_entries) bindings/matlab/gd_match_entries.c gd_nvectors.m
+	bindings/matlab/gd_vector_list.m (match_entries) bindings/php/getdata.c
+	(gd_match_entries) bindings/python/pydirfile.c (gdpy_dirfile_matchentries):
+	Added.
+	* bindings/cxx/getdata/phaseentry.h bindings/cxx/phaseentry.cpp
+	(PhaseEntry::PhaseEntry PhaseEntry::SetShift) bindings/perl/simple_funcs.pl
+	bindings/perl/simple_funcs.xsin bindings/perl/src/GetData.xs
+	bindings/perl/src/typemap: Replace gd_shift_t with gd_int64_t.
+	* bindings/cxx/test/big_test.cpp bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro
+	bindings/matlab/test/big_test.m bindings/perl/t/big_test.t
+	bindings/php/test/big_test.php bindings/python/test/big_test.py: Add test 305.
+
+2016-12-08   D. V. Wiebe <getdata at ketiltrout.net> svn:1129
+	* bindings/matlab/gd_include.c: Initialise ns to NULL.
+
+	* bindings/php/getdata.c (gdphp_convert_sarray): Fix empty list check.
+	* bindings/php/getdata.c (gdphp_convert_cmparray gdphp_convert_sarray
+	gdphp_convert_nsarray gdphp_convert_array): Make index unsigned.
+
+	* src/flush.c (WriteInclude): Added to simplify cleaning up sx on error.
+	* src/flush.c (_GD_FlushFragment): Call WriteInclude.
+
+	* test/alloc_callback.c test/parse_ref_type.c: Remove unused variables.
+
+2016-12-06   D. V. Wiebe <getdata at ketiltrout.net> svn:1128
+	* src/include.c (_GD_IncludeAffix): Actually delete the deleted entries,
+	why not.
+
+	* src/name.c (_GD_PerformRename): Steal 'new_name' instead of strdup'ing a
+	copy.
+	* src/move.c (_GD_Move): Delete unnecessary free()s.
+	* src/name.c (_GD_Rename): Properly clean up on error.
+
+	* src/name.c (_GD_RenameCode): Fix error handling when _GD_CodeOffsets
+	checks fail.
+
+	* src/parse.c (_GD_ParseFieldSpec): Clean up after I/O errors.
+
+	* src/compat.c (_GD_ReadDir): We don't know how big struct dirent actually
+	is, so don't pretend we do.  Ignore the second parameter (entry), just set
+	*result to the returned pointer.
+	* src/open.c (_GD_TruncDir): Ignore the second parameter to _GD_ReadDir
+	(which may be readdir_r(3)).
+	
+	* src/field_list.c (_GD_ListEntry): Don't match SINDIR entries with
+	GD_VECTOR_ENTRIES.
+	* cxx/test/big_test.cpp f77/test/big_test.f f77/test/big_test95.f90
+	idl/test/big_test.pro matlab/test/big_test.m perl/t/big_test.t
+	php/test/big_test.php python/test/big_test.py: Update tests 69, 70, 237, 239
+	* test/vlist.c: Update.
+
+	* test/mflush_affix.c test/mflush_pretty.c test/put_carray_bad.c
+	test/put_carray_bounds.c test/put_carray_bounds.c test/put_carray_type.c
+	test/put_sarray_bad.c test/put_sarray_bounds.c test/put_sarray_type.c: Call
+	gd_discard().
+	* test/put_carray_bounds.c: Don't double-open the dirfile.
+
+2016-12-06   D. V. Wiebe <getdata at ketiltrout.net> svn:1127
+	* src/flac.c (_GD_FlacOutput): Fix memcpy src calculation.
+	* test/bzip_get_cont.c test/enc_get_cont.c test/flac_get_cont.c
+	test/gzip_get_cont.c test/lzma_xz_get_cont.c: Added.
+
+2016-11-30   D. V. Wiebe <getdata at ketiltrout.net> svn:1126
+	* bindings/cxx/dirfile.cpp: Update Dirfile::PutString return type.
+	* bindings/perl/simple_funcs.xsin: Update put_string return type.
+
+	* bindings/f77/fgetdata.c (GDPTST): Don't return n_wrote.
+	* bindings/f77/getdata.f90.in (fgd_put_string): Change to subroutine.
+
+	* bindings/cxx/test/big_test.cpp bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/perl/t/big_test.t: Update
+	test 94.	
+
+2016-11-30   D. V. Wiebe <getdata at ketiltrout.net> svn:1125
+	* m4/perl.m4: Better default install path.
+
+2016-11-29   D. V. Wiebe <getdata at ketiltrout.net> svn:1122
+	* src/protect.c (gd_alter_protection): If the protection level changes,
+	mark the fragment dirty (modified).
+
+	* src/parse.c (_GD_CodeFromFrag): Fix version check.
+
+	* src/add.c (_GD_BadType): Deal with DSV <= 4 correctly.
+
+	* src/common.c (_GD_Alloc _GD_LinterpData) src/getdata.c (_GD_ExtractRepr
+	_GD_PolynomData _GD_CPolynomData _GD_MultiplyData _GD_CMultiplyData
+	_GD_DivideData _GD_CDivideData _GD_WindowData _GD_MplexData) src/types.c
+	(_GD_ConvertType): Return internal error on bad data type.
+	* src/constant.c (gd_get_carray_slice gd_get_carray _GD_PutCarraySlice)
+	src/field_list.c (_GD_Constants _GD_Carrays) src/getdata.c (gd_getdata64)
+	src/putdata.c (gd_putdata64):
+	Call _GD_BadType.
+
+	* src/getdata.c (_GD_DoLincom _GD_DoMultiply _GD_DoRecip _GD_DoDivide
+	_GD_DoBit _GD_DoPhase _GD_DoLinterp _GD_DoPolynom _GD_DoWindow _GD_DoMplex
+	_GD_DoIndir) src/putdata.c (_GD_DoLinterpOut _GD_DoBitOut _GD_DoPhaseOut
+	_GD_DoRecipOut _GD_DoPolynomOut _GD_MplexOutData): Remove _GD_BadInput call.
+	* src/entry.c (_GD_BadInput): Moved from common.c and statickified.
+	* src/entry.c (_GD_FindInputs): Added.
+	* src/entry.c (gd_validate) src/flimits.c (_GD_GetEOF _GD_GetBOF)
+	src/flush.c (_GD_Flush) src/getdata.c (_GD_DoSindir) src/iopos.c
+	(_GD_GetIOPos _GD_Seek) src/native.c (_GD_NativeType) src/putdata.c
+	(_GD_DoFieldOut) src/spf.c (_GD_GetSPF): Call _GD_FindInputs.
+	* src/flush.c (_GD_Flush): Permit E == NULL (in which case do nothing).
+
+	* src/fragment.c (_GD_UpdateAffixes): Remove dead code.
+
+	* src/close.c (_GD_FreeF): Added.
+	* src/close.c (_GD_FreeD) src/include (gd_uninclude): Call _GD_FreeF.
+	* src/include.c (_GD_IncludeAffix): Properly clean up after errors.
+
+	* src/close.c (_GD_FreeD _GD_ShutdownDirfile): Move directory closing from
+	_GD_ShutdownDirfile to _GD_FreeD.
+
+	* src/parse.c (_GD_CodeFromFrag): Fix early calculation in _GD_BuildCode
+	call.
+
+	* src/protect.c (gd_alter_protection): Dirty fragment if protection changed.
+
+	* src/nfields.c (_GD_NEntries): Correct invalid type check.
+
+	* src/parse.c (_GD_ParseFieldSpec): Remove n_cols < 2 check.
+	* src/add.c (_GD_AddSpec): Add n_cols < 2 check.
+
+	* src/parse.c (_GD_ParseFieldSpec): Remove encoding checks; _GD_InitRawIO
+	already does them.
+
+	* src/common.c (_GD_ReadLinterpFile): Return non-zero on error.
+
+	* src/getdata.c (gd_getdata64) src/putdata.c (gd_putdata64): Always convert
+	from frames to samples.
+
+	* src/parse.c (_GD_WindOp): Also check for the trailing NUL.
+
+	* src/parse.c (_GD_ParseNamespace): Fix trailing . removal.
+
+	* src/parse.c (_GD_ResolveAlias): Add base parameter and delete the recursion
+	counter, which want' being used.  Alias loops are valid syntax, so don't
+	return an error when encountering them, just make them all dangle (set
+	entry[0] to NULL).
+
+	* src/putdata.c (_GD_DoLinterpOut): Load the LUT *before* checking if it's
+	complex valued, instead of after.
+
+	* src/string.c (_GD_PutSarraySlice): Return void.
+	* src/string.c (gd_put_string): Return int D->error.
+
+	* test/alter_entry_lincom_nfields.c: Renamed from alter_lincom_nfields.c
+	* test/mflush.c: Renamed from flush_meta.c
+	* test/mflush_amb_code.c test/mflush_hex.c test/mflush_ref.c
+	test/mflush_repr.c test/mflush_repr9.c test/mflush_reprz.c
+	test/mflush_spec.c test/mflush_string.c: Renamed from flush_*.c
+	* test/ref_empty.c test/ref_get.c test/ref_set.c: Renamed from
+	global_ref_*.c
+	* test/tell_multi_div.c: Renamed from tell_multidiv.c
+	* test/parse_name_pedantic.c: Deleted.
+	* test/add_name_len.c test/add_spec_raw_autoenc.c test/add_spec_raw_prot.c
+	test/add_spec_raw_unkenc.c test/alloc_affix.c test/alloc_callback.c
+	test/alloc_clear.c test/alloc_entry.c test/alloc_tok.c
+	test/alter_bit_scalar.c test/alter_clincom_32.c test/alter_clincom_nfields.c
+	test/alter_clincom_nfields_code.c test/alter_clincom_null.c
+	test/alter_cpolynom_ord.c test/alter_cpolynom_ord_code.c
+	test/alter_lincom_nfields.c test/alter_lincom_nfields_code.c
+	test/alter_lincom_scalar.c test/alter_mplex_scalar.c test/alter_phase_scalar.c
+	test/alter_polynom_ord2.c test/alter_polynom_ord_code.c
+	test/alter_polynom_scalar.c test/alter_raw_spf_type.c
+	test/alter_recip_scalar.c test/alter_spec_prot.c test/alter_spec_rdonly.c
+	test/alter_window_scalar.c test/flush_recurse.c test/get_divide_code.c
+	test/get_index_type.c test/get_lincom_code.c test/get_multiply_code.c
+	test/get_sindir_code.c test/get_sindir_neg.c test/include_format.c
+	test/include_ref_code.c test/include_ref_type.c test/index_empty.c
+	test/index_one.c test/index_scalar.c test/mflush_carray.c test/mflush_indir.c
+	test/mflush_mplex.c test/mflush_ns.c test/mflush_pretty.c test/mflush_prot.c
+	test/mflush_sindir.c test/mflush_type.c test/mflush_type4.c
+	test/mflush_windop.c test/move_unkenc.c test/native_code.c
+	test/native_recurse.c test/nentries_entype.c test/nmeta_parent_meta.c
+	test/parse_alias_loop.c test/parse_alias_ncols.c test/parse_carray_ncols.c
+	test/parse_carray_type.c test/parse_const_type.c test/parse_endian_bad2.c
+	test/parse_esc.c test/parse_hidden_frag.c test/parse_meta_ncols.c
+	test/parse_mplex_neg.c test/parse_recip_ncols.c test/parse_ref_type.c
+	test/parse_sarray_ncols.c test/protect_alter_arg.c test/protect_alter_index.c
+	test/protect_alter_rdonly.c test/protect_index.c test/put_bit_repr.c
+	test/put_lincom_repr.c test/put_linterp_cmp.c test/put_linterp_repr.c
+	test/put_mplex_repr.c test/put_neg.c test/put_phase_repr.c
+	test/put_polynom_repr.c test/put_recip_repr.c test/put_scalar.c
+	test/put_string_type.c test/ref_set_code.c test/ref_set_prot.c
+	test/ref_set_rdonly.c test/ref_set_type.c test/seek_arg.c test/seek_code.c
+	test/seek_dim.c test/seek_index_end.c test/seek_mplex.c test/seek_range_end.c
+	test/seek_recurse.c test/spf_const.c test/tell_code.c test/tell_dim.c
+	test/tell_multi_lincom.c test/tell_recurse.c: Added.
+
+  * test/convert_float64_int64.c test/parse_const_ncols.c
+	test/put_lincom_noin.c test/put_recurse.c: Fixed.
+
+	* test/fragment_affix_alter_code.c test/name_updb_carray.c
+	test/name_updb_const.c test/parse_window_op.c test/put_string.c
+	test/put_string_protect.c: Updated.
+
+2016-11-26   D. V. Wiebe <getdata at ketiltrout.net> svn:1121
+	* src/ascii.c (_GD_AsciiOpen): Remove the ancient existing file code.
+
+	* src/ascii.c (_GD_AsciiWrite): Update file->pos.
+
+	* src/bzip.c (_GD_Bzip2Seek): Unfortunately, remove the dead backwards
+	seek code: the current bookkeping layer means this can never happen. (For
+	OOP encodings, seeks calls to the framework are always forward.)
+
+	* src/common.c (_GD_ReadLinterpFile): Return GD_E_IO for I/O errors instead
+	of GD_E_LUT.
+
+	* src/common.c (_GD_CInvertData): Remove dead, non-complex return_type code:
+	_GD_DoField ensures that return_type is always complex valued in this case.
+
+	* src/constat.c (gd_array_len): Return 0 on error.
+
+	* src/del.c (_GD_ClearInput): Added.
+	* src/del.c (_GD_ClearDerived): Call _GD_ClearInput for each in_fields
+	element.  strcmp is not adequate for field matching; _GD_ClearInput uses
+	_GD_FindFieldAndRepr.
+
+	* src/del.c (_GD_Delete): Remove incorrect check for _GD_ClearDerived call.
+
+	* src/getdata.c (_GD_DoRaw): Update s0 based on zero padding.  Instead of
+	calling the encoding's seek function directly, use _GD_Seek, which also will
+	handle calling _GD_InitRawIO when necessary.  Always call _GD_Seek if zero
+	padding.
+
+	* src/iopos.c (_GD_DoSeek): Fix oop_write calculation.
+
+	* test/get_carray.c: Remove GD_VERBOSE.
+
+	* test/legacy_format.c bindings/cxx/test/big_test.cpp
+	bindings/f77/test/big_test.f bindings/f77/test/big_test95.f90
+	bindings/idl/test/big_test.pro bindings/matlab/test/big_test.m
+	bindings/perl/t/big_test.t bindings/php/test/big_test.php
+	bindings/python/test/big_test.py: Update checks for sortation change.
+
+	* test/test.h: Define INFINITY if necessary.
+
+	* test/len_carray.c test/len_sarray.c: Renamed from get_carray_len.c and
+	get_sarray_len.c.
+
+	* test/calist.c test/calist0.c test/calist_free.c test/calist_hidden.c
+	test/calist_long.c test/calist_meta.c test/calist_meta0.c
+	test/calist_meta_free.c test/calist_meta_hidden.c test/calist_meta_meta.c
+	test/calist_meta_parent.c test/calist_null.c test/salist.c test/salist0.c
+	test/salist_hidden.c test/salist_long.c test/salist_meta.c test/salist_meta0.c
+	test/salist_meta_free.c test/salist_meta_hidden.c test/salist_meta_meta.c
+	test/salist_meta_parent.c: Renamed from [cs]vlist_array*.c.
+
+	* test/add_sarray_dup.c test/add_spec_nil.c test/add_string_dup.c
+	test/ascii_complex128.c test/ascii_complex64.c test/ascii_float32.c
+	test/ascii_float64.c test/ascii_int16.c test/ascii_int32.c test/ascii_int64.c
+	test/ascii_int8.c test/ascii_uint16.c test/ascii_uint32.c test/ascii_uint64.c
+	test/ascii_uint8.c test/bof_bit_code.c test/bof_code.c test/bof_const.c
+	test/bof_lincom_code.c test/bof_phase_code.c test/bof_recurse.c
+	test/bzip_complex128.c test/bzip_complex64.c test/bzip_float32.c
+	test/bzip_float64.c test/bzip_int16.c test/bzip_int32.c test/bzip_int64.c
+	test/bzip_int8.c test/bzip_uint16.c test/bzip_uint32.c test/bzip_uint64.c
+	test/bzip_uint8.c test/cvlist_meta_code.c test/del_alias_dangle.c
+	test/del_alias_target.c test/del_data_prot.c test/del_divide.c test/del_prot.c
+	test/del_rdonly.c test/elist_parent2.c test/enc_complex128.c
+	test/enc_complex64.c test/enc_float32.c test/enc_float64.c test/enc_int16.c
+	test/enc_int32.c test/enc_int64.c test/enc_int8.c test/enc_uint16.c
+	test/enc_uint32.c test/enc_uint64.c test/enc_uint8.c test/endian_alter_arg.c
+	test/endian_alter_dprot.c test/endian_alter_fprot.c test/endian_alter_index.c
+	test/endian_alter_rdonly.c test/endian_index.c test/eof_bit_code.c
+	test/eof_const.c test/eof_lincom_code.c test/eof_phase_code.c
+	test/eof_recurse.c test/flac_complex128.c test/flac_complex64.c
+	test/flac_float32.c test/flac_float64.c test/flac_int16.c test/flac_int32.c
+	test/flac_int64.c test/flac_int8.c test/flac_uint16.c test/flac_uint32.c
+	test/flac_uint64.c test/flac_uint8.c test/foffs_alter_dprot.c
+	test/foffs_alter_fprot.c test/foffs_alter_index.c test/foffs_alter_range.c
+	test/foffs_alter_rdonly.c test/foffs_index.c test/get_carray_bad.c
+	test/get_carray_slice_bounds.c test/get_carray_slice_type.c
+	test/get_carray_type.c test/get_dimin.c test/get_indir_typein.c
+	test/get_recip_cmpin.c test/get_sarray_bad.c test/get_sarray_slice_bounds.c
+	test/get_sarray_slice_type.c test/get_sarray_type.c test/get_sindir_reprz.c
+	test/get_sindir_typein.c test/gzip_complex128.c test/gzip_complex64.c
+	test/gzip_float32.c test/gzip_float64.c test/gzip_int16.c test/gzip_int32.c
+	test/gzip_int64.c test/gzip_int8.c test/gzip_uint16.c test/gzip_uint32.c
+	test/gzip_uint64.c test/gzip_uint8.c test/len_bad.c test/len_const.c
+	test/len_string.c test/len_type.c test/lzma_xz_complex128.c
+	test/lzma_xz_complex64.c test/lzma_xz_float32.c test/lzma_xz_float64.c
+	test/lzma_xz_int16.c test/lzma_xz_int32.c test/lzma_xz_int64.c
+	test/lzma_xz_int8.c test/lzma_xz_uint16.c test/lzma_xz_uint32.c
+	test/lzma_xz_uint64.c test/lzma_xz_uint8.c test/madd_sarray_dup.c
+	test/madd_spec_parent.c test/madd_string_dup.c test/put_carray_bad.c
+	test/put_carray_bounds.c test/put_carray_rdonly.c test/put_carray_type.c
+	test/put_sarray_bad.c test/put_sarray_bounds.c test/put_sarray_rdonly.c
+	test/put_sarray_type.c: Added.
+
+2016-11-24   D. V. Wiebe <getdata at ketiltrout.net> svn:1118, 1119
+	* src/internal.h: Add GD_CO_REPR and GD_CO_REPRZ flags.
+	* src/name.c (_GD_SlashDot): Don't match '.z' unless GD_CO_REPRZ is set.
+	* src/name.c (_GD_StripCode): Keep a representation suffix if GD_CO_REPR is
+	set.  If GD_CO_REPR and GD_CO_REPRZ set, add a disambiguating .z if needed.
+
+	* src/flush.c (_GD_WriteFieldCode): Add GD_WFC_NAME flag.  Set GD_CO_REPR
+	and/or GD_CO_REPRZ in strip_flags when appropriate.
+	* src/flush.c (_GD_PadField): Call _GD_WriteFieldCode with GD_WFC_NAME set.
+	* src/flush.c (_GD_FieldSpec) src/flush.c (_GD_FlushFragment): For
+	/ALIAS, /HIDDEN, and /REFERENCE directives, add GD_WFC_NAME to
+	_GD_WriteFieldCode call.
+
+	* src/name.c (_GD_CodeOffsets): Fix offset[8] calculation for repr.
+
+	* test/flush_affix.c test/flush_repr.c test/flush_repr9.c
+	test/flush_reprz.c: Added.
+
+2016-11-23   D. V. Wiebe <getdata at ketiltrout.net> svn:1117
+	* src/common.c (_GD_FindFieldWithParent): Remove unused DIRFILE* parameter.
+
+2016-11-23   D. V. Wiebe <getdata at ketiltrout.net> svn:1116
+	* src/common.c (_GD_FindFieldWithParent _GD_FindField): Ignore an initial
+	dot in the field code.
+
+	* src/common.c (_GD_FindFieldAndRepr): Look for field code with repr first
+	to resolve the .z ambiguity.
+
+	* src/entry.c (_GD_GetScalar): Don't set an error (for gd_entry() use).
+
+	* src/entry.c (gd_validate): If _GD_CalculateEntry() fails, return early.
+
+	* test/get_const_bad.c test/get_const_reprz.c test/get_dot.c test/get_reprz.c
+	test/index_reprz.c test/native_reprz.c test/valid_reprz.c: Added.
+	
+2016-11-22   D. V. Wiebe <getdata at ketiltrout.net> svn:1115
+	* src/common.c (_GD_GetRepr): Add len parameter.  Don't malloc, just
+	decrement *len twice if matched.  Don't set errors.  Remove D and field_code
+	parameters.
+	* src/common.c (_GD_FindFieldAndRepr): Remove field_code and set parameters.
+
+	* src/constant.c (gd_array_len): Call _GD_FindEntry instead of
+	_GD_FindFieldAndRepr.
+
+	* src/entry.c (gd_aliases): Don't call gd_naliases.  Resize as necessary.
+
+2016-11-22   D. V. Wiebe <getdata at ketiltrout.net> svn:1112
+	* bindings/perl/src/GetData.xs: Fix a few EXTEND() calls.
+
+	* src/add.c (_GD_Add): subfield_offs is size_t.  Move _GD_InvalidEntype call
+	earlier.
+
+	* src/internal.h (gd_private_entry_): Add len.
+	* src/internal.h (gd_rename_update_): Add new_len and dst_len.
+	* src/add.c (_GD_Add _GD_AddAlias) src/fragment.c (_GD_UpdateAffixes)
+	src/open.c (_GD_Open) src/parse.c (_GD_SetField): Set E->e->len.
+	* src/move.c (_GD_Move): Update E->e->len.
+	* src/add.c (_GD_FixName) src/common.c (_GD_FindField): Add len parameter.
+	* src/name.c (_GD_RenameCode): Add len parameter.  Record E->e->len update.
+	* src/name.c (_GD_PerformRename): Do all the len updates.
+	* src/name.c (_GD_PrepareRename): Add new_len parameter.
+	* src/parse.c (_GD_CheckParent): Add len parameter.  Update *len.
+	* src/parse.c (_GD_ParseFieldSpec): Add len0 parameter.
+
+	* src/common.c (_GD_pstrlencmp _GD_strlencmp _GD_FindFieldWithParent): Added.
+	* src/common.c (_GD_EntryCmp): Use _GD_strlencmp for comparison.  This
+	changes the sorted entry order!
+	* src/common.c (_GD_FindField): Don't malloc. Use _GD_FindFieldWithParent to
+	find subfields of aliased fields.
+	* test/name_alias.c test/name_dangle.c test/name_move.c
+	test/name_move_alias.c test/name_name.c test/parse_sort.c: Update for
+	changes in entry sort.
+
+	* src/del.c (_GD_Delete): Delete meta fields the expensive way (by searching
+	for each one) because they aren't necessarily sorted together anymore.
+
+	* src/constant.c (gd_put_carray_slice gd_put_carray) src/entry.c (gd_aliases
+	gd_naliases) src/field_list.c (gd_entry_list _GD_Constants _GD_Carrays
+	_GD_Strings _GD_SArrays) src/globals.c (gd_reference) src/mod.c (_GD_Change
+	gd_alter_lincom gd_alter_clincom gd_alter_polynom gd_alter_cpolynom
+	_GD_AlterSpec) src/nfields.c (gd_nentries) src/putdata.c (gd_putdata64)
+	src/string.c (gd_get_sarray_slice gd_put_sarray_slice gd_put_sarray
+	gd_put_string): Call _GD_FindEntry instead of _GD_FindField.
+
+	* src/field_list.c (_GD_Carrays _GD_Strings _GD_SArrays): Add space for the
+	terminating record.
+
+	* src/name.c (_GD_PerformRename): Don't allow rdat==NULL.
+	* src/move.c (_GD_Move): Only call _GD_PerformRename if rdat is non-NULL.
+
+	* test/alter_bit_in.c test/alter_divide_in.c test/alter_mplex_in.c
+	test/alter_phase_in.c test/alter_window_in.c test/alter_window_op.c: Free
+	entry strings.
+
+	* test/cvlist_array_long.c: Check number returned.
+
+	* test/enc_add.c test/enc_del.c test/enc_enoent.c test/enc_move_from.c
+	test/enc_nframes.c test/enc_seek.c: Added.
+	* test/bzip_add.c test/bzip_enoent.c test/bzip_move_from.c
+	test/bzip_nframes.c test/bzip_seek.c test/flac_add.c test/flac_enoent.c
+	test/flac_nframes.c test/flac_seek.c test/gzip_add.c test/gzip_del.c
+	test/gzip_enoent.c test/gzip_move_from.c test/gzip_nframes.c
+	test/gzip_seek.c test/lzma_enoent.c test/lzma_nframes.c test/lzma_xz_add.c
+	test/lzma_xz_nframes.c test/lzma_xz_seek.c: Use enc_*.c version.
+	* test/bzip_del.c test/flac_del.c test/flac_move_from.c: Added.
+	* test/flac_seek_far.c test/gzip_seek_far.c test/lzma_xz_del.c
+	test/lzma_xz_move_from.c test/zzip_nframes.c: Update.
+
+	* test/unclude_index.c test/unclude_prot.c test/unclude_rdonly.c: Call
+	gd_discard.
+
+2016-11-19   D. V. Wiebe <getdata at ketiltrout.net> svn:1111
+	* src/fragment.c (_GD_UpdateAffixes): Always steal nsin.  Caller must pass
+	nsl and ensure ns has a dot at the end.
+	* src/fragment.c (_GD_NormaliseNamespace): Added.
+	* src/fragment.c (gd_alter_affixes): Handle leading dots correctly.
+	* src/include.c (gd_include_ns) src/fragment.c (gd_fragment_namespace): Call
+	_GD_NormaliseNamespace.
+
+	* configure.ac: Look for features.h.
+	* src/internal.h: Deal with glibc-2.24's deprecation of readdir_r, I
+	suppose.
+
+	* test/fragment_ns_dot.c test/fragment_ns_dotdot.c test/fragment_ns_dotns.c
+	test/fragment_ns_nsdot.c test/include_ns_dotdot.c test/move_ns.c
+	test/move_nsns.c: Added.
+
+2016-11-18   D. V. Wiebe <getdata at ketiltrout.net> svn:1110
+	* src/open.c (gd_desync): Moved from fragment.c.
+	* src/open.c (_GD_Open): Statickify.
+
+	* src/internal.h: Renamed gd_fragment_t.prefix and gd_fragment_t.suffix to
+	px and sx, and add pxl and sxl to match namespace handling.
+	* src/flush.c (_GD_FlushFragment): Handle /INCLUDE affixes directly.
+
+	* src/getdata.h.in: GD_EN_DOTTED deleted.
+	* src/internal.h: GD_EN_EARLY internal entry flag, does basically the
+	same thing that GD_EN_DOTTED did.
+	* src/add.c (_GD_Add): Set GD_EN_EARLY when appropriate.
+	* test/add_dot10.c test/add_dot5.c test/name_dot10.c test/name_dot5.c
+	test/name_dot5r.c: Remove references to GD_EN_DOTTED.
+
+	* src/parse.c (_GD_SubfieldCode): Remove nso parameter.
+
+	* src/parse.c (_GD_ParseNamespace): Simplify /NAMESPACE: it now is always
+	relative to the fragment rootspace.  An initial . is ignored.
+	* src/include.c (_GD_SetFieldAffixes): Use memcpy instead of sprintf.
+	Handle namespace better.
+	* src/include.c (_GD_Include _GD_SetFieldAffixes): Update for /NAMESPACE
+	changes: parser_state_->ns now holds only the namespace part relative to
+	fragment rootspace.
+	* test/parse_include_ns2.c test/parse_name_dot.c test/parse_ns_dotdot.c
+	test/parse_nsf_dot.c test/parse_nsf_sub.c: Update test.
+	* test/parse_nsf_par.c test/parse_nsf_refrel.c test/parse_nsf_rpar.c:
+	Deleted.
+
+	* src/include.c (_GD_IncludeAffix): Renamed form gd_include_affix to get
+	parser_state function name correct.
+	* src/include.c (gd_include_affix): Added.
+
+	* src/include.c (_GD_CollectFragments): Deleted.  Duplicated by
+	_GD_SubFragmentList in fragment.c.
+	* src/include.c (gd_uninclude): Call _GD_SubFragmentList.
+
+	* bindings/matlab/gd_include.c: Renamed from gd_include_ns.c
+	* bindings/matlab/gd_include_affix.c: Renamed from gd_include.c
+
+	* bindings/perl/src/GetData.xs (include): Call gd_include_ns instead of
+		gd_include_affix.
+	* bindings/perl/simple_funcs.xsin: Removed include_ns. Added include_affix.
+
+	* bindings/php/getdata.c (gd_include_affix): Renamed from gd_include.
+	* bindings/php/getdata.c (gd_include): Renamed from gd_include_ns.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_include): Re-order keywords.
+
+	* man/gd_fragment_namespace.3: Added.
+
+	* src/add.c (_GD_InvalidEntype): Parameterise check.
+	
+	* src/add.c (_GD_BadType): Added.
+	* src/add.c (_GD_Add): Call _GD_BadType to check storage type.
+	* test/alter_carray_type.c test/alter_raw_type.c: Expand test.
+
+	* src/add.c (_GD_Add): Add init_scalar parameter to avoid unnecessary
+		scalar initialisations.
+
+	* src/add.c (_GD_Add _GD_AddAlias): Reject aliases as parents.  Call
+	_GD_SlashDot to find namespace.
+
+	* src/fragment.c (_GD_CheckAffixes): Deleted.  Replaced by
+	_GD_UpdateAffixes.
+	* src/fragment.c (_GD_UpdateCode _GD_UpdateAffixes) src/name.c (_GD_SlashDot
+	_GD_CodeOffsets _GD_StripCode _GD_BuildCode): Added.
+	* src/internal.h: Replace GD_MC_ flags with GD_CO_ flags.
+	* src/fragment.c (_GD_ChangeAffixes) src/name.c (_GD_MungeCode): Deleted.
+	Functionality broken up into smaller pieces: _GD_SlashDot, _GD_CodeOffsets,
+	_GD_StripCode, _GD_BuildCode in name.c plus _GD_UpdateCode in fragment.c.
+	* src/add.c (_GD_Add) src/flush.c (_GD_WriteFieldCode) src/move.c (_GD_Move)
+	src/parse.c (_GD_CodeFromFrag): Replace _GD_MungeCode calls with
+	_GD_StripCode or _GD_BuildCode calls.
+	* src/parse.c (_GD_InputCode): Just call _GD_BuildCode.
+
+	* src/name.c (_GD_RenameCode): Added.
+	* src/name.c (_GD_MatchCode _GD_MakeNewCode): Deleted.  Functionality
+	combined into _GD_RenameCode.
+	* src/name.c (_GD_UpdateScalar _GD_UpdateInField): Do little other than
+	call _GD_RenameCode and dirty caches.
+	* src/internal.h: Update gd_rename_data_ struct.  Add gd_rename_update_
+	struct.
+	* src/name.c (_GD_CleanUpRename _GD_PrepareRename): Update.  Call
+	_GD_RenameCode for subfields.
+	* src/name.c (_GD_PerformRename): Handle rename directly.
+
+	* src/name.c (_GD_Rename): Create new filebase with _GD_StripCode to
+	properly handle namespaces.
+
+	* src/flush.c (GD_WRITE_INFIELD GD_WRITE_CONST): Added.
+
+	* src/include.h src/add.c (_GD_Add) src/common.c (_GD_FindEntry
+	_GD_FindFieldAndRepr) src/move.c (_GD_Move) src/parse.c (_GD_ParseFieldSpec):
+	Remove dot_list stuff.
+
+	* src/mod.c (_GD_AlterSpec): Only undo the parser's handiwork on success.
+
+	* src/entry.c (_GD_FreeE): Don't assume the caller has set n_fields or
+	poly_ord to a valid value.
+
+	* src/errors.c: Fix GD_E_BAD_TYPE string.
+
+	* src/field_list.c (_GD_SArrays): Don't leak.
+
+	* src/add.c (gd_add_polynom gd_add_cpolynom): Fix poly_ord check.
+	* test/add_cpolynom.c test/add_polynom.c: Update.
+
+	* test/add_alias_index.c test/add_alias_name.c test/add_alias_ns.c
+	test/add_alias_prot.c test/add_alias_rdonly.c test/add_bit_inaff.c
+	test/add_carray_entry.c test/add_carray_type.c test/add_clincom_nfields.c
+	test/add_const_type.c test/add_cpolynom_order.c test/add_divide_inaff1.c
+	test/add_divide_inaff2.c test/add_lincom_nfields2.c test/add_linterp_inaff.c
+	test/add_meta_parent.c test/add_mplex_inaff.c test/add_mplex_period.c
+	test/add_phase_inaff.c test/add_polynom_inaff.c test/add_polynom_order.c
+	test/add_polynom_order2.c test/add_raw_prot.c test/add_recip_inaff.c
+	test/add_spec_index.c test/add_spec_prot.c test/add_string_entry.c
+	test/add_window_inaff.c test/alter_bit_in.c test/alter_code.c
+	test/alter_const_type.c test/alter_divide_in.c test/alter_entry_entype.c
+	test/alter_lincom_nfields.c test/alter_linterp_in.c test/alter_mplex_in.c
+	test/alter_phase_in.c test/alter_prot.c test/alter_raw_prot.c
+	test/alter_rdonly.c test/alter_sarray_nop.c test/alter_sbit.c
+	test/alter_spec_code.c test/alter_spec_format.c test/alter_spec_nil.c
+	test/alter_window_in.c test/alter_window_op.c test/cvlist_array_long.c
+	test/cvlist_array_meta_meta.c test/cvlist_array_meta_parent.c
+	test/cvlist_long.c test/cvlist_meta_meta.c test/cvlist_meta_parent.c
+	test/elist_parent.c test/elist_type.c test/fragment_affix_alter_dotpx.c
+	test/fragment_affix_alter_index.c test/fragment_affix_alter_nons.c
+	test/fragment_affix_alter_ns.c test/fragment_affix_alter_pns.c
+	test/fragment_affix_index.c test/fragment_ns_alter_nop.c
+	test/fragment_ns_alter_pdel.c test/fragment_parent_index.c
+	test/fragment_parent_root.c test/include_prot.c test/madd_alias_alias.c
+	test/madd_alias_subsub.c test/madd_aliasmeta.c test/madd_clincom_nfields.c
+	test/madd_cpolynom_order.c test/madd_lincom_nfields.c test/madd_parent_bad.c
+	test/madd_polynom_order.c test/madd_raw.c test/madd_subsub.c test/move_code.c
+	test/move_data_enc_un.c test/move_data_prot.c test/move_entype.c
+	test/move_nop.c test/move_rdonly.c test/name_code.c test/name_index.c
+	test/name_meta2.c test/name_prot.c test/name_rdonly.c test/parse_huge.c
+	test/parse_include_nodir.c test/parse_ns_include.c test/parse_ns_include_ns.c
+	test/svlist_array_long.c test/svlist_array_meta_meta.c
+	test/svlist_array_meta_parent.c test/svlist_long.c test/svlist_meta_meta.c
+	test/svlist_meta_parent.c test/unclude_index.c test/unclude_keep.c
+	test/unclude_prot.c test/unclude_rdonly.c: Added.
+	* test/add_code.c test/add_ns.c: Zero memory to avoid crashing.
+	* test/cvlist_array_meta.c test/cvlist_array_meta0.c
+	test/cvlist_array_meta_free.c test/cvlist_array_meta_hidden.c
+	test/svlist_array_meta_free.c test/svlist_array_meta_hidden.c: error is
+	signed.
+
+	* test/elist_alias.c test/elist_fragment.c test/elist_hidden.c
+	test/elist_noalias.c test/elist_scalar.c util/checkdirfile.c: Fix
+	gd_entry_list call.
+	* test/nentries_alias.c test/nentries_fragment.c test/nentries_hidden.c
+	test/nentries_noalias.c test/nentries_scalar.c util/checkdirfile.c: Fix
+	gd_nentries call.
+
+	* test/parse_alias_code.c: Specify version.
+
+	* test/include_ns_prefix.c: Check e2.
+
+2016-09-29   D. V. Wiebe <getdata at ketiltrout.net> svn:1109
+	* bindings/cxx/dirfile.cpp (Dirfile::IncludeNS) bindings/cxx/fragment.cpp
+	(Fragment::SetNamespace) bindings/cxx/getdata/fragment.h (Namespace)
+	bindings/f77/fgetdata.c (GDFRNS GDINCN) bindings/f77/getdata.f90.in
+	(fgd_include_ns fgd_fragment_namespace fgd_alter_namespace)
+	bindings/idl/getdata.c (gdidl_fragment_namespace)
+	bindings/matlab/gd_fragment_namespace.c bindings/matlab/gd_include_ns.c
+	bindings/perl/simple_funcs.xsin (include_ns fragment_namespace)
+	bindings/php/getdata.c (gd_fragment_namespace gd_include_ns)
+	bindings/python/pyfragment.c (gdpy_fragment_getns gdpy_fragment_setns): Added.
+	* bindings/idl/getdata.c (gdidl_include) bindings/python/pydirfile.c
+	(gdpy_dirfile_include): Handle both prefix and namespace.
+	* bindings/cxx/fragment.cpp (Fragment::Fragment): Initialise ns.
+	* bindings/cxx/fragment.cpp (Fragment::SetPrefix): Reload ns.
+
+	* bindings/cxx/dirfile.cpp (Dirfile::NEntries Dirfile::EntryList)
+	bindings/f77/fgetdata.c (GDNENT GDENTX GDENTN) bindings/f77/getdata.f90.in
+	(fgd_nentries fgd_entry_list) bindings/idl/getdata.c (gdidl_get_field_list
+	gdidl_get_nfields) bindings/matlab/gd_entry_list.c
+	bindings/matlab/gd_nentries.c bindings/perl/src/GetData.xs (entry_list)
+	bindings/php/getdata.c (gd_entry_list gd_nentries)
+	bindings/python/pydirfile.c (gdpy_dirfile_nentries gdpy_dirfile_entrylist)
+	src/field_list.c (gd_entry_list) src/nfields.c (gd_nentries):
+	Swap order of fragment and parent arguments.
+
+	* src/fragment.c: fix GD_E_BAD_INDEX error initialisation.
+
+	* bindings/matlab/gd_include.c: Make flags optional.
+
+	* bindings/idl/getdata.c (gdidl_get_raw_filename)
+	bindings/matlab/gd_linterp_tablename.c bindings/matlab/gd_raw_filename.c
+	bindings/php/getdata.c (gd_linterp_tablename gd_raw_filename):
+	Free string returned by C API.
+
+	* bindings/cxx/test/big_test.cpp bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro
+	bindings/matlab/test/big_test.m bindings/perl/t/big_test.t
+	bindings/php/test/big_test.php bindings/python/test/big_test.py:
+	Added tests 302, 303, and 304.
+
+	* src/common.c: Initialise _GD_CMalloc, _GD_CFree, _GD_CStrdup.
+	* src/globals.c (_GD_CallerStrdup gd_alloc_funcs): Added.
+	* src/entry.c (_GD_FreeE): Use the correct free function in all cases.
+	* src/entry.c (gd_raw_filename gd_linterp_tablename) src/errors.c
+	(gd_error_string) src/fragment.c (gd_fragment_affixes) src/parse.c
+	(gd_strtok): Move result to caller's heap, if necessary.
+	* src/parse.c (_GD_ParseFragment): Move a callback-returned string off
+	the caller's heap, if necessary.
+	* src/errors.c (_GD_SetError2): Call _GD_CFree.
+	* src/entry.c (gd_entry): Allocate strings on the caller's heap.
+	* bindings/matlab/matlab.c (gdmx_initialise): Added.
+	* bindings/matlab/gd_invalid_dirfile.c bindings/matlab/gd_open.c: Call
+	gdmx_initialise;
+	* bindings/perl/src/GetData.xs (gdp_malloc): Added.
+	* bindings/perl/src/GetData.xs: Call gd_alloc_funcs() in BOOT; use Newx,
+	savepv, &c. everywhere appropriate.
+	* bindings/python/pygetdata.c (gdpy_strdup): Added.
+	* bindings/python/pygetdata.c: (GDPY_MODINITFUNC): Call gd_alloc_funcs.
+	* man/gd_alloc_funcs.3: Added.
+
+	* bindings/matlab/matlab.c (gdmx_err): Errors don't need to be globals.
+
+	* src/getdata.h.in: Remove the GetData-0.6 API (GD_FUNCTION_ALIASES).
+
+2016-09-27   D. V. Wiebe <getdata at ketiltrout.net> svn:1108
+	* src/error.c (gd_error_string): Use -D->error in the UNKNOWN error case.
+
+	* src/fragment.c (_GD_CheckChangeNamespace): Handle both oldns == NULL
+	and newns == NULL, by adding or deleting the dot when appropriate.  Also,
+	don't crash when pns == NULL;
+	* src/include.c (gd_include_ns): Added.
+
+	* test/include_affix_ns.c: Renamed from include_ns.c
+	* fragment_affix_ns.c test/fragment_ns.c test/fragment_ns0.c
+	test/fragment_ns_add.c test/fragment_ns_add0.c test/fragment_ns_alter.c
+	test/fragment_ns_del.c test/include_affix_ns.c test/include_ndotdots.c
+	test/include_ndots.c test/include_ns_dot.c test/include_ns_dotns.c
+	test/include_ns_nil.c test/include_ns.c test/include_ns_null.c
+	test/include_ns_prefix.c test/fragment_ndotdots.c test/fragment_ndots.c:
+	Added.
+	* test/parse_nsf_alias.c: Fix and add to test suite.
+
+	* test/test.h: Don't segfault in CHECKS tests if n == NULL.  (Which
+	shouldn't be true, but can occur when there are bugs in the library.)
+
+2016-09-26   D. V. Wiebe <getdata at ketiltrout.net> svn:1106
+	* configure.ac: Make --enable-modules the default.
+
+2016-09-25   D. V. Wiebe <getdata at ketiltrout.net> svn:1105
+
+	Merge in getdata-dsv10 branch:
+
+	* bindings/matlab/matlab.c (gdmx_err) bindings/python/pygetdata.h
+	(PYGD_REPORT_ERROR): Handle negative error codes. (r1027)
+
+  * bindings/perl/src/GetData.xs (fragments): Return undef on error in array
+	context.  (r1027)
+
+  * src/getdata.h.in: Make all error codes negative and remove unused numbers.
+	(r1027)
+  * bindings/matlab/matlab.c (gdmx_msgid) bindings/python/pygetdata.c
+  (gdpy_exception_list) src/legacy.c (GD_ERROR_CODES): Update for renumbered
+  codes. (r1027)
+  * src/legacy.c (_GD_GetDirfile GetFormat GetData GetNFrames
+  GetSamplesPerFrame PutData): Set *error_code to -D->error. (r1027)
+
+  * src/add.c (_GD_AddSpec _GD_AddAlias) src/constant.c (_GD_PutCarraySlice)
+  src/del.c (_GD_Delete) src/flush.c (_GD_SyncOrClose) src/mod.c (_GD_Change)
+  src/mod.c (_GD_AlterYoke _GD_AlterSpec) src/move.c (_GD_Move) src/name.c
+  (_GD_Rename): Return void. (r1027)
+
+  * src/add.c (gd_madd_spec gd_add_spec gd_add gd_add_raw gd_add_lincom
+  gd_add_clincom gd_add_linterp gd_add_bit gd_add_sbit _GD_AddYoke
+  gd_add_multiply gd_add_recip gd_add_crecip89 gd_add_polynom gd_add_cpolynom
+  gd_add_phase gd_add_window gd_add_mplex gd_add_string gd_add_const
+  gd_add_carray gd_add_sarray gd_madd_lincom gd_madd_clincom gd_madd_linterp
+  gd_madd_bit gd_madd_sbit _GD_MAddYoke gd_madd_phase gd_madd_polynom
+  gd_madd_cpolynom gd_madd_recip gd_madd_crecip89 gd_madd_window gd_madd_mplex
+  gd_madd_string gd_madd_const gd_madd_carray gd_madd_sarray gd_add_alias
+  gd_madd_alias) src/constant.c (gd_get_carray_slice gd_get_carray
+  gd_put_carray_slice gd_put_carray) src/del.c (gd_delete) src/encoding.c
+  (gd_alter_encoding gd_encoding_support) src/endian.c (gd_alter_endianness)
+  src/entry.c (gd_entry gd_fragment_index gd_hide gd_hidden gd_unhide
+  gd_validate) src/flimits.c (gd_alter_frameoffset64 gd_frameoffset64
+  gd_eof64 gd_bof64) src/flush.c (gd_metaflush gd_rewrite_fragment gd_sync
+  gd_raw_close gd_flush gd_dirfile_standards) src/fpos.c (_GD_GetFilePos
+  gd_tell64 _GD_DoSeek _GD_Seek gd_seek64) src/fragment.c (gd_fragment_affixes
+  gd_alter_affixes gd_nfragments gd_parent_fragment gd_desync) src/globals.c
+  (gd_verbose_prefix) src/include.c (gd_include_affix gd_uninclude) src/mod.c
+  (gd_alter_entry gd_alter_raw gd_alter_lincom gd_alter_clincom
+  gd_alter_linterp gd_alter_bit gd_alter_sbit gd_alter_recip gd_alter_recip
+  gd_alter_crecip89 gd_alter_divide gd_alter_multiply gd_alter_indir
+  gd_alter_sindir gd_alter_phase gd_alter_const gd_alter_carray
+  gd_alter_sarray gd_alter_polynom gd_alter_cpolynom gd_alter_window
+  gd_alter_mplex gd_alter_spec gd_malter_spec) src/move.c (gd_move) src/name.c
+  (gd_rename) src/nframes.c (gd_nframes64) src/protect.c (gd_protection
+  gd_alter_protection) src/string.c (gd_get_sarray_slice gd_get_sarray
+  gd_put_sarray_slice gd_put_sarray gd_put_string): Return D->error. (r1027)
+
+	Re-enable DSV 10 stuff removed for GetData-0.9, reverting (at least parts 
+	of) revisions 997, 999, 1000, 1001, 1004 through selective merge in from
+	getdata-dsv10 branch:
+
+	* src/add.c (_GD_InvalidEntype _GD_Add) src/close.c (_GD_FreeD)
+	src/constant.c (gd_array_len) src/del.c (_GD_ClearDerived _GD_DeReference)
+	src/entry.c (_GD_FreeE _GD_CalculateEntry gd_entry gd_validate)
+	src/field_list.c (_GD_EntryIndex) src/flimits.c (_GD_GetEOF _GD_GetBOF)
+	src/flush.c (_GD_Flush _GD_FieldSpec _GD_FindVersion) src/fpos.c
+	(_GD_GetFilePos _GD_Seek) src/getdata.c (_GD_DoField gd_getdata64)
+	src/getdata.h.in src/internal.h src/mod.c (_GD_Change) src/name.c
+	(_GD_UpdateInputs) src/native.c (_GD_NativeType) src/parse.c
+	(_GD_ParseArray _GD_ParseFieldSpec _GD_ParseDirective) src/putdata.c
+	(_GD_DoFieldOut) src/spf.c (_GD_GetSPF) src/include.c (_GD_SetFieldAffixes):
+	Restore from getdata-dsv10 branch.
+
+	* src/add.c (gd_add_indir gd_add_sindir gd_add_sarray gd_madd_indir
+	gd_madd_sindir gd_madd_sarray) src/field_list.c (gd_sarrays gd_msarrays)
+	src/getdata.c (_GD_IndirData _GD_DoIndir _GD_DoSindir) src/mod.c
+	(gd_alter_indir gd_alter_sindir gd_alter_sarray) src/parse.c
+	(_GD_ParseNamespace) src/string.c (gd_get_sarray gd_put_sarray_slice
+	gd_put_sarray) src/fragment.c (_GD_CheckChangeNamespace
+	gd_fragment_namespace): Restore from getdata-dsv10 branch.
+	* src/string.c (gd_get_sarray_slice): Remove static.
+
+	* test/add_dot10.c test/add_indir.c test/add_sarray.c test/add_sarray_nil.c
+	test/add_sindir.c test/alter_entry_sarray.c test/alter_indir.c
+	test/alter_sarray.c test/alter_sindir.c test/get_indir.c test/get_sarray.c
+	test/get_sarray_len.c test/get_sarray_slice.c test/get_sindir.c
+	test/get_sindir_none.c test/get_sindir_null.c test/get_sindir_type.c
+	test/get_type_string.c test/madd_indir.c test/madd_sarray.c
+	test/madd_sindir.c test/name_updb_sarray.c test/parse_include_ns2.c
+	test/parse_include_nsabs.c test/parse_include_nsinh.c
+	test/parse_include_nspop.c test/parse_include_nsrabs.c
+	test/parse_include_nsrainh.c test/parse_include_nsrinh.c
+	test/parse_include_nsroot.c test/parse_indir.c test/parse_ns.c
+	test/parse_ns_abs.c test/parse_ns_dot.c test/parse_ns_dotdot.c
+	test/parse_ns_dotdotns.c test/parse_ns_dotns.c test/parse_ns_ndotdots.c
+	test/parse_ns_ndots.c test/parse_ns_nsdot.c test/parse_ns_nsdotdot.c
+	test/parse_ns_par.c test/parse_ns_sub.c test/parse_nsf.c
+	test/parse_nsf_abs.c test/parse_nsf_alias.c test/parse_nsf_dot.c
+	test/parse_nsf_hide.c test/parse_nsf_index.c test/parse_nsf_meta.c
+	test/parse_nsf_meta2.c test/parse_nsf_par.c test/parse_nsf_ref.c
+	test/parse_nsf_refabs.c test/parse_nsf_refrel.c test/parse_nsf_root.c
+	test/parse_nsf_rpar.c test/parse_nsf_sub.c test/parse_sarray.c
+	test/parse_sarray_long.c test/parse_sindir.c put_indir.c test/put_sarray.c
+	test/put_sarray_slice.c test/put_sindir.c test/svlist_array.c
+	test/svlist_array_meta.c test/add_ns.c test/add_ns_frag.c
+	test/add_ns_frag2.c test/include_ns.c test/name_ns.c test/name_ns2.c
+	test/name_nsdot.c test/parse_include_ns.c test/name_dot10.c: Restore from
+	getdata-dsv10 branch.
+	* test/name_updb.c test/name_updb_carray.c test/native_string.c: Restore
+	from getdata-dsv10 branch.
+
+	* bindings/make_parameters.c bindings/cxx/dirfile.cpp (Dirfile::Entry
+	Dirfile::GetData) bindings/cxx/entry.cpp (Entry::CheckIndex scalar_ok)
+	bindings/cxx/getdata/entry.h bindings/f77/fgetdata.c (GDGSCA GDASCA)
+	bindings/f77/getdata.f90.in (fgd_entry fgd_add fgd_madd fgd_alter_entry)
+	bindings/idl/getdata.c (gdidl_make_idl_entry gdidl_convert_entry_num
+	gdidl_read_idl_entry gdidl_getdata) bindings/matlab/gd_getdata.c
+	bindings/matlab/matlab.c (gdmx_from_entry gdmx_to_entry)
+	bindings/perl/GetData.xs (gdp_to_entry entry getdata)
+	bindings/perl/simple_funcs.xsin bindings/php/getdata.c (gdphp_from_entry
+	gdphp_to_entry gd_getdata) bindings/python/pydirfile.c
+	(gdpy_dirfile_getdata) bindings/python/pyentry.c (gdpy_set_entry_from_tuple
+	gdpy_entry_getinfields gdpy_entry_setinfields gdpy_entry_getarraylen
+	gdpy_entry_setarraylen gdpy_entry_getparms) bindings/python/pygetdata.c
+	(gdpy_convert_to_pylist gdpy_convert_to_pyobj): Restore from getdata-dsv10
+	branch.
+
+	* bindings/cxx/dirfile.cpp (Dirfile::GetSarray Dirfile::Sarrays
+	Dirfile::MSarrays Dirfile::PutSarray) bindings/f77/fgetdata.c (GDGEID GDGESD
+	GDGESA GDADID GDADSD GDMDID GDMDSD GDADSA GDMDSA GDALID GDALSD GDSARX GDMSAX
+	GDGTSA GDPTSA GDALSA GDGSTD GDGSTP GDXSTP) bindings/f77/getdata.f90.in
+	(fgd_sarray_value_max fgd_msarray_value_max fgd_get_sarray
+	fgd_get_sarray_slice fgd_put_sarray fgd_put_sarray_slice fgd_add_sarray
+	fgd_madd_sarray fgd_alter_sarray fgd_add_indir fgd_add_sindir fgd_madd_indir
+	fgd_madd_sindir fgd_alter_indir fgd_alter_sindir fgd_getstrdata)
+	bindings/idl/getdata.c (gdidl_add_sarray gdidl_get_sarray gdidl_get_sarray
+	gdidl_alter_sarray gdidl_add_indir gdidl_alter_indir gdidl_add_sindir
+	gdidl_alter_sindir) bindings/matlab/matlab.c (gdmx_from_sarrays)
+	bindings/perl/GetData.xs (get_sarray get_sarray_slice sarrays put_sarray
+	put_sarray_slice add_sarray madd_sarray msarrays) bindings/php/getdata.c
+	(gdphp_convert_sarray gd_add_sarray gd_add_indir gd_add_sindir
+	gd_alter_sarray gd_alter_indir gd_alter_sindir gd_sarrays gd_get_sarray
+	gd_madd_sarray gd_madd_indir gd_madd_sindir gd_msarrays gd_put_sarray)
+	bindings/python/pydirfile.c (gdpy_dirfile_getsarray gdpy_dirfile_sarrays
+	gdpy_dirfile_msarrays gdpy_dirfile_putsarray): Restore from getdata-dsv10
+	branch.
+
+	* bindings/cxx/getdata/indirentry.h bindings/cxx/getdata/sarrayentry.h
+	bindings/cxx/getdata/sindirentry.h bindings/cxx/indirentry.cpp
+	bindings/cxx/sarrayentry.cpp bindings/cxx/sindirentry.cpp
+	bindings/matlab/gd_add_sarray.c bindings/matlab/gd_alter_sarray.m
+	bindings/matlab/gd_get_sarray.c bindings/matlab/gd_get_sarray_slice.c
+	bindings/matlab/gd_madd_sarray.c bindings/matlab/gd_put_sarray.m
+	bindings/matlab/gd_put_sarray_slice.c bindings/matlab/gd_sarrays.c: Restore
+	from getdata-dsv10 branch.
+
+	* src/fragment.c (_GD_SubFragmentList): Restore from getdata-dsv10 branch.
+
+	* src/common.c (_GD_GetRepr): Restore DSV 10 features from getdata-dsv10
+	branch.
+
+	* src/include.c (_GD_SetFieldAffixes): Restore ns and nsl arguments from
+	getdata-dsv10 branch.
+
+	* src/legacy.c (GetFormat): Restore DSV 10 stuff from getdata-dsv10 branch.
+
+	* bindings/cxx/test/big_test.cpp bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro
+	bindings/matlab/test/big_test.m bindings/perl/t/big_test.t
+	bindings/php/test/big_test.php bindings/python/test/big_test.py
+	doc/list.tests: Restore tests 275-301 from getdata-dsv10 branch (where they
+	were numbered 272-298).
+
+	* src/getdata.h.in: Bump GD_DIRFILE_STANDARDS_VERSION.
+
+	Also:
+	
+	* test/svlist_array.c test/svlist_array0.c test/svlist_array_hidden.c
+	test/svlist_array_meta.c test/svlist_array_meta0.c
+	test/svlist_array_meta_free.c test/svlist_array_meta_hidden.c: Added.
+
+	* bindings/perl/src/GetData.xs: Replace gratuitous use of XPUSH with
+	EXTEND + PUSH.
+
+	* src/field_list.c (gd_entry_list) src/nfields.c (gd_nentries): Add fragment
+	argument.
+	* bindings/perl/src/GetData.xs bindings/perl/src/typemap: Rename gdp_bitnum_t
+	to gdp_ffff_t for generic use.
+	* test/elist_fragment.c test/nentries_fragment.c: Added.
+	* bindings/cxx/dirfile.cpp (Dirfile::NEntries Dirfile::EntryList)
+	bindings/f77/fgetdata.c (GDNENT GDENTX GDENTN)
+	bindings/f77/getdata.f90.in (fgd_nentries fgd_entry_list)
+	bindings/idl/getdata.c (gdidl_get_field_list gdidl_get_nfields)
+	bindings/matlab/gd_entry_list.c bindings/matlab/gd_nentries.c
+	bindings/matlab/gd_field_list.m bindings/matlab/gd_field_list_by_type.m
+	bindings/matlab/gd_mfield_list.m bindings/matlab/gd_mfield_list_by_type.m
+	bindings/matlab/gd_mvector_list.m bindings/matlab/gd_nfields.m
+	bindings/matlab/gd_nfields_by_type.m bindings/matlab/gd_nmfields.m
+	bindings/matlab/gd_nmfields_by_type.m bindings/matlab/gd_nmvectors.m
+	bindings/matlab/gd_nvectors.m bindings/matlab/gd_vector_list.m
+	bindings/perl/src/GetData.xs (entry_list) bindings/php/getdata.c
+	(gd_entry_list gd_nentries) bindings/python/pydirfile.c
+	(gdpy_dirfile_nentries gdpy_dirfile_entrylist): Handle fragment parameter.
+
+2016-09-19   D. V. Wiebe <getdata at ketiltrout.net> svn:1104
+	* src/sie.c (_GD_SampIndOpen): Remove all the weird existing file checks
+	before the malloc.  That kind of stuff got put in the bookkeeping layer
+	a loooong time ago.
+	* test/sie_err_open.c: Added.
+
+2016-09-19   D. V. Wiebe <getdata at ketiltrout.net> svn:1101
+	* src/flac.c (_GD_FlacDecodeCallback): Renamed from _GD_FlacWriteCallback
+	because that name was confusing.  (The callback is invoked via
+	_GD_FlacRead).
+
+	* src/flac.c (_GD_FlacSeek): Fix write-seek.
+
+	* src/gzip.c (_GD_GzipOpen): Set errno when fdopen fails.
+	* test/bzip_enoent.c test/flac_enoent.c test/gzip_enoent.c
+	test/lzma_enoent.c: Added.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_getentry
+	gdpy_dirfile_getfragment): Remove Py_INCREF call on new object: tp_alloc
+	already sets the refcount to 1.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_getentry): strdup() the char_enc
+	to avoid double free.
+
+	* bindings/python/pyfragment.c (gdpy_dirfile_getfragment): Call Py_INCREF on
+	self to match the decref in gdpy_fragment_delete().
+
+	* src/encoding.c (_GD_FiniRawIO): When closing an OOP write, count passed
+	to _GD_ef->read should be samples, not bytes.
+	* test/lzma_xz_offs_clear.c: Added.
+
+	* src/bzip.c (_GD_Bzip2Seek) src/flac.c (_GD_FlacSeek) src/gzip.c
+	(_GD_GzipSeek _GD_GzipWrite) src/lzma.c (_GD_LzmaSeek _GD_LzmaSync): Treat
+	file as a simple struct pointer, not an array for better encapsulation.  (All
+	dealings with the array should occur in the bookkeeping layer.)
+	* src/encoding.c (_GD_InitRawIO): Initialise E->e->u.raw.file[1].subenc for
+	OOP writes.
+	* src/flush.c (_GD_SyncRaw): Added.
+	* src/flush.c (_GD_Flush): sync the correct file for OOP write encodings.
+
+	* src/bzip.c (_GD_Bzip2Seek): Rename count parameter to offset to reduce
+	confusion.  Handle byte counting in a separate variable (remaining).
+
+	* src/encoding.c (_GD_FiniRawIO): count to read call should be samples, not
+	bytes.
+
+	* src/iopos.c (_GD_DoSeek): Fix OOP seek check.
+
+	* src/lzma.c: Increased GD_LZMA_DATA_IN to 32752 from 4096.
+
+	* src/lzma.c (_GD_LzmaReady): Don't read more data if we already have some
+	ready.
+
+	* src/lzma.c (_GD_LzmaClear): Set lzd->offset after move.
+
+	* src/lzma.c (_GD_LzmaWrite _GD_LzmaRead): Update file->pos on success.
+
+	* src/lzma.c (_GD_LzmaSeek): count to _GD_LzmaWrite is samples not bytes.
+
+	* src/lzma.c (_GD_LzmaRead): Only call _GD_LzmaClear when there's no
+	data ready.
+	
+	* test/enc_put_offs.c test/bzip_put_offs.c test/flac_put_offs.c
+	test/gzip_put_offs.c test/lzma_xz_offs_clear.c test/lzma_xz_put_offs.c:
+	Added.
+
+2016-09-17   D. V. Wiebe <getdata at ketiltrout.net> svn:1099
+	* bindings/python/pydirfile.c (gdpy_dirfile_setverboseprefix): Report
+	encoding errors.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_setverboseprefix): Don't
+	trash the value of self->verbose_prefix (= dirfile.verbose_prefix) if
+	encoding fails.
+
+	* bindings/python/pyentry.c (gdpy_entry_getinfields): Remove dead code.
+
+	* bindings/python/pyentry.c (gdpy_entry_setinfields): Return error on first
+	encoding failure.
+
+	* bindings/python/pyentry.c (gdpy_set_entry_from_tuple gdpy_entry_init
+	gdpy_entry_setname gdpy_entry_setinfields) bindings/python/pyfragment.c
+	(gdpy_fragment_setprefix gdpy_fragment_setsuffix)
+	bindings/python/pygetdata.c (gdpy_parse_charenc): Re-arrange things a bit
+	to help Coverity Scan figure out what's going on.
+
+	* bindings/python/pygetdata.c (gdpy_string_from_pyobj): Return error on
+	encoding failure.
+
 2016-09-07   D. V. Wiebe <getdata at ketiltrout.net> svn:1097
 	GetData-0.9.4 released.
 
@@ -5,6 +1125,12 @@
 
 	* bindings/python/pyentry.c (gdpy_set_entry_from_tuple): Fix printf format.
 
+	* test/flac_get_big.c test/flac_get_far.c test/flac_get_get.c
+		test/flac_get_get2.c test/flac_get_int64.c test/flac_get_int8.c
+		test/flac_get_little.c test/flac_get_long.c test/flac_nframes.c
+		test/flac_seek.c test/flac_seek_far.c test/flac_sync.c: Discard
+		flac(1)'s stderr.  If flac fails, the test will, too.
+
 2016-09-01   D. V. Wiebe <getdata at ketiltrout.net> svn:1096
 	* src/flac.c (_GD_FlacOutput): Skip pointless memcpy when ns == 0.
 	* src/flac.c (_GD_FlacRead): Advance output after write.
@@ -227,7 +1353,6 @@
 	PyString_Check calls.
 	* bindings/python/pyentry.c (gdpy_dup_pystring): Deleted (now handled by
 	gdpy_string_from_pyobj).
-	* bindings/python/pygetdata.c (
 
 	* bindings/python/pygetdata.c (gdpy_path_from_pyobj_): Added for Python3.
 	* bindings/python/pygetdata.h: Define gdpy_path_from_pyobj to either
@@ -509,7 +1634,7 @@
 	* bindings/matlab/matlab.c (gdmx_from_uint64): Renamed from gdmx_from_ullong.
 
 	* src/internal.h: Properly distinguish between _MSC_VER (compiler stuff) and
-	__MSCVRT__ (library stuff).
+	__MSVCRT__ (library stuff).
 
 	* bindings/idl/getdata.c (gdidl_getdata gdidl_get_constant
 	gdidl_get_carray) bindings/matlab/gd_get_carray.c
@@ -4572,7 +5697,7 @@
 2010-06-29   D. V. Wiebe <getdata at ketiltrout.net>   svn:418
 	* m4/compiler.m4 (GD_CHECK_LFS_TYPE): Added.
 	* configure.ac: Better tests for LFS Transitional API types.  Don't rely on
-	the `complex' macro when checking types.  Move the MSCVRT test back to the
+	the `complex' macro when checking types.  Move the MSVCRT test back to the
 	proper place.
 
 2010-06-28   D. V. Wiebe <getdata at ketiltrout.net>   svn:414
diff --git a/Makefile.am b/Makefile.am
index ef7c59f..e9a867c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,7 +24,10 @@ EXTRA_DIST = ChangeLog
 
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = src . test bindings util man doc
+if MAKE_UTIL
+UTIL = util
+endif
+SUBDIRS = src . test bindings ${UTIL} man doc
 
 dist_doc_DATA = COPYING.DOC
 
@@ -37,7 +40,7 @@ clean-local:
 %.sig: %
 	gpg -abo $@ $<
 
-DISTCHECK_CONFIGURE_FLAGS = --enable-legacy-api --enable-modules 
+DISTCHECK_CONFIGURE_FLAGS = --enable-legacy-api
 
 # a locally-installed library for building and testing the IDL and matlab
 # packages
@@ -50,6 +53,7 @@ $(distdir)/_inst/lib/pkgconfig: $(distdir).tar.gz
 		${MAKE} install
 
 # matlab-only package
+matlab_$(distdir).tar.gz: matlabdist
 matlabdist: $(DISTFILES) $(distdir)/_inst/lib/pkgconfig
 	rm -rf svn_export
 	svn export $(top_srcdir) svn_export
@@ -92,6 +96,7 @@ matlabdistcheck: matlab_$(distdir).tar.gz $(distdir)/_inst/lib/pkgconfig
 	rm -rf $(distdir)
 
 # idl-only package
+idl_$(distdir).tar.gz: idldist
 idldist: $(DISTFILES) $(distdir)/_inst/lib/pkgconfig
 	rm -rf svn_export
 	svn export $(top_srcdir) svn_export
diff --git a/Makefile.in b/Makefile.in
index 7da3a7f..654cccc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -194,7 +194,7 @@ am__define_uniq_tagged_files = \
 ETAGS = etags
 CTAGS = ctags
 CSCOPE = cscope
-DIST_SUBDIRS = $(SUBDIRS)
+DIST_SUBDIRS = src . test bindings util man doc
 am__DIST_COMMON = $(srcdir)/Makefile.in \
 	$(top_srcdir)/bindings/perl/src/Makefile.PL.in AUTHORS COPYING \
 	COPYING.DOC ChangeLog INSTALL NEWS README TODO compile \
@@ -271,6 +271,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
@@ -492,9 +494,10 @@ top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign dist-xz check-news 1.13
 EXTRA_DIST = ChangeLog
 ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src . test bindings util man doc
+ at MAKE_UTIL_TRUE@UTIL = util
+SUBDIRS = src . test bindings ${UTIL} man doc
 dist_doc_DATA = COPYING.DOC
-DISTCHECK_CONFIGURE_FLAGS = --enable-legacy-api --enable-modules 
+DISTCHECK_CONFIGURE_FLAGS = --enable-legacy-api
 
 # package lists
 PACKAGES = $(distdir).tar.gz $(distdir).tar.xz idl_$(distdir).tar.gz \
@@ -1021,6 +1024,7 @@ $(distdir)/_inst/lib/pkgconfig: $(distdir).tar.gz
 		${MAKE} install
 
 # matlab-only package
+matlab_$(distdir).tar.gz: matlabdist
 matlabdist: $(DISTFILES) $(distdir)/_inst/lib/pkgconfig
 	rm -rf svn_export
 	svn export $(top_srcdir) svn_export
@@ -1063,6 +1067,7 @@ matlabdistcheck: matlab_$(distdir).tar.gz $(distdir)/_inst/lib/pkgconfig
 	rm -rf $(distdir)
 
 # idl-only package
+idl_$(distdir).tar.gz: idldist
 idldist: $(DISTFILES) $(distdir)/_inst/lib/pkgconfig
 	rm -rf svn_export
 	svn export $(top_srcdir) svn_export
diff --git a/NEWS b/NEWS
index b85a2c4..eddf322 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,333 @@
+New in version 0.10.0:
+
+  Dirfile Changes:
+
+  * Dirfile Standards Version 10 has been released.  It adds three new
+    field types: SARRAY, which is an array of STRING scalars (like a
+    CARRAY, but with STRINGs instead of CONSTs), and INDIR and SINDIR,
+    which are vector fields provide indexed look-ups from CARRAY (INDIR) or
+    SARRAY (SINDIR) scalar arrays.  It also adds field code namespaces,
+    which can be specified with the new /NAMESPACE directive, or else as
+    part of an /INCLUDE directive.
+
+  * Some notes about namespaces:
+
+    - Namespaces are separated from field names by a dot (.):
+  
+          namespace.name
+        
+      and can be nested arbitrarily deep, separating namespaces with
+      intermediate dots:
+
+          namespace.subspace.subsubspace.name
+
+      Namespaces were created to provide an alternative to the prefix and
+      suffix added to the /INCLUDE directive in Standards Version 9, which
+      have some unfortunate side-effects due to their modifying field names
+      directly.  Because namespaces nest and are syntactically separate
+      from field names, they do a better job of encapsulation.
+
+    - If the namespace of a field is null (""), which is the default, then
+      the dot separating the namespace from the field name may be omitted.
+
+    - An /INCLUDE statement can specify a namespace which becomes the
+      included fragment's "root namespace".  The root namespace of the base
+      (top-level) format file is always the nullspace (""), and cannot be
+      changed.
+
+    - In addition to root namespaces, there is also a "current namespace".
+      At the top of a fragment, the current namespace is set to the root
+      namespace.  A /NAMESPACE directive can be used to change the current
+      namespace to a subspace under the root namespace.  That is, if the
+      root namespace is "root", then the directive:
+
+          /NAMESPACE subspace
+
+       changes the current namespace to "root.subspace" regardless of what
+       the current namespace was before.  To change the current namespace
+       back to the root namespace, use the null token ("") with the
+       /NAMESPACE directive:
+
+          /NAMESPACE ""
+
+    - If no namespace is specified in an /INCLUDE line, then the current
+      namespace becomes the root namespace of the included fragment.
+
+    - Subnamespaces under the root namespace may also be specified directly
+      in the name part of a field specification.  As a result, it is never
+      necessary to use the /NAMESPACE directive.
+
+    - Every field code and name in a fragment implicitly gains either the
+      fragment's root namespace or the current namespace.  If the field
+      code starts with an initial dot, then the root namespace is prepended
+      to it, otherwise the current namespace is prepended to it.  Because
+      the current namespace is always a subspace of the root namespace,
+      this means that metadata in a given fragment is never able to access
+      other fields outside its own root namespace.
+
+    - The exception to the above is the implicit INDEX vector, which
+      ignores all namespaces attached to it, either implicitly, through the
+      current namespace, or explicitly when specified in the metadata.
+      This contrasts with the behaviour of the INDEX field in the presence
+      of affixes, where it can appears or disappears based on the effects
+      of the affixes creating or modifying the specific field name "INDEX".
+
+  * Because syntactically the dot (.) now performs two functions, namely
+    both separating namespaces from each other and field names, but also
+    separating a field code from a representation suffix, there exists
+    ambiguity in the syntax.  To resolve the ambiguity, a new representa-
+    tion suffix, .z has been added which does nothing.  As an example, the
+    field code:
+
+      name.r
+
+    is interpreted as the real part of the field named "name", assuming
+    such a field exists.  To indicate the field named "r" in the namespace
+    "name", the field code:
+
+      name.r.z
+
+    must be used.  Note that this ambiguity only exists in a Dirfile where
+    both "name" and "name.r" are valid field names.  If the field named
+    "name" doesn't exist, then the first field code, "name.r" is unambig-
+    uously interpreted as the field "r" in the namespace "name".
+
+  * A note on the SINDIR field: Unlike every other vector field, this
+    field produces character string data at the sample rate of it's input
+    vector, which may be surprising, in certain instances.
+
+  * GetData has supported FLAC compression since 0.9.0.  Standards Version
+    10 now adds "flac" to the list of pre-defined encodings.
+
+  Library Changes:
+
+  * The function gd_array_len() no longer silently ignores a representation
+    suffix in the field_code provided.  In most cases, passing a
+    representation suffix will now cause this function to fail with a
+    GD_E_BAD_CODE error.
+
+  * A couple of unnecessary malloc's have been removed from the field
+    code search, reducing the chance of encountering a GD_E_ALLOC error.
+    Notably, the functions gd_array_len(), gd_bof(), gd_entry_type(),
+    gd_fragment_index(), and gd_spf() will no longer produce this error at
+    all.
+
+  * NOTE: The GD_VECTOR_ENTRIES symbol in gd_entry_list() and gd_nentries()
+    calls does not match SINDIR entries, only numeric-valued vectors.
+    This also affects the corresponding special case functions
+    (gd_nvectors(), gd_vector_list() &c.)
+
+  * BUG FIX: When building in ANSI-C mode, the computation of complex-
+    valued RECIP fields is now correct.
+
+  * BUG FIX: The gd_include() family of functions now correctly clean up
+    after encountering an error.  Previously, encountering a syntax error
+    would result in these functions erroneously adding fields specified
+    before the syntax error to the DIRFILE, with a bogus fragment index.
+    Similarly, when these functions return GD_E_REFERENCE, they no longer
+    add the included fragment (excluding the bad /REFERENCE directive) to
+    the DIRFILE without telling the caller about it.
+
+  * BUG FIX: gd_alter_protection() wasn't marking affected fragments as
+    modified, meaning the change in protection level would be lost upon
+    close unless other metadata changes were made to the fragment as well,
+    or a flush of the fragment's metadata was triggered explicitly with a
+    call to gd_rewrite_fragment().
+
+  * BUG FIX: The metadata update performed by gd_delete() now successfully
+    updates all fields which used the deleted field as an input.
+    Previously some fields could be skipped, leading to segfaults later
+    when these fields were accessed.
+
+  * BUG FIX: gd_add_spec() no longer creates an empty data file while
+    failing with GD_E_PROTECT when operating in a fragment with data
+    protection turned on.
+
+  * BUG FIX: gd_putdata() now refuses to write to complex-valued LINTERP
+    fields.  Previously, the write would succeed as if the imaginary
+    part of the field were zero.
+
+  * BUG FIX: gd_nentries() now correctly rejects invalid values for the
+    type parameter.
+
+  * BUG FIX GetData now properly deals with circular series of aliases,
+    turning them all into dangling aliases.  Previously, the alias
+    resolution would terminate at some arbitrary point around the loop,
+    resulting in internal errors arising from attempts to use an alias as
+    a field.
+
+  * BUG FIX: Several bugs in the I/O positioning performed before reads and
+    writes to compressed data have been fixed.  Previously, reads and
+    writes could occur in the wrong place in the data stream.  Reported by
+    S. J. Benton.
+
+  * BUG FIX: Similarly, a number of bugs associated with random-access
+    writes to compressed data files which were causing data corruption have
+    been fixed.
+
+  * BUG FIX: When reading LZMA-compressed data, gd_getdata() no longer
+    hangs if liblzma returns only part of a multibyte sample.
+
+  * BUG FIX: The FLAC encoding now works correctly with non-native endian
+    data.
+
+  * BUG FIX: Writes to ASCII (text) encoded files weren't properly updating
+    the file's I/O position, leading to subsequent reads and writes
+    occurring in the wrong place.
+
+  * BUG FIX: Trying to open a non-existent, gzip-encoded data file now
+    reports the correct error (GD_E_IO; "No such file or directory"),
+    instead of segfaulting.  Reported by Matthew Petroff.
+
+  * BUG FIX: A segfault encountered when closing very large compressed
+    files after writing to them has been fixed.
+
+  * BUG FIX: Attempting to open a SIE-encoded data file a second time
+    after a first attempt failed no longer results in a segfault.
+
+  * BUG FIX: The parser no longer assumes a new string buffer returned by
+    the parser callback (by assigning it to pdata->line) has the size given
+    by pdata->buflen, which the callback is not required to update, but
+    instead determines the buffer size directly.  Previously, this
+    assumption could result in a segfault within the parser.
+
+  * BUG FIX: gd_add_polynom() and gd_add_cpolynom() no longer reject valid
+    poly_ord values.
+
+  * BUG FIX: The gd_[m]add() family of functions are now better at
+    rejecting invalid data types.
+
+  * BUG FIX: A segfault-on-error has been fixed in gd_[m]alter_spec.
+
+  * BUG FIX: The gd_madd() functions longer accept aliases as parent field
+    names.
+
+  * BUG FIX: Setting n_fields (for LINCOMs) or poly_ord (for POLYNOMs) to
+    an out-of-range value and then calling gd_free_entry_strings() no
+    longer results in a segfault.
+
+  * BUG FIX: A rare segfault has been fixed in gd_carrays() and
+    gd_strings().
+
+  API Changes:
+
+  * The new function gd_alloc_funcs() allows callers to change the memory
+    manager used by GetData to allocate and de-allocate heap buffers that
+    it returns.  The functions gd_entry(), gd_error_string(),
+    gd_fragment_affixes(), gd_linterp_tablename(), and gd_raw_filename()
+    will use this memory manager to allocate the buffers they return.  The
+    function gd_free_entry_strings() will use this memory manager to free
+    strings.  Even if an alternate memory manager is specified, GetData
+    will still use the Standard Library's malloc() and free() for much of
+    it's internal storage.
+
+  * A new function, gd_match_entries(), extends the functionality of
+    gd_entry_list() and gd_nentries() by additionally allowing both
+    searches restricted to a particular fragment and also regular
+    expression matching against entry names.
+
+  * A number of functions which used to return -1 on error now instead
+    return an appropriate error code, previously only available through
+    gd_error().  These error codes are all negative-valued.  Functions
+    whose error returns have changed and now do this are:
+
+      gd_add(), gd_add_alias(), all the gd_add_<entry_type>() functions,
+      gd_add_spec(), gd_alter_affixes(), all the gd_alter_<entry_type>(),
+      functions, gd_alter_encoding(), gd_alter_endianness(),
+      gd_alter_entry(), gd_alter_frameoffset(), gd_alter_protection(),
+      gd_alter_spec(), gd_array_len(), gd_bof(), gd_delete(), gd_desync(),
+      gd_dirfile_standards(), gd_discard(), gd_entry(), gd_entry_type(),
+      gd_eof(), gd_flush(), gd_fragment_affixes(), gd_fragment_index(),
+      gd_frameoffset(), gd_get_carray(), gd_get_carray_slice(),
+      gd_get_constant(), gd_hidden(), gd_hide(), gd_include(),
+      gd_include_affix(), gd_include_ns(), gd_madd(), gd_madd_alias(),
+      all the gd_madd_<entry_type>() functions, gd_madd_spec(),
+      gd_metaflush(), gd_move(), gd_nframes(), gd_open(),
+      gd_parent_fragment(), gd_protection(), gd_put_carray(),
+      gd_put_carray_slice(), gd_put_const(), gd_raw_close(),
+      gd_rename(), gd_rewrite_fragment(), gd_seek(), gd_spf(), gd_sync(),
+      gd_tell(), gd_unhide(), gd_uninclude(), gd_validate(),
+      gd_verbose_prefix()
+
+  * gd_add_indir(), gd_add_sarray(), gd_add_sindir(), gd_madd_indir(),
+    gd_madd_sarray(), gd_madd_sindir(), gd_alter_indir(),
+    gd_alter_sarray(), and gd_alter_sindir() have been added to manipulate
+    metadata of the new field types.
+
+  * gd_msarrays(), gd_get_sarray(), gd_get_sarray_slice(), gd_put_sarray(),
+    gd_put_sarray_slice(), gd_sarrays() have been added to read and write
+    SARRAY values.
+
+  * gd_fragment_namespace() and gd_include_ns() have been added to read and
+    write the root namespace of a fragment.
+
+  * gd_put_string() now returns zero on success and a negative-valued error
+    code on error, as well, following the lead of gd_put_constant() and
+    gd_put_sarray().  Also note that the return type is now int, where
+    previously it was size_t, despite the documentation having always
+    claimed it returned int.
+
+  * A new data type symbol, GD_STRING, exists to represent string data.
+    The gd_native_type() function now returns GD_STRING for STRING fields
+    (as well as for the new SARRAY and SINDIR fields).
+
+  * The GD_FUNCTION_ALIASES block, and hence the long-deprecated
+    GetData-0.6 API, has been removed from getdata.h.  Anyone still using
+    the GetData-0.6 API should modernise to avoid known problems with that
+    API.
+
+  * The gd_shift_t type, which was used for PHASE field shifts, has been
+    deprecated.  It has been replaced with gd_int64_t, which is what it
+    was always typedef'd to.
+
+  * BUG FIX: gd_getdata() and gd_putdata() now properly report GD_E_IO when
+    an I/O error occurs while reading a LINTERP table.  Previously GD_E_LUT
+    would be erroneously returned, as if the table file were empty.
+
+  Bindings Changes:
+
+  * MATLAB: The FLAGS argument to GD_INCLUDE is now optional and defaults
+    to zero.
+
+  * C++, F77, F95, PERL: The bindings for gd_put_string() have changed to
+    reflect changes in the C library.  Fortran 77 no longer returns a
+    n_wrote integer; Fortran 95 implements fgd_put_string a subroutine;
+    C++ and Perl bindings now return integer zero on success, and negative
+    on error.
+
+  * IDL, MATLAB, PHP BUG FIX: Bindings for the C functions gd_raw_filename
+    and gd_linterp_tablename now no longer leak the string returned by the
+    C API.
+
+  * PYTHON BUG FIX: A UnicodeEncodeError while assigning to
+    dirfile.verbose_prefix no longer results in that attribute being set
+    to None.  Instead, it retains its former value, which reflects what
+    actually happens in the underlying C library in this case.
+
+  * PYTHON BUG FIX: Objects returned by dirfile.entry() and
+    dirfile.fragment() weren't being initialised with the correct reference
+    count, leading to memory leaks when they went out of scope.  Reported
+    by Alexandra Rahlin.
+
+  Miscellaneous:
+
+  * The --enable-assert configure option, which hasn't done anything for a
+    long time, has been removed.
+
+  * A new configure option, --disable-util, can be used to suppress
+    building of the executables in the util/ subdirectory.
+
+  * In the standard autotools build system, encodings which use external
+    libraries for compression (gzip, bzip2, flac, lzma, slim, zzip, zzslim)
+    are now by default built as dynamically loaded modules.  To recover the
+    old build behaviour, which put everything into the core GetData library
+    binary, pass --disable-modules to ./configure.  Using modules intro-
+    duces a runtime dependency on GNU libltdl.  The CMake-based build
+    system used in the native Microsoft Windows source release retains the
+    old (monolithic) behaviour.
+
+|=========================================================================|
+
 New in version 0.9.4:
 
   Library Changes:
@@ -14,7 +344,7 @@ New in version 0.9.4:
 
   Bindings Changes:
 
-  * PYTHON BUG FIX: An erroreous preprocessor definition which made the
+  * PYTHON BUG FIX: An erroneous preprocessor definition which made the
     Python bindings unbuildable for Python 3 has been fixed.  Reported by
     Akito Kusaka.
 
@@ -88,7 +418,7 @@ New in version 0.9.3:
     then ASCII encoded to ensure they're always available, regardless of
     the capabilities of standard error.
 
-  * PYTHON: As a side-effect to the above, pygetdata now accepts unicode
+  * PYTHON: As a side-effect to the above, pygetdata now accepts Unicode
     strings (both in Python2 and in Python3).  The specified
     character_encoding will be used to encode them to C strings before
     being passed to the C library.  If no character_encoding is specified,
@@ -189,7 +519,7 @@ New in version 0.9.1:
 
   * Functions returning entry lists (gd_entry_list(), &c.) or bulk scalar
     field data (gd_constants(), gd_carrays(), &c.) no longer run through
-    the entry list twice, resulting in noticable speed improvements when
+    the entry list twice, resulting in noticeable speed improvements when
     operating on large dirfiles.
 
   * BUG FIX: Top-level aliases pointing to metafields, and non-hidden
@@ -215,7 +545,7 @@ New in version 0.9.1:
 
   * BUG FIX: GetData no longer ignores errors reported by zlib when
     writing to gzipped data files.  In the past, this could, in some
-    cases, cause GetData to wegde.
+    cases, cause GetData to wedge.
 
   API Changes:
 
@@ -300,7 +630,7 @@ New in version 0.9.1:
 
 |=========================================================================|
 
-New in verison 0.9.0:
+New in version 0.9.0:
 
   Library Changes:
 
@@ -382,12 +712,12 @@ New in verison 0.9.0:
   
   * BUG FIX: In addition to the addition of write support mentioned above,
     a number of problems with reading LZMA files has been fixed, which
-    should result in fewer segmentaion faults.
+    should result in fewer segmentation faults.
 
   * BUG FIX: The parser no longer silently appends a closing > to scalar
-    field codes that contain an umatched opening < (e.g. "scalar<3").  This
-    is now interpreted as a simple field code (which may be rejected later
-    due to the presence of the invalid '<' character).
+    field codes that contain an unmatched opening < (e.g. "scalar<3").
+    This is now interpreted as a simple field code (which may be rejected
+    later due to the presence of the invalid '<' character).
 
   * BUG FIX: The parser no longer interprets various numbers as field codes
     when it shouldn't (e.g. when specifying a PHASE shift as "1." instead
@@ -513,12 +843,12 @@ New in verison 0.9.0:
 
   * F77 and F95: The bindings no longer raise SIGABRT when the dirfile
     space is exhausted.  Instead they simply return a dirfile unit number
-    referenceing a static, invalid dirfile.
+    referencing a static, invalid dirfile.
 
   * F77: Functions to add fields with named scalar parameters have been
     added (GDASBT GDASCL GDASCP GDASCR GDASLC GDASMX GDASPH GDASPN GDASRC
     GDASRW GDASSB GDASWD), but only for those field types which permit
-    named scalars.  Similarly, functions for altering field metatdata with
+    named scalars.  Similarly, functions for altering field metadata with
     named scalars are also present (GDLSBT GDLSCL GDLSCP GDLSCR GDLSLC
     GDLSMX GDLSPH GDLSPN GDLSRC GDLSRW GDLSSB GDLSWD).  These are provided
     as an alternative to using GDASCA after the fact.
@@ -548,10 +878,10 @@ New in verison 0.9.0:
   * PYTHON: Building the python bindings now requires NumPy.  Previously,
     NumPy support was optional.
 
-  * PYTHON: for backwards compatiblity, exceptions now exist for deprecated
-    error codes (such as OpenError).  These deprecated exceptions are
-    simply aliases for the current ones and are never returned by the
-    bindings.
+  * PYTHON: for backwards compatibility, exceptions now exist for
+    deprecated error codes (such as OpenError).  These deprecated
+    exceptions are simply aliases for the current ones and are never
+    returned by the bindings.
 
   * C++ BUG FIX: The Entry methods Input, Scalar, and ScalarIndex
     (including subclasses) now return zero or NULL when passed an out-of-
@@ -579,7 +909,7 @@ New in verison 0.9.0:
 
 |=========================================================================|
 
-New in verison 0.8.9:
+New in version 0.8.9:
 
   Library Changes:
 
@@ -588,7 +918,7 @@ New in verison 0.8.9:
     \x##).
 
   * BUG FIX: A number of memory leaks associated with error returns from
-    libary functions have been fixed.
+    library functions have been fixed.
 
   * BUG FIX: Attempting to create a new field or alias with the name of
     an existing dangling alias now fails with error GD_E_DUPLICATE, as it
@@ -619,7 +949,7 @@ New in verison 0.8.9:
 
 |=========================================================================|
 
-New in verison 0.8.8:
+New in version 0.8.8:
 
   Library Changes:
 
@@ -632,7 +962,7 @@ New in verison 0.8.8:
 
 |=========================================================================|
 
-New in verison 0.8.7:
+New in version 0.8.7:
 
   Library Changes:
 
@@ -681,7 +1011,7 @@ New in version 0.8.6:
     pletely ignored by gd_[m]add() when corresponding named scalars are
     specified.  Previously, an invalid value in these members would result
     in the entry being rejected, even though the rest of GetData ignored
-    the invalid, unsued value.
+    the invalid, unused value.
 
   * BUG FIX: The parsing of the \x and \u escape sequences is now correct.
 
@@ -711,6 +1041,7 @@ New in version 0.8.6:
 
   * BUG FIX: gd_flush(), gd_sync(), gd_raw_close() no longer segfault when
     operating on a LINCOM with only one input field.
+
   * BUG FIX: gd_seek() now works correctly on PHASE fields; previously, the
     sign of the PHASE shift was flipped.
 
@@ -765,11 +1096,11 @@ New in version 0.8.6:
 
 |=========================================================================|
 
-New in verison 0.8.5:
+New in version 0.8.5:
 
   Library Changes:
 
-  * BUG FIX: The zzslim encoding framework, which was inadvertantly
+  * BUG FIX: The zzslim encoding framework, which was inadvertently
     rendered non-compilable in 0.8.4, should once again work.  Reported by
     Matthew Hasselfield.
 
@@ -784,14 +1115,14 @@ New in version 0.8.4:
 
   Dirfile Changes:
 
-  * CLARIFICATION: Inconsistant behaviour in the library, coupled with
+  * CLARIFICATION: Inconsistent 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
+    between successive occurrences of the "count" value in the index
+    vector.  (It is used by GetData only to figure out a reasonable 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
@@ -799,7 +1130,7 @@ New in version 0.8.4:
 
     - 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
+      successive occurrences 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.
 
@@ -862,7 +1193,7 @@ New in version 0.8.4:
 
   * 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
+    changes listed above.  CountMax and SetCountMax are still available as
     aliases, but are marked deprecated.
 
   * IDL BUG FIX: GD_ENTRY structures representing MPLEX fields are now
@@ -964,7 +1295,7 @@ New in version 0.8.1:
     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.),
+    is that when modifying metadata (gd_add(), gd_alter_entry(), &c.),
     supplied field codes must also contain the appropriate affixes.
 
   * A new function, gd_linterp_tablename() has been added which returns a
@@ -1001,8 +1332,8 @@ New in version 0.8.0:
     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##,
+    0####) or hexadecimal (using 0x##### or 0X#####) in addition to
+    decimal.  C99-standard hexadecimal floating point literals (0x##.##p##,
     &c.) are also accepted.
 
   * The /INCLUDE directive can take two additional, optional parameters
@@ -1103,7 +1434,7 @@ New in version 0.8.0:
     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
+    contains it as dirty, which will ensure the rename is written to disk
     when the metadata are next flushed.
 
   * BUG FIX: Whitespace within tokens is now properly escaped when metadata
@@ -1156,8 +1487,8 @@ New in version 0.8.0:
     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
+  * New aliases may be added with gd_add_alias() or gd_madd_alias.  The
+    target of an alias is returned by gd_alias_target(); a list of aliases
     of a field, or their number, is returned by gd_aliases() and
     gd_naliases().
 
@@ -1195,11 +1526,11 @@ New in version 0.8.0:
     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.
+    left unchanged.
 
   * 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.
+    and GD_PRETTY_PRINT.
 
   * 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(),
@@ -1256,7 +1587,7 @@ New in version 0.8.0:
     parties.
 
   * Python: The return_type, num_fields, and num_samples parameters to
-    dirfile.getdata() are now optional.  The return_type defautls to
+    dirfile.getdata() are now optional.  The return_type defaults to
     pygetdata.FLOAT, and if neither num_fields nor num_samples are given,
     all frames (ie. the value of dirfile.nframes) are returned.
 
@@ -1465,7 +1796,7 @@ New in version 0.7.0:
 
   * Since Standards Versions 4 and earlier were never codified, we've made
     some assumptions as to their behaviour in certain undocumented situta-
-    tions.  Most noticably, they still prohibit ASCII control codes (bytes
+    tions.  Most noticeably, they still prohibit ASCII control codes (bytes
     0x01 through 0x1F) 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.
@@ -1502,7 +1833,7 @@ New in version 0.7.0:
 
   * 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.
+    complex, leading to loss of the imaginary part in certain situations.
 
   * 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
@@ -1512,12 +1843,12 @@ New in version 0.7.0:
     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 charac-
+    the maximum line length has been increased to at least 2**31 charac-
     ters, 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.
+    field's existence.
 
   API Changes
 
@@ -1634,8 +1965,8 @@ New in version 0.7.0:
 
   * 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.
+  * F77: The signatures 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
diff --git a/README b/README
index 66b5c72..e453735 100644
--- a/README
+++ b/README
@@ -41,6 +41,11 @@ You should have received a copy of the GNU Lesser General Public License along
 with GetData in a file called `COPYING'; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
+The Free Software Foundation has also published the License on the World Wide
+Web:
+
+  https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
+
 
 CONTENTS
 ========
@@ -68,22 +73,23 @@ A full list of features new to this release of GetData may be found in the
 file called `NEWS'.
 
 
-DIRFILE STANDARDS VERSION 9
-===========================
+DIRFILE STANDARDS VERSION 10
+============================
 
-The 0.8.0 release of the GetData Library (July 2012) is the first release to
+The 0.10.0 release of the GetData Library (January 2017) 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
+Version 10.
+
+Standards Version 10 introduces the following:
+  * Three new field types: INDIR, SARRAY, and SINDIR.
+  * Field code namespaces.
+  * A new representation suffix, .z, which does nothing, which is occasionally
+    needed for disambiguation of syntax.
+  * Support for FLAC (Free Lossless Audio Compression) encoding of data.
+    (FLAC has been supported by GetData since 0.9.0.)
+
+This is the first update to the Dirfile Standards since Standards Version 9
+(July 2012).  A full history of the Dirfile Standards can be found in the
 dirfile-format(5) man page.
 
 
@@ -91,10 +97,11 @@ BUILDING THE LIBRARY
 ====================
 
 This package may be configured and built using the GNU autotools.  Generic
-installation instructions are provided in the file called `INSTALL'.  A
-brief summary follows.  A C99-compliant compiler is required to build (but not
-to use) the package, although a compatible library with reduced functionality
-can be built with any ANSI C compiler.
+installation instructions are provided in the file called `INSTALL'.  A brief
+summary follows.  If a C99-compliant compiler is used to build the pacakge,
+the library will be built with both a C99 API (the default) as well as a ANSI
+C (C89) API.  If the compiler used to build the library is not C99-compliant,
+only the ANSI C API will be built.
 
 Most users should be able to build the package by simply executing:
 
@@ -128,42 +135,59 @@ The only library required to build GetData is the C Standard Library.  Several
 other external will be used if found by ./configure to provide support for
 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;
+- the libFLAC library by Josh Coalson and the Xiph.Org Foundation;
 - the lzma library, part of the XZ Utils suite by Lasse Collin, Ville Koskinen,
-  and Igor Pavlov; and,
+  and Igor Pavlov;
+- the slim compression library by Joseph Fowler;
+- the zlib library by Jean-loup Gailly and Mark Adler; 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.
 
+GetData has optional support for regular expression matching of field names.
+This support is implemented through the use of two additional libraries,
+specifically:
+
+- the POSIX standard regex(7) library (providing regcomp(3) and regexec(3)),
+  originally written by Henry Spencer.  On most platforms, this is bundled
+  with the C Standard Library.
+- the Perl-Compatible Regular Expression (PCRE) library by Philip Hazel.
+
+If these libraries are not found at build time, partial or all regular
+expression support will be missing from the library: the appropriate GetData
+API (gd_match_entries) will exist, but attempting to preform a regex search
+will fail.
+
 Building bindings requires appropriate compilers/interpreters and libraries for
 the various languages.  In particular:
 
-- the C++ bindings require a C++90 compliant compiler
+- 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)
+  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.
+  as the Math::Complex module.
+- the PHP bindings support both PHP5 and PHP7.
+- the Python bindings support both Python2, from version 2.4, as well as
+  Python3, from version 3.2.
+
 
 USING THE LIBRARY
 =================
 
 To use the library in C programs, the header file getdata.h should be included.
-This file declares all the various APIs provided by th library.  Programs
+This file declares all the various APIs provided by the 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>'.
+required to support the compiled regular expression functionality and encodings
+supported by the library.
 
 The various small programs in the `util' subdirectory of the package provide
 examples of use.
@@ -183,31 +207,33 @@ terms as the GetData Project, we encourage you to submit them for inclusion in
 the package.
 
 
-USING MODULES
-=============
+ENCODING MODULES
+================
+
+Encoding schemes which rely on optional external libraries (slim, gzip, bzip2,
+&c.) may be built as stand-alone library modules which will be dynamically
+loaded, as needed, at runtime by the core GetData library.  This is the
+default behaviour in GetData-0.10.  In earlier versions, by default the
+encoding support was built directly into the core GetData library.
 
-Starting with GetData 0.5.0, encoding schemes which rely on optional external
-libraries (slim, gzip, bzip2, &c.) may be built as stand-alone library modules
-which will be dynamically loaded, as needed, at runtime by the core GetData
-library.  This architecture is provided to permit packaging the core GetData
-library separately from the parts of the library requiring the optional external
+External modules are used primarily to permit packaging the core GetData library
+separately from the parts of the library requiring the optional external
 libraries without having to give up the functionality these extra libraries
 provide.  To enable this behaviour, pass `--enable-modules' to ./configure.
 
 The modules are dynamically loaded via GNU libtool's portable dlopen wrapper
 library, libltdl.  The libltdl library permits dynamic loading of modules on at
-least Solaris, Linux, BSD, HP-UX, Win16, Win32, BeOS, Darwin, MacOS X.  The
-libltdl library is no longer distributed with GetData.  It can usually be found
-as part of the GNU libtool package on any modern GNU system, or else obtained
-for free from the GNU Project.
+least Solaris, Linux, BSD, HP-UX, Win16, Win32, BeOS, Darwin, MacOS X.  It can
+usually be found as part of the GNU libtool package on any modern GNU system,
+or else obtained for free from the GNU Project.
 
 GetData will fail gracefully if a library module is not found or cannot be
 opened at runtime.  In this case, the call which triggered the attempt to load
 the module will fail with the GD_E_UNSUPPORTED error.
 
-The dlopen library (and, by extension, libltdl) is notoriously not thread safe.
-As a result, if a POSIX thread implementation can be found, calls to the dynamic
-loader will be wrapped in a mutex.
+The POSIX dlopen library (and, by extension, libltdl) is notoriously not thread
+safe.  As a result, if a POSIX thread implementation can be found, calls to the
+dynamic loader will be wrapped in a mutex.
 
 
 THE GETDATA HEADER FILE
@@ -236,36 +262,33 @@ to indicate this.
 LARGEFILE SUPPORT
 =================
 
-When built on a platform using the GNU C Library, or another compatible
-C Library, the new GetData API will respect the feature test macros
-_LARGEFILE64_SOURCE and _FILE_OFFSET_BITS affecting largefile (> 2 GB)
-support.  If one or the other of these are to be used, they must be defined
-before including getdata.h or any Standard C Library header file.
-
-The first of these, _LARGEFILE64_SOURCE, if defined before including getdata.h,
-will enable the obsolete, transitional largefile extensions defined by the LFS.
-This will enable explicit support for large files through the definition of the
-64-bit explicit type `off64_t', and result in GetData defining the explicitly
-64-bit interfaces `gd_getdata64', `gd_putdata64', `gd_get_nframes64', &c.  This
-macro is largely obsolete, and using _FILE_OFFSET_BITS is preferred, if
-supported.
-
-The second macro, _FILE_OFFSET_BITS, determines the size of `off_t'.  If not
-defined, or defined to `32', `off_t' will be the old 32-bit type.  If, instead,
-this macro is defined to `64', `off_t' will be the largefile supporting 64-bit
-type, and calls to gd_getdata, gd_putdata, &c. will intrinsically have largefile
-support.  On 64-bit systems this macro has no effect, since a 64-bit `off_t'
-is used all the time.
-
-If your system uses the GNU C Library, the feature_test_macros(7) man page
-will provide further explanation.  On systems where these macros are
-unsupported, the gd_getdata64, &c. interfaces will never be defined, and the
-size of `off_t' will be system dependent.  In this case, GetData will likely
-lack largefile support.
-
-If you build GetData against a C Library that lacks largefile support, the
-GetData library will not support large files either, no matter what you do with
-these macros.
+The default GetData API uses the standard C type off_t for frame and sample
+offsets into the database.  To overcome the addressable limit imposed by a
+32-bit off_t, GetData provides an optional API for largefile support. Defining
+GD_64BIT_API before including getdata.h will define the 64-bit type
+gd_off64_t, as well as declare additional functions that use this 64-bit type.
+If the platform provides off64_t, the GetData type will be simply that.
+
+On platforms where off_t is 64-bits wide, this API may still be useful for
+portable programming; in this case gd_off64_t is simply off_t. On some
+platforms this API may be automatically enabled; in this case, the symbol
+GD_64BIT_API is ignored.
+
+The explicit 64-bit functions this API declares are:
+
+  * gd_alter_frameoffset64
+  * gd_bof64
+  * gd_eof64
+  * gd_framenum_subset64
+  * gd_frameoffset64
+  * gd_getdata64
+  * gd_nframes64
+  * gd_putdata64
+  * gd_seek64
+  * gd_tell64 
+
+These functions behave identically to the versions without the -64 suffix,
+except they use gd_off64_t in place of off_t. 
 
 
 AUTHOR
diff --git a/TODO b/TODO
index 08b8750..1cbe459 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,4 @@
 * Locking
 * Hashed compressed files
-* linterp table path munging [MH]
 * Make webpage suck less
 * Fused multiply-add [CBN]
-* Entry list regex [AR]
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
index a498a6f..bc65a52 100644
--- a/bindings/Makefile.am
+++ b/bindings/Makefile.am
@@ -55,8 +55,8 @@ noinst_PROGRAMS=make_parameters
 make_parameters_SOURCES = make_parameters.c
 nodist_make_parameters_SOURCES = ../src/getdata.h ../src/gd_config.h
 
-SUBDIRS = . ${F77_SUBDIR} ${CXX_SUBDIR} ${IDL_SUBDIR} ${PY_SUBDIR} \
-					${PERL_SUBDIR} ${MATLAB_SUBDIR} ${PHP_SUBDIR}
+SUBDIRS = . ${CXX_SUBDIR} ${F77_SUBDIR} ${IDL_SUBDIR} ${MATLAB_SUBDIR} \
+					${PERL_SUBDIR} ${PHP_SUBDIR} ${PY_SUBDIR} 
 
 make_parameters$(EXEEXT): $(make_parameters_SOURCES) \
 				    $(nodist_make_parameters_SOURCES)
diff --git a/bindings/Makefile.in b/bindings/Makefile.in
index 038e9e2..0ecb251 100644
--- a/bindings/Makefile.in
+++ b/bindings/Makefile.in
@@ -194,7 +194,7 @@ am__define_uniq_tagged_files = \
   done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = . f77 cxx idl python perl matlab php
+DIST_SUBDIRS = . cxx f77 idl matlab perl php python
 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
@@ -252,6 +252,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
@@ -480,8 +482,8 @@ AUTOMAKE_OPTIONS = foreign
 @MAKE_PHPBINDINGS_TRUE at PHP_SUBDIR = php
 make_parameters_SOURCES = make_parameters.c
 nodist_make_parameters_SOURCES = ../src/getdata.h ../src/gd_config.h
-SUBDIRS = . ${F77_SUBDIR} ${CXX_SUBDIR} ${IDL_SUBDIR} ${PY_SUBDIR} \
-					${PERL_SUBDIR} ${MATLAB_SUBDIR} ${PHP_SUBDIR}
+SUBDIRS = . ${CXX_SUBDIR} ${F77_SUBDIR} ${IDL_SUBDIR} ${MATLAB_SUBDIR} \
+					${PERL_SUBDIR} ${PHP_SUBDIR} ${PY_SUBDIR} 
 
 all: all-recursive
 
diff --git a/bindings/cxx/Makefile.am b/bindings/cxx/Makefile.am
index 784c693..13bc29c 100644
--- a/bindings/cxx/Makefile.am
+++ b/bindings/cxx/Makefile.am
@@ -35,16 +35,17 @@ getdata_include_HEADERS = getdata/dirfile.h getdata/entry.h getdata/rawentry.h \
 													getdata/fragment.h getdata/divideentry.h \
 													getdata/recipentry.h getdata/carrayentry.h \
 													getdata/windowentry.h getdata/mplexentry.h \
-													getdata/types.h
+													getdata/types.h getdata/sarrayentry.h \
+													getdata/indirentry.h getdata/sindirentry.h
 
 lib_LTLIBRARIES=libgetdata++.la
 libgetdata___la_SOURCES = dirfile.cpp bitentry.cpp carrayentry.cpp \
 													constentry.cpp divideentry.cpp entry.cpp \
-													fragment.cpp lincomentry.cpp \
+													fragment.cpp indirentry.cpp lincomentry.cpp \
 													linterpentry.cpp mplexentry.cpp multiplyentry.cpp \
 													phaseentry.cpp polynomentry.cpp rawentry.cpp \
-													recipentry.cpp sbitentry.cpp \
-													stringentry.cpp windowentry.cpp \
+													recipentry.cpp sarrayentry.cpp sbitentry.cpp \
+													sindirentry.cpp stringentry.cpp windowentry.cpp \
 													${getdata_include_HEADERS} internal.h
 libgetdata___la_LIBADD=../../src/libgetdata.la
 libgetdata___la_LDFLAGS = -version-info @GETDATAXX_VERSION@
diff --git a/bindings/cxx/Makefile.in b/bindings/cxx/Makefile.in
index 1bef3e6..55f4b6f 100644
--- a/bindings/cxx/Makefile.in
+++ b/bindings/cxx/Makefile.in
@@ -143,9 +143,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 \
-	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)
+	indirentry.lo lincomentry.lo linterpentry.lo mplexentry.lo \
+	multiplyentry.lo phaseentry.lo polynomentry.lo rawentry.lo \
+	recipentry.lo sarrayentry.lo sbitentry.lo sindirentry.lo \
+	stringentry.lo windowentry.lo $(am__objects_1)
 libgetdata___la_OBJECTS = $(am_libgetdata___la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -308,6 +309,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
@@ -539,16 +542,17 @@ getdata_include_HEADERS = getdata/dirfile.h getdata/entry.h getdata/rawentry.h \
 													getdata/fragment.h getdata/divideentry.h \
 													getdata/recipentry.h getdata/carrayentry.h \
 													getdata/windowentry.h getdata/mplexentry.h \
-													getdata/types.h
+													getdata/types.h getdata/sarrayentry.h \
+													getdata/indirentry.h getdata/sindirentry.h
 
 lib_LTLIBRARIES = libgetdata++.la
 libgetdata___la_SOURCES = dirfile.cpp bitentry.cpp carrayentry.cpp \
 													constentry.cpp divideentry.cpp entry.cpp \
-													fragment.cpp lincomentry.cpp \
+													fragment.cpp indirentry.cpp lincomentry.cpp \
 													linterpentry.cpp mplexentry.cpp multiplyentry.cpp \
 													phaseentry.cpp polynomentry.cpp rawentry.cpp \
-													recipentry.cpp sbitentry.cpp \
-													stringentry.cpp windowentry.cpp \
+													recipentry.cpp sarrayentry.cpp sbitentry.cpp \
+													sindirentry.cpp stringentry.cpp windowentry.cpp \
 													${getdata_include_HEADERS} internal.h
 
 libgetdata___la_LIBADD = ../../src/libgetdata.la
@@ -638,6 +642,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/divideentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/indirentry.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@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mplexentry.Plo at am__quote@
@@ -646,7 +651,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/polynomentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rawentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/recipentry.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sarrayentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sbitentry.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sindirentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stringentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/windowentry.Plo at am__quote@
 
diff --git a/bindings/cxx/dirfile.cpp b/bindings/cxx/dirfile.cpp
index 5379700..d47b059 100644
--- a/bindings/cxx/dirfile.cpp
+++ b/bindings/cxx/dirfile.cpp
@@ -111,12 +111,18 @@ Entry *Dirfile::Entry(const char* field_code) const
       return new GetData::CarrayEntry(this, field_code);
     case StringEntryType:
       return new GetData::StringEntry(this, field_code);
+    case SarrayEntryType:
+      return new GetData::SarrayEntry(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 IndirEntryType:
+      return new GetData::IndirEntry(this, field_code);
+    case SindirEntryType:
+      return new GetData::SindirEntry(this, field_code);
     case NoEntryType:
       break;
   }
@@ -307,6 +313,14 @@ size_t Dirfile::GetData(const char* field_code, gd_off64_t first_frame,
       num_samples, (gd_type_t)type, data_out);
 }
 
+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,
+    const char** data_out) const
+{
+  return gd_getdata64(D, field_code, first_frame, first_sample, num_frames,
+      num_samples, GD_STRING, data_out);
+}
+
 size_t Dirfile::GetString(const char *field_code, size_t len, char* data_out)
   const
 {
@@ -337,7 +351,7 @@ size_t Dirfile::PutData(const char* field_code, gd_off64_t first_frame,
       num_samples, (gd_type_t)type, data_in);
 }
 
-size_t Dirfile::PutString(const char *field_code, const char* data_in) const
+int Dirfile::PutString(const char *field_code, const char* data_in) const
 {
   return gd_put_string(D, field_code, data_in);
 }
@@ -496,6 +510,12 @@ int Dirfile::IncludeAffix(const char *file, int fragment_index,
   return gd_include_affix(D, file, fragment_index, prefix, suffix, flags);
 }
 
+int Dirfile::IncludeNS(const char *file, int fragment_index,
+    const char* ns, unsigned long flags) const
+{
+  return gd_include_ns(D, file, fragment_index, ns, flags);
+}
+
 int Dirfile::MAddAlias(const char* parent, const char* name, const char* target)
   const
 {
@@ -572,3 +592,37 @@ char* Dirfile::LinterpTableName(const char *field_code)
 {
   return gd_linterp_tablename(D, field_code);
 }
+
+int Dirfile::GetSarray(const char *field_code, const char **data_out,
+    unsigned int start, size_t len) const
+{
+  if (len == 0)
+    return gd_get_sarray(D, field_code, data_out);
+  else
+    return gd_get_sarray_slice(D, field_code, start, len, data_out);
+}
+
+const char*** Dirfile::Sarrays() const
+{
+  return gd_sarrays(D);
+}
+
+const char*** Dirfile::MSarrays(const char* parent) const
+{
+  return gd_msarrays(D, parent);
+}
+
+int Dirfile::PutSarray(const char *field_code, const char **data_in,
+    unsigned int start, size_t len) const
+{
+  if (len == 0)
+    return gd_put_sarray(D, field_code, data_in);
+  else
+    return gd_put_sarray_slice(D, field_code, start, len, data_in);
+}
+
+unsigned int Dirfile::MatchEntries(const char *regex, int fragment, int type,
+    unsigned int flags, const char ***entries)
+{
+  return gd_match_entries(D, regex, fragment, type, flags, entries);
+}
diff --git a/bindings/cxx/entry.cpp b/bindings/cxx/entry.cpp
index 13581c3..6f1264b 100644
--- a/bindings/cxx/entry.cpp
+++ b/bindings/cxx/entry.cpp
@@ -50,6 +50,7 @@ int Entry::CheckIndex(gd_entype_t field_type, int n_fields, int index)
     case GD_INDEX_ENTRY:
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_STRING_ENTRY:
     case GD_NO_ENTRY:
     case GD_ALIAS_ENTRY:
@@ -60,6 +61,8 @@ int Entry::CheckIndex(gd_entype_t field_type, int n_fields, int index)
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
     case GD_WINDOW_ENTRY:
     case GD_MPLEX_ENTRY:
       if (index > 2)
@@ -182,9 +185,12 @@ static inline int scalar_ok(const gd_entry_t &E, int index)
     case GD_LINTERP_ENTRY:
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_STRING_ENTRY:
     case GD_NO_ENTRY:
     case GD_ALIAS_ENTRY:
diff --git a/bindings/cxx/fragment.cpp b/bindings/cxx/fragment.cpp
index da84501..4a3a7ed 100644
--- a/bindings/cxx/fragment.cpp
+++ b/bindings/cxx/fragment.cpp
@@ -36,9 +36,11 @@ Fragment::Fragment(const GetData::Dirfile *dirfile, int index)
   name = gd_fragmentname(D->D, index);
   parent = (index == 0) ? -1 : gd_parent_fragment(D->D, index);
 
-  if (gd_fragment_affixes(D->D, index, &prefix, &suffix) == -1)
+  if (gd_fragment_affixes(D->D, index, &prefix, &suffix) < 0)
     prefix = suffix = NULL;
 
+  ns = gd_fragment_namespace(D->D, index, NULL);
+
   dreturnvoid();
 }
 
@@ -93,14 +95,25 @@ int Fragment::SetProtection(int protection_level)
   return ret;
 }
 
+int Fragment::SetNamespace(const char* new_namespace)
+{
+  const char *ret = gd_fragment_namespace(D->D, ind, new_namespace);
+
+  if (ret)
+    ns = ret;
+  return gd_error(D->D);
+}
+
 int Fragment::SetPrefix(const char* new_prefix)
 {
   int ret = gd_alter_affixes(D->D, ind, new_prefix, suffix);
 
   free(prefix);
   free(suffix);
-  if (!ret)
+  if (!ret) {
+    ns = gd_fragment_namespace(D->D, ind, NULL);
     ret = gd_fragment_affixes(D->D, ind, &prefix, &suffix);
+  }
   return ret;
 }
 
diff --git a/bindings/cxx/getdata/dirfile.h b/bindings/cxx/getdata/dirfile.h
index 9e93ebc..a01d182 100644
--- a/bindings/cxx/getdata/dirfile.h
+++ b/bindings/cxx/getdata/dirfile.h
@@ -36,11 +36,14 @@
 #include <getdata/constentry.h>
 #include <getdata/carrayentry.h>
 #include <getdata/stringentry.h>
+#include <getdata/sarrayentry.h>
 #include <getdata/mplexentry.h>
 #include <getdata/multiplyentry.h>
 #include <getdata/divideentry.h>
 #include <getdata/recipentry.h>
 #include <getdata/windowentry.h>
+#include <getdata/indirentry.h>
+#include <getdata/sindirentry.h>
 
 namespace GetData {
   
@@ -63,8 +66,11 @@ namespace GetData {
     friend class PolynomEntry;
     friend class WindowEntry;
     friend class MplexEntry;
+    friend class IndirEntry;
+    friend class SindirEntry;
     friend class ConstEntry;
     friend class CarrayEntry;
+    friend class SarrayEntry;
     friend class StringEntry;
     friend class IndexEntry;
     friend class Fragment;
@@ -149,6 +155,13 @@ namespace GetData {
           gd_off64_t first_sample, size_t num_frames, size_t num_samples,
           DataType type, void* data_out) const;
 
+			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,
+          const char** data_out) const;
+
+      int GetSarray(const char *field_code, const char**data_out,
+          unsigned int start = 0, size_t len = 0) const;
+
       size_t GetString(const char *field_code, size_t len, char *data_out)
         const;
 
@@ -163,6 +176,9 @@ namespace GetData {
           const char* prefix = NULL, const char* suffix = NULL,
           unsigned long flags = 0) const;
 
+      int IncludeNS(const char *file, int fragment_index = 0,
+          const char* ns = NULL, unsigned long flags = 0) const;
+
       char *LinterpTableName(const char *field_code);
 
       int MAdd(GetData::Entry &entry, const char *parent) const;
@@ -175,6 +191,10 @@ namespace GetData {
       int MAlterSpec(const char *line, const char *parent, int recode = 0)
         const;
 
+      unsigned int MatchEntries(const char *regex = NULL,
+          int fragment = GD_ALL_FRAGMENTS, int type = 0, unsigned int flags = 0,
+          const char ***entries = NULL);
+
       const gd_carray_t *MCarrays(const char *parent, DataType type = Float64)
         const;
 
@@ -188,6 +208,8 @@ namespace GetData {
 
       void MplexLookback(int lookback) const;
 
+			const char*** MSarrays(const char *parent) const;
+
       const char **MStrings(const char *parent) const;
 
       const char **MVectorList(const char *parent) const;
@@ -227,7 +249,11 @@ namespace GetData {
           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 PutSarray(const char *field_code, const char **data_in,
+          unsigned int start = 0, size_t len = 0) const;
+
+      int PutString(const char *field_code, const char *data_in) const;
 
       int RawClose(const char *field_code = NULL) const;
 
@@ -237,6 +263,8 @@ namespace GetData {
 
       unsigned int SamplesPerFrame(const char *field_code) const;
 
+			const char*** Sarrays() const;
+
       gd_off64_t Seek(const char* field_code, gd_off64_t frame_num,
           gd_off64_t sample_num, int flags) const;
 
diff --git a/bindings/cxx/getdata/entry.h b/bindings/cxx/getdata/entry.h
index ad5ff46..354bc9e 100644
--- a/bindings/cxx/getdata/entry.h
+++ b/bindings/cxx/getdata/entry.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2013, 2015, 2016 D. V. Wiebe
+// Copyright (C) 2008-2013, 2015-2017 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -130,7 +130,7 @@ namespace GetData {
       };
 
       /* PHASE methods */
-      virtual gd_shift_t Shift() const {
+      virtual gd_int64_t Shift() const {
         return (E.field_type == GD_PHASE_ENTRY) ? E.u.phase.shift : 0;
       };
 
@@ -194,7 +194,7 @@ namespace GetData {
         return (E.field_type == GD_MPLEX_ENTRY) ? E.u.mplex.period : 0;
       }
 
-      /* deprecated member alias */
+      /* deprecated in GetData-0.8.4; use Period() instead */
       virtual int gd_deprecated CountMax() const { return Period(); }
 
       /* Set methods */
diff --git a/bindings/cxx/getdata/fragment.h b/bindings/cxx/getdata/fragment.h
index 2102b75..ac99aa3 100644
--- a/bindings/cxx/getdata/fragment.h
+++ b/bindings/cxx/getdata/fragment.h
@@ -44,6 +44,8 @@ namespace GetData {
 
       const char* Name() const { return name; }
 
+      const char* Namespace() const { return ns; }
+
       int Parent() const { return parent; }
 
       const char *Prefix() { return prefix; };
@@ -60,6 +62,8 @@ namespace GetData {
 
       int SetFrameOffset(gd_off64_t offset, int recode = 0);
 
+      int SetNamespace(const char* new_namespace);
+
       int SetPrefix(const char *preix);
 
       int SetProtection(int protection_level);
@@ -76,6 +80,7 @@ namespace GetData {
       int prot;
       gd_off64_t off;
       const char* name;
+      const char* ns;
       char* prefix;
       char* suffix;
       int parent;
diff --git a/bindings/cxx/getdata/indirentry.h b/bindings/cxx/getdata/indirentry.h
new file mode 100644
index 0000000..89f7a3e
--- /dev/null
+++ b/bindings/cxx/getdata/indirentry.h
@@ -0,0 +1,52 @@
+// Copyright (C) 2010 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General 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_INDIRENTRY_H
+#define GETDATA_INDIRENTRY_H
+
+#include <getdata/entry.h>
+
+namespace GetData {
+
+  class Dirfile;
+
+  class IndirEntry : public Entry {
+    friend class Dirfile;
+
+    public:
+      IndirEntry() : Entry() { E.field_type = GD_INDIR_ENTRY; };
+
+      IndirEntry(const char* field_code, const char* in_field1,
+          const char* in_field2, int fragment_index = 0);
+
+      virtual const char *Input(int index) const {
+        return (index == 0 || index == 1) ? E.in_fields[index] : NULL;
+      };
+
+      int SetInput(const char* field, int index);
+
+    private:
+      IndirEntry(const GetData::Dirfile *dirfile, const char* field_code) :
+        Entry(dirfile, field_code) { };
+  };
+}
+
+#endif
diff --git a/bindings/cxx/getdata/mplexentry.h b/bindings/cxx/getdata/mplexentry.h
index aea09af..46e47b8 100644
--- a/bindings/cxx/getdata/mplexentry.h
+++ b/bindings/cxx/getdata/mplexentry.h
@@ -60,7 +60,7 @@ namespace GetData {
       virtual int SetPeriod(int period);
       virtual int SetPeriod(const char* period);
 
-      /* deprecated member aliases */
+      /* deprecated in GetData-0.8.4; use Period() or SetPeriod() instead */
       virtual int gd_deprecated CountMax() const { return Period(); };
       virtual int gd_deprecated SetCountMax(int period) {
         return SetPeriod(period);
diff --git a/bindings/cxx/getdata/phaseentry.h b/bindings/cxx/getdata/phaseentry.h
index b88ab4b..402d381 100644
--- a/bindings/cxx/getdata/phaseentry.h
+++ b/bindings/cxx/getdata/phaseentry.h
@@ -34,17 +34,17 @@ namespace GetData {
     public:
       PhaseEntry() : Entry() { E.field_type = GD_PHASE_ENTRY; };
 
-      PhaseEntry(const char* field_code, const char* in_field, gd_shift_t shift,
+      PhaseEntry(const char* field_code, const char* in_field, gd_int64_t shift,
           int fragment_index = 0);
 
       virtual const char *Input(int index = 0) const {
         return (index == 0) ? E.in_fields[0] : NULL;
       };
 
-      virtual gd_shift_t Shift() const { return E.u.phase.shift; };
+      virtual gd_int64_t Shift() const { return E.u.phase.shift; };
 
       int SetInput(const char* field);
-      int SetShift(gd_shift_t shift);
+      int SetShift(gd_int64_t shift);
       int SetShift(const char* shift);
 
       virtual const char *Scalar(int index = 0) const {
diff --git a/bindings/cxx/getdata/sarrayentry.h b/bindings/cxx/getdata/sarrayentry.h
new file mode 100644
index 0000000..6c9d731
--- /dev/null
+++ b/bindings/cxx/getdata/sarrayentry.h
@@ -0,0 +1,50 @@
+// Copyright (C) 2010 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General 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_SARRAYENTRY_H
+#define GETDATA_SARRAYENTRY_H
+
+#include <getdata/entry.h>
+
+namespace GetData {
+
+  class Dirfile;
+
+  class SarrayEntry : public Entry {
+    friend class Dirfile;
+
+    public:
+      SarrayEntry() : Entry() { E.field_type = GD_SARRAY_ENTRY; };
+
+      SarrayEntry(const char* field_code, size_t array_len,
+          int fragment_index = 0);
+
+      virtual size_t ArrayLen() const { return E.u.scalar.array_len; }
+
+      int SetArrayLen(size_t array_len);
+
+    private:
+      SarrayEntry(const GetData::Dirfile *dirfile, const char* field_code) :
+        Entry(dirfile, field_code) { };
+  };
+}
+
+#endif
diff --git a/bindings/cxx/getdata/sindirentry.h b/bindings/cxx/getdata/sindirentry.h
new file mode 100644
index 0000000..1c2268b
--- /dev/null
+++ b/bindings/cxx/getdata/sindirentry.h
@@ -0,0 +1,52 @@
+// Copyright (C) 2010 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General 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_SINDIRENTRY_H
+#define GETDATA_SINDIRENTRY_H
+
+#include <getdata/entry.h>
+
+namespace GetData {
+
+  class Dirfile;
+
+  class SindirEntry : public Entry {
+    friend class Dirfile;
+
+    public:
+      SindirEntry() : Entry() { E.field_type = GD_SINDIR_ENTRY; };
+
+      SindirEntry(const char* field_code, const char* in_field1,
+          const char* in_field2, int fragment_index = 0);
+
+      virtual const char *Input(int index) const {
+        return (index == 0 || index == 1) ? E.in_fields[index] : NULL;
+      };
+
+      int SetInput(const char* field, int index);
+
+    private:
+      SindirEntry(const GetData::Dirfile *dirfile, const char* field_code) :
+        Entry(dirfile, field_code) { };
+  };
+}
+
+#endif
diff --git a/bindings/cxx/getdata/types.h b/bindings/cxx/getdata/types.h
index 875902e..fc48652 100644
--- a/bindings/cxx/getdata/types.h
+++ b/bindings/cxx/getdata/types.h
@@ -63,7 +63,8 @@ namespace GetData {
     UInt32    = GD_UINT32,    Int32      = GD_INT32,
     UInt64    = GD_UINT64,    Int64      = GD_INT64,
     Float32   = GD_FLOAT32,   Float64    = GD_FLOAT64,
-    Complex64 = GD_COMPLEX64, Complex128 = GD_COMPLEX128
+    Complex64 = GD_COMPLEX64, Complex128 = GD_COMPLEX128,
+    String    = GD_STRING
   };
 
   enum EntryType {
@@ -78,12 +79,15 @@ namespace GetData {
     PolynomEntryType  = GD_POLYNOM_ENTRY,
     ConstEntryType    = GD_CONST_ENTRY,
     CarrayEntryType   = GD_CARRAY_ENTRY,
+    SarrayEntryType   = GD_SARRAY_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
+    MplexEntryType    = GD_MPLEX_ENTRY,
+    IndirEntryType    = GD_INDIR_ENTRY,
+    SindirEntryType   = GD_SINDIR_ENTRY
   };
 
   enum WindOpType {
diff --git a/bindings/cxx/indirentry.cpp b/bindings/cxx/indirentry.cpp
new file mode 100644
index 0000000..ced5888
--- /dev/null
+++ b/bindings/cxx/indirentry.cpp
@@ -0,0 +1,52 @@
+// Copyright (C) 2014 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public 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"
+
+using namespace GetData;
+
+IndirEntry::IndirEntry(const char* field_code, const char* in_field1,
+    const char* in_field2, int fragment_index) : Entry()
+{
+  E.field = strdup(field_code);
+  E.field_type = GD_INDIR_ENTRY;
+  E.in_fields[0] = strdup(in_field1);
+  E.in_fields[1] = strdup(in_field2);
+  E.fragment_index = fragment_index;
+}
+
+int IndirEntry::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;
+}
diff --git a/bindings/cxx/phaseentry.cpp b/bindings/cxx/phaseentry.cpp
index 71006bf..d56e138 100644
--- a/bindings/cxx/phaseentry.cpp
+++ b/bindings/cxx/phaseentry.cpp
@@ -23,7 +23,7 @@
 using namespace GetData;
 
 PhaseEntry::PhaseEntry(const char* field_code, const char* in_field,
-    gd_shift_t shift, int fragment_index) : Entry()
+    gd_int64_t shift, int fragment_index) : Entry()
 {
   E.field = strdup(field_code);
   E.field_type = GD_PHASE_ENTRY;
@@ -48,7 +48,7 @@ int PhaseEntry::SetInput(const char* field)
   return 0;
 }
 
-int PhaseEntry::SetShift(gd_shift_t shift)
+int PhaseEntry::SetShift(gd_int64_t shift)
 {
   E.u.phase.shift = shift;
 
diff --git a/bindings/cxx/sarrayentry.cpp b/bindings/cxx/sarrayentry.cpp
new file mode 100644
index 0000000..3ac4f23
--- /dev/null
+++ b/bindings/cxx/sarrayentry.cpp
@@ -0,0 +1,40 @@
+// Copyright (C) 2014 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public 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"
+
+SarrayEntry::SarrayEntry(const char* field_code, size_t array_len,
+    int fragment_index)
+{
+  E.field = strdup(field_code);
+  E.field_type = GD_SARRAY_ENTRY;
+  E.u.scalar.array_len = array_len;
+  E.fragment_index = fragment_index;
+}
+
+int SarrayEntry::SetArrayLen(size_t array_len)
+{
+  E.u.scalar.array_len = array_len;
+
+  if (D != NULL)
+    return gd_alter_entry(D->D, E.field, &E, 0);
+  
+  return 0;
+}
diff --git a/bindings/cxx/sindirentry.cpp b/bindings/cxx/sindirentry.cpp
new file mode 100644
index 0000000..5f92387
--- /dev/null
+++ b/bindings/cxx/sindirentry.cpp
@@ -0,0 +1,52 @@
+// Copyright (C) 2014 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public 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"
+
+using namespace GetData;
+
+SindirEntry::SindirEntry(const char* field_code, const char* in_field1,
+    const char* in_field2, int fragment_index) : Entry()
+{
+  E.field = strdup(field_code);
+  E.field_type = GD_SINDIR_ENTRY;
+  E.in_fields[0] = strdup(in_field1);
+  E.in_fields[1] = strdup(in_field2);
+  E.fragment_index = fragment_index;
+}
+
+int SindirEntry::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;
+}
diff --git a/bindings/cxx/test/Makefile.in b/bindings/cxx/test/Makefile.in
index fb02f8d..75ca362 100644
--- a/bindings/cxx/test/Makefile.in
+++ b/bindings/cxx/test/Makefile.in
@@ -231,6 +231,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/cxx/test/big_test.cpp b/bindings/cxx/test/big_test.cpp
index 845ab07..68eb049 100644
--- a/bindings/cxx/test/big_test.cpp
+++ b/bindings/cxx/test/big_test.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2015 D. V. Wiebe
+// Copyright (C) 2009-2013 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -139,6 +139,7 @@ void run_tests(void)
   const char* empty = "dirfile/empty";
   const char* eformat = "dirfile/empty/format";
   const char* format1 = "dirfile/format1";
+  const char* format2 = "dirfile/format2";
   const char* form2 = "dirfile/form2";
   const char* new1 = "dirfile/new1";
   const char* data = "dirfile/data";
@@ -163,13 +164,17 @@ void run_tests(void)
     "phase PHASE data 11\n"
     "window WINDOW linterp mult LT 4.1\n"
     "/ALIAS alias data\n"
-    "string STRING \"Zaphod Beeblebrox\"\n";
+    "string STRING \"Zaphod Beeblebrox\"\n"
+    "sarray SARRAY one two three four five six seven\n"
+    "data/msarray SARRAY eight nine ten eleven twelve\n"
+    "indir INDIR data carray\n"
+    "sindir SINDIR data sarray\n";
   const char* form2_data = "const2 CONST INT8 -19\n";
-  const int nfields = 17;
+  const int nfields = 20;
   unsigned char c[8];
   unsigned char data_data[80];
   signed char sc;
-  int m, n, i;
+  int m, n, i, j;
   float fl;
   double dp, p[6], q[6];
   const double *qp;
@@ -195,22 +200,27 @@ void run_tests(void)
   StringEntry gent;
   WindowEntry went, *wep;
   MplexEntry xent, *xep;
+  SarrayEntry saent, *saep;
+  IndirEntry ient, *iep;
+  SindirEntry sient, *siep;
   Fragment *frag;
   gd_triplet_t thresh;
   const gd_carray_t *carrays;
-
-  char* fields[nfields + 10] = {(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, NULL};
+  const char*** sarrays;
+
+  char* fields[nfields + 8] = { (char*)"bit", (char*)"div", (char*)"data",
+    (char*)"mult", (char*)"sbit", (char*)"INDEX", (char*)"alias",
+    (char*)"const", (char*)"indir", (char*)"mplex", (char*)"phase",
+    (char*)"recip", (char*)"carray", (char*)"lincom", (char*)"sarray",
+    (char*)"sindir", (char*)"string", (char*)"window", (char*)"linterp",
+    (char*)"polynom", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
   char *strings[3];
 
   unlink(data);
   unlink(new1);
   unlink(format);
   unlink(format1);
+  unlink(format2);
   unlink(form2);
   rmdir(filedir);
 
@@ -266,13 +276,14 @@ void run_tests(void)
   // 26: Dirfile::NFields check
   n = d->NMFields("data");
   CHECK_OK(26);
-  CHECK_INT(26,n,4);
+  CHECK_INT(26,n,5);
 
   // 27: Dirfile::MFieldList check
   fields[0] = (char*)"mstr";
   fields[1] = (char*)"mconst";
   fields[2] = (char*)"mcarray";
   fields[3] = (char*)"mlut";
+  fields[4] = (char*)"msarray";
   list = d->MFieldList("data");
   CHECK_OK(27);
   CHECK_STRING_ARRAY(27,n,list[i],fields[i]);
@@ -665,9 +676,9 @@ void run_tests(void)
   CHECK_INT(67,n,3);
 
   // 68: Dirfile::FieldListByType check
-  fields[0] = (char*)"lincom";
-  fields[1] = (char*)"new2";
-  fields[2] = (char*)"new3";
+  fields[0] = (char*)"new2";
+  fields[1] = (char*)"new3";
+  fields[2] = (char*)"lincom";
   list = d->FieldListByType(LincomEntryType);
   CHECK_OK(68);
   CHECK_STRING_ARRAY(68,n,list[i],fields[i]);
@@ -675,33 +686,34 @@ void run_tests(void)
   // 69: Dirfile::NVectors check
   n = d->NVectors();
   CHECK_OK(69);
-  CHECK_INT(69,n,24);
+  CHECK_INT(69,n,25);
 
   // 70: Dirfile::VectorList check
-  fields[0] = (char*)"INDEX";
-  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[ 0] = (char*)"bit";
+  fields[ 1] = (char*)"div";
+  fields[ 2] = (char*)"data";
+  fields[ 3] = (char*)"mult";
+  fields[ 4] = (char*)"new1";
+  fields[ 5] = (char*)"new2";
+  fields[ 6] = (char*)"new3";
+  fields[ 7] = (char*)"new4";
+  fields[ 8] = (char*)"new5";
+  fields[ 9] = (char*)"new6";
+  fields[10] = (char*)"new7";
+  fields[11] = (char*)"new8";
+  fields[12] = (char*)"new9";
+  fields[13] = (char*)"sbit";
+  fields[14] = (char*)"INDEX";
+  fields[15] = (char*)"alias";
+  fields[16] = (char*)"indir";
+  fields[17] = (char*)"mplex";
+  fields[18] = (char*)"new10";
   fields[19] = (char*)"phase";
-  fields[20] = (char*)"polynom";
-  fields[21] = (char*)"recip";
-  fields[22] = (char*)"sbit";
-  fields[23] = (char*)"window";
+  fields[20] = (char*)"recip";
+  fields[21] = (char*)"lincom";
+  fields[22] = (char*)"window";
+  fields[23] = (char*)"linterp";
+  fields[24] = (char*)"polynom";
   list = d->VectorList();
   CHECK_OK(70);
   CHECK_STRING_ARRAY(70,n,list[i],fields[i]);
@@ -761,7 +773,7 @@ void run_tests(void)
   // 94: Dirfile::PutString check
   n = d->PutString("string", "Arthur Dent");
   CHECK_OK2(94,1);
-  CHECK_INT2(94,1,n,12);
+  CHECK_INT2(94,1,n,0);
 
   n = d->GetString("string", GD_MAX_LINE_LENGTH, buf);
   CHECK_OK2(94,2);
@@ -1109,7 +1121,7 @@ void run_tests(void)
   // 131: Dirfile::Validate check
   n = d->Validate("new7");
   CHECK_ERROR(131,GD_E_BAD_CODE);
-  CHECK_INT(131,n,-1);
+  CHECK_INT(131,n,GD_E_BAD_CODE);
 
   // 133: Dirfile::FrameNum check
   delete d->Reference("data");
@@ -1697,39 +1709,40 @@ void run_tests(void)
   n = d->NEntries("data", GD_SCALAR_ENTRIES,
       GD_ENTRIES_HIDDEN | GD_ENTRIES_NOALIAS);
   CHECK_OK2(237, 1);
-  CHECK_INT2(237, 1, n, 4);
+  CHECK_INT2(237, 1, n, 5);
   n = d->NEntries(NULL, GD_VECTOR_ENTRIES,
       GD_ENTRIES_HIDDEN | GD_ENTRIES_NOALIAS);
   CHECK_OK2(237, 2);
-  CHECK_INT2(237, 2, n, 26);
+  CHECK_INT2(237, 2, n, 27);
 
   // 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[ 0] = (char*)"bit";
+  fields[ 1] = (char*)"div";
+  fields[ 2] = (char*)"data";
+  fields[ 3] = (char*)"mult";
+  fields[ 4] = (char*)"new1";
+  fields[ 5] = (char*)"new2";
+  fields[ 6] = (char*)"new3";
+  fields[ 7] = (char*)"new4";
+  fields[ 8] = (char*)"new5";
+  fields[ 9] = (char*)"new6";
+  fields[10] = (char*)"new7";
+  fields[11] = (char*)"new8";
+  fields[12] = (char*)"sbit";
+  fields[13] = (char*)"INDEX";
+  fields[14] = (char*)"indir";
+  fields[15] = (char*)"mplex";
+  fields[16] = (char*)"new14";
+  fields[17] = (char*)"new15";
+  fields[18] = (char*)"new16";
+  fields[19] = (char*)"new18";
+  fields[20] = (char*)"new21";
   fields[21] = (char*)"phase";
-  fields[22] = (char*)"polynom";
-  fields[23] = (char*)"recip";
-  fields[24] = (char*)"sbit";
-  fields[25] = (char*)"window";
+  fields[22] = (char*)"recip";
+  fields[23] = (char*)"lincom";
+  fields[24] = (char*)"window";
+  fields[25] = (char*)"linterp";
+  fields[26] = (char*)"polynom";
   list = d->EntryList(NULL, GD_VECTOR_ENTRIES,
       GD_ENTRIES_HIDDEN | GD_ENTRIES_NOALIAS);
   CHECK_OK(239);
@@ -1770,6 +1783,245 @@ void run_tests(void)
 
   delete id;
 
+  // 277: gd_entry (SARRAY)
+  ent = d->Entry("sarray");
+  CHECK_OK(277);
+  CHECK_INT2(277,1,ent->Type(),SarrayEntryType);
+  CHECK_INT2(277,2,ent->FragmentIndex(),0);
+  CHECK_INT2(277,3,ent->ArrayLen(),7);
+  delete ent;
+
+  // 278: gd_get_sarray
+  fields[0] = (char*)"one";
+  fields[1] = (char*)"two";
+  fields[2] = (char*)"three";
+  fields[3] = (char*)"four";
+  fields[4] = (char*)"five";
+  fields[5] = (char*)"six";
+  fields[6] = (char*)"seven";
+  n = d->GetSarray("sarray", list);
+  CHECK_OK(278);
+  CHECK_INT(278,n,0);
+  CHECK_STRING_ARRAY(278,7,list[i],fields[i]);
+
+  // 279: gd_get_sarray_slice
+  n = d->GetSarray("sarray", list, 4, 3);
+  CHECK_OK(279);
+  CHECK_INT(279,n,0);
+  CHECK_STRING_ARRAY(279,3,list[i],fields[i+4]);
+
+  // 280: gd_sarrays
+  sarrays = d->Sarrays();
+  CHECK_OK(280);
+  CHECK_NONNULL(280,sarrays);
+  for (i = 0; sarrays[i] != NULL; ++i) {
+    for (j = 0; sarrays[i][j] != NULL; ++j)
+      CHECK_STRINGi(280, i * 1000 + j, sarrays[i][j], fields[j]);
+    CHECK_INT2(280, i + 1, j, 7);
+  }
+  CHECK_INT2(280, 0, i, 1);
+
+  // 281: gd_put_sarray
+  fields[0] = (char*)"eka";
+  fields[1] = (char*)"dvi";
+  fields[2] = (char*)"tri";
+  fields[3] = (char*)"catur";
+  fields[4] = (char*)"panca";
+  fields[5] = (char*)"sas";
+  fields[6] = (char*)"sapta";
+  n = d->PutSarray("sarray", (const char**)fields);
+  CHECK_OK2(281, 1);
+
+  n = d->GetSarray("sarray", list);
+  CHECK_OK2(281,2);
+  CHECK_INT(281,n,0);
+  CHECK_STRING_ARRAY(281,7,list[i],fields[i]);
+
+  // 282: gd_put_sarray_slice
+  fields[4] = (char*)"asta";
+  fields[5] = (char*)"nava";
+  n = d->PutSarray("sarray", (const char**)fields + 4, 4, 2);
+  CHECK_OK2(282, 1);
+
+  n = d->GetSarray("sarray", list);
+  CHECK_OK2(282,2);
+  CHECK_INT(282,n,0);
+  CHECK_STRING_ARRAY(282,7,list[i],fields[i]);
+
+  // 283: gd_add_sarray
+  saent.SetName("new283");
+  saent.SetFragmentIndex(0);
+  saent.SetArrayLen(4);
+  d->Add(saent);
+  CHECK_OK2(283,1);
+
+  ent = d->Entry("new283");
+  CHECK_OK2(283,2);
+  CHECK_INT2(283,1,ent->Type(),SarrayEntryType);
+  CHECK_INT2(283,2,ent->FragmentIndex(),0);
+  CHECK_INT2(283,4,ent->ArrayLen(),4);
+  delete ent;
+
+  // 285: gd_madd_sarray
+  saent.Dissociate();
+  saent.SetName("mnew285");
+  saent.SetFragmentIndex(0);
+  saent.SetArrayLen(2);
+  d->MAdd(saent, "data");
+  CHECK_OK2(285,1);
+
+  ent = d->Entry("data/mnew285");
+  CHECK_OK2(285,2);
+  CHECK_INT2(285,1,ent->Type(),SarrayEntryType);
+  CHECK_INT2(285,2,ent->FragmentIndex(),0);
+  CHECK_INT2(285,4,ent->ArrayLen(),2);
+  delete ent;
+
+  // 286: gd_alter_sarray
+  saep = reinterpret_cast<SarrayEntry*>(d->Entry("new283"));
+  CHECK_OK2(286,1);
+  saep->SetArrayLen(12);
+  CHECK_OK2(286,2);
+  delete saep;
+
+  ent = d->Entry("new283");
+  CHECK_OK2(286,3);
+  CHECK_INT2(286,1,ent->Type(),SarrayEntryType);
+  CHECK_INT2(286,2,ent->FragmentIndex(),0);
+  CHECK_INT2(286,4,ent->ArrayLen(),12);
+  delete ent;
+
+  // 287: gd_msarrays
+  fields[0] = (char*)"eight";
+  fields[1] = (char*)"nine";
+  fields[2] = (char*)"ten";
+  fields[3] = (char*)"eleven";
+  fields[4] = (char*)"twelve";
+  sarrays = d->MSarrays("data");
+  CHECK_OK(287);
+  CHECK_NONNULL2(287,0,sarrays);
+  CHECK_NONNULL2(287,1,sarrays[0]);
+  for (j = 0; sarrays[0][j] != NULL; ++j)
+    CHECK_STRINGi(287, j, sarrays[0][j], fields[j]);
+  CHECK_INT2(287, 1, j, 5);
+
+  fields[0] = (char*)"";
+  fields[1] = (char*)"";
+  CHECK_NONNULL2(287,2,sarrays[1]);
+  for (j = 0; sarrays[1][j] != NULL; ++j)
+    CHECK_STRINGi(287, 1000 + j, sarrays[1][j], fields[j]);
+  CHECK_INT2(287, 3, j, 2);
+  CHECK_NULL2(287,4,sarrays[2]);
+
+  // 288: Dirfile::Entry / IndirEntry check
+  ent = d->Entry("indir");
+  CHECK_OK(288);
+  CHECK_INT2(288,1,ent->Type(),IndirEntryType);
+  CHECK_INT2(288,2,ent->FragmentIndex(),0);
+  CHECK_STRING2(288,3,ent->Input(0),"data");
+  CHECK_STRING2(288,4,ent->Input(1),"carray");
+  delete ent;
+
+  // 289: Dirfile::Add / IndirEntry check
+  ient.SetName("new289");
+  ient.SetFragmentIndex(0);
+  ient.SetInput("in1", 0);
+  ient.SetInput("in2", 1);
+  d->Add(ient);
+  CHECK_OK2(289,1);
+
+  ent = d->Entry("new289");
+  CHECK_OK2(289,2);
+  CHECK_INT2(289,1,ent->Type(),IndirEntryType);
+  CHECK_INT2(289,2,ent->FragmentIndex(),0);
+  CHECK_STRING2(289,3,ent->Input(0),"in1");
+  CHECK_STRING2(289,4,ent->Input(1),"in2");
+
+  // 291: IndirEntry check
+  iep = reinterpret_cast<IndirEntry*>(d->Entry("new289"));
+  CHECK_OK2(291,1);
+  iep->SetInput("in4",0);
+  CHECK_OK2(291,2);
+  iep->SetInput("in5",1);
+  CHECK_OK2(291,3);
+  delete iep;
+
+  ent = d->Entry("new289");
+  CHECK_OK2(291,2);
+  CHECK_INT2(291,1,ent->Type(),IndirEntryType);
+  CHECK_INT2(291,2,ent->FragmentIndex(),0);
+  CHECK_STRING2(291,3,ent->Input(0),"in4");
+  CHECK_STRING2(291,4,ent->Input(1),"in5");
+
+  // 292: Dirfile::Entry / SindirEntry check
+  ent = d->Entry("sindir");
+  CHECK_OK(292);
+  CHECK_INT2(292,1,ent->Type(),SindirEntryType);
+  CHECK_INT2(292,2,ent->FragmentIndex(),0);
+  CHECK_STRING2(292,3,ent->Input(0),"data");
+  CHECK_STRING2(292,4,ent->Input(1),"sarray");
+  delete ent;
+
+  // 293: Dirfile::Add / SindirEntry check
+  sient.SetName("new293");
+  sient.SetFragmentIndex(0);
+  sient.SetInput("in1", 0);
+  sient.SetInput("in2", 1);
+  d->Add(sient);
+  CHECK_OK2(293,1);
+
+  ent = d->Entry("new293");
+  CHECK_OK2(293,2);
+  CHECK_INT2(293,1,ent->Type(),SindirEntryType);
+  CHECK_INT2(293,2,ent->FragmentIndex(),0);
+  CHECK_STRING2(293,3,ent->Input(0),"in1");
+  CHECK_STRING2(293,4,ent->Input(1),"in2");
+
+  // 295: SindirEntry check
+  siep = reinterpret_cast<SindirEntry*>(d->Entry("new293"));
+  CHECK_OK2(295,1);
+  siep->SetInput("in4",0);
+  CHECK_OK2(295,2);
+  siep->SetInput("in5",1);
+  CHECK_OK2(295,3);
+  delete siep;
+
+  ent = d->Entry("new293");
+  CHECK_OK2(295,2);
+  CHECK_INT2(295,1,ent->Type(),SindirEntryType);
+  CHECK_INT2(295,2,ent->FragmentIndex(),0);
+  CHECK_STRING2(295,3,ent->Input(0),"in4");
+  CHECK_STRING2(295,4,ent->Input(1),"in5");
+  delete ent;
+
+  // 296: gd_getstrdata
+  n = d->GetData("sindir", 0, 0, 1, 0, list);
+  CHECK_OK(296);
+  CHECK_INT(296,n,8);
+  CHECK_STRING_ARRAY(296,8,list[i],"eka");
+
+  // 302: gd_include_ns
+  d->IncludeNS("format2", 0, "ns", GD_CREAT | GD_EXCL);
+  CHECK_OK(302);
+
+  // 303: Get Namespace
+  frag = d->Fragment(2);
+  CHECK_STRING(303, frag->Namespace(), "ns");
+
+  // 304: Set Namespace
+  n = frag->SetNamespace("ns2");
+  CHECK_OK(304);
+  CHECK_INT(304, n, 0);
+  CHECK_STRING(304, frag->Namespace(), "ns2");
+
+  // 305: gd_match_entries
+#ifndef GD_NO_REGEX
+  n = d->MatchEntries("^lin", 0, 0, 0, &list);
+  CHECK_OK(305);
+  CHECK_INT(305, n, 2);
+  CHECK_STRINGi(287, 0, list[0], "lincom");
+  CHECK_STRINGi(287, 1, list[1],  "linterp");
+#endif
 
 
 
@@ -1786,6 +2038,7 @@ void run_tests(void)
   unlink(new1);
   unlink(format);
   unlink(format1);
+  unlink(format2);
   unlink(form2);
   rmdir(filedir);
 }
diff --git a/bindings/f77/Makefile.in b/bindings/f77/Makefile.in
index 518b48c..e40f5ad 100644
--- a/bindings/f77/Makefile.in
+++ b/bindings/f77/Makefile.in
@@ -306,6 +306,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/f77/fgetdata.c b/bindings/f77/fgetdata.c
index 5bf9df5..2f33428 100644
--- a/bindings/f77/fgetdata.c
+++ b/bindings/f77/fgetdata.c
@@ -37,7 +37,7 @@
 
 /* Fortran 77 has no facility to take a pointer to a DIRFILE* object.
  * Instead, we keep a list of them here.  If we ever run out of these,
- * the caller will be abort()ed. */
+ * we'll just return the invalid dirfile */
 static DIRFILE* f77dirfiles[GDF_N_DIRFILES];
 static int f77dirfiles_initialised = 0;
 
@@ -861,6 +861,36 @@ void F77_FUNC(gdgedv, GDGEDV) (char *in_field1, int32_t *in_field1_l,
   dreturnvoid();
 }
 
+/* gd_entry wrapper for INDIR */
+void F77_FUNC(gdgeid, GDGEID) (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)
+{
+  dtrace("%p, %i, %p, %i, %p, %i, %p, %i", in_field1, *in_field1_l,
+      in_field2, *in_field2_l, fragment_index, *dirfile, field_code,
+      *field_code_l);
+
+  _GDF_GetEntryYoke(in_field1, in_field1_l, in_field2, in_field2_l,
+      fragment_index, dirfile, field_code, field_code_l, GD_INDIR_ENTRY);
+
+  dreturnvoid();
+}
+
+/* gd_entry wrapper for SINDIR */
+void F77_FUNC(gdgesd, GDGESD) (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)
+{
+  dtrace("%p, %i, %p, %i, %p, %i, %p, %i", in_field1, *in_field1_l,
+      in_field2, *in_field2_l, fragment_index, *dirfile, field_code,
+      *field_code_l);
+
+  _GDF_GetEntryYoke(in_field1, in_field1_l, in_field2, in_field2_l,
+      fragment_index, dirfile, field_code, field_code_l, GD_SINDIR_ENTRY);
+
+  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,
@@ -1057,6 +1087,29 @@ void F77_FUNC(gdgeca, GDGECA) (int32_t *data_type, int32_t *array_len,
   dreturnvoid();
 }
 
+/* gd_entry wrapper for SARRAY */
+void F77_FUNC(gdgesa, GDGESA) (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;
+
+  dtrace("%p, %p, %i, %p, %i", array_len, fragment_index, *dirfile, field_code,
+      *field_code_l);
+
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
+          *field_code_l), &E) || E.field_type != GD_SARRAY_ENTRY)
+    *array_len = -1;
+  else {
+    *array_len = E.EN(scalar,array_len);
+    *fragment_index = E.fragment_index;
+    gd_free_entry_strings(&E);
+  }
+
+  free(out);
+  dreturnvoid();
+}
+
 /* gd_fragment_index wrapper */
 void F77_FUNC(gdfrgi, GDFRGI) (int32_t *fragment_index, const int32_t *dirfile,
     const char *field_code, const int32_t *field_code_l)
@@ -1366,6 +1419,50 @@ void F77_FUNC(gdaddv, GDADDV) (const int32_t *dirfile, const char *field_code,
   dreturnvoid();
 }
 
+/* gd_add_indir wrapper */
+void F77_FUNC(gdadid, GDADID) (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);
+
+  gd_add_indir(_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_sindir wrapper */
+void F77_FUNC(gdadsd, GDADSD) (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);
+
+  gd_add_sindir(_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_recip wrapper */
 void F77_FUNC(gdadrc, GDADRC) (const int32_t *dirfile, const char *field_code,
     const int32_t *field_code_l, const char *in_field,
@@ -1892,6 +1989,58 @@ void F77_FUNC(gdmddv, GDMDDV) (const int32_t *dirfile, const char *parent,
   dreturnvoid();
 }
 
+/* gd_madd_indir wrapper */
+void F77_FUNC(gdmdid, GDMDID) (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_indir(_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_sindir wrapper */
+void F77_FUNC(gdmdsd, GDMDSD) (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_sindir(_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_recip wrapper */
 void F77_FUNC(gdmdrc, GDMDRC) (const int32_t *dirfile, const char *parent,
     const int32_t *parent_l, const char *field_code,
@@ -2020,6 +2169,34 @@ void F77_FUNC(gdadca, GDADCA) (const int32_t *dirfile, const char *field_code,
   dreturnvoid();
 }
 
+/* gd_add_sarray wrapper -- values are intialised to nil */
+void F77_FUNC(gdadsa, GDADSA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, int32_t *array_len,
+    const int32_t *fragment_index)
+{
+  char *fc;
+  const char **nils;
+  int32_t i;
+
+  dtrace("%i, %p, %i, %i, %i", *dirfile, field_code, *field_code_l, *array_len,
+      *fragment_index);
+
+  nils = malloc(*array_len * sizeof(*nils));
+  if (nils == NULL) { /* XXX error reporting? */
+    dreturnvoid();
+    return;
+  }
+  for (i = 0; i < *array_len; ++i)
+    nils[i] = "";
+
+  gd_add_sarray(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), *array_len, nils, *fragment_index);
+
+  free(fc);
+  free(nils);
+  dreturnvoid();
+}
+
 /* gd_madd_carray wrapper */
 void F77_FUNC(gdmdca, GDMDCA) (const int32_t *dirfile, const char *parent,
     const int32_t *parent_l, const char *field_code,
@@ -2040,6 +2217,36 @@ void F77_FUNC(gdmdca, GDMDCA) (const int32_t *dirfile, const char *parent,
   dreturnvoid();
 }
 
+/* gd_madd_sarray wrapper -- values are intialised to nil */
+void F77_FUNC(gdmdsa, GDMDSA) (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 *array_len)
+{
+  char *pa, *fc;
+  const char **nils;
+  int32_t i;
+
+  dtrace("%i, %p, %i, %p, %i, %i", *dirfile, parent, *parent_l, field_code, 
+      *field_code_l, *array_len);
+
+  nils = malloc(*array_len * sizeof(*nils));
+  if (nils == NULL) { /* XXX error reporting? */
+    dreturnvoid();
+    return;
+  }
+  for (i = 0; i < *array_len; ++i)
+    nils[i] = "";
+
+  gd_madd_sarray(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l), *array_len,
+      nils);
+
+  free(pa);
+  free(fc);
+  free(nils);
+  dreturnvoid();
+}
+
 /* gd_add_string wrapper */
 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,
@@ -2248,19 +2455,18 @@ void F77_FUNC(gdpcas, GDPCAS) (const int32_t *dirfile, const char *field_code,
 }
 
 /* gd_put_string wrapper */
-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)
+void F77_FUNC(gdptst, GDPTST) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *len, const char *data_in)
 {
   char *fc, *in;
-  dtrace("%p, %i, %p, %i, %i, %p", n_wrote, *dirfile, field_code, *field_code_l,
-      *len, data_in);
+  dtrace("%i, %p, %i, %i, %p", *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;
+  gd_put_string(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, data_in, *len));
   free(fc);
   free(in);
-  dreturn("%i", *n_wrote);
+  dreturnvoid();
 }
 
 /* gd_nmfields wrapper */
@@ -2673,6 +2879,50 @@ void F77_FUNC(gdaldv, GDALDV) (const int32_t *dirfile, const char *field_code,
   dreturnvoid();
 }
 
+/* gd_alter_indir wrapper */
+void F77_FUNC(gdalid, GDALID) (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,
+      in_field1, *in_field1_l, in_field2, *in_field2_l);
+
+  gd_alter_indir(_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_sindir wrapper */
+void F77_FUNC(gdalsd, GDALSD) (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,
+      in_field1, *in_field1_l, in_field2, *in_field2_l);
+
+  gd_alter_sindir(_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_recip wrapper */
 void F77_FUNC(gdalrc, GDALRC) (const int32_t *dirfile, const char *field_code,
     const int32_t *field_code_l, const char *in_field1,
@@ -3096,9 +3346,12 @@ void F77_FUNC(gdgsca, GDGSCA) (char *scalar, int32_t *scalar_l,
       case GD_LINTERP_ENTRY:
       case GD_MULTIPLY_ENTRY:
       case GD_DIVIDE_ENTRY:
+      case GD_INDIR_ENTRY:
+      case GD_SINDIR_ENTRY:
       case GD_INDEX_ENTRY:
       case GD_CONST_ENTRY:
       case GD_CARRAY_ENTRY:
+      case GD_SARRAY_ENTRY:
       case GD_STRING_ENTRY:
         ok = 0;
         break;
@@ -3171,10 +3424,13 @@ void F77_FUNC(gdasca, GDASCA) (const int32_t *dirfile, const char *field_code,
     case GD_LINTERP_ENTRY:
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
     case GD_STRING_ENTRY:
+    case GD_SARRAY_ENTRY:
       ok = 0;
       break;
     case GD_LINCOM_ENTRY:
@@ -3733,6 +3989,29 @@ void F77_FUNC(gdfraf, GDFRAF) (char *prefix, int32_t *prefix_l, char *suffix,
   dreturnvoid();
 }
 
+/* gd_fragment_namespace */
+void F77_FUNC(gdfrns, GDFRNS) (char *nsout, int32_t *nsout_l,
+    const int32_t *dirfile, const int32_t *index, const char *nsin,
+    const int32_t *nsin_l)
+{
+  const char *out; 
+  char *in;
+
+  dtrace("%p, %i, %i, %i, %p, %i", nsout, *nsout_l, *dirfile, *index, nsin,
+      *nsin_l);
+
+  out = gd_fragment_namespace(_GDF_GetDirfile(*dirfile), *index,
+      _GDF_CString(&in, nsin, *nsin_l));
+  free(in);
+
+  if (out)
+    _GDF_FString(nsout, nsout_l, out);
+  else
+    *nsout_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)
@@ -3820,6 +4099,24 @@ void F77_FUNC(gdinca, GDINCA) (const int32_t *dirfile, const char *file,
   dreturnvoid();
 }
 
+/* gd_include_ns wrapper */
+void F77_FUNC(gdincn, GDINCN) (const int32_t *dirfile, const char *file,
+    const int32_t *file_l, const int32_t *fragment_index, const char *nsin,
+    const int32_t *ns_l, const int32_t *flags)
+{
+  char *fi, *ns;
+
+  dtrace("%i, %p, %i, %i, %p, %i, %i", *dirfile, file, *file_l,
+      *fragment_index, nsin, *ns_l, *flags);
+
+  gd_include_ns(_GDF_GetDirfile(*dirfile), _GDF_CString(&fi, file, *file_l),
+      *fragment_index, _GDF_CString(&ns, nsin, *ns_l), *flags);
+
+  free(ns);
+  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)
@@ -3988,8 +4285,8 @@ void F77_FUNC(gdentn, GDENTN) (char *name, int32_t *name_l,
   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);
+  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);
@@ -5213,6 +5510,72 @@ void F77_FUNC(gdencs,GDENCS) (int32_t *ret, const int32_t *encoding)
   dreturn("%i", *ret);
 }
 
+/* Return the maximum sarray value length */
+void F77_FUNC(gdsarx, GDSARX) (int32_t *max, const int32_t *dirfile)
+{
+  const char ***pptr;
+  const char **ptr;
+  size_t len = 0;
+  DIRFILE *D;
+
+  dtrace("%p, %i", max, *dirfile);
+
+  D = _GDF_GetDirfile(*dirfile);
+
+  pptr = gd_sarrays(D);
+  if (gd_error(D)) {
+    dreturnvoid();
+    return;
+  }
+
+  for (; *pptr; ++pptr)
+    for (ptr = *pptr; *ptr; ++ptr) {
+      size_t newlen = strlen(*ptr);
+      if (newlen > len) {
+        dprintf("\"%s\" > %zu", *ptr, len);
+        len = newlen;
+      }
+    }
+
+  *max = (int32_t)len;
+
+  dreturn("%i", *max);
+}
+
+/* Return the maximum meta sarray value length */
+void F77_FUNC(gdmsax, GDMSAX) (int32_t *max, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l)
+{
+  const char ***pptr;
+  const char **ptr;
+  size_t len = 0;
+  DIRFILE *D;
+  char *pa;
+
+  dtrace("%p, %i, %p, %i", max, *dirfile, parent, *parent_l);
+
+  D = _GDF_GetDirfile(*dirfile);
+
+  pptr = gd_msarrays(D, _GDF_CString(&pa, parent, *parent_l));
+  free(pa);
+
+  if (gd_error(D)) {
+    dreturnvoid();
+    return;
+  }
+
+  for (; *pptr; ++pptr)
+    for (ptr = *pptr; *ptr; ++ptr) {
+      size_t newlen = strlen(*ptr);
+      if (newlen > len)
+        len = newlen;
+    }
+
+  *max = (int32_t)len;
+
+  dreturn("%i", *max);
+}
+
 /* gd_array_len wrapper */
 void F77_FUNC(gdarln, GDARLN) (int32_t *len, const int32_t *dirfile,
     const char *field_code, const int32_t *field_code_l)
@@ -5227,3 +5590,249 @@ void F77_FUNC(gdarln, GDARLN) (int32_t *len, const int32_t *dirfile,
 
   dreturn("%i", *len);
 }
+
+/* gd_get_sarray_slice -- this only returns one value */
+void F77_FUNC(gdgtsa, GDGTSA) (char *value, int32_t *value_l,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l,
+    const int32_t *index)
+{
+  const char* v[1];
+  char *fc;
+  int r;
+
+  dtrace("%p, %p, %i, %p, %i, %i", value, value_l, *dirfile, field_code,
+      *field_code_l, *index);
+  
+  r = gd_get_sarray_slice(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc,
+        field_code, *field_code_l), *index - 1, 1, v);
+  free(fc);
+
+  if (r)
+    *value_l = 0;
+  else
+    _GDF_FString(value, value_l, *v);
+
+  dreturn("%i", *value_l);
+}
+
+/* gd_put_sarray_slice -- this only stores one value */
+void F77_FUNC(gdptsa, GDPTSA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *index, const char *value,
+    const int32_t *value_l)
+{
+  char *fc, *v;
+
+  dtrace("%i, %p, %i, %i, %p, %i", *dirfile, field_code, *field_code_l,
+      *index, value, *value_l);
+
+  _GDF_CString(&v, value, *value_l);
+
+  gd_put_sarray_slice(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc,
+        field_code, *field_code_l), *index - 1, 1, (const char **)&v);
+
+  free(v);
+  free(fc);
+
+  dreturnvoid();
+}
+
+/* gd_alter_sarray wrapper */
+void F77_FUNC(gdalsa, GDALSA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *array_len)
+{
+  char *fc;
+
+  dtrace("%i, %p, %i, %i", *dirfile, field_code, *field_code_l, *array_len);
+
+  gd_alter_sarray(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), (size_t)*array_len);
+
+  free(fc);
+  dreturnvoid();
+}
+
+/* gd_getdata wrapper for SINDIRs -- this only returns one sample */
+void F77_FUNC(gdgstd, GDGSTD) (char *value, int32_t *value_l,
+    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 char *datum[1];
+  char *fc;
+  size_t n_read;
+
+  dtrace("%p, %p, %i, %p, %i, %i, %i", value, value_l, *dirfile, field_code,
+      *field_code_l, *first_frame, *first_sample);
+
+  n_read = gd_getdata(_GDF_GetDirfile(*dirfile),
+      _GDF_CString(&fc, field_code, *field_code_l), *first_frame,
+      *first_sample, 0, 1, GD_STRING, datum);
+  free(fc);
+  if (n_read == 0)
+    *value_l = 0;
+  else
+    _GDF_FString(value, value_l, *datum);
+
+  dreturn("%i", *value_l);
+}
+
+/* gd_getdata wrapper for SINDIRs-- this returns an opaquely packed array of
+ * strings; see also GDXSTP and GDDSTP */
+void F77_FUNC(gdgstp, GDGSTP) (int32_t *n_read, char *data,
+    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 char **buffer;
+  char *fc;
+  unsigned spf;
+  size_t ns;
+  DIRFILE *D;
+  
+  dtrace("%p, %p, %i, %p, %i, %i, %i, %i, %i", n_read, data, *dirfile,
+      field_code, *field_code_l, *first_frame, *first_sample, *num_frames,
+      *num_samples);
+
+  D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&fc, field_code, *field_code_l);
+
+  /* convert to num_samples */
+  if (*num_frames > 0) {
+    spf = gd_spf(D, fc);
+    if (gd_error(D)) {
+      free(fc);
+      *n_read = 0;
+      *((void**)data) = NULL;
+      dreturn("%i", 0);
+      return;
+    }
+    ns = *num_samples + *num_frames * spf;
+  } else
+    ns = *num_samples;
+
+  /* output buffer */
+  buffer = malloc(sizeof(*buffer) * ns);
+  if (buffer == NULL) {
+    free(fc);
+    *n_read = 0;
+    *((void**)data) = NULL;
+    dreturn("%i", 0);
+    return;
+  }
+
+  *n_read = gd_getdata(D, fc, *first_frame, *first_sample, 0, ns, GD_STRING,
+      buffer);
+  free(fc);
+
+  if (*n_read == 0) {
+    free(buffer);
+    *((void**)data) = NULL;
+  } else
+    *((const char***)data) = buffer;
+
+  dreturn("%i/%p", *n_read, *(const char***)data);
+}
+
+void F77_FUNC(gdxstp, GDXSTP) (char *value, int32_t *value_l, const char *data,
+    const int32_t *index)
+{
+  const char **list;
+
+  dtrace("%p, %p, %p, %i", value, value_l, data, *index);
+
+  list = *((const char***)data);
+
+  if (list == NULL) 
+    *value_l = 0;
+  else
+    _GDF_FString(value, value_l, list[*index - 1]);
+
+  dreturn("%i", *value_l);
+}
+
+void F77_FUNC(gddstp, GDDSTP) (char *data)
+{
+  dtrace("%p", data);
+
+  free(*(void**)data);
+  *((void**)data) = NULL;
+  
+  dreturnvoid();
+}
+
+/* Return the maximum field name length of a gd_match_entries call */
+void F77_FUNC(gdmatx, GDMATX) (int32_t *max, const int32_t *dirfile,
+    const char *regex, const int32_t *regex_l, const int32_t *fragment,
+    const int32_t *type, const int32_t *flags)
+{
+  const char **el;
+  char *rx;
+  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, %i, 0x%X, 0x%X", max, *dirfile, regex, *regex_l,
+      *fragment, utype, uflags);
+
+  D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&rx, regex, *regex_l);
+  nentries = gd_match_entries(D, rx, *fragment, utype, uflags, &el);
+
+  if (!gd_error(D)) {
+    for (i = 0; i < nentries; ++i)
+      if (strlen(el[i]) > len)
+        len = strlen(el[i]);
+  }
+
+  *max = len;
+  free(rx);
+  dreturn("%i", *max);
+}
+
+/* gd_match_entries wrapper */
+void F77_FUNC(gdmatn, GDMATN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *regex, const int32_t *regex_l,
+    const int32_t *fragment, const int32_t *type, const int32_t *flags,
+    const int32_t *field_num)
+{
+  const char **el;
+  char *rx;
+  DIRFILE* D;
+  unsigned int nentries;
+  const unsigned int utype = (unsigned int)*type;
+  const unsigned int uflags = (unsigned int)*flags;
+
+  dtrace("%p, %i, %i, %p, %i, %i, 0x%X, 0x%X, %i", name, *name_l, *dirfile,
+      regex, *regex_l, *fragment, utype, uflags, *field_num);
+
+  D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&rx, regex, *regex_l);
+  nentries = gd_match_entries(D, rx, *fragment, utype, uflags, &el);
+
+  if (!gd_error(D) && *field_num > 0 && *field_num <= (int)nentries) 
+    _GDF_FString(name, name_l, el[*field_num - 1]);
+  else
+    *name_l = 0;
+
+  free(rx);
+  dreturn("%i", *name_l);
+}
+
+/* gd_match_entries wrapper */
+void F77_FUNC(gdnmat, GDNMAT) (int32_t *nentries, const int32_t *dirfile,
+    const char *regex, const int32_t *regex_l, const int32_t *fragment,
+    const int32_t *type, const int32_t *flags)
+{
+  char *rx;
+
+  dtrace("%p, %i, %p, %i, %i, 0x%X, 0x%X", nentries, *dirfile, regex, *regex_l,
+      *fragment, *type, *flags);
+
+  *nentries = gd_match_entries(_GDF_GetDirfile(*dirfile), _GDF_CString(&rx,
+        regex, *regex_l), *fragment, (unsigned int)*type, (unsigned int)*flags,
+      NULL);
+
+  free(rx);
+  dreturn("%i", *nentries);
+}
diff --git a/bindings/f77/fgetdata.h b/bindings/f77/fgetdata.h
index 8d5df20..69509d4 100644
--- a/bindings/f77/fgetdata.h
+++ b/bindings/f77/fgetdata.h
@@ -283,9 +283,8 @@ void F77_FUNC(gdptco, GDPTCO) (const int32_t *dirfile, const char *field_code,
 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(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(gdptst, GDPTST) (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(gdnmfd, GDNMFD) (int32_t *nfields, const int32_t *dirfile,
     const char *parent, const int32_t *parent_l);
@@ -660,6 +659,10 @@ void F77_FUNC(gdinca, GDINCA) (const int32_t *dirfile, const char *file,
     const int32_t *prefix_l, const char *suffix, const int32_t *suffix_l,
     const int32_t *flags);
 
+void F77_FUNC(gdincn, GDINCN) (const int32_t *dirfile, const char *file,
+    const int32_t *file_l, const int32_t *fragment_index, const char *nsin,
+    const int32_t *ns_l, const int32_t *flags);
+
 void F77_FUNC(gdmova, GDMOVA) (const int32_t *dirfile, const char *field_code,
     const int32_t *field_code_l, const int32_t *new_fragment);
 
@@ -679,6 +682,10 @@ void F77_FUNC(gdhidn, GDHIDN) (int32_t *result, const int32_t *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(gdfrns, GDFRNS) (char *nsout, int32_t *nsout_l,
+    const int32_t *dirfile, const int32_t *index, const char *nsin,
+    const int32_t *nsin_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);
@@ -789,6 +796,21 @@ void F77_FUNC(gdascl, GDASCL) (const int32_t *dirfile, const char *field_code,
     const GD_DCOMPLEXP(b3), const char *b3_scalar, const int32_t *b3_scalar_l,
     const int32_t *b3_scalar_ind, const int32_t *fragment_index);
 
+void F77_FUNC(gdascl, GDASCL) (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 char *m1_scalar,
+    const int32_t *m1_scalar_l, const int32_t *m1_scalar_ind,
+    const GD_DCOMPLEXP(b1), const char *b1_scalar, const int32_t *b1_scalar_l,
+    const int32_t *b1_scalar_ind, const char *in_field2,
+    const int32_t *in_field2_l, const GD_DCOMPLEXP(m2), const char *m2_scalar,
+    const int32_t *m2_scalar_l, const int32_t *m2_scalar_ind,
+    const GD_DCOMPLEXP(b2), const char *b2_scalar, const int32_t *b2_scalar_l,
+    const int32_t *b2_scalar_ind, const char *in_field3,
+    const int32_t *in_field3_l, const GD_DCOMPLEXP(m3), const char *m3_scalar,
+    const int32_t *m3_scalar_l, const int32_t *m3_scalar_ind,
+    const GD_DCOMPLEXP(b3), const char *b3_scalar, const int32_t *b3_scalar_l,
+    const int32_t *b3_scalar_ind, const int32_t *fragment_index);
+
 void F77_FUNC(gdasph, GDASPH) (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,
@@ -817,6 +839,12 @@ void F77_FUNC(gdasrc, GDASCR) (const int32_t *dirfile, const char *field_code,
     const char *dividend_scalar, const int32_t *dividend_scalar_l,
     const int32_t *dividend_scalar_ind, const int32_t *fragment_index);
 
+void F77_FUNC(gdascr, GDASCR) (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 char *dividend_scalar, const int32_t *dividend_scalar_l,
+    const int32_t *dividend_scalar_ind, const int32_t *fragment_index);
+
 void F77_FUNC(gdlsrw, GDLSRW) (const int32_t *dirfile, const char *field_code,
     const int32_t *field_code_l, const int32_t *data_type, const int32_t *spf,
     const char *spf_scalar, const int32_t *spf_scalar_l,
@@ -859,6 +887,21 @@ void F77_FUNC(gdlscl, GDLSCL) (const int32_t *dirfile, const char *field_code,
     const GD_DCOMPLEXP(b3), const char *b3_scalar, const int32_t *b3_scalar_l,
     const int32_t *b3_scalar_ind);
 
+void F77_FUNC(gdlscl, GDLSCL) (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 char *m1_scalar,
+    const int32_t *m1_scalar_l, const int32_t *m1_scalar_ind,
+    const GD_DCOMPLEXP(b1), const char *b1_scalar, const int32_t *b1_scalar_l,
+    const int32_t *b1_scalar_ind, const char *in_field2,
+    const int32_t *in_field2_l, const GD_DCOMPLEXP(m2), const char *m2_scalar,
+    const int32_t *m2_scalar_l, const int32_t *m2_scalar_ind,
+    const GD_DCOMPLEXP(b2), const char *b2_scalar, const int32_t *b2_scalar_l,
+    const int32_t *b2_scalar_ind, const char *in_field3,
+    const int32_t *in_field3_l, const GD_DCOMPLEXP(m3), const char *m3_scalar,
+    const int32_t *m3_scalar_l, const int32_t *m3_scalar_ind,
+    const GD_DCOMPLEXP(b3), const char *b3_scalar, const int32_t *b3_scalar_l,
+    const int32_t *b3_scalar_ind);
+
 void F77_FUNC(gdlsph, GDLSPH) (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,
@@ -886,11 +929,96 @@ void F77_FUNC(gdlsrc, GDLSCR) (const int32_t *dirfile, const char *field_code,
     const char *dividend_scalar, const int32_t *dividend_scalar_l,
     const int32_t *dividend_scalar_ind);
 
+void F77_FUNC(gdlscr, GDLSCR) (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 char *dividend_scalar, const int32_t *dividend_scalar_l,
+    const int32_t *dividend_scalar_ind);
+
 void F77_FUNC(gdencs,GDENCS) (int32_t *ret, const int32_t *encoding);
 
+void F77_FUNC(gdsarx, GDSARX) (int32_t *max, const int32_t *dirfile);
+
+void F77_FUNC(gdmsax, GDMSAX) (int32_t *max, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l);
+
+void F77_FUNC(gdgesa, GDGESA) (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(gdgtsa, GDGTSA) (char *value, int32_t *value_l,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l,
+    const int32_t *index);
+
 void F77_FUNC(gdarln, GDARLN) (int32_t *len, const int32_t *dirfile,
     const char *field_code, const int32_t *field_code_l);
 
+void F77_FUNC(gdptsa, GDPTSA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *index, const char *value,
+    const int32_t *value_l);
+
+void F77_FUNC(gdadsa, GDADSA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, int32_t *array_len,
+    const int32_t *fragment_index);
+
+void F77_FUNC(gdmdsa, GDMDSA) (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 *array_len);
+
+void F77_FUNC(gdalsa, GDALSA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *array_len);
+
+void F77_FUNC(gdgeid, GDGEID) (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(gdgesd, GDGESD) (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(gdadid, GDADID) (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(gdadsd, GDADSD) (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(gdmdid, GDMDID) (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(gdmdsd, GDMDSD) (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(gdalid, GDALID) (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(gdalsd, GDALSD) (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(gdgstd, GDGSTD) (char *value, int32_t *value_l,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l,
+    const int32_t *first_frame, const int32_t *first_sample);
+
+void F77_FUNC(gdgstp, GDGSTP) (int32_t *n_read, char *data,
+    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);
+
 void F77_FUNC(gdaspn, GDASPN) (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 char *a0_scalar,
@@ -958,6 +1086,24 @@ void F77_FUNC(gdlssb, GDLSSB) (const int32_t *dirfile, const char *field_code,
     const int32_t *numbits, const char *numbits_scalar,
     const int32_t *numbits_scalar_l, const int32_t *numbits_scalar_ind);
 
+void F77_FUNC(gdxstp, GDXSTP) (char *value, int32_t *value_l, const char *data,
+    const int32_t *index);
+
+void F77_FUNC(gddstp, GDDSTP) (char *data);
+
+void F77_FUNC(gdmatx, GDMATX) (int32_t *max, const int32_t *dirfile,
+    const char *regex, const int32_t *regex_l, const int32_t *fragment,
+    const int32_t *type, const int32_t *flags);
+
+void F77_FUNC(gdmatn, GDMATN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *regex, const int32_t *regex_l,
+    const int32_t *fragment, const int32_t *type, const int32_t *flags,
+    const int32_t *field_num);
+
+void F77_FUNC(gdnmat, GDNMAT) (int32_t *nentries, const int32_t *dirfile,
+    const char *regex, const int32_t *regex_l, const int32_t *fragment,
+    const int32_t *type, const int32_t *flags);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/bindings/f77/getdata.f.in b/bindings/f77/getdata.f.in
index 4357efe..7e7c303 100644
--- a/bindings/f77/getdata.f.in
+++ b/bindings/f77/getdata.f.in
@@ -24,6 +24,10 @@ C     constants useful to Fortran programs.
 
       @PARAMETERS@
 
+C     The length of the opaque packed data string returned by GDGSTP
+      INTEGER GDPKSZ
+      PARAMETER (GDPKSZ=@SIZEOF_VOID_P@)
+
 C Externals
 C     Corresponding to gd_alter_affixes(3)
       EXTERNAL GDAAFX
@@ -43,6 +47,8 @@ C     Corresponding to gd_add_crecip(3)
       EXTERNAL GDADCR
 C     Corresponding to gd_add_divide(3)
       EXTERNAL GDADDV
+C     Corresponding to gd_add_indir(3)
+      EXTERNAL GDADID
 C     Corresponding to gd_add_lincom(3)
       EXTERNAL GDADLC
 C     Corresponding to gd_add_linterp(3)
@@ -59,8 +65,12 @@ C     Corresponding to gd_add_recip(3)
       EXTERNAL GDADRC
 C     Corresponding to gd_add_raw(3)
       EXTERNAL GDADRW
+C     Corresponding to gd_add_sarray(3)
+      EXTERNAL GDADSA
 C     Corresponding to gd_add_sbit(3)
       EXTERNAL GDADSB
+C     Corresponding to gd_add_sindir(3)
+      EXTERNAL GDADSD
 C     Corresponding to gd_add_spec(3)
       EXTERNAL GDADSP
 C     Corresponding to gd_add_string(3)
@@ -87,6 +97,8 @@ C     Correpsonding to gd_alter_crecip(3)
       EXTERNAL GDALCR
 C     Correpsonding to gd_alter_divide(3)
       EXTERNAL GDALDV
+C     Correpsonding to gd_alter_indir(3)
+      EXTERNAL GDALID
 C     Correpsonding to gd_alter_lincom(3)
       EXTERNAL GDALLC
 C     Correpsonding to gd_alter_linterp(3)
@@ -103,8 +115,12 @@ C     Correpsonding to gd_alter_recip(3)
       EXTERNAL GDALRC
 C     Correpsonding to gd_alter_raw(3)
       EXTERNAL GDALRW
+C     Correpsonding to gd_alter_sarray(3)
+      EXTERNAL GDALSA
 C     Correpsonding to gd_alter_sbit(3)
       EXTERNAL GDALSB
+C     Correpsonding to gd_alter_sindir(3)
+      EXTERNAL GDALSD
 C     Correpsonding to gd_alter_spec(3)
       EXTERNAL GDALSP
 C     Correpsonding to gd_aliases(3)
@@ -155,10 +171,14 @@ C     Corresponding to gd_constants(3) (sort of)
       EXTERNAL GDCONS
 C     Corresponding to gd_copen(3)
       EXTERNAL GDCOPN
+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     Frees the packed data returned by GDGSTP
+      EXTERNAL GDDSTP
 C     Corresponding to gd_desync(3)
       EXTERNAL GDDSYN
 C     Corresponding to gd_error_count(3)
@@ -193,6 +213,8 @@ C     Corresponding to gd_framenum(3)
       EXTERNAL GDFNUM
 C     Corresponding to gd_fragment_affixes(3)
       EXTERNAL GDFRAF
+C     Corresponding to gd_fragment_namespace(3)
+      EXTERNAL GDFRNS
 C     Corresponding to gd_fragment_index(3)
       EXTERNAL GDFRGI
 C     Corresponding to gd_fragmentname(3)
@@ -213,6 +235,8 @@ C     Corresponding to gd_entry(3) for complex-valued POLYNOM fields
       EXTERNAL GDGECP
 C     Corresponding to gd_entry(3) for complex-valued RECIP fields
       EXTERNAL GDGECR
+C     Corresponding to gd_entry(3) for INDIR fields
+      EXTERNAL GDGEID
 C     Corresponding to gd_entry(3) for LINCOM fields
       EXTERNAL GDGELC
 C     Corresponding to gd_entry(3) for LINTERP fields
@@ -233,8 +257,12 @@ C     Corresponding to gd_entry(3) for RECIP fields
       EXTERNAL GDGERC
 C     Corresponding to gd_entry(3) for RAW fields
       EXTERNAL GDGERW
+C     Corresponding to gd_entry(3) for SARRAY fields
+      EXTERNAL GDGESA
 C     Corresponding to gd_entry(3) for SBIT fields
       EXTERNAL GDGESB
+C     Corresponding to gd_entry(3) for SINDIR fields
+      EXTERNAL GDGESD
 C     Corresponding to gd_getdata(3)
       EXTERNAL GDGETD
 C     Corresponding to gd_entry(3) for WINDOW fields
@@ -247,10 +275,17 @@ C     Retrieve a scalar parameter
       EXTERNAL GDGSCA
 C     Corresponding to gd_spf(3)
       EXTERNAL GDGSPF
+C     Gets one sample of a SINDIR via gd_getstrdata(3)
+      EXTERNAL GDGSTD
+C     Gets a packed array of SINDIR data via gd_getstrdata(3)
+C     see also GDXSTP and GDDSTP and the GDPKSZ parameter above
+      EXTERNAL GDGSTP
 C     Corresponding to gd_get_carray(3)
       EXTERNAL GDGTCA
 C     Corresponding to gd_get_constant(3)
       EXTERNAL GDGTCO
+C     Gets a single SARRAY element via gd_get_sarray_slice(3)
+      EXTERNAL GDGTSA
 C     Corresponding to gd_get_string(3)
       EXTERNAL GDGTST
 C     Corresponding to gd_hide(3)
@@ -261,6 +296,8 @@ C     Corresponding to gd_include_affixes(3)
       EXTERNAL GDINCA
 C     Corresponding to gd_include(3)
       EXTERNAL GDINCL
+C     Corresponding to gd_include_ns(3)
+      EXTERNAL GDINCN
 C     Corresponding to gd_invalid_dirfile(3)
       EXTERNAL GDINVD
 C     Corresponding to gd_alter_entry(3) for BIT fields
@@ -289,6 +326,10 @@ C     Corresponding to gd_alter_entry(3) for WINDOW fields
       EXTERNAL GDLSWD
 C     Corresponding to gd_linterp_tablename(3)
       EXTERNAL GDLTTN
+C     Corresponding to gd_match_entries(3)
+      EXTERNAL GDMATN
+C     Returns the maximum entry name length
+      EXTERNAL GDMATX
 C     Corresponding to gd_mconstants(3) (sort of)
       EXTERNAL GDMCOS
 C     Corresponding to gd_madd_alias(3)
@@ -307,6 +348,8 @@ C     Corresponding to gd_madd_crecip(3)
       EXTERNAL GDMDCR
 C     Corresponding to gd_madd_divide(3)
       EXTERNAL GDMDDV
+C     Corresponding to gd_madd_indir(3)
+      EXTERNAL GDMDID
 C     Corresponding to gd_madd_lincom(3)
       EXTERNAL GDMDLC
 C     Corresponding to gd_madd_linterp(3)
@@ -321,8 +364,12 @@ C     Corresponding to gd_madd_polynom(3)
       EXTERNAL GDMDPN
 C     Corresponding to gd_madd_recip(3)
       EXTERNAL GDMDRC
+C     Corresponding to gd_madd_sarray(3)
+      EXTERNAL GDMDSA
 C     Corresponding to gd_madd_sbit(3)
       EXTERNAL GDMDSB
+C     Corresponding to gd_madd_sindir(3)
+      EXTERNAL GDMDSD
 C     Corresponding to gd_madd_spec(3)
       EXTERNAL GDMDSP
 C     Corresponding to gd_madd_string(3)
@@ -341,6 +388,8 @@ C     Correpsonding to gd_malter_spec(3)
       EXTERNAL GDMLSP
 C     Correpsonding to gd_move(3)
       EXTERNAL GDMOVE
+C     Returns the maximum meta sarray value length
+      EXTERNAL GDMSAX
 C     Corresponding to gd_mstrings(3) (sort of)
       EXTERNAL GDMSTS
 C     Returns the maximum length of the longest string metafield for a
@@ -364,6 +413,8 @@ C     Corresponding to gd_nfragments(3)
       EXTERNAL GDNFRG
 C     Corresponding to gd_nframes(3)
       EXTERNAL GDNFRM
+C     Corresponding to gd_match_entries(3)
+      EXTERNAL GDNMAT
 C     Corresponding to gd_nmfields(3)
       EXTERNAL GDNMFD
 C     Corresponding to gd_nmfields_by_type(3)
@@ -386,6 +437,8 @@ C     Corresponding to gd_put_carray(3)
       EXTERNAL GDPTCA
 C     Corresponding to gd_put_constant(3)
       EXTERNAL GDPTCO
+C     Puts a single SARRAY element via gd_put_sarray_slice(3)
+      EXTERNAL GDPTSA
 C     Corresponding to gd_put_string(3)
       EXTERNAL GDPTST
 C     Corresponding to gd_putdata(3)
@@ -400,6 +453,8 @@ C     Corresponding to gd_rewrite_fragment(3)
       EXTERNAL GDRFRG
 C     Corresponding to gd_raw_filename(3)
       EXTERNAL GDRWFN
+C     Returns the maximum sarray value length
+      EXTERNAL GDSARX
 C     Corresponding to gd_seek(3)
       EXTERNAL GDSEEK
 C     Corresponding to gd_dirfile_standards(3)
@@ -424,3 +479,5 @@ C     Corresponding to gd_vector_list(3) (sort of)
       EXTERNAL GDVECN
 C     Corresponding to gd_validate(3)
       EXTERNAL GDVLDT
+C     Extracts one sample from the data returned by GDGSTP
+      EXTERNAL GDXSTP
diff --git a/bindings/f77/getdata.f90.in b/bindings/f77/getdata.f90.in
index e148e4c..4dbaf5e 100644
--- a/bindings/f77/getdata.f90.in
+++ b/bindings/f77/getdata.f90.in
@@ -753,14 +753,13 @@ subroutine fgd_put_constant_c16 (dirfile, field_code, data_in)
   data_in)
 end subroutine
 
-function fgd_put_string (dirfile, field_code, data_in)
-  integer :: fgd_put_string
+subroutine fgd_put_string (dirfile, field_code, data_in)
   integer, intent(in) :: dirfile
   character (len=*), intent(in) :: field_code, data_in
 
-  call gdptst(fgd_put_string, dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+  call gdptst(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
   LEN_TRIM(data_in), TRIM(data_in))
-end function
+end subroutine
 
 function fgd_error (dirfile)
   integer :: fgd_error
@@ -916,6 +915,12 @@ function fgd_entry (dirfile, field_code, ent)
     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_INDIR_ENTRY) then
+    call gdgeid(ent%field(1), len1, ent%field(2), len2, ent%fragment_index, &
+    dirfile, TRIM(field_code), LEN_TRIM(field_code))
+  else if (fgd_entry .EQ. GD_SINDIR_ENTRY) then
+    call gdgesd(ent%field(1), len1, ent%field(2), len2, ent%fragment_index, &
+    dirfile, TRIM(field_code), LEN_TRIM(field_code))
   else if (fgd_entry .EQ. GD_CONST_ENTRY) then
     !const
     call gdgeco(ent%data_type, ent%fragment_index, dirfile, TRIM(field_code), &
@@ -924,6 +929,10 @@ function fgd_entry (dirfile, field_code, ent)
     !carray
     call gdgeca(ent%data_type, ent%array_len, ent%fragment_index, dirfile, &
     TRIM(field_code), LEN_TRIM(field_code))
+  else if (fgd_entry .EQ. GD_SARRAY_ENTRY) then
+    !sarray
+    call gdgesa(ent%array_len, ent%fragment_index, dirfile, TRIM(field_code), &
+      LEN_TRIM(field_code))
   else if (fgd_entry .EQ. GD_STRING_ENTRY) then
     !string
     call gdfrgi(ent%fragment_index, dirfile, TRIM(field_code), &
@@ -1079,12 +1088,22 @@ subroutine fgd_add (dirfile, field_code, ent)
     LEN_TRIM(ent%scalar(1)), ent%scalar_ind(1), ent%period, &
     TRIM(ent%scalar(2)), LEN_TRIM(ent%scalar(2)), ent%scalar_ind(2), &
     ent%fragment_index)
+  else if (ent%field_type .EQ. GD_INDIR_ENTRY) then
+    call gdadid(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%fragment_index)
+  else if (ent%field_type .EQ. GD_SINDIR_ENTRY) then
+    call gdadsd(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%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)
   else if (ent%field_type .EQ. GD_CARRAY_ENTRY) then
     call fgd_add_carray(dirfile, field_code, ent%data_type, ent%array_len, &
     ent%fragment_index)
+  else if (ent%field_type .EQ. GD_SARRAY_ENTRY) then
+    call fgd_add_sarray(dirfile, field_code, ent%array_len, ent%fragment_index)
   else if (ent%field_type .EQ. GD_STRING_ENTRY) then
     call gdadst(dirfile, TRIM(field_code), LEN_TRIM(field_code), nil, zero, &
     ent%fragment_index)
@@ -1323,12 +1342,22 @@ subroutine fgd_madd (dirfile, parent, field_code, ent)
     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_INDIR_ENTRY) then
+    call gdmdid(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)))
+  else if (ent%field_type .EQ. GD_SINDIR_ENTRY) then
+    call gdmdsd(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)))
   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)
   else if (ent%field_type .EQ. GD_CARRAY_ENTRY) then
     call fgd_madd_carray(dirfile, parent, field_code, ent%data_type, &
     ent%array_len)
+  else if (ent%field_type .EQ. GD_SARRAY_ENTRY) then
+    call fgd_madd_sarray(dirfile, parent, field_code, ent%array_len)
   else if (ent%field_type .EQ. GD_STRING_ENTRY) then
     call gdmdst(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
     LEN_TRIM(field_code), nil, zero)
@@ -1824,6 +1853,16 @@ subroutine fgd_alter_entry (dirfile, field_code, ent, remove_scalars, recode)
     TRIM(ent%field(1)), field_len(1), TRIM(ent%field(2)), field_len(2), &
     ent%count_val, TRIM(ent%scalar(1)), scalar_len(1), ent%scalar_ind(1), &
     ent%period, TRIM(ent%scalar(2)), scalar_len(2), ent%scalar_ind(2))
+  else if (ent%field_type .EQ. GD_INDIR_ENTRY) then
+    call fgd__set_field_len(field_len, 2, ent)
+
+    call gdalid(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+    TRIM(ent%field(1)), field_len(1), TRIM(ent%field(2)), field_len(2))
+  else if (ent%field_type .EQ. GD_SINDIR_ENTRY) then
+    call fgd__set_field_len(field_len, 2, ent)
+
+    call gdalsd(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+    TRIM(ent%field(1)), field_len(1), TRIM(ent%field(2)), field_len(2))
   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
@@ -2877,6 +2916,15 @@ suffix, flags)
   LEN_TRIM(suffix), flags)
 end subroutine
 
+subroutine fgd_include_ns (dirfile, fragmentname, fragment_index, namespace, &
+    flags)
+  integer, intent(in) :: dirfile, fragment_index, flags
+  character (len=*), intent(in) :: fragmentname, namespace
+
+  call gdincn(dirfile, TRIM(fragmentname), LEN_TRIM(fragmentname), &
+  fragment_index, TRIM(namespace), LEN_TRIM(namespace), flags)
+end subroutine
+
 subroutine fgd_sync (dirfile, field_code)
   integer, intent(in) :: dirfile
   character (len=*), intent(in) :: field_code
@@ -2899,7 +2947,28 @@ fragment_index)
 
   call gdfraf(prefix, pl, suffix, sl, dirfile, fragment_index)
 end subroutine
-  
+
+function fgd_fragment_namespace (dirfile, fragment_index)
+  character (len=GD_MAX_LINE_LENGTH) :: fgd_fragment_namespace
+  integer, intent(in) :: dirfile, fragment_index
+
+  character (len=1) :: nil = ""
+  integer :: l = GD_MAX_LINE_LENGTH
+
+  call gdfrns(fgd_fragment_namespace, l, dirfile, fragment_index, nil, -1)
+end function
+
+function fgd_alter_namespace (dirfile, fragment_index, namespace)
+  character (len=GD_MAX_LINE_LENGTH) :: fgd_alter_namespace
+  integer, intent(in) :: dirfile, fragment_index
+  character (len=*), intent(in) :: namespace
+
+  integer :: l = GD_MAX_LINE_LENGTH
+
+  call gdfrns(fgd_alter_namespace, l, dirfile, fragment_index, &
+    TRIM(namespace), LEN_TRIM(namespace))
+end function
+
 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
@@ -2990,11 +3059,11 @@ function fgd_entry_name_max (dirfile, parent, entype, flags)
 
   ! call f77 library
   call gdentx(fgd_entry_name_max, dirfile, TRIM(parent), parent_l, entype, &
-  flags)
+    flags)
 end function
 
 subroutine fgd_entry_list (entry_list, dirfile, parent, entype, flags, &
-entry_len)
+    entry_len)
   character(len=*), dimension(:), intent(out) :: entry_list
   integer, intent(in) :: dirfile, entype, flags
   integer, intent(inout) :: entry_len
@@ -3013,7 +3082,7 @@ entry_len)
     do i=1,nentries
       ! call f77 library
       call gdentn(entry_list(i), entry_len, dirfile, TRIM(parent), parent_l, &
-      entype, flags, i)
+        entype, flags, i)
     end do
   end if
 end subroutine
@@ -3036,4 +3105,244 @@ function fgd_encoding_support (encoding)
   call gdencs(fgd_encoding_support, encoding)
 end function
 
+function fgd_sarray_value_max (dirfile)
+  integer :: fgd_sarray_value_max
+  integer, intent(in) :: dirfile
+
+  call gdsarx(fgd_sarray_value_max, dirfile)
+end function
+
+function fgd_msarray_value_max (dirfile, parent)
+  integer :: fgd_msarray_value_max
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: parent
+
+  call gdmsax(fgd_msarray_value_max, dirfile, TRIM(parent), LEN_TRIM(parent))
+end function
+
+subroutine fgd_get_sarray (field_list, field_len, dirfile, field_code)
+  character(len=*), dimension(:), intent(out) :: field_list
+  integer, intent(inout) :: field_len
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+  integer :: array_len, i, max_field_len, l
+
+  array_len = fgd_array_len(dirfile, field_code)
+
+  max_field_len = field_len
+  do i=1,array_len
+    l = field_len
+    call gdgtsa(field_list(i), l, dirfile, TRIM(field_code), &
+      LEN_TRIM(field_code), i)
+    if (l .gt. max_field_len) then
+      max_field_len = l
+    end if
+  end do
+  field_len = max_field_len
+end subroutine
+
+subroutine fgd_get_sarray_slice (field_list, field_len, dirfile, field_code, &
+  first, num)
+  character(len=*), dimension(:), intent(out) :: field_list
+  integer, intent(inout) :: field_len
+  integer, intent(in) :: dirfile, first, num
+  character (len=*), intent(in) :: field_code
+
+  integer :: i, max_field_len, l
+
+  max_field_len = field_len
+  do i=1,num
+    l = field_len
+    call gdgtsa(field_list(i), l, dirfile, TRIM(field_code), &
+      LEN_TRIM(field_code), i+first-1)
+    if (l .gt. max_field_len) then
+      max_field_len = l
+    end if
+  end do
+  field_len = max_field_len
+end subroutine
+
+subroutine fgd_put_sarray (dirfile, field_code, strdata)
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: field_code
+  character(len=*), dimension(:), intent(in) :: strdata
+
+  integer :: i, array_len
+
+  array_len = fgd_array_len(dirfile, field_code)
+
+  do i=1,array_len
+    call gdptsa(dirfile, TRIM(field_code), LEN_TRIM(field_code), i, &
+      TRIM(strdata(i)), LEN_TRIM(strdata(i)))
+  end do
+end subroutine
+
+subroutine fgd_put_sarray_slice (dirfile, field_code, first, num, strdata)
+  integer, intent(in) :: dirfile, first, num
+  character(len=*), intent(in) :: field_code
+  character(len=*), dimension(:), intent(in) :: strdata
+
+  integer :: i
+
+  do i=1,num
+    call gdptsa(dirfile, TRIM(field_code), LEN_TRIM(field_code), i+first-1, &
+      TRIM(strdata(i)), LEN_TRIM(strdata(i)))
+  end do
+end subroutine
+
+subroutine fgd_add_sarray (dirfile, field_name, array_len, fragment_index)
+  integer, intent(in) :: dirfile, fragment_index, array_len
+  character (len=*), intent(in) :: field_name
+
+  call gdadsa(dirfile, TRIM(field_name), LEN_TRIM(field_name), array_len, &
+    fragment_index)
+end subroutine
+
+subroutine fgd_madd_sarray (dirfile, parent, field_name, array_len)
+  integer, intent(in) :: dirfile, array_len
+  character (len=*), intent(in) :: field_name, parent
+
+  call gdmdsa(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_name), &
+  LEN_TRIM(field_name), array_len)
+end subroutine
+
+subroutine fgd_alter_sarray (dirfile, field_name, array_len)
+  integer, intent(in) :: dirfile, array_len
+  character (len=*), intent(in) :: field_name
+
+  call gdalsa(dirfile, TRIM(field_name), LEN_TRIM(field_name), array_len)
+end subroutine
+
+subroutine fgd_add_indir (dirfile, field_name, in_field1, in_field2, &
+  fragment_index)
+  integer, intent(in) :: dirfile, fragment_index
+  character (len=*), intent(in) :: field_name, in_field1, in_field2
+
+  call gdadid(dirfile, TRIM(field_name), LEN_TRIM(field_name), &
+  TRIM(in_field1), LEN_TRIM(in_field1), TRIM(in_field2), LEN_TRIM(in_field2), &
+  fragment_index)
+end subroutine
+
+subroutine fgd_add_sindir (dirfile, field_name, in_field1, in_field2, &
+  fragment_index)
+  integer, intent(in) :: dirfile, fragment_index
+  character (len=*), intent(in) :: field_name, in_field1, in_field2
+
+  call gdadsd(dirfile, TRIM(field_name), LEN_TRIM(field_name), &
+  TRIM(in_field1), LEN_TRIM(in_field1), TRIM(in_field2), LEN_TRIM(in_field2), &
+  fragment_index)
+end subroutine
+
+subroutine fgd_madd_indir (dirfile, parent, field_name, in_field1, in_field2)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_name, in_field1, in_field2, parent
+
+  call gdmdid(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_name), &
+  LEN_TRIM(field_name), TRIM(in_field1), LEN_TRIM(in_field1), TRIM(in_field2), &
+  LEN_TRIM(in_field2))
+end subroutine
+
+subroutine fgd_madd_sindir (dirfile, parent, field_name, in_field1, in_field2)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_name, in_field1, in_field2, parent
+
+  call gdmdsd(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_name), &
+  LEN_TRIM(field_name), TRIM(in_field1), LEN_TRIM(in_field1), TRIM(in_field2), &
+  LEN_TRIM(in_field2))
+end subroutine
+
+subroutine fgd_alter_indir (dirfile, field_name, in_field1, in_field2)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_name, in_field1, in_field2
+
+  call gdalid(dirfile, TRIM(field_name), LEN_TRIM(field_name), &
+  TRIM(in_field1), LEN_TRIM(in_field1), TRIM(in_field2), LEN_TRIM(in_field2))
+end subroutine
+
+subroutine fgd_alter_sindir (dirfile, field_name, in_field1, in_field2)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_name, in_field1, in_field2
+
+  call gdalsd(dirfile, TRIM(field_name), LEN_TRIM(field_name), &
+  TRIM(in_field1), LEN_TRIM(in_field1), TRIM(in_field2), LEN_TRIM(in_field2))
+end subroutine
+
+function fgd_getstrdata (dirfile, field_code, first_frame, first_sample, &
+  num_frames, num_samples, data_out, data_len)
+  integer :: fgd_getstrdata
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+  integer, intent(in) :: first_frame, first_sample, num_frames, num_samples
+  character(len=*), dimension(:), intent(out) :: data_out
+  integer, intent(inout) :: data_len
+  
+  integer :: i, l, max_data_len
+  character(len=@SIZEOF_VOID_P@) :: packed
+
+  call gdgstp(fgd_getstrdata, packed, dirfile, TRIM(field_code), &
+    LEN_TRIM(field_code), first_frame, first_sample, num_frames, num_samples)
+
+  if (fgd_getstrdata .gt. 0) then
+    ! unpack
+    max_data_len = data_len
+    do i=1,fgd_getstrdata
+      l = data_len
+      call gdxstp(data_out(i), l, packed, i)
+      if (l .gt. max_data_len) then
+        max_data_len = l
+      end if
+    end do
+
+    ! clean up
+    call gddstp(packed)
+    if (max_data_len .ne. data_len) then
+      fgd_getstrdata = 0
+    end if
+  endif
+end function
+
+function fgd_match_entries_max (dirfile, regex, fragment, entype, flags)
+  integer :: fgd_match_entries_max
+  integer, intent(in) :: dirfile, fragment, entype, flags
+  character (len=*), intent(in) :: regex
+  integer :: regex_l
+
+  regex_l = LEN_TRIM(regex)
+  if (regex_l .EQ. 0) regex_l = -1
+
+  ! call f77 library
+  call gdmatx(fgd_match_entries_max, dirfile, TRIM(regex), regex_l, fragment, &
+    entype, flags)
+end function
+
+function fgd_match_entries (entry_list, dirfile, regex, fragment, entype, &
+    flags, entry_len)
+  integer :: fgd_match_entries
+  character(len=*), dimension(:), intent(out) :: entry_list
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: regex
+  integer, intent(inout) :: entry_len
+  integer, intent(in) :: fragment, entype, flags
+
+  integer :: max_len, i, regex_l
+
+  ! make sure the entry list is large enough
+  max_len = fgd_match_entries_max(dirfile, regex, fragment, entype, flags)
+  regex_l = LEN_TRIM(regex)
+  if (regex_l .EQ. 0) regex_l = -1
+
+  if (entry_len .lt. max_len) then
+    entry_len = max_len
+  else
+    call gdnmat(fgd_match_entries, dirfile, TRIM(regex), regex_l, fragment, &
+      entype, flags)
+    do i=1,fgd_match_entries
+      ! call f77 library
+      call gdmatn(entry_list(i), entry_len, dirfile, TRIM(regex), regex_l, &
+        fragment, entype, flags, i)
+    end do
+  end if
+end function
+
 end module
diff --git a/bindings/f77/test/Makefile.in b/bindings/f77/test/Makefile.in
index bdc5e44..a9ce973 100644
--- a/bindings/f77/test/Makefile.in
+++ b/bindings/f77/test/Makefile.in
@@ -268,6 +268,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/f77/test/big_test.f b/bindings/f77/test/big_test.f
index d0e1849..ae7ecdb 100644
--- a/bindings/f77/test/big_test.f
+++ b/bindings/f77/test/big_test.f
@@ -183,7 +183,7 @@ C     This is good to single precision
       INTEGER flen
       PARAMETER (flen = 11)
       INTEGER nfields
-      PARAMETER (nfields = 17)
+      PARAMETER (nfields = 20)
       INTEGER slen
       PARAMETER (slen = 26)
       INTEGER plen
@@ -197,7 +197,7 @@ C     doesn't.
       PARAMETER (backslash = '\\')
 
       CHARACTER*26 strings(3)
-      CHARACTER*11 fields(nfields + 10)
+      CHARACTER*11 fields(nfields + 9)
       CHARACTER*11 fn
       CHARACTER*26 str
       CHARACTER*4096 path
@@ -224,23 +224,26 @@ C     doesn't.
       datdat(k) = k
    10 CONTINUE
  
-      fields( 1) = 'INDEX  '
-      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( 1) = 'bit    '
+      fields( 2) = 'div    '
+      fields( 3) = 'data   '
+      fields( 4) = 'mult   '
+      fields( 5) = 'sbit   '
+      fields( 6) = 'INDEX  '
+      fields( 7) = 'alias  '
+      fields( 8) = 'const  '
+      fields( 9) = 'indir  '
       fields(10) = 'mplex  '
-      fields(11) = 'mult   '
-      fields(12) = 'phase  '
-      fields(13) = 'polynom'
-      fields(14) = 'recip  '
-      fields(15) = 'sbit   '
-      fields(16) = 'string '
-      fields(17) = 'window '
+      fields(11) = 'phase  '
+      fields(12) = 'recip  '
+      fields(13) = 'carray '
+      fields(14) = 'lincom '
+      fields(15) = 'sarray '
+      fields(16) = 'sindir '
+      fields(17) = 'string '
+      fields(18) = 'window '
+      fields(19) = 'linterp'
+      fields(20) = 'polynom'
 
 C     Write the test dirfile
       OPEN(1, FILE=frmat, STATUS='NEW')
@@ -266,6 +269,10 @@ C     Write the test dirfile
       WRITE(1, *) 'window WINDOW linterp mult LT 4.1'
       WRITE(1, *) '/ALIAS alias data'
       WRITE(1, *) 'string STRING "Zaphod Beeblebrox"'
+      WRITE(1, *) 'sarray SARRAY one two three four five six seven'
+      WRITE(1, *) 'data/msarray SARRAY eight nine ten eleven twelve'
+      WRITE(1, *) 'indir INDIR data carray'
+      WRITE(1, *) 'sindir SINDIR data sarray'
       CLOSE(1, STATUS='KEEP')
 
       OPEN(1, FILE=frm2, STATUS='NEW')
@@ -308,7 +315,7 @@ C     21: GDFDNX check
 C     22: GDMFNX check
       CALL GDMFNX(i, d, 'data', 4)
       CALL CHKEOK(ne, 22, d)
-      CALL CHKINT(ne, 22, i, 6)
+      CALL CHKINT(ne, 22, i, 7)
 
 C     23: GDNFLD check
       CALL GDNFLD(n, d)
@@ -319,7 +326,7 @@ C     24: This is a check of (one of many instances of) _GDF_FString
       l = 2
       CALL GDFLDN(fn, l, d, 1)
       CALL CHKEOK(ne, 24, d)
-      CALL CHKINT(ne, 24, l, 5)
+      CALL CHKINT(ne, 24, l, 3)
 
 C     25: GDFLDN check
       DO 250 i = 1, n
@@ -333,12 +340,13 @@ C     25: GDFLDN check
 C     26: GDNMFD check
       CALL GDNMFD(n, d, 'data', 4)
       CALL CHKEOK(ne, 26, d)
-      CALL CHKINT(ne, 26, n, 3)
+      CALL CHKINT(ne, 26, n, 4)
 
 C     27: GDMFDN check
       fields(1) = 'mstr'
       fields(2) = 'mconst'
       fields(3) = 'mlut'
+      fields(4) = 'msarray'
       DO 270 i = 1, n
       l = flen
       CALL GDMFDN(fn, l, d, 'data', 4, i)
@@ -755,9 +763,9 @@ C     67: GDNFDT check
       CALL CHKINT(ne, 67, n, 3)
 
 C     68: GDFDNT check
-      fields(1) = 'lincom'
-      fields(2) = 'new2'
-      fields(3) = 'new3'
+      fields(1) = 'new2'
+      fields(2) = 'new3'
+      fields(3) = 'lincom'
       DO 680 i = 1, n
       l = flen
       CALL GDFDNT(fn, l, d, GD_LCE, i)
@@ -769,33 +777,35 @@ C     68: GDFDNT check
 C     69: GDNVEC check
       CALL GDNVEC(n, d)
       CALL CHKEOK(ne, 69, d)
-      CALL CHKINT(ne, 69, n, 24)
+      CALL CHKINT(ne, 69, n, 25)
 
 C     70: GDVECN check
-      fields( 1) = 'INDEX  '
-      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( 1) = 'bit    '
+      fields( 2) = 'div    '
+      fields( 3) = 'data   '
+      fields( 4) = 'mult   '
+      fields( 5) = 'new1   '
+      fields( 6) = 'new2   '
+      fields( 7) = 'new3   '
+      fields( 8) = 'new4   '
+      fields( 9) = 'new5   '
+      fields(10) = 'new6   '
+      fields(11) = 'new7   '
+      fields(12) = 'new8   '
+      fields(13) = 'new9   '
+      fields(14) = 'sbit   '
+      fields(15) = 'INDEX  '
+      fields(16) = 'alias  '
+      fields(17) = 'indir  '
+      fields(18) = 'mplex  '
+      fields(19) = 'new10  '
       fields(20) = 'phase  '
-      fields(21) = 'polynom'
-      fields(22) = 'recip  '
-      fields(23) = 'sbit   '
-      fields(24) = 'window '
+      fields(21) = 'recip  '
+      fields(22) = 'lincom '
+      fields(23) = 'window '
+      fields(24) = 'linterp'
+      fields(25) = 'polynom'
+
       DO 700 i = 1, n
       l = flen
       CALL GDVECN(fn, l, d, i)
@@ -1029,9 +1039,8 @@ C     86: GDPTCO check
       CALL CHKDBL(ne, 86, 1d0 * fl, 10.0d0)
 
 C     94: GDPTST check
-      CALL GDPTST(n, d, 'string', 6, 11, "Arthur Dent")
+      CALL GDPTST(d, 'string', 6, 11, "Arthur Dent")
       CALL CHKOK2(ne, 94, 1, d)
-      CALL CHKINT(ne, 94, n, 11)
 
       CALL GDGTST(n, d, 'string', 6, slen, str)
       CALL CHKOK2(ne, 94, 2, d)
@@ -1418,7 +1427,7 @@ C     130: GDENFL check
 C     131: GDVLDT check
       CALL GDVLDT(n, d, 'new7', 4)
       CALL CHKERR(ne, 131, d, GD_EBC)
-      CALL CHKINT(ne, 131, n, -1)
+      CALL CHKINT(ne, 131, n, GD_EBC)
 
 C     132: GDFNUM check
       l = slen
@@ -1983,8 +1992,8 @@ C     221: GDNALS check
 C     222: GDALSS check
       fields(1) = 'data'
       fields(2) = 'alias'
-      fields(3) = 'data/mnew20'
-      fields(4) = 'new20'
+      fields(3) = 'new20'
+      fields(4) = 'data/mnew20'
       DO 2220 i = 1, n
       l = flen
       CALL GDALSS(fn, l, d, 'data', 4, i)
@@ -2117,10 +2126,10 @@ C     236: GDVBPX check
 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 CHKIN2(ne, 237, 1, n, 6)
       CALL GDNENT(n, d, "", -1, GDEN_V, GDEN_H + GDEN_N)
       CALL CHKOK2(ne, 237, 2, d)
-      CALL CHKIN2(ne, 237, 2, n, 27)
+      CALL CHKIN2(ne, 237, 2, n, 28)
 
 C     238: GDENTX check
       CALL GDENTX(l, d, "", -1, GDEN_V, GDEN_H + GDEN_N)
@@ -2128,33 +2137,34 @@ C     238: GDENTX check
       CALL CHKINT(ne, 238, l, 7)
 
 C     239: GDENTN check
-      fields( 1) = "INDEX"
-      fields( 2) = "bit"
+      fields( 1) = "bit"
+      fields( 2) = "div"
       fields( 3) = "data"
-      fields( 4) = "div"
-      fields( 5) = "lincom"
-      fields( 6) = "linterp"
-      fields( 7) = "mplex"
-      fields( 8) = "mult"
-      fields( 9) = "new1"
-      fields(10) = "new135"
-      fields(11) = "new14"
-      fields(12) = "new15"
-      fields(13) = "new16"
-      fields(14) = "new18"
-      fields(15) = "new2"
-      fields(16) = "new21"
-      fields(17) = "new3"
-      fields(18) = "new4"
-      fields(19) = "new5"
-      fields(20) = "new6"
-      fields(21) = "new7"
-      fields(22) = "new8"
-      fields(23) = "phase"
-      fields(24) = "polynom"
-      fields(25) = "recip"
-      fields(26) = "sbit"
-      fields(27) = "window"
+      fields( 4) = "mult"
+      fields( 5) = "new1"
+      fields( 6) = "new2"
+      fields( 7) = "new3"
+      fields( 8) = "new4"
+      fields( 9) = "new5"
+      fields(10) = "new6"
+      fields(11) = "new7"
+      fields(12) = "new8"
+      fields(13) = "sbit"
+      fields(14) = "INDEX"
+      fields(15) = "indir"
+      fields(16) = "mplex"
+      fields(17) = "new14"
+      fields(18) = "new15"
+      fields(19) = "new16"
+      fields(20) = "new18"
+      fields(21) = "new21"
+      fields(22) = "phase"
+      fields(23) = "recip"
+      fields(24) = "lincom"
+      fields(25) = "new135"
+      fields(26) = "window"
+      fields(27) = "linterp"
+      fields(28) = "polynom"
       DO 2390 i = 1, n
       l = flen
       CALL GDENTN(fn, l, d, "", -1, GDEN_V, GDEN_H + GDEN_N, i)
@@ -2980,6 +2990,251 @@ C     272: NULL return from gd_reference
 
       CALL GDDSCD(m)
 
+C     275: GDSARX
+      CALL GDSARX(n, d)
+      CALL CHKEOK(ne, 275, d)
+      CALL CHKINT(ne, 275, n, 5)
+
+C     276: GDMSAX
+      CALL GDMSAX(n, d, 'data', 4)
+      CALL CHKEOK(ne, 276, d)
+      CALL CHKINT(ne, 276, n, 6)
+
+C     277: GDGESA check
+      CALL GDGESA(l, n, d, 'sarray', 6)
+      CALL CHKEOK(ne, 277, d)
+      CALL CHKIN2(ne, 277, 1, l, 7)
+      CALL CHKIN2(ne, 277, 2, n, 0)
+
+C     279: GDGTSA check
+      fields(1) = 'one'
+      fields(2) = 'two'
+      fields(3) = 'three'
+      fields(4) = 'four'
+      fields(5) = 'five'
+      fields(6) = 'six'
+      fields(7) = 'seven'
+      DO 2790 i = 1, n
+      l = flen
+      CALL GDGTSA(fn, l, d, 'sarray', 6, i)
+      CALL CHKOK2(ne, 279, i, d)
+      CALL CHKIN2(ne, 279, i, l, flen)
+      CALL CHKST2(ne, 279, i, fn, fields(i))
+ 2790 CONTINUE
+
+C     282: GDPTSA check
+      fields(1) = 'abc'
+      fields(2) = 'def'
+      fields(3) = 'ghi'
+      fields(4) = 'jkl'
+      fields(5) = 'mno'
+      fields(6) = 'pqr'
+      fields(7) = 'stu'
+      DO 2820 i = 1, 7
+      l = flen
+      CALL GDPTSA(d, 'sarray', 6, i, fields(i), 3)
+      CALL CHKOK2(ne, 282, i, d)
+ 2820 CONTINUE
+
+      DO 2821 i = 1, n
+      l = flen
+      CALL GDGTSA(fn, l, d, 'sarray', 6, i)
+      CALL CHKOK2(ne, 282, i + n, d)
+      CALL CHKIN2(ne, 282, i, l, flen)
+      CALL CHKST2(ne, 282, i, fn, fields(i))
+ 2821 CONTINUE
+
+C     283: GDADSA check
+      CALL GDADSA(d, 'new283', 6, 4, 0)
+      CALL CHKOK2(ne, 283, 0, d)
+
+      CALL GDARLN(n, d, 'new283', 6)
+      CALL CHKOK2(ne, 283, 1, d)
+      CALL CHKIN2(ne, 283, 0, n, 4)
+
+      DO 2830 i = 1, 4
+      l = flen
+      CALL GDGTSA(fn, l, d, 'new283', 6, i)
+      CALL CHKOK2(ne, 283, i + 1, d)
+      CALL CHKIN2(ne, 283, i, l, flen)
+      CALL CHKST2(ne, 283, i, fn, '')
+ 2830 CONTINUE
+
+C     285: GDMDSA check
+      CALL GDMDSA(d, 'data', 4, 'mnew285', 7, 3, 0)
+      CALL CHKOK2(ne, 285, 0, d)
+
+      CALL GDARLN(n, d, 'data/mnew285', 12)
+      CALL CHKOK2(ne, 285, 1, d)
+      CALL CHKIN2(ne, 285, 0, n, 3)
+
+      DO 2850 i = 1, 3
+      l = flen
+      CALL GDGTSA(fn, l, d, 'data/mnew285', 12, i)
+      CALL CHKOK2(ne, 285, i + n, d)
+      CALL CHKIN2(ne, 285, i, l, flen)
+      CALL CHKST2(ne, 285, i, fn, '')
+ 2850 CONTINUE
+
+C     286: GDALSA check
+      CALL GDALSA(d, 'new283', 6, 3)
+      CALL CHKOK2(ne, 286, 0, d)
+
+      CALL GDARLN(n, d, 'new283', 6)
+      CALL CHKOK2(ne, 286, 1, d)
+      CALL CHKIN2(ne, 286, 0, n, 3)
+
+C     288: GDGEID check
+      l = flen
+      CALL GDGEID(fields(1), l, fields(2), l, n, d, 'indir', 5)
+      CALL CHKEOK(ne, 288, d)
+      CALL CHKIN2(ne, 288, 1, l, flen)
+      CALL CHKIN2(ne, 288, 2, n, 0)
+      CALL CHKST2(ne, 288, 3, fields(1), 'data')
+      CALL CHKST2(ne, 288, 4, fields(2), 'carray')
+
+C     289: GDADID check
+      CALL GDADID(d, 'new289', 6, 'in1', 3, 'in2', 3, 0)
+      CALL CHKOK2(ne, 289, 1, d)
+
+      l = flen
+      CALL GDGEID(fields(1), l, fields(2), l, n, d, 'new289', 6)
+      CALL CHKOK2(ne, 289, 2, d)
+      CALL CHKIN2(ne, 289, 1, l, flen)
+      CALL CHKIN2(ne, 289, 2, n, 0)
+      CALL CHKST2(ne, 289, 3, fields(1), 'in1')
+      CALL CHKST2(ne, 289, 4, fields(2), 'in2')
+
+C     290: GDMDID check
+      CALL GDMDID(d, 'data', 4, 'new290', 6, 'in3', 3, 'in4', 3)
+      CALL CHKOK2(ne, 290, 1, d)
+
+      l = flen
+      CALL GDGEID(fields(1), l, fields(2), l, n, d, 'data/new290', 11)
+      CALL CHKOK2(ne, 290, 2, d)
+      CALL CHKIN2(ne, 290, 1, l, flen)
+      CALL CHKIN2(ne, 290, 2, n, 0)
+      CALL CHKST2(ne, 290, 3, fields(1), 'in3')
+      CALL CHKST2(ne, 290, 4, fields(2), 'in4')
+
+C     291: GDALID check
+      CALL GDALID(d, 'new289', 6, 'in6', 3, 'in4', 3)
+      CALL CHKOK2(ne, 291, 1, d)
+
+      l = flen
+      CALL GDGEID(fields(1), l, fields(2), l, n, d, 'new289', 6)
+      CALL CHKOK2(ne, 291, 2, d)
+      CALL CHKIN2(ne, 291, 1, l, flen)
+      CALL CHKIN2(ne, 291, 2, n, 0)
+      CALL CHKST2(ne, 291, 3, fields(1), 'in6')
+      CALL CHKST2(ne, 291, 4, fields(2), 'in4')
+
+C     292: GDGESD check
+      l = flen
+      CALL GDGESD(fields(1), l, fields(2), l, n, d, 'sindir', 6)
+      CALL CHKEOK(ne, 292, d)
+      CALL CHKIN2(ne, 292, 1, l, flen)
+      CALL CHKIN2(ne, 292, 2, n, 0)
+      CALL CHKST2(ne, 292, 3, fields(1), 'data')
+      CALL CHKST2(ne, 292, 4, fields(2), 'sarray')
+
+C     293: GDADSD check
+      CALL GDADSD(d, 'new293', 6, 'in1', 3, 'in2', 3, 0)
+      CALL CHKOK2(ne, 293, 1, d)
+
+      l = flen
+      CALL GDGESD(fields(1), l, fields(2), l, n, d, 'new293', 6)
+      CALL CHKOK2(ne, 293, 2, d)
+      CALL CHKIN2(ne, 293, 1, l, flen)
+      CALL CHKIN2(ne, 293, 2, n, 0)
+      CALL CHKST2(ne, 293, 3, fields(1), 'in1')
+      CALL CHKST2(ne, 293, 4, fields(2), 'in2')
+
+C     294: GDMDSD check
+      CALL GDMDSD(d, 'data', 4, 'new294', 6, 'in3', 3, 'in4', 3)
+      CALL CHKOK2(ne, 294, 1, d)
+
+      l = flen
+      CALL GDGESD(fields(1), l, fields(2), l, n, d, 'data/new294', 11)
+      CALL CHKOK2(ne, 294, 2, d)
+      CALL CHKIN2(ne, 294, 1, l, flen)
+      CALL CHKIN2(ne, 294, 2, n, 0)
+      CALL CHKST2(ne, 294, 3, fields(1), 'in3')
+      CALL CHKST2(ne, 294, 4, fields(2), 'in4')
+
+C     295: GDALSD check
+      CALL GDALSD(d, 'new293', 6, 'in6', 3, 'in4', 3)
+      CALL CHKOK2(ne, 295, 1, d)
+
+      l = flen
+      CALL GDGESD(fields(1), l, fields(2), l, n, d, 'new293', 6)
+      CALL CHKOK2(ne, 295, 2, d)
+      CALL CHKIN2(ne, 295, 1, l, flen)
+      CALL CHKIN2(ne, 295, 2, n, 0)
+      CALL CHKST2(ne, 295, 3, fields(1), 'in6')
+      CALL CHKST2(ne, 295, 4, fields(2), 'in4')
+
+C     296: GDGSTD check
+      l = flen
+      CALL GDGSTD(fn, l, d, 'sindir', 6, 0, 0)
+      CALL CHKEOK(ne, 296, d)
+      CALL CHKINT(ne, 296, l, flen)
+      CALL CHKSTR(ne, 296, fn, 'abc')
+
+C     297: GDGSTP check
+      CALL GDGSTP(n, fn, d, 'sindir', 6, 0, 0, 1, 0)
+      CALL CHKEOK(ne, 297, d)
+      CALL CHKINT(ne, 297, n, 8)
+
+C     298: GDXSTP check
+      DO 2980 i = 1, 8
+      l = slen
+      CALL GDXSTP(str, l, fn, i)
+      CALL CHKIN2(ne, 298, i, l, slen)
+      CALL CHKST2(ne, 298, i, str, 'abc')
+ 2980 CONTINUE
+
+C     299: GDDSTP check
+      CALL GDDSTP(fn)
+
+C     302: GDINCA check
+      CALL GDINCN(d, 'format2', 7, 0, 'NS', 2, GD_CR + GD_EX)
+      CALL CHKEOK(ne, 302, d)
+
+C     303: GDFRNS check (read)
+      l = flen
+      CALL GDFRNS(fields(1), l, d, 2, "", -1)
+      CALL CHKEOK(ne, 303, d)
+      CALL CHKIN2(ne, 303, 1, l, flen)
+      CALL CHKST2(ne, 303, 2, fields(1), 'NS')
+
+C     304: GDFRNS check (update)
+      l = flen
+      CALL GDFRNS(fields(1), l, d, 2, "NS2", 3)
+      CALL CHKEOK(ne, 304, d)
+      CALL CHKIN2(ne, 304, 1, l, flen)
+      CALL CHKST2(ne, 304, 2, fields(1), 'NS2')
+
+C     305: GDMATN, GDMATX, GDNMAT checks
+      CALL GDMATX(m, d, "^lin", 4, 0, 0, 0)
+      CALL CHKOK2(ne, 305, 0, d)
+      CALL CHKINT(ne, 305, m, 7)
+
+      CALL GDNMAT(n, d, "^lin", 4, 0, 0, 0)
+      CALL CHKOK2(ne, 305, 1, d)
+      CALL CHKINT(ne, 305, n, 2)
+
+      CALL GDMATN(fn, l, d, "^lin", 4, 0, 0, 0, 1)
+      CALL CHKOK2(ne, 305, 3, d)
+      CALL CHKIN2(ne, 305, 4, l, flen)
+      CALL CHKST2(ne, 305, 5, fn, "lincom")
+
+      CALL GDMATN(fn, l, d, "^lin", 4, 0, 0, 0, 2)
+      CALL CHKOK2(ne, 305, 6, d)
+      CALL CHKIN2(ne, 305, 7, l, flen)
+      CALL CHKST2(ne, 305, 8, fn, "linterp")
+
+
 
 
 
diff --git a/bindings/f77/test/big_test95.f90 b/bindings/f77/test/big_test95.f90
index a1b01a2..dd794e3 100644
--- a/bindings/f77/test/big_test95.f90
+++ b/bindings/f77/test/big_test95.f90
@@ -166,13 +166,13 @@ program big_test
   character (len=*), parameter :: frm2 = 'test95_dirfile/form2'
   character (len=*), parameter :: dat = 'test95_dirfile/data'
   integer, parameter :: flen = 11
-  integer, parameter :: nfields = 17
+  integer, parameter :: nfields = 20
   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=flen), dimension(nfields + 9) :: fields
+  character (len=flen), dimension(nfields + 9) :: flist
   character (len=GD_FIELD_LEN) :: str
   character (len=4096) :: path
   integer(1), dimension(80) :: datadata
@@ -201,12 +201,12 @@ program big_test
   call system ( 'rm -rf ' // fildir )
   call system ( 'mkdir ' // fildir )
 
-  fields = (/    'INDEX      ', 'alias      ', 'bit        ', 'carray     ', &
-  'const      ', 'data       ', 'div        ', 'lincom     ', 'linterp    ', &
-  'mplex      ', 'mult       ', 'phase      ', 'polynom    ', 'recip      ', &
-  'sbit       ', 'string     ', 'window     ', '           ', '           ', &
-  '           ', '           ', '           ', '           ', '           ', &
-  '           ', '           ', '           ', '           ' /)
+  fields = (/      'bit        ', 'div        ', 'data       ', 'mult       ', &
+    'sbit       ', 'INDEX      ', 'alias      ', 'const      ', 'indir      ', &
+    'mplex      ', 'phase      ', 'recip      ', 'carray     ', 'lincom     ', &
+    'sarray     ', 'sindir     ', 'string     ', 'window     ', 'linterp    ', &
+    'polynom    ', '           ', '           ', '           ', '           ', &
+    '           ', '           ', '           ', '           ', '           ' /)
 
   open(1, file=frmat, status='new')
   write(1, *) '/ENDIAN little'
@@ -229,6 +229,10 @@ program big_test
   write(1, *) 'window WINDOW linterp mult LT 4.1'
   write(1, *) '/ALIAS alias data'
   write(1, *) 'string STRING "Zaphod Beeblebrox"'
+  write(1, *) 'sarray SARRAY one two three four five six seven'
+  write(1, *) 'data/msarray SARRAY eight nine ten eleven twelve'
+  write(1, *) 'indir INDIR data carray'
+  write(1, *) 'sindir SINDIR data sarray'
   close(1, status='keep')
 
   open(1, file=frm2, status='new')
@@ -380,7 +384,7 @@ program big_test
 ! 22: fgd_mfield_name_max check
   i = fgd_mfield_name_max(d, 'data')
   call check_ok(ne, 22, d)
-  call check_int(ne, 22, i, 6)
+  call check_int(ne, 22, i, 7)
 
 ! 23: fgd_nfields check
   n = fgd_nfields(d)
@@ -400,12 +404,13 @@ program big_test
 ! 26: fgd_nmfields check
   n = fgd_nmfields(d, 'data')
   call check_ok(ne, 26, d)
-  call check_int(ne, 26, n, 3)
+  call check_int(ne, 26, n, 4)
 
 ! 27: fgd_mfield_list check
   fields(1) = 'mstr'
   fields(2) = 'mconst'
   fields(3) = 'mlut'
+  fields(4) = 'msarray'
 
   l = flen
   call fgd_mfield_list(flist, d, 'data', l)
@@ -882,9 +887,9 @@ program big_test
   call check_int(ne, 67, n, 3)
 
 ! 68: fgd_field_list_by_type check
-  fields(1) = 'lincom'
-  fields(2) = 'new2'
-  fields(3) = 'new3'
+  fields(1) = 'new2'
+  fields(2) = 'new3'
+  fields(3) = 'lincom'
   l = flen
   call fgd_field_list_by_type(flist, d, GD_LINCOM_ENTRY, l)
   call check_ok(ne, 68, d)
@@ -897,15 +902,15 @@ program big_test
 ! 69: fgd_nvectors check
   n = fgd_nvectors(d)
   call check_ok(ne, 69, d)
-  call check_int(ne, 69, n, 24)
+  call check_int(ne, 69, n, 25)
 
 ! 70: fgd_vector_list check
-  fields = (/    'INDEX      ', 'alias      ', 'bit        ', 'data       ', &
-  'div        ', 'lincom     ', 'linterp    ', 'mplex      ', 'mult       ', &
-  'new1       ', 'new10      ', 'new2       ', 'new3       ', 'new4       ', &
-  'new5       ', 'new6       ', 'new7       ', 'new8       ', 'new9       ', &
-  'phase      ', 'polynom    ', 'recip      ', 'sbit       ', 'window     ', &
-  '           ', '           ', '           ', '           ' /)
+  fields = (/      'bit        ', 'div        ', 'data       ', 'mult       ', &
+    'new1       ', 'new2       ', 'new3       ', 'new4       ', 'new5       ', &
+    'new6       ', 'new7       ', 'new8       ', 'new9       ', 'sbit       ', &
+    'INDEX      ', 'alias      ', 'indir      ', 'mplex      ', 'new10      ', &
+    'phase      ', 'recip      ', 'lincom     ', 'window     ', 'linterp    ', &
+    'polynom    ', '           ', '           ', '           ', '           ' /)
   l = flen
   call fgd_vector_list(flist, d, l)
   call check_ok(ne, 70, d)
@@ -1185,9 +1190,8 @@ program big_test
   call check_dbl(ne, 93, 1d0 * fl, 93d0)
 
 ! 94: fgd_put_string check
-  n = fgd_put_string(d, 'string', "Arthur Dent")
+  call fgd_put_string(d, 'string', "Arthur Dent")
   call check_ok2(ne, 94, 1, d)
-  call check_int(ne, 94, n, 11)
 
   n = fgd_get_string(d, 'string', GD_FIELD_LEN, str)
   call check_ok2(ne, 94, 2, d)
@@ -1221,7 +1225,7 @@ program big_test
   'mnew10     ', '           ', '           ', '           ', '           ', &
   '           ', '           ', '           ', '           ', '           ', &
   '           ', '           ', '           ', '           ', '           ', &
-  '           ', '           ', '           ', '           ' /)
+  '           ', '           ', '           ', '           ', '           ' /)
   l = flen
   call fgd_mvector_list(flist, d, "data", l)
   call check_ok2(ne, 98, i, d)
@@ -1546,7 +1550,7 @@ program big_test
 ! 131: fgd_validate check
   n = fgd_validate(d, 'new7')
   call check_err(ne, 131, d, GD_E_BAD_CODE)
-  call check_int(ne, 131, n, -1)
+  call check_int(ne, 131, n, GD_E_BAD_CODE)
 
 ! 132: fgd_framenum check
   str = fgd_reference(d, "data")
@@ -2383,8 +2387,8 @@ program big_test
 ! 222: GDALSS check
   fields(1) = 'data'
   fields(2) = 'alias'
-  fields(3) = 'data/mnew20'
-  fields(4) = 'new20'
+  fields(3) = 'new20'
+  fields(4) = 'data/mnew20'
   l = flen
   call fgd_aliases(flist, d, 'data', l)
   call check_ok(ne, 222, d)
@@ -2502,31 +2506,31 @@ program big_test
   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))
+  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_int2(ne, 237, 1, n, 6)
+  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)
+  call check_int2(ne, 237, 2, n, 29)
 
 ! 238: fgd_field_name_max check
-  i = fgd_entry_name_max(d, "", GD_VECTOR_ENTRIES, IOR(GD_ENTRIES_HIDDEN, &
-    GD_ENTRIES_NOALIAS))
+  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       ', &
-  'new135     ', 'new14      ', 'new15      ', 'new16      ', 'new18      ', &
-  'new19      ', 'new2       ', 'new21      ', 'new3       ', 'new4       ', &
-  'new5       ', 'new6       ', 'new7       ', 'new8       ', 'phase      ', &
-  'polynom    ', 'recip      ', 'sbit       ', 'window     ' /)
+  fields = (/      'bit        ', 'div        ', 'data       ', 'mult       ', &
+    'new1       ', 'new2       ', 'new3       ', 'new4       ', 'new5       ', &
+    'new6       ', 'new7       ', 'new8       ', 'sbit       ', 'INDEX      ', &
+    'indir      ', 'mplex      ', 'new14      ', 'new15      ', 'new16      ', &
+    'new18      ', 'new19      ', 'new21      ', 'phase      ', 'recip      ', &
+    'lincom     ', 'new135     ', 'window     ', 'linterp    ', 'polynom    ' /)
   l = flen
-  call fgd_entry_list(flist, d, "", GD_VECTOR_ENTRIES, IOR(GD_ENTRIES_HIDDEN, &
-      GD_ENTRIES_NOALIAS), l)
+  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)
 
@@ -3136,6 +3140,243 @@ program big_test
 
   call fgd_discard(l)
 
+! 275: fgd_sarray_value_max
+  n = fgd_sarray_value_max(d)
+  call check_int(ne, 275, n, 5)
+
+! 276: fgd_msarray_value_max
+  n = fgd_msarray_value_max(d, 'data')
+  call check_int(ne, 276, n, 6)
+
+! 277: gd_entry (SARRAY)
+  n = fgd_entry(d, 'sarray', ent)
+  call check_ok(ne, 277, d)
+  call check_int2(ne, 277, 1, n, GD_SARRAY_ENTRY)
+  call check_int2(ne, 277, 2, ent%fragment_index, 0)
+  call check_int2(ne, 277, 3, ent%array_len, 7)
+
+! 278: gd_get_sarray
+  fields(1) = 'one'
+  fields(2) = 'two'
+  fields(3) = 'three'
+  fields(4) = 'four'
+  fields(5) = 'five'
+  fields(6) = 'six'
+  fields(7) = 'seven'
+  l = flen
+  call fgd_get_sarray(flist, l, d, 'sarray')
+  call check_ok(ne, 278, d)
+  call check_int(ne, 278, l, flen)
+  do i=1,7
+  call check_str2(ne, 278, i, flist(i), fields(i))
+  end do 
+
+! 279: gd_get_sarray_slice
+  l = flen
+  call fgd_get_sarray_slice(flist, l, d, 'sarray', 4, 3)
+  call check_ok(ne, 279, d)
+  call check_int(ne, 279, l, flen)
+  do i=1,3
+  call check_str2(ne, 279, i, flist(i), fields(i + 3))
+  end do 
+
+! 281: gd_put_sarray
+  fields(1) = 'eka'
+  fields(2) = 'dvi'
+  fields(3) = 'tri'
+  fields(4) = 'catur'
+  fields(5) = 'panca'
+  fields(6) = 'sas'
+  fields(7) = 'sapta'
+  call fgd_put_sarray(d, 'sarray', fields)
+  call check_ok2(ne, 281, 1, d)
+
+  l = flen
+  call fgd_get_sarray(flist, l, d, 'sarray')
+  call check_ok2(ne, 281, 2, d)
+  call check_int(ne, 281, l, flen)
+  do i=1,7
+  call check_str2(ne, 281, i, flist(i), fields(i))
+  end do 
+
+! 282: gd_put_sarray_slice
+  fields(4) = 'asta'
+  fields(5) = 'nava'
+  call fgd_put_sarray_slice(d, 'sarray', 4, 2, fields(4:5))
+  call check_ok2(ne, 282, 1, d)
+
+  l = flen
+  call fgd_get_sarray(flist, l, d, 'sarray')
+  call check_ok2(ne, 282, 2, d)
+  call check_int(ne, 282, l, flen)
+  do i=1,7
+  call check_str2(ne, 282, i, flist(i), fields(i))
+  end do 
+
+! 283: gd_add_sarray
+  call fgd_add_sarray(d, 'new283', 4, 0)
+  call check_ok2(ne, 283, 1, d)
+
+  n = fgd_entry(d, 'new283', ent)
+  call check_ok2(ne, 283, 2, d)
+  call check_int2(ne, 283, 1, n, GD_SARRAY_ENTRY)
+  call check_int2(ne, 283, 2, ent%fragment_index, 0)
+  call check_int2(ne, 283, 3, ent%array_len, 4)
+
+  call fgd_get_sarray(flist, l, d, 'new283')
+  call check_ok2(ne, 283, 3, d)
+
+  do i=1,4
+  call check_str2(ne, 283, i, flist(i), "");
+  end do
+
+! 285: gd_madd_sarray
+  call fgd_madd_sarray(d, 'data', 'new285', 4)
+  call check_ok2(ne, 285, 1, d)
+
+  n = fgd_entry(d, 'data/new285', ent)
+  call check_ok2(ne, 285, 2, d)
+  call check_int2(ne, 285, 1, n, GD_SARRAY_ENTRY)
+  call check_int2(ne, 285, 2, ent%fragment_index, 0)
+  call check_int2(ne, 285, 3, ent%array_len, 4)
+
+  call fgd_get_sarray(flist, l, d, 'data/new285')
+  call check_ok2(ne, 285, 3, d)
+
+  do i=1,4
+  call check_str2(ne, 285, i, flist(i), "")
+  end do
+
+! 286: gd_alter_carray
+  call fgd_alter_sarray(d, 'new283', 3)
+  call check_ok2(ne, 286, 1, d)
+
+  n = fgd_entry(d, 'new283', ent)
+  call check_ok2(ne, 286, 2, d)
+  call check_int2(ne, 286, 1, n, GD_SARRAY_ENTRY)
+  call check_int2(ne, 286, 2, ent%fragment_index, 0)
+  call check_int2(ne, 286, 3, ent%array_len, 3)
+
+! 288: fgd_entry (INDIR)
+  n = fgd_entry(d, 'indir', ent)
+  call check_ok(ne, 288, d)
+  call check_int2(ne, 288, 1, n, GD_INDIR_ENTRY)
+  call check_int2(ne, 288, 2, ent%fragment_index, 0)
+  call check_str2(ne, 288, 3, ent%field(1), 'data')
+  call check_str2(ne, 288, 4, ent%field(2), 'carray')
+
+! 289: fgd_add_indir check
+  call fgd_add_indir(d, 'new289', 'in1', 'in2', 0)
+  call check_ok2(ne, 289, 1, d)
+
+  n = fgd_entry(d, 'new289', ent)
+  call check_ok2(ne, 289, 2, d)
+  call check_int2(ne, 289, 1, n, GD_INDIR_ENTRY)
+  call check_int2(ne, 289, 2, ent%fragment_index, 0)
+  call check_str2(ne, 289, 3, ent%field(1), 'in1')
+  call check_str2(ne, 289, 4, ent%field(2), 'in2')
+
+! 290: fgd_madd_indir check
+  call fgd_madd_indir(d, 'data', 'new290', 'in3', 'in4')
+  call check_ok2(ne, 290, 1, d)
+
+  n = fgd_entry(d, 'data/new290', ent)
+  call check_ok2(ne, 290, 2, d)
+  call check_int2(ne, 290, 1, n, GD_INDIR_ENTRY)
+  call check_int2(ne, 290, 2, ent%fragment_index, 0)
+  call check_str2(ne, 290, 3, ent%field(1), 'in3')
+  call check_str2(ne, 290, 4, ent%field(2), 'in4')
+
+! 291: fgd_alter_indir check
+  call fgd_alter_indir(d, 'new289', 'in6', 'in4')
+  call check_ok2(ne, 291, 1, d)
+
+  n = fgd_entry(d, 'new289', ent)
+  call check_ok2(ne, 291, 2, d)
+  call check_int2(ne, 291, 1, n, GD_INDIR_ENTRY)
+  call check_int2(ne, 291, 2, ent%fragment_index, 0)
+  call check_str2(ne, 291, 3, ent%field(1), 'in6')
+  call check_str2(ne, 291, 4, ent%field(2), 'in4')
+
+! 292: fgd_entry (SINDIR)
+  n = fgd_entry(d, 'sindir', ent)
+  call check_ok(ne, 292, d)
+  call check_int2(ne, 292, 1, n, GD_SINDIR_ENTRY)
+  call check_int2(ne, 292, 2, ent%fragment_index, 0)
+  call check_str2(ne, 292, 3, ent%field(1), 'data')
+  call check_str2(ne, 292, 4, ent%field(2), 'sarray')
+
+! 293: fgd_add_sindir check
+  call fgd_add_sindir(d, 'new293', 'in1', 'in2', 0)
+  call check_ok2(ne, 293, 1, d)
+
+  n = fgd_entry(d, 'new293', ent)
+  call check_ok2(ne, 293, 2, d)
+  call check_int2(ne, 293, 1, n, GD_SINDIR_ENTRY)
+  call check_int2(ne, 293, 2, ent%fragment_index, 0)
+  call check_str2(ne, 293, 3, ent%field(1), 'in1')
+  call check_str2(ne, 293, 4, ent%field(2), 'in2')
+
+! 294: fgd_madd_sindir check
+  call fgd_madd_sindir(d, 'data', 'new294', 'in3', 'in4')
+  call check_ok2(ne, 294, 1, d)
+
+  n = fgd_entry(d, 'data/new294', ent)
+  call check_ok2(ne, 294, 2, d)
+  call check_int2(ne, 294, 1, n, GD_SINDIR_ENTRY)
+  call check_int2(ne, 294, 2, ent%fragment_index, 0)
+  call check_str2(ne, 294, 3, ent%field(1), 'in3')
+  call check_str2(ne, 294, 4, ent%field(2), 'in4')
+
+! 295: fgd_alter_sindir check
+  call fgd_alter_sindir(d, 'new293', 'in6', 'in4')
+  call check_ok2(ne, 295, 1, d)
+
+  n = fgd_entry(d, 'new293', ent)
+  call check_ok2(ne, 295, 2, d)
+  call check_int2(ne, 295, 1, n, GD_SINDIR_ENTRY)
+  call check_int2(ne, 295, 2, ent%fragment_index, 0)
+  call check_str2(ne, 295, 3, ent%field(1), 'in6')
+  call check_str2(ne, 295, 4, ent%field(2), 'in4')
+
+! 296: fgd_getstrdata check
+  l = flen
+  n  = fgd_getstrdata(d, 'sindir', 0, 0, 1, 0, flist, l)
+  call check_ok(ne, 296, d)
+  call check_int2(ne, 296, 1, l, flen)
+  call check_int2(ne, 296, 2, n, 8)
+
+  do i=1,8
+  call check_str2(ne, 296, i, flist(i), 'eka')
+  end do
+
+! 302: fgd_include_ns
+  call fgd_include_ns(d, 'format2', 0, 'NS', GD_CREAT + GD_EXCL)
+  call check_ok(ne, 302, d)
+
+! 303: fgd_fragment_namespace (read)
+  str = fgd_fragment_namespace(d, 2)
+  call check_ok(ne, 303, d)
+  call check_eos(ne, 303, str, 'NS')
+
+! 304: fgd_fragment_namespace (alter)
+  str = fgd_alter_namespace(d, 2, 'NS2')
+  call check_ok(ne, 304, d)
+  call check_eos(ne, 304, str, 'NS2')
+
+! 305: fgd_match_entries
+  i = fgd_match_entries_max(d, "^lin", 0, 0, 0)
+  call check_ok2(ne, 305, 1, d)
+  call check_int2(ne, 305, 2, i, 7)
+  
+  l = flen
+  n = fgd_match_entries(flist, d, "^lin", 0, 0, 0, l)
+  call check_ok2(ne, 305, 3, d)
+  call check_int2(ne, 305, 4, n, 2)
+  call check_str2(ne, 305, 5, flist(1), "lincom")
+  call check_str2(ne, 305, 6, flist(2), "linterp")
+  call check_int2(ne, 305, 7, l, flen)
+
 
 
 
diff --git a/bindings/idl/Makefile.in b/bindings/idl/Makefile.in
index 02dea04..9dedb07 100644
--- a/bindings/idl/Makefile.in
+++ b/bindings/idl/Makefile.in
@@ -287,6 +287,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/idl/getdata.c b/bindings/idl/getdata.c
index c092638..d3181aa 100644
--- a/bindings/idl/getdata.c
+++ b/bindings/idl/getdata.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2015 D. V. Wiebe
+/* Copyright (C) 2009-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -305,6 +305,7 @@ gd_static_inline_ IDL_ALLTYPES gdidl_to_alltypes(gd_type_t t, void* d)
       v.cmp.i = cimag(dc);
       break;
     case GD_NULL:
+    case GD_STRING:
     case GD_UNKNOWN:
       ;
   }
@@ -456,7 +457,8 @@ IDL_VPTR gdidl_make_idl_entry(const gd_entry_t* E)
       || 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_WINDOW_ENTRY || E->field_type == GD_MPLEX_ENTRY)
+      || E->field_type == GD_WINDOW_ENTRY || E->field_type == GD_MPLEX_ENTRY
+      || E->field_type == GD_INDIR_ENTRY || E->field_type == GD_SINDIR_ENTRY)
   {
     IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
             "IN_FIELDS", IDL_MSG_LONGJMP, NULL)), E->in_fields[0]);
@@ -532,6 +534,8 @@ IDL_VPTR gdidl_make_idl_entry(const gd_entry_t* E)
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
               "IN_FIELDS", IDL_MSG_LONGJMP, NULL)) + 1, E->in_fields[1]);
       break;
@@ -622,10 +626,12 @@ IDL_VPTR gdidl_make_idl_entry(const gd_entry_t* E)
           "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;
       *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "DATA_TYPE",
             IDL_MSG_LONGJMP, NULL)) = E->const_type;
+      /* Fallthrough */
+    case GD_SARRAY_ENTRY:
+      *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "ARRAY_LEN",
+            IDL_MSG_LONGJMP, NULL)) = E->array_len;
       break;
     case GD_CONST_ENTRY:
       *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "DATA_TYPE",
@@ -705,6 +711,7 @@ static void gdidl_convert_entry_num(void *dst, gd_type_t dtype, const char *key,
   switch (dtype) {
     case GD_NULL:
     case GD_UNKNOWN:
+    case GD_STRING:
       break;
     case GD_UINT8:
       GDIDL_CONVERT_ENTRY_ELEMENT(*(( uint8_t*)dst), src, key, offset, stype);
@@ -1021,6 +1028,8 @@ static void gdidl_read_idl_entry(gd_entry_t *E, IDL_VPTR v, int no_fragment,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       gdidl_get_in_fields((char**)E->in_fields, v, 2, 2, miss_ok);
       break;
     case GD_RECIP_ENTRY:
@@ -1115,8 +1124,10 @@ static void gdidl_read_idl_entry(gd_entry_t *E, IDL_VPTR v, int no_fragment,
         gdidl_get_entry_num(&E->period, GD_INT_TYPE, v, "PERIOD", 1);
       break;
     case GD_CARRAY_ENTRY:
-      gdidl_get_entry_num(&E->array_len, GD_INT_TYPE, v, "ARRAY_LEN", miss_ok);
       gdidl_get_entry_num(&E->const_type, GD_INT_TYPE, v, "DATA_TYPE", miss_ok);
+      /* FALLTHROUGH */
+    case GD_SARRAY_ENTRY:
+      gdidl_get_entry_num(&E->array_len, GD_INT_TYPE, v, "ARRAY_LEN", miss_ok);
       break;
     case GD_CONST_ENTRY:
       gdidl_get_entry_num(&E->const_type, GD_INT_TYPE, v, "DATA_TYPE", miss_ok);
@@ -3140,6 +3151,7 @@ void gdidl_include(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
 
+  int free_prefix = 0;
   char *prefix = NULL;
   char *suffix = NULL;
   typedef struct {
@@ -3167,12 +3179,14 @@ void gdidl_include(int argc, IDL_VPTR argv[], char *argk)
     int prefix_x;
     IDL_STRING suffix;
     int suffix_x;
+    IDL_STRING ns;
+    int ns_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 =
-    kw.prefix_x = kw.suffix_x = 0;
+    kw.prefix_x = kw.suffix_x = kw.ns_x = 0;
   GDIDL_KW_INIT_ERROR;
 
   static IDL_KW_PAR kw_pars[] = {
@@ -3193,6 +3207,8 @@ void gdidl_include(int argc, IDL_VPTR argv[], char *argk)
     { "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_dups) },
     { "LITTLE_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(little_end) },
+    { "NAMESPACE", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(ns_x),
+      IDL_KW_OFFSETOF(ns) },
     { "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) },
@@ -3227,7 +3243,31 @@ void gdidl_include(int argc, IDL_VPTR argv[], char *argk)
   if (kw.enc_x)
     flags |= gdidl_convert_encoding(kw.enc);
 
-  if (kw.prefix_x)
+  /* Handle combinations of prefix and namespace */
+  if (kw.ns_x && kw.prefix_x) {
+    const char *fmt;
+    char *ns = IDL_STRING_STR(&kw.ns);
+    char *prefix0 = IDL_STRING_STR(&kw.prefix);
+
+    prefix = malloc(strlen(prefix0) + strlen(ns) + 2);
+    free_prefix = 1;
+
+    if (ns[strlen(ns) - 1] == '.')
+      fmt = "%s%s";
+    else
+      fmt = "%s.%s";
+    
+    sprintf(prefix, fmt, ns, prefix0);
+  } else if (kw.ns_x) {
+    char *ns = IDL_STRING_STR(&kw.ns);
+    if (ns[strlen(ns) - 1] == '.')
+      prefix = ns;
+    else {
+      prefix = malloc(strlen(ns) + 2);
+      free_prefix = 1;
+      sprintf(prefix, "%s.", ns);
+    }
+  } else if (kw.prefix_x)
     prefix = IDL_STRING_STR(&kw.prefix);
 
   if (kw.suffix_x)
@@ -3236,6 +3276,9 @@ void gdidl_include(int argc, IDL_VPTR argv[], char *argk)
   int index = (int16_t)gd_include_affix(D, file, kw.fragment_index, prefix,
       suffix, flags);
 
+  if (free_prefix)
+    free(prefix);
+
   if (kw.index_x) {
     IDL_ALLTYPES v;
     v.i = index;
@@ -3660,6 +3703,7 @@ IDL_VPTR gdidl_getdata(int argc, IDL_VPTR argv[], char *argk)
 
   /* check for metadata */
   unsigned int spf = 1;
+  gd_entype_t t = gd_entry_type(D, field_code);
   if (!gd_error(D) && kw.n_frames > 0)
     spf = gd_spf(D, field_code);
 
@@ -3672,11 +3716,25 @@ IDL_VPTR gdidl_getdata(int argc, IDL_VPTR argv[], char *argk)
     }
     kw.n_samples += kw.n_frames * spf;
 
-    /* no signed 8-bit type in IDL */
-    if (kw.return_type == GD_INT8)
-      GDIDL_KW_ABORT("Cannot return data as a signed 8-bit integer.");
+    if (t == GD_SINDIR_ENTRY) {
+      const char **data = malloc(kw.n_samples * sizeof(*data));
 
-    if (kw.return_type == GD_NULL) {
+      n = gd_getdata64(D, field_code, kw.first_frame, kw.first_sample, 0,
+          kw.n_samples, GD_STRING, data);
+
+      if (n == 0)
+        r = IDL_GettmpInt(0);
+      else {
+        int i;
+        IDL_STRING *idata = (IDL_STRING*)IDL_MakeTempVector(IDL_TYP_STRING, n,
+            IDL_ARR_INI_ZERO, &r);
+        for (i = 0; i < n; ++i)
+          IDL_StrStore(idata + i, (char*)data[i]);
+      }
+      free(data);
+    } else if (kw.return_type == GD_INT8) /* no signed 8-bit type in IDL */
+      GDIDL_KW_ABORT("Cannot return data as a signed 8-bit integer.");
+		else if (kw.return_type == GD_NULL) {
       n = gd_getdata64(D, field_code, kw.first_frame, kw.first_sample, 0,
           kw.n_samples, GD_NULL, NULL);
 
@@ -4106,8 +4164,9 @@ IDL_VPTR gdidl_get_eof(int argc, IDL_VPTR argv[], char *argk)
   return r;
 }
 
+/* @@DLM: F gdidl_get_field_list GD_MATCH_ENTRIES 1 1 KEYWORDS */
+/* the following aliases are needed for backwards compatibility */
 /* @@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 */
 IDL_VPTR gdidl_get_field_list(int argc, IDL_VPTR argv[], char *argk)
 {
@@ -4116,32 +4175,47 @@ IDL_VPTR gdidl_get_field_list(int argc, IDL_VPTR argv[], char *argk)
   unsigned int i, nentries, flags = 0;
   const char **list;
   const char *parent = NULL;
+  const char *regex = NULL;
 
   typedef struct {
     IDL_KW_RESULT_FIRST_FIELD;
     GDIDL_KW_RESULT_ERROR;
     int type;
     IDL_STRING parent;
-    int parent_x;
-    int hidden, noalias, scalars, vectors, aliases;
+    IDL_STRING regex;
+    int parent_x, regex_x, fragment_x;
+    int hidden, noalias, scalars, vectors, aliases, fragment;
+    int extended, pcre, javascript, icase, unicode;
   } KW_RESULT;
   KW_RESULT kw;
 
   GDIDL_KW_INIT_ERROR;
   kw.type = 0;
+  kw.fragment = 0;
   kw.hidden = kw.noalias = kw.scalars = kw.vectors = kw.aliases = 0;
-  kw.parent_x = 0;
+  kw.extended = kw.pcre = kw.javascript = kw.icase = kw.unicode = 0;
+  kw.parent_x = kw.regex_x = 0;
 
   static IDL_KW_PAR kw_pars[] = {
     { "ALIASES", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(aliases) },
+    { "CASELESS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(icase) },
     GDIDL_KW_PAR_ERROR,
     GDIDL_KW_PAR_ESTRING,
+    { "EXTENDED", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(extended) },
+    { "FRAGMENT", IDL_TYP_INT, 1, 0, IDL_KW_OFFSETOF(fragment_x),
+      IDL_KW_OFFSETOF(fragment) },
     { "HIDDEN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(hidden) },
+    { "ICASE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(icase) },
+    { "JAVASCRIPT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(javascript) },
     { "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) },
+    { "PCRE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(pcre) },
+    { "REGEX", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(regex_x),
+      IDL_KW_OFFSETOF(regex) },
     { "SCALARS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(scalars) },
     { "TYPE", IDL_TYP_UINT, 1, 0, 0, IDL_KW_OFFSETOF(type) },
+    { "UNICODE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(unicode) },
     { "VECTORS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(vectors) },
     { NULL }
   };
@@ -4150,9 +4224,31 @@ 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 && kw.regex_x)
+    GDIDL_KW_ABORT("parent and regex may not both be specified");
+  if (kw.parent_x && kw.fragment_x)
+    GDIDL_KW_ABORT("parent and fragment may not both be specified");
+
+  if (!kw.fragment_x)
+    kw.fragment = GD_ALL_FRAGMENTS;
+
   if (kw.parent_x)
     parent = IDL_STRING_STR(&kw.parent);
 
+  if (kw.regex_x) {
+    regex = IDL_STRING_STR(&kw.regex);
+    if (kw.extended)
+      flags |= GD_REGEX_EXTENDED;
+    if (kw.icase)
+      flags |= GD_REGEX_ICASE;
+    if (kw.javascript)
+      flags |= GD_REGEX_JAVASCRIPT;
+    if (kw.pcre)
+      flags |= GD_REGEX_PCRE;
+    if (kw.unicode)
+      flags |= GD_REGEX_UNICODE;
+  }
+
   if (kw.hidden)
     flags |= GD_ENTRIES_HIDDEN;
   if (kw.noalias)
@@ -4167,8 +4263,11 @@ IDL_VPTR gdidl_get_field_list(int argc, IDL_VPTR argv[], char *argk)
       kw.type = GD_ALIAS_ENTRIES;
   }
 
-  nentries = gd_nentries(D, parent, kw.type, flags);
-  list = gd_entry_list(D, parent, kw.type, flags);
+  if (kw.parent_x) {
+    nentries = gd_nentries(D, parent, kw.type, flags);
+    list = gd_entry_list(D, parent, kw.type, flags);
+  } else
+    nentries = gd_match_entries(D, regex, kw.fragment, kw.type, flags, &list);
 
   GDIDL_SET_ERROR(D);
 
@@ -4571,18 +4670,23 @@ IDL_VPTR gdidl_get_raw_filename(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
 
+  DIRFILE *D;
+  char *name;
+  const char *field_code;
   GDIDL_KW_ONLY_ERROR;
 
-  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
-  const char* field_code = IDL_VarGetString(argv[1]);
+  D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  field_code = IDL_VarGetString(argv[1]);
 
-  const char* name = gd_raw_filename(D, field_code);
+  name = gd_raw_filename(D, field_code);
 
   GDIDL_SET_ERROR(D);
 
   IDL_KW_FREE;
 
-  IDL_VPTR r = IDL_StrToSTRING((char*)name);
+  IDL_VPTR r = IDL_StrToSTRING(name);
+  free(name);
+
   dreturn("%p", r);
   return r;
 }
@@ -5688,6 +5792,52 @@ IDL_VPTR gdidl_fragment_affixes(int argc, IDL_VPTR argv[], char *argk)
   return r;
 }
 
+/* @@DLM: F gdidl_fragment_namespace GD_FRAGMENT_NAMESPACE 1 1 KEYWORDS */
+IDL_VPTR gdidl_fragment_namespace(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  DIRFILE *D;
+  char *nsin = NULL;
+  const char *nsout;
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    IDL_STRING ns;
+    int ns_x, fragment;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.fragment = kw.ns_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) },
+    { "NAMESPACE", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(ns_x),
+      IDL_KW_OFFSETOF(ns) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+
+  if (kw.ns_x)
+    nsin = IDL_STRING_STR(&kw.ns);
+
+  nsout = gd_fragment_namespace(D, kw.fragment, nsin);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r = IDL_StrToSTRING((char*)nsout);
+  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)
 {
@@ -5938,6 +6088,262 @@ IDL_VPTR gdidl_encoding_support(int argc, IDL_VPTR argv[], char *argk)
   return r;
 }
 
+/* @@DLM: P gdidl_add_sarray GD_ADD_SARRAY 2 2 KEYWORDS */
+void gdidl_add_sarray(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  const char **data = NULL;
+  int i;
+
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    int n;
+    IDL_VPTR value;
+    int fragment_index;
+    IDL_STRING parent;
+    int parent_x;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.value = NULL;
+  kw.fragment_index = kw.n = 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) },
+    { "LENGTH", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(n) },
+    { "PARENT", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(parent_x),
+      IDL_KW_OFFSETOF(parent) },
+    { "VALUE", 0, 1, IDL_KW_VIN, 0, IDL_KW_OFFSETOF(value) },
+    { 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]);
+  if (kw.value) {
+    IDL_ENSURE_ARRAY(kw.value);
+    IDL_ENSURE_STRING(kw.value);
+    if (kw.value->value.arr->n_dim != 1)
+      GDIDL_KW_ABORT("VALUE must be a vector, not a multidimensional array");
+    kw.n = kw.value->value.arr->n_elts;
+    data = malloc(kw.n * sizeof(const char*));
+    for (i = 0; i < kw.n; ++i)
+      data[i] = IDL_STRING_STR((IDL_STRING*)(kw.value->value.arr->data) + i);
+  } else if (kw.n) {
+    data = malloc(kw.n * sizeof(const char*));
+    for (i = 0; i < kw.n; ++i)
+      data[i] = "";
+  } else
+    GDIDL_KW_ABORT("either LENGTH or VALUE must be specified");
+
+  if (kw.parent_x) {
+    const char* parent = IDL_STRING_STR(&kw.parent);
+    gd_madd_sarray(D, parent, field_code, kw.n, data);
+  } else
+    gd_add_sarray(D, field_code, kw.n, data, kw.fragment_index);
+
+  free(data);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: F gdidl_get_sarray GD_GET_SARRAY 2 2 KEYWORDS */
+IDL_VPTR gdidl_get_sarray(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+  int ret = 1;
+  const char **data = NULL;
+
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    unsigned int start;
+    unsigned int n;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.start = kw.n = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "LENGTH", IDL_TYP_UINT, 1, 0, 0, IDL_KW_OFFSETOF(n) },
+    { "START", IDL_TYP_UINT, 1, 0, 0, IDL_KW_OFFSETOF(start) },
+    { 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]);
+  if (kw.n == 0) {
+    kw.n = gd_array_len(D, field_code);
+    if (kw.n > kw.start)
+      kw.n -= kw.start;
+    else
+      kw.n = 0;
+  }
+
+  data = malloc(sizeof(*data) * kw.n);
+  ret = gd_get_sarray_slice(D, field_code, kw.start, kw.n, data);
+
+  IDL_VPTR r;
+  if (!ret) {
+    int i;
+    IDL_STRING *idata = (IDL_STRING*)IDL_MakeTempVector(IDL_TYP_STRING, kw.n,
+        IDL_ARR_INI_ZERO, &r);
+    for (i = 0; i < kw.n; ++i)
+      IDL_StrStore(idata + i, (char*)data[i]);
+  } else {
+    GDIDL_SET_ERROR(D);
+    r = IDL_GettmpInt(0);
+  }
+
+  free(data);
+  IDL_KW_FREE;
+
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: P gdidl_alter_sarray GD_ALTER_SARRAY 2 2 KEYWORDS */
+void gdidl_alter_sarray(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    int len;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.len = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "LENGTH", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(len) },
+    { 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]);
+
+  gd_alter_sarray(D, field_code, (size_t)kw.len);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_put_sarray GD_PUT_SARRAY 3 3 KEYWORDS */
+void gdidl_put_sarray(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  const char **data;
+  int i;
+
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    int start;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.start = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "START", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(start) },
+    { 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]);
+
+  IDL_ENSURE_ARRAY(argv[2]);
+  IDL_ENSURE_STRING(argv[2]);
+  if (argv[2]->value.arr->n_dim != 1)
+    GDIDL_KW_ABORT("data must be a vector, not a multidimensional array");
+
+  int length = argv[2]->value.arr->n_elts;
+  data = malloc(sizeof(*data) * length);
+  for (i = 0; i < length; ++i)
+    data[i] = IDL_STRING_STR((IDL_STRING*)(argv[2]->value.arr->data) + i);
+
+  gd_put_sarray_slice(D, field_code, kw.start, length, data);
+
+  GDIDL_SET_ERROR(D);
+
+  free(data);
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_add_indir GD_ADD_INDIR 4 4 KEYWORDS */
+void gdidl_add_indir(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  gdidl_add_yoke_(GD_INDIR_ENTRY, argc, argv, argk);
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_alter_indir GD_ALTER_INDIR 2 2 KEYWORDS */
+void gdidl_alter_indir(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  gdidl_alter_yoke_(GD_INDIR_ENTRY, argc, argv, argk);
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_add_sindir GD_ADD_SINDIR 4 4 KEYWORDS */
+void gdidl_add_sindir(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  gdidl_add_yoke_(GD_SINDIR_ENTRY, argc, argv, argk);
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_alter_sindir GD_ALTER_SINDIR 2 2 KEYWORDS */
+void gdidl_alter_sindir(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  gdidl_alter_yoke_(GD_SINDIR_ENTRY, argc, argv, argk);
+
+  dreturnvoid();
+}
+
 /**** Module initialisation ****/
 
 /* These are defined in the automatically generated sublist.c */
@@ -5963,7 +6369,7 @@ static IDL_STRUCT_TAG_DEF gdidl_entry[] = {
   { "IN_FIELDS",  lincom_dims, (void*)IDL_TYP_STRING },
   { "A",          polynom_dims, (void*)IDL_TYP_DOUBLE }, /* POLYNOM */
   { "CA",         polynom_dims, (void*)IDL_TYP_DCOMPLEX }, /* POLYNOM */
-  { "ARRAY_LEN",  0, (void*)IDL_TYP_INT }, /* CARRAY */
+  { "ARRAY_LEN",  0, (void*)IDL_TYP_INT }, /* CARRAY / SARRAY */
   { "B",          lincom_dims, (void*)IDL_TYP_DOUBLE }, /* LINCOM */
   { "CB",         lincom_dims, (void*)IDL_TYP_DCOMPLEX }, /* LINCOM */
   { "BITNUM",     0, (void*)IDL_TYP_INT }, /* (S)BIT */
diff --git a/bindings/idl/test/Makefile.in b/bindings/idl/test/Makefile.in
index 45de824..731619e 100644
--- a/bindings/idl/test/Makefile.in
+++ b/bindings/idl/test/Makefile.in
@@ -180,6 +180,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/idl/test/big_test.pro b/bindings/idl/test/big_test.pro
index 1c61466..535c81a 100644
--- a/bindings/idl/test/big_test.pro
+++ b/bindings/idl/test/big_test.pro
@@ -35,7 +35,7 @@ form2   = "test_dirfile/form2"
 data    = "test_dirfile/data"
 
 flen    = 11
-nfields = 17
+nfields = 20
 nume    = 0
 
 spawn, "rm -rf " + filedir
@@ -43,9 +43,9 @@ file_mkdir, filedir
 
 datadata = bindgen(80) + 1
 
-fields = [ 'INDEX', 'alias', 'bit', 'carray', 'const', 'data', 'div', $
-  'lincom', 'linterp', 'mplex', 'mult', 'phase', 'polynom', 'recip', 'sbit', $
-  'string', 'window' ]
+fields = [ 'bit', 'div', 'data', 'mult', 'sbit', 'INDEX', 'alias', 'const', $
+  'indir', 'mplex', 'phase', 'recip', 'carray', 'lincom', 'sarray', 'sindir', $
+  'string', 'window', 'linterp', 'polynom' ]
 
 ; Write the test dirfile
 openw,1,format
@@ -69,6 +69,10 @@ 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"'
+printf,1,'sarray SARRAY one two three four five six seven'
+printf,1,'data/msarray SARRAY eight nine ten eleven twelve'
+printf,1,'indir INDIR data carray'
+printf,1,'sindir SINDIR data sarray'
 close,1
 
 openw,1,form2
@@ -127,7 +131,7 @@ nume += check_simple(25, n, fields)
 ;  26: gd_nmfields_check
 n = gd_nfields(d, parent="data")
 nume += check_ok(26, d)
-nume += check_simple(26, n, 3)
+nume += check_simple(26, n, 4)
 
 ;  27: gd_mfield_list check
 n = gd_field_list(d, parent="data")
@@ -429,20 +433,20 @@ nume += check_simple(67, n, 2)
 ;  68: gd_field_list_by_type check
 n = gd_field_list(d, type=!GD.LINCOM_ENTRY)
 nume += check_ok(68, d)
-nume += check_simple(68, n, [ "lincom", "new2"  ])
+nume += check_simple(68, n, [ 'new2', 'lincom' ])
 
 ;  69: gd_nvectors check
 n = gd_nvectors(d)
 nume += check_ok(69, d)
-nume += check_simple(69, n, 22)
+nume += check_simple(69, n, 23)
 
 ;  70: gd_vector_list check
 n = gd_vector_list(d)
 nume += check_ok(70, d)
-nume += check_simple(70, n, [ 'INDEX', 'alias', 'bit', 'data', 'div', $
-  'lincom', 'linterp', 'mplex', 'mult', 'new1', 'new10', 'new2', 'new4', $
-  'new6', 'new7', 'new8', 'new9', 'phase', 'polynom', 'recip', 'sbit', $
-  'window' ])
+nume += check_simple(70, n, [ 'bit', 'div', 'data', 'mult', 'new1', 'new2', $
+  'new4', 'new6', 'new7', 'new8', 'new9', 'sbit', 'INDEX', 'alias', 'indir', $
+  'mplex', 'new10', 'phase', 'recip', 'lincom', 'window', 'linterp', $
+  'polynom' ])
 
 ;  71: gd_madd_lincom
 gd_add_lincom, d, "mnew2", "in1", 9.9D, 8.8D, "in2", 7.7D, 6.6D, $
@@ -903,7 +907,7 @@ nume += check_simple(129,n,!GD.INT8)
 ;  131: gd_validate
 n =  gd_validate(d, "new7")
 nume += check_error(131,d,!GD.E_BAD_CODE)
-nume += check_simple(131,n,-1)
+nume += check_simple(131,n,!GD.E_BAD_CODE)
 
 ;  133: gd_framenum
 n = gd_framenum(d, "data", 33.3, field_start=6)
@@ -1264,7 +1268,7 @@ 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' ])
+nume += check_simple(222, n, [ 'data', 'alias', 'new20', 'data/mnew20' ])
 
 ; 223: gd_include_affix check
 gd_include, d, 'format1', prefix='A', suffix='Z', /CREAT, /EXCL
@@ -1359,18 +1363,18 @@ 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)
+nume += check_simple2(237, 1, n, 6)
 n = gd_nentries(d, /VECTORS, /HIDDEN, /NOALIAS)
 nume += check_ok2(237, 2, d)
-nume += check_simple2(237, 2, n, 24)
+nume += check_simple2(237, 2, n, 25)
  
 ; 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", "new135", "new14", "new16", "new18", $
-  "new2", "new21", "new4", "new6", "new7", "new8", "phase", "polynom", $
-  "recip", "sbit", "window"])
+nume += check_simple(239, n, [ 'bit', 'div', 'data', 'mult', 'new1', 'new2', $
+  'new4', 'new6', 'new7', 'new8', 'sbit', 'INDEX', 'indir', 'mplex', 'new14', $
+  'new16', 'new18', 'new21', 'phase', 'recip', 'lincom', 'new135', 'window', $
+  'linterp', 'polynom' ])
 
 ; 240: gd_mplex_lookback check
 gd_mplex_lookback, d, /ALL
@@ -1617,8 +1621,193 @@ n = gd_get_carray(d, "carray", type=!GD.NULL, len=2, start=2)
 nume += check_ok(274, d)
 nume += check_simple(274, n, 0)
 
-
-
+;  277: gd_entry (SARRAY)
+n = gd_entry(d, "sarray")
+nume += check_ok(277, d)
+nume += check_simple2(277, 1, n.field_type, !GD.SARRAY_ENTRY)
+nume += check_simple2(277, 2, n.field, "sarray")
+nume += check_simple2(277, 3, n.fragment, 0)
+nume += check_simple2(277, 4, n.array_len, 7)
+
+;  278: gd_get_sarray
+n = gd_get_sarray(d, "sarray")
+nume += check_ok(278, d)
+nume += check_simple(278, n, $
+  [ 'one', 'two', 'three', 'four', 'five', 'six', 'seven' ])
+
+;  279: gd_get_sarray_slice
+n = gd_get_sarray(d, "sarray", len=2, start=2)
+nume += check_ok(279, d)
+nume += check_simple(279, n, [ 'three', 'four' ])
+
+;  281: gd_put_sarray
+m = [ 'eka', 'dvi', 'tri', 'catur', 'panca', 'sas', 'sapta' ]
+gd_put_sarray, d, "sarray", m
+nume += check_ok(281, d)
+
+n = gd_get_sarray(d, "sarray")
+nume += check_ok(281, d)
+nume += check_simple(281, n, m)
+
+;  282: gd_put_sarray_slice
+gd_put_sarray, d, "sarray", [ 'asta', 'nava' ], start=2
+nume += check_ok(282, d)
+
+n = gd_get_sarray(d, "sarray")
+nume += check_ok(282, d)
+nume += check_simple(282, n, $
+  [ 'eka', 'dvi', 'asta', 'nava', 'panca', 'sas', 'sapta' ])
+
+;  283: gd_add_sarray
+gd_add_sarray, d, "new283", value=['un', 'deux']
+nume += check_ok2(283, 1, d)
+
+n = gd_entry(d, "new283")
+nume += check_ok2(283, 2, d)
+nume += check_simple2(283, 1, n.field_type, !GD.SARRAY_ENTRY)
+nume += check_simple2(283, 2, n.field, "new283")
+nume += check_simple2(283, 3, n.fragment, 0)
+nume += check_simple2(283, 4, n.array_len, 2)
+
+n = gd_get_sarray(d, "new283")
+nume += check_ok2(283, 3, d)
+nume += check_simple2(283, 5, n, ['un', 'deux'])
+
+;  285: gd_madd_sarray
+gd_add_sarray, d, "mnew285", parent="data", value=['eins', 'zwei']
+nume += check_ok2(285, 1, d)
+
+n = gd_entry(d, "data/mnew285")
+nume += check_ok2(285, 2, d)
+nume += check_simple2(285, 1, n.field_type, !GD.SARRAY_ENTRY)
+nume += check_simple2(285, 2, n.field, "data/mnew285")
+nume += check_simple2(285, 3, n.fragment, 0)
+nume += check_simple2(285, 4, n.array_len, 2)
+
+n = gd_get_sarray(d, "data/mnew285")
+nume += check_ok2(285, 3, d)
+nume += check_simple2(285, 6, n, ['eins', 'zwei'])
+
+;  286: gd_alter_sarray
+gd_alter_sarray, d, "new283", len=3
+nume += check_ok2(286, 1, d)
+
+n = gd_entry(d, "new283")
+nume += check_ok2(286, 2, d)
+nume += check_simple2(286, 1, n.field_type, !GD.SARRAY_ENTRY)
+nume += check_simple2(286, 2, n.field, "new283")
+nume += check_simple2(286, 3, n.fragment, 0)
+nume += check_simple2(286, 4, n.array_len, 3)
+
+;  288: gd_entry (indir)
+n = gd_entry(d, "indir")
+nume += check_ok(288, d)
+nume += check_simple2(288, 1, n.field_type, !GD.INDIR_ENTRY)
+nume += check_simple2(288, 2, n.field, "indir")
+nume += check_simple2(288, 3, n.fragment, 0)
+nume += check_simple2(288, 4, n.in_fields, [ "data", "carray" ])
+
+;  289: gd_add_indir
+gd_add_indir, d, "new289", "in2", "in3"
+nume += check_ok2(289, 1, d)
+
+n = gd_entry(d, "new289")
+nume += check_ok(289, d)
+nume += check_simple2(289, 1, n.field_type, !GD.INDIR_ENTRY)
+nume += check_simple2(289, 2, n.field, "new289")
+nume += check_simple2(289, 3, n.fragment, 0)
+nume += check_simple2(289, 4, n.in_fields, [ "in2", "in3" ])
+
+;  291: gd_alter_indir
+gd_alter_indir, d, "new289", in_field1="in6"
+nume += check_ok2(291, 1, d)
+
+n = gd_entry(d, "new289")
+nume += check_ok(291, d)
+nume += check_simple2(291, 1, n.field_type, !GD.INDIR_ENTRY)
+nume += check_simple2(291, 2, n.field, "new289")
+nume += check_simple2(291, 3, n.fragment, 0)
+
+;  292: gd_entry (sindir)
+n = gd_entry(d, "sindir")
+nume += check_ok(292, d)
+nume += check_simple2(292, 1, n.field_type, !GD.SINDIR_ENTRY)
+nume += check_simple2(292, 2, n.field, "sindir")
+nume += check_simple2(292, 3, n.fragment, 0)
+nume += check_simple2(292, 4, n.in_fields, [ "data", "sarray" ])
+
+;  293: gd_add_sindir
+gd_add_sindir, d, "new293", "in2", "in3"
+nume += check_ok2(293, 1, d)
+
+n = gd_entry(d, "new293")
+nume += check_ok(293, d)
+nume += check_simple2(293, 1, n.field_type, !GD.SINDIR_ENTRY)
+nume += check_simple2(293, 2, n.field, "new293")
+nume += check_simple2(293, 3, n.fragment, 0)
+nume += check_simple2(293, 4, n.in_fields, [ "in2", "in3" ])
+
+;  295: gd_alter_sindir
+gd_alter_sindir, d, "new293", in_field1="in6"
+nume += check_ok2(295, 1, d)
+
+n = gd_entry(d, "new293")
+nume += check_ok(295, d)
+nume += check_simple2(295, 1, n.field_type, !GD.SINDIR_ENTRY)
+nume += check_simple2(295, 2, n.field, "new293")
+nume += check_simple2(295, 3, n.fragment, 0)
+nume += check_simple2(295, 4, n.in_fields, [ "in6", "in3" ])
+
+;  296: gd_getstrdata
+n = gd_getdata(d, "sindir", first_frame=0, num_frames=1)
+nume += check_ok(296, d)
+nume += check_simple(296, n, $
+  ['eka', 'eka', 'eka', 'eka', 'eka', 'eka', 'eka', 'eka'])
+
+;  300: gd_add (INDIR)
+n = {field: 'new300', field_type: !GD.INDIR_ENTRY, fragment: 0, $
+  in_fields: [ "in3", "in0"]};
+gd_add, d, n
+nume += check_ok2(300, 1, d)
+
+n = gd_entry(d, "new300")
+nume += check_ok2(300, 2, d)
+nume += check_simple2(300, 3, n.field_type, !GD.INDIR_ENTRY)
+nume += check_simple2(300, 4, n.field, "new300")
+nume += check_simple2(300, 5, n.fragment, 0)
+nume += check_simple2(300, 6, n.in_fields, [ "in3", "in0" ])
+
+;  301: gd_add (SINDIR)
+n = {field: 'new301', field_type: !GD.SINDIR_ENTRY, fragment: 0, $
+  in_fields: [ "in3", "in1"]};
+gd_add, d, n
+nume += check_ok2(301, 1, d)
+
+n = gd_entry(d, "new301")
+nume += check_ok2(301, 2, d)
+nume += check_simple2(301, 3, n.field_type, !GD.SINDIR_ENTRY)
+nume += check_simple2(301, 4, n.field, "new301")
+nume += check_simple2(301, 5, n.fragment, 0)
+nume += check_simple2(301, 6, n.in_fields, [ "in3", "in1" ])
+
+;  302: gd_include_ns
+gd_include, d, 'format2', namespace='ns', /CREAT, /EXCL
+nume += check_ok(302, d)
+
+;  303: gd_fragment_namespace (read)
+n = gd_fragment_namespace(d, fragment=2)
+nume += check_ok(303, d)
+nume += check_simple(303, n, 'ns')
+
+;  304: gd_fragment_namespace (alter)
+n = gd_fragment_namespace(d, fragment=2, namespace='ns2')
+nume += check_ok(304, d)
+nume += check_simple(304, n, 'ns2')
+
+;  305: gd_match_entries
+n = gd_match_entries(d, fragment=0, regex="^lin")
+nume += check_ok(305, d)
+nume += check_simple(305, n, [ "lincom", "linterp" ])
 
 
 
diff --git a/bindings/make_parameters.c b/bindings/make_parameters.c
index 4fc852b..4c8a002 100644
--- a/bindings/make_parameters.c
+++ b/bindings/make_parameters.c
@@ -147,8 +147,11 @@ static struct {
   CONSTANT(RECIP_ENTRY,      "GD_RCE", GDMP_ENTYPE),
   CONSTANT(WINDOW_ENTRY,     "GD_WDE", GDMP_ENTYPE),
   CONSTANT(MPLEX_ENTRY,      "GD_MXE", GDMP_ENTYPE),
+  CONSTANT(INDIR_ENTRY,      "GD_IDE", GDMP_ENTYPE),
+  CONSTANT(SINDIR_ENTRY,     "GD_SDE", GDMP_ENTYPE),
   CONSTANT(CONST_ENTRY,      "GD_COE", GDMP_ENTYPE),
   CONSTANT(CARRAY_ENTRY,     "GD_CAE", GDMP_ENTYPE),
+  CONSTANT(SARRAY_ENTRY,     "GD_SAE", GDMP_ENTYPE),
   CONSTANT(STRING_ENTRY,     "GD_STE", GDMP_ENTYPE),
 
   CONSTANT(NULL,             "GD_NUL", GDMP_DTYPE),
@@ -164,6 +167,7 @@ static struct {
   CONSTANT(FLOAT64,          "GD_F64", GDMP_DTYPE),
   CONSTANT(COMPLEX64,        "GD_C64", GDMP_DTYPE),
   CONSTANT(COMPLEX128,       "GDC128", GDMP_DTYPE),
+  CONSTANT(STRING,           "GD_STR", GDMP_DTYPE),
 
   CONSTANT(DEL_META,         "GDD_MT", GDMP_RFLAG),
   CONSTANT(DEL_DATA,         "GDD_DT", GDMP_RFLAG),
@@ -237,6 +241,13 @@ static struct {
   CONSTANT(ENTRIES_HIDDEN,   "GDEN_H", GDMP_ENLIST),
   CONSTANT(ENTRIES_NOALIAS,  "GDEN_N", GDMP_ENLIST),
 
+  CONSTANT(REGEX_PCRE,       "GDRX_P", GDMP_ENLIST),
+  CONSTANT(REGEX_EXTENDED,   "GDRX_X", GDMP_ENLIST),
+  CONSTANT(REGEX_ICASE,      "GDRX_I", GDMP_ENLIST),
+  CONSTANT(REGEX_CASELESS,   "GDRX_C", GDMP_ENLIST),
+  CONSTANT(REGEX_JAVASCRIPT, "GDRX_J", GDMP_ENLIST),
+  CONSTANT(REGEX_UNICODE,    "GDRX_U", GDMP_ENLIST),
+
   CONSTANT(EN_CALC,          "GDE_CA", GDMP_EFLAG),
   CONSTANT(EN_HIDDEN,        "GDE_HI", GDMP_EFLAG),
   CONSTANT(EN_COMPSCAL,      "GDE_CS", GDMP_EFLAG),
@@ -392,6 +403,7 @@ void Fortran(void)
     printf("/\n");
   }
   printf("s/@GD_MAX_LINE_LENGTH@/%i/\n", GD_MAX_LINE_LENGTH);
+  printf("s/@SIZEOF_VOID_P@/%i/\n", SIZEOF_VOID_P);
 }
 
 void Python(void)
diff --git a/bindings/matlab/Makefile.am b/bindings/matlab/Makefile.am
index 108ca5c..3ed2f9d 100644
--- a/bindings/matlab/Makefile.am
+++ b/bindings/matlab/Makefile.am
@@ -24,24 +24,28 @@ 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 \
+matlabfiles=gd_add_bit.m gd_add_divide.m gd_add_indir.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_sindir.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_divide.m gd_alter_indir.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_polynom.m gd_alter_raw.m gd_alter_recip.m \
+						gd_alter_sarray.m gd_alter_sbit.m gd_alter_sindir.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 \
+						gd_get_constant.m gd_madd_bit.m gd_madd_divide.m gd_madd_indir.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_sindir.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_put_sarray.m gd_vector_list.m \
 						getdata_constants.m
 mexfiles=gd_add gd_add_alias \
-				 gd_add_carray gd_add_const \
+				 gd_add_carray gd_add_const gd_add_sarray \
 				 gd_add_spec gd_add_string gd_aliases \
 				 gd_alias_target gd_alter_affixes \
 				 gd_alter_encoding gd_alter_endianness gd_alter_entry \
@@ -52,21 +56,22 @@ mexfiles=gd_add gd_add_alias \
 				 gd_discard gd_encoding gd_encoding_support 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_fragment_index gd_fragmentname gd_fragment_namespace \
 				 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_getdata gd_get_sarray gd_get_sarray_slice \
+				 gd_get_string gd_hidden gd_hide gd_include gd_include_affix \
+				 gd_invalid_dirfile gd_linterp_tablename gd_madd gd_madd_alias \
+				 gd_madd_carray gd_madd_const gd_madd_sarray \
 				 gd_madd_spec gd_madd_string \
-				 gd_malter_spec gd_mcarrays \
-				 gd_mconstants gd_metaflush gd_move gd_mplex_lookback \
+				 gd_malter_spec gd_match_entries gd_mcarrays \
+				 gd_mconstants gd_metaflush gd_move gd_mplex_lookback gd_msarrays \
 				 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_putdata gd_put_sarray_slice \
+				 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_sarrays 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})
@@ -114,4 +119,4 @@ getdata_constants.m: ../make_parameters
 	cd .. && ${MAKE} make_parameters
 
 clean-local:
-	rm -rf $(nodist_matlab_SCRIPTS)
+	rm -rf $(nodist_matlab_SCRIPTS) *~ *.gcno
diff --git a/bindings/matlab/Makefile.in b/bindings/matlab/Makefile.in
index a15afd5..548e051 100644
--- a/bindings/matlab/Makefile.in
+++ b/bindings/matlab/Makefile.in
@@ -287,6 +287,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
@@ -508,25 +510,29 @@ top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign
 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 \
+matlabfiles = gd_add_bit.m gd_add_divide.m gd_add_indir.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_sindir.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_divide.m gd_alter_indir.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_polynom.m gd_alter_raw.m gd_alter_recip.m \
+						gd_alter_sarray.m gd_alter_sbit.m gd_alter_sindir.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 \
+						gd_get_constant.m gd_madd_bit.m gd_madd_divide.m gd_madd_indir.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_sindir.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_put_sarray.m gd_vector_list.m \
 						getdata_constants.m
 
 mexfiles = gd_add gd_add_alias \
-				 gd_add_carray gd_add_const \
+				 gd_add_carray gd_add_const gd_add_sarray \
 				 gd_add_spec gd_add_string gd_aliases \
 				 gd_alias_target gd_alter_affixes \
 				 gd_alter_encoding gd_alter_endianness gd_alter_entry \
@@ -537,21 +543,22 @@ mexfiles = gd_add gd_add_alias \
 				 gd_discard gd_encoding gd_encoding_support 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_fragment_index gd_fragmentname gd_fragment_namespace \
 				 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_getdata gd_get_sarray gd_get_sarray_slice \
+				 gd_get_string gd_hidden gd_hide gd_include gd_include_affix \
+				 gd_invalid_dirfile gd_linterp_tablename gd_madd gd_madd_alias \
+				 gd_madd_carray gd_madd_const gd_madd_sarray \
 				 gd_madd_spec gd_madd_string \
-				 gd_malter_spec gd_mcarrays \
-				 gd_mconstants gd_metaflush gd_move gd_mplex_lookback \
+				 gd_malter_spec gd_match_entries gd_mcarrays \
+				 gd_mconstants gd_metaflush gd_move gd_mplex_lookback gd_msarrays \
 				 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_putdata gd_put_sarray_slice \
+				 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_sarrays 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})
@@ -1066,7 +1073,7 @@ getdata_constants.m: ../make_parameters
 	cd .. && ${MAKE} make_parameters
 
 clean-local:
-	rm -rf $(nodist_matlab_SCRIPTS)
+	rm -rf $(nodist_matlab_SCRIPTS) *~ *.gcno
 
 # 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/matlab/doc.tail b/bindings/matlab/doc.tail
index d02ffa7..960cbbd 100644
--- a/bindings/matlab/doc.tail
+++ b/bindings/matlab/doc.tail
@@ -1,5 +1,5 @@
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013-2016 D. V. Wiebe
 % 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % 
diff --git a/bindings/matlab/gd_add_indir.m b/bindings/matlab/gd_add_indir.m
new file mode 100644
index 0000000..feebde0
--- /dev/null
+++ b/bindings/matlab/gd_add_indir.m
@@ -0,0 +1,39 @@
+function gd_add_indir(D, field_code, in1, in2, fragment_index)
+% GD_ADD_INDIR  Add an INDIR field
+%
+%   GD_ADD_INDIR(DIRFILE,NAME,INPUT1,INPUT2,FRAGMENT) 
+%             adds an INDIR 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_indir(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_INDIR, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.INDIR_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {{in1; in2}}));
+end
+
+% Copyright (C) 2014 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General 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_sarray.c b/bindings/matlab/gd_add_sarray.c
new file mode 100644
index 0000000..6b4efd5
--- /dev/null
+++ b/bindings/matlab/gd_add_sarray.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_SARRAY  Add a SARRAY field
+ %
+ %   GD_ADD_SARRAY(DIRFILE,NAME,VALUES,FRAGMENT)
+ %             adds a SARRAY field called NAME to the dirfile specified by
+ %             DIRFILE.  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_sarray(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ADD, GD_MADD_SARRAY, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char **data;
+  char *field_name;
+  size_t n;
+  int fragment_index;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_name = gdmx_to_string(prhs, 1, 0);
+  gdmx_to_sdata(&data, &n, prhs[2], 2);
+  fragment_index = gdmx_to_int(prhs, 3);
+
+  gd_add_sarray(D, field_name, n, data, fragment_index);
+
+  gdmx_free_sdata(data, n);
+  mxFree(field_name);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_add_sindir.m b/bindings/matlab/gd_add_sindir.m
new file mode 100644
index 0000000..b3ca0ce
--- /dev/null
+++ b/bindings/matlab/gd_add_sindir.m
@@ -0,0 +1,39 @@
+function gd_add_sindir(D, field_code, in1, in2, fragment_index)
+% GD_ADD_INDIR  Add a SINDIR field
+%
+%   GD_ADD_INDIR(DIRFILE,NAME,INPUT1,INPUT2,FRAGMENT) 
+%             adds a SINDIR 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_sindir(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_INDIR, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.SINDIR_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {{in1; in2}}));
+end
+
+% Copyright (C) 2014 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General 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_indir.m b/bindings/matlab/gd_alter_indir.m
new file mode 100644
index 0000000..cb50eb2
--- /dev/null
+++ b/bindings/matlab/gd_alter_indir.m
@@ -0,0 +1,39 @@
+function gd_alter_indir(D, field_code, in1, in2)
+% GD_ALTER_INDIR  Modify the metadata of an INDIR field
+%
+%   GD_ALTER_INDIR(DIRFILE,NAME,INPUT1,INPUT2)
+%             modifies the metadata of the INDIR 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_indir(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.INDIR_ENTRY, ...
+  'in_fields', {{in1; in2}}), 0);
+end
+
+% Copyright (C) 2014 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General 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_sarray.m b/bindings/matlab/gd_alter_sarray.m
new file mode 100644
index 0000000..f9d3ace
--- /dev/null
+++ b/bindings/matlab/gd_alter_sarray.m
@@ -0,0 +1,39 @@
+function gd_alter_carray(D, field_code, array_len)
+% GD_ALTER_SARRAY  Modify the metadata of a SARRAY field
+%
+%   GD_ALTER_SARRAY(DIRFILE,NAME,LEN)
+%             modifies the metadata of the SARRAY field called NAME in the
+%             dirfile specified by DIRFILE, setting the the length of the
+%             SARRAY 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.SARRAY_ENTRY, ...
+  'array_len', array_len), 0);
+end
+
+% Copyright (C) 2014 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General 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_sindir.m b/bindings/matlab/gd_alter_sindir.m
new file mode 100644
index 0000000..38a095d
--- /dev/null
+++ b/bindings/matlab/gd_alter_sindir.m
@@ -0,0 +1,39 @@
+function gd_alter_sindir(D, field_code, in1, in2)
+% GD_ALTER_INDIR  Modify the metadata of a SINDIR field
+%
+%   GD_ALTER_INDIR(DIRFILE,NAME,INPUT1,INPUT2)
+%             modifies the metadata of the SINDIR 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_sindir(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.SINDIR_ENTRY, ...
+  'in_fields', {{in1; in2}}), 0);
+end
+
+% Copyright (C) 2014 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General 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_entry_list.c b/bindings/matlab/gd_entry_list.c
index d365921..c502982 100644
--- a/bindings/matlab/gd_entry_list.c
+++ b/bindings/matlab/gd_entry_list.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -23,7 +23,7 @@
 /*
  % GD_ENTRY_LIST  Retrieve a list of field names
  %
- %   L = GD_ENTRY_LIST(DIRFILE[,PARENT[,TYPE[,FLAGS]]])
+ %   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.
diff --git a/bindings/matlab/gd_error_string.c b/bindings/matlab/gd_error_string.c
index c6969eb..3494989 100644
--- a/bindings/matlab/gd_error_string.c
+++ b/bindings/matlab/gd_error_string.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -51,5 +51,5 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
   s = gd_error_string(D, NULL, 0);
 
   plhs[0] = gdmx_from_string(s);
-  free(s);
+  mxFree(s);
 }
diff --git a/bindings/matlab/gd_field_list.m b/bindings/matlab/gd_field_list.m
index 780b279..97aac5e 100644
--- a/bindings/matlab/gd_field_list.m
+++ b/bindings/matlab/gd_field_list.m
@@ -6,10 +6,10 @@ function field_list = gd_field_list(D)
 %
 %   See also GD_ENTRY_LIST
 
-  field_list = gd_entry_list(D, 0, 0, 0);
+  field_list = gd_entry_list(D);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_field_list_by_type.m b/bindings/matlab/gd_field_list_by_type.m
index f73869d..c5dcb27 100644
--- a/bindings/matlab/gd_field_list_by_type.m
+++ b/bindings/matlab/gd_field_list_by_type.m
@@ -6,10 +6,10 @@ function field_list = gd_field_list_by_type(D, type)
 %
 %   See also GD_ENTRY_LIST
 
-  field_list = gd_entry_list(D, 0, type, 0);
+  field_list = gd_entry_list(D, 0, type);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_fragment_affixes.c b/bindings/matlab/gd_fragment_affixes.c
index 7999a0c..544fcee 100644
--- a/bindings/matlab/gd_fragment_affixes.c
+++ b/bindings/matlab/gd_fragment_affixes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -55,6 +55,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
 
   plhs[0] = gdmx_from_string_list((const char**)al);
 
-  free(al[0]);
-  free(al[1]);
+  mxFree(al[0]);
+  mxFree(al[1]);
 }
diff --git a/bindings/matlab/gd_fragment_namespace.c b/bindings/matlab/gd_fragment_namespace.c
new file mode 100644
index 0000000..e0f95bd
--- /dev/null
+++ b/bindings/matlab/gd_fragment_namespace.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_NAMESPACE  Set and retrieve the root namespace of a fragment
+ %
+ %  NS = GD_FRAGMENT_AFFIXES(DIRFILE,FRAGMENT[,NAMESPACE])
+ %             returns the root namespace of the fragment specified by FRAGMENT
+ %             in the dirfile DIRFILE.  If a string NAMESPACE is specified,
+ %             the root namespace of the fragment is first updated to that
+ %             value before being returned.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_fragment_namespace(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ALTER_AFFIXES, GD_FRAGMENT_AFFIXES, GD_INCLUDE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  int fragment;
+  char *nsin = NULL;
+  const char *nsout;
+
+  GDMX_CHECK_RHS2(2,3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  fragment = gdmx_to_int(prhs, 1);
+  if (nrhs > 2)
+    nsin = gdmx_to_string(prhs, 2, 1);
+
+  nsout = gd_fragment_namespace(D, fragment, nsin);
+  mxFree(nsin);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = mxCreateString(nsout);
+}
diff --git a/bindings/matlab/gd_get_sarray.c b/bindings/matlab/gd_get_sarray.c
new file mode 100644
index 0000000..c71bcfc
--- /dev/null
+++ b/bindings/matlab/gd_get_sarray.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_SARRAY  Retrieve SARRAY data
+ %
+ %   A = GD_GET_SARRAY(DIRFILE,FIELD_CODE)
+ %             retrieves an array, A, of value of the SARRAY 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_sarray_slice(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_GET_SARRAY_SLICE, GD_PUT_SARRAY, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code;
+  size_t len;
+  const char **fl;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  len = gd_array_len(D, field_code);
+  gdmx_err(D, 0);
+
+  fl = mxMalloc(sizeof(*fl) * len);
+
+  gd_get_sarray(D, field_code, fl);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_nstring_list(fl, len);
+  mxFree(fl);
+}
diff --git a/bindings/matlab/gd_get_sarray_slice.c b/bindings/matlab/gd_get_sarray_slice.c
new file mode 100644
index 0000000..a257b87
--- /dev/null
+++ b/bindings/matlab/gd_get_sarray_slice.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_SARRAY_SLICE  Retrieve SARRAY data
+ %
+ %   A = GD_GET_SARRAY_SLICE(DIRFILE,FIELD_CODE,START,LEN)
+ %             retrieves a subset, A, of the SARRAY field called FIELD_CODE.
+ %             LEN elements are retrieved, starting with element START.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_get_sarray_slice(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_GET_SARRAY, GD_PUT_SARRAY_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;
+  const char **fl;
+
+  GDMX_CHECK_RHS(4);
+
+  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);
+
+  fl = mxMalloc(sizeof(*fl) * len);
+
+  gd_get_sarray_slice(D, field_code, start, len, fl);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_nstring_list(fl, len);
+  mxFree(fl);
+}
diff --git a/bindings/matlab/gd_getdata.c b/bindings/matlab/gd_getdata.c
index 56d97e7..16dcad4 100644
--- a/bindings/matlab/gd_getdata.c
+++ b/bindings/matlab/gd_getdata.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2013, 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -66,10 +66,22 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
     gdmx_err(D, 0);
   }
 
-  if (type == GD_NULL) {
+  if (gd_entry_type(D, field_code) == GD_SINDIR_ENTRY) {
+    const char **data = mxMalloc(sizeof(*data) * nsamp);
+
+    nsamp = gd_getdata64(D, field_code, (gd_off64_t)first_frame,
+        (gd_off64_t)first_samp, 0, nsamp, GD_STRING, data);
+
+    mxFree(field_code);
+    gdmx_err(D, 0);
+
+    plhs[0] = gdmx_from_nstring_list(data, nsamp);
+    mxFree(data);
+  } else if (type == GD_NULL) {
     nsamp = gd_getdata64(D, field_code, (gd_off64_t)first_frame,
         (gd_off64_t)first_samp, 0, nsamp, GD_NULL, NULL);
 
+    mxFree(field_code);
     gdmx_err(D, 0);
 
     plhs[0] = gdmx_from_int64(nsamp);
@@ -82,7 +94,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
     mxFree(field_code);
     gdmx_err(D, 0);
 
-
     gdmx_fix_vector(plhs[0], type, nsamp, data);
   }
 }
diff --git a/bindings/matlab/gd_include.c b/bindings/matlab/gd_include.c
index fc6551a..ad81a71 100644
--- a/bindings/matlab/gd_include.c
+++ b/bindings/matlab/gd_include.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,21 @@
 #include "gd_matlab.h"
 
 /*
- % GD_INCLUDE  Add a format metadata fragment
+ % GD_INCLUDE  Add a format metadata fragment with a namespace
  %
- %   GD_INCLUDE(DIRFILE,PATH,PARENT,FLAGS[,PREFIX[,SUFFIX]])
+ %   GD_INCLUDE(DIRFILE,PATH,PARENT,[NS[,FLAGS]])
  %             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.
+ %             current fragment indexed by PARENT, using NS, if given, as the
+ %             new fragment's root namespace.  If given, FLAGS should be
+ %             zero or more Dirfile open flags provided by GETDATA_CONSTANTS,
+ %             bitwise-or'd together.
  %
  %   The DIRFILE object should have previously been created with GD_OPEN.
  %
- %   See the documentation on the C API function gd_include_affix(3) in
+ %   See the documentation on the C API function gd_include_ns(3) in
  %   section 3 of the UNIX manual for more details.
  %
- %   See also GD_UNINCLUDE, GD_FRAGMENT_AFFIXES, GD_ALTER_AFFIXEX, GD_OPEN
+ %   See also GD_INCLUDE_AFFIX, GD_UNINCLUDE, GD_FRAGMENT_NAMESPACE, GD_OPEN
  */
 
 void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
@@ -43,26 +43,24 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
   DIRFILE *D;
   void *data;
   char *filename;
-  char *prefix = NULL, *suffix = NULL;
+  char *ns = NULL;
   int parent, n;
-  unsigned long flags;
+  unsigned long flags = 0;
 
-  GDMX_CHECK_RHS2(4,6);
+  GDMX_CHECK_RHS2(3,5);
 
   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 > 3)
+    ns = gdmx_to_string(prhs, 3, 1);
   if (nrhs > 4)
-    prefix = gdmx_to_string(prhs, 4, 1);
-  if (nrhs > 5)
-    suffix = gdmx_to_string(prhs, 5, 1);
+    flags = gdmx_to_ulong(prhs, 4);
 
-  n = gd_include_affix(D, filename, parent, prefix, suffix, flags);
+  n = gd_include_ns(D, filename, parent, ns, flags);
 
   mxFree(filename);
-  mxFree(prefix);
-  mxFree(suffix);
+  mxFree(ns);
   gdmx_err(D, 0);
 
   plhs[0] = gdmx_from_int(n);
diff --git a/bindings/matlab/gd_include_affix.c b/bindings/matlab/gd_include_affix.c
new file mode 100644
index 0000000..3951d51
--- /dev/null
+++ b/bindings/matlab/gd_include_affix.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2013, 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_AFFIX(DIRFILE,PATH,PARENT[,PREFIX[,SUFFIX[,FLAGS]]])
+ %             adds the fragment at PATH to the open dirfile DIRFILE below the
+ %             current fragment indexed by PARENT.  If given, FLAGS should be
+ %             zero or more Dirfile open 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_INCLUDE, GD_UNINCLUDE, GD_FRAGMENT_AFFIXES, GD_ALTER_AFFIXES,
+ %   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 = 0;
+
+  GDMX_CHECK_RHS2(3,6);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  filename = gdmx_to_string(prhs, 1, 0);
+  parent = gdmx_to_int(prhs, 2);
+  if (nrhs > 3)
+    prefix = gdmx_to_string(prhs, 3, 1);
+  if (nrhs > 4)
+    suffix = gdmx_to_string(prhs, 4, 1);
+  if (nrhs > 5)
+    flags = gdmx_to_ulong(prhs, 5);
+
+  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
index 4b01565..926b5e5 100644
--- a/bindings/matlab/gd_invalid_dirfile.c
+++ b/bindings/matlab/gd_invalid_dirfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -39,6 +39,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
 
   GDMX_CHECK_RHS(0);
 
+  gdmx_initialise();
+
   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
index 028573c..68495c2 100644
--- a/bindings/matlab/gd_linterp_tablename.c
+++ b/bindings/matlab/gd_linterp_tablename.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -38,8 +38,7 @@
 void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
 {
   DIRFILE *D;
-  const char *s;
-  char *field_code;
+  char *s, *field_code;
 
   GDMX_CHECK_RHS(2);
 
@@ -52,4 +51,5 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
   gdmx_err(D, 0);
 
   plhs[0] = mxCreateString(s);
+  mxFree(s);
 }
diff --git a/bindings/matlab/gd_madd_indir.m b/bindings/matlab/gd_madd_indir.m
new file mode 100644
index 0000000..73d5e11
--- /dev/null
+++ b/bindings/matlab/gd_madd_indir.m
@@ -0,0 +1,38 @@
+function gd_madd_indir(D, parent, field_code, in1, in2)
+% GD_MADD_INDIR  Add an INDIR metafield
+%
+%   GD_MADD_INDIR(DIRFILE,PARENT,NAME,INPUT1,INPUT2)
+%             adds an INDIR 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_indir(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_INDIR, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.INDIR_ENTRY, ...
+  'in_fields', {{in1; in2}}), parent);
+end
+
+% Copyright (C) 2014 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General 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_sarray.c b/bindings/matlab/gd_madd_sarray.c
new file mode 100644
index 0000000..8771188
--- /dev/null
+++ b/bindings/matlab/gd_madd_sarray.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_SARRAY  Add a SARRAY field
+ %
+ %   GD_MADD_SARRAY(DIRFILE,PARENT,NAME,TYPE,VALUES)
+ %             adds a SARRAY metafield called NAME to the dirfile specified by
+ %             DIRFILE under parent field PARENT.  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_sarray(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MADD, GD_ADD_SARRAY, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char **data;
+  char *field_name, *parent;
+  size_t n;
+
+  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);
+  gdmx_to_sdata(&data, &n, prhs[3], 3);
+
+  gd_madd_sarray(D, parent, field_name, n, data);
+
+  gdmx_free_sdata(data, n);
+  mxFree(field_name);
+  mxFree(parent);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_madd_sindir.m b/bindings/matlab/gd_madd_sindir.m
new file mode 100644
index 0000000..a23459a
--- /dev/null
+++ b/bindings/matlab/gd_madd_sindir.m
@@ -0,0 +1,38 @@
+function gd_madd_sindir(D, parent, field_code, in1, in2)
+% GD_MADD_INDIR  Add an SINDIR metafield
+%
+%   GD_MADD_INDIR(DIRFILE,PARENT,NAME,INPUT1,INPUT2)
+%             adds an SINDIR 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_sindir(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_INDIR, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.SINDIR_ENTRY, ...
+  'in_fields', {{in1; in2}}), parent);
+end
+
+% Copyright (C) 2014 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General 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_match_entries.c b/bindings/matlab/gd_match_entries.c
new file mode 100644
index 0000000..3ffc979
--- /dev/null
+++ b/bindings/matlab/gd_match_entries.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_MATCH_ENTRIES  Retrieve a list of field names
+ %
+ %   L = GD_MATCH_ENTRIES(DIRFILE [, REGEX [, FRAGMENT [, TYPE [, FLAGS]]]])
+ %             returns a cell array of strings, L, listing all fields in the
+ %             dirfile DIRFILE which satisfy the supplied REGEX, FRAGMENT,
+ %             TYPE, and/or FLAGS.
+ %
+ %   If REGEX is given, and not numeric zero, it provides a regular expression
+ %   to match against the field lists.  If FRAGMENT is given and not
+ %   GD.ALL_FRAGMENTS, only the specified fragment is searched.  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_... and GD.REGEX_... 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_match_entries(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 *regex = NULL;
+  int fragment = GD_ALL_FRAGMENTS, type = 0;
+  unsigned int flags = 0;
+  const char **fl;
+
+  GDMX_CHECK_RHS2(1,5);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    regex = gdmx_to_string(prhs, 1, 1);
+  if (nrhs > 2)
+    fragment = gdmx_to_int(prhs, 2);
+  if (nrhs > 3)
+    type = gdmx_to_int(prhs, 3);
+  if (nrhs > 4)
+    flags = gdmx_to_uint(prhs, 4);
+
+  gd_match_entries(D, regex, fragment, type, flags, &fl);
+
+  mxFree(regex);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_string_list(fl);
+}
diff --git a/bindings/matlab/gd_matlab.h b/bindings/matlab/gd_matlab.h
index fbd2c01..bf425a8 100644
--- a/bindings/matlab/gd_matlab.h
+++ b/bindings/matlab/gd_matlab.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2013, 2014, 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -87,6 +87,9 @@
 extern "C" {
 #endif
 
+/* initialiser */
+void gdmx_initialise(void);
+
 void gdmx_err(DIRFILE *, int);
 mxClassID gdmx_classid(gd_type_t);
 void gdmx_free_entry(gd_entry_t *);
diff --git a/bindings/matlab/gd_mfield_list.m b/bindings/matlab/gd_mfield_list.m
index 864fde0..4b43879 100644
--- a/bindings/matlab/gd_mfield_list.m
+++ b/bindings/matlab/gd_mfield_list.m
@@ -6,10 +6,10 @@ function field_list = gd_mfield_list(D, parent)
 %
 %   See also GD_ENTRY_LIST
 
-  field_list = gd_entry_list(D, parent, 0, 0);
+  field_list = gd_entry_list(D, parent);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_mfield_list_by_type.m b/bindings/matlab/gd_mfield_list_by_type.m
index f5f36f6..e5a63eb 100644
--- a/bindings/matlab/gd_mfield_list_by_type.m
+++ b/bindings/matlab/gd_mfield_list_by_type.m
@@ -6,10 +6,10 @@ function field_list = gd_mfield_list_by_type(D, parent, type)
 %
 %   See also GD_ENTRY_LIST
 
-  field_list = gd_entry_list(D, parent, type, 0);
+  field_list = gd_entry_list(D, parent, type);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_msarrays.c b/bindings/matlab/gd_msarrays.c
new file mode 100644
index 0000000..139ba9e
--- /dev/null
+++ b/bindings/matlab/gd_msarrays.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_MSARRAYS  Fetch all CARRAY metafield values
+ %
+ %   A = GD_MSARRAYS(DIRFILE,PARENT)
+ %             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 DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_msarrays(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_SARRAYS, GD_MFIELD_LIST_BY_TYPE, GD_GET_CARRAY_SLICE
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char ***l;
+  char *parent;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  parent = gdmx_to_string(prhs, 1, 0);
+
+  l = gd_msarrays(D, parent);
+  mxFree(parent);
+
+  gdmx_err(D, 0);
+
+  /* convert to array of arrays */
+  plhs[0] = gdmx_from_sarrays(l);
+}
diff --git a/bindings/matlab/gd_mvector_list.m b/bindings/matlab/gd_mvector_list.m
index ade6ebc..175b03e 100644
--- a/bindings/matlab/gd_mvector_list.m
+++ b/bindings/matlab/gd_mvector_list.m
@@ -10,10 +10,10 @@ function field_list = gd_mvector_list(D, parent)
 %   See also GD_ENTRY_LIST, GETDATA_CONSTANTS
 
   GD = getdata_constants();
-  field_list = gd_entry_list(D, parent, GD.VECTOR_ENTRIES, 0);
+  field_list = gd_entry_list(D, parent, GD.VECTOR_ENTRIES);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_nentries.c b/bindings/matlab/gd_nentries.c
index 6cb26e6..eb5824d 100644
--- a/bindings/matlab/gd_nentries.c
+++ b/bindings/matlab/gd_nentries.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -23,16 +23,16 @@
 /*
  % GD_NENTRIES  Retrieve a count of fields
  %
- %   N = GD_NENTRIES(DIRFILE[,PARENT[,TYPE[,FLAGS]]])
+ %   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.
+ %   considered.  If non-zero, 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.
  %
diff --git a/bindings/matlab/gd_nfields.m b/bindings/matlab/gd_nfields.m
index bd63c37..926fc3e 100644
--- a/bindings/matlab/gd_nfields.m
+++ b/bindings/matlab/gd_nfields.m
@@ -6,10 +6,10 @@ function nfields = gd_nfields(D)
 %
 %   See also GD_NENTRIES
 
-  nfields = gd_nentries(D, 0, 0, 0);
+  nfields = gd_nentries(D);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_nfields_by_type.m b/bindings/matlab/gd_nfields_by_type.m
index 78db654..adaa61f 100644
--- a/bindings/matlab/gd_nfields_by_type.m
+++ b/bindings/matlab/gd_nfields_by_type.m
@@ -6,10 +6,10 @@ function nfields = gd_nfields_by_type(D, type)
 %
 %   See also GD_NENTRIES
 
-  nfields = gd_nentries(D, 0, type, 0);
+  nfields = gd_nentries(D, 0, type);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_nmfields.m b/bindings/matlab/gd_nmfields.m
index 551355c..b08d17a 100644
--- a/bindings/matlab/gd_nmfields.m
+++ b/bindings/matlab/gd_nmfields.m
@@ -6,10 +6,10 @@ function nfields = gd_nmfields(D, parent)
 %
 %   See also GD_NENTRIES
 
-  nfields = gd_nentries(D, parent, 0, 0);
+  nfields = gd_nentries(D, parent);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_nmfields_by_type.m b/bindings/matlab/gd_nmfields_by_type.m
index dca8cee..317fd4a 100644
--- a/bindings/matlab/gd_nmfields_by_type.m
+++ b/bindings/matlab/gd_nmfields_by_type.m
@@ -6,10 +6,10 @@ function nfields = gd_nmfields_by_type(D, parent, type)
 %
 %   See also GD_NENTRIES
 
-  nfields = gd_nentries(D, parent, type, 0);
+  nfields = gd_nentries(D, parent, type);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_nmvectors.m b/bindings/matlab/gd_nmvectors.m
index f5780cd..d97a2e0 100644
--- a/bindings/matlab/gd_nmvectors.m
+++ b/bindings/matlab/gd_nmvectors.m
@@ -10,10 +10,10 @@ function nfields = gd_nmvectors(D, parent)
 %   See also GD_NENTRIES, GETDATA_CONSTANTS
 
   GD = getdata_constants();
-  nfields = gd_nentries(D, parent, GD.VECTOR_ENTRIES, 0);
+  nfields = gd_nentries(D, parent, GD.VECTOR_ENTRIES);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_nvectors.m b/bindings/matlab/gd_nvectors.m
index e7dabc7..a7138ca 100644
--- a/bindings/matlab/gd_nvectors.m
+++ b/bindings/matlab/gd_nvectors.m
@@ -10,10 +10,10 @@ function nvectors = gd_nvectors(D)
 %   See also GD_NENTRIES, GETDATA_CONSTANTS
 
   GD = getdata_constants();
-  nvectors = gd_nentries(D, 0, GD.VECTOR_ENTRIES, 0);
+  nvectors = gd_nentries(D, 0, GD.VECTOR_ENTRIES);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/gd_open.c b/bindings/matlab/gd_open.c
index 4b579f9..38bb7ab 100644
--- a/bindings/matlab/gd_open.c
+++ b/bindings/matlab/gd_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -53,6 +53,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
   if (nrhs > 1)
     flags = gdmx_to_ulong(prhs, 1);
 
+  gdmx_initialise();
+
   D = gd_open(filename, flags);
   mxFree(filename);
 
diff --git a/bindings/matlab/gd_put_sarray.m b/bindings/matlab/gd_put_sarray.m
new file mode 100644
index 0000000..ddbffee
--- /dev/null
+++ b/bindings/matlab/gd_put_sarray.m
@@ -0,0 +1,31 @@
+function gd_put_sarray(D, field_code, data)
+% GD_PUT_SARRAY  Modify SARRAY values
+%
+%   GD_PUT_SARRAY(DIRFILE,FIELD_CODE,DATA)
+%             is equivalent to calling GD_PUT_SARRAY_SLICE(DIRFILE, ...
+%                                                             FIELD_CODE,0,DATA)
+%
+%   See also GD_PUT_SARRAY_SLICE
+
+  gd_put_sarray_slice(D, field_code, 0, data);
+end
+
+% Copyright (C) 2014 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General 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_sarray_slice.c b/bindings/matlab/gd_put_sarray_slice.c
new file mode 100644
index 0000000..34c1ba8
--- /dev/null
+++ b/bindings/matlab/gd_put_sarray_slice.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_SARRAY_SLICE  Modify SARRAY or STRING values
+ %
+ %   GD_PUT_SARRAY_SLICE(DIRFILE,FIELD_CODE,START,VALUES)
+ %             sets elements of the SARRAY or STRING 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_sarray_slice(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_GET_SARRAY_SLICE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char **data;
+  char *field_code;
+  unsigned int start;
+  size_t n;
+
+  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_sdata(&data, &n, prhs[3], 3);
+
+  gd_put_sarray_slice(D, field_code, start, n, data);
+
+  gdmx_free_sdata(data, n);
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_raw_filename.c b/bindings/matlab/gd_raw_filename.c
index df1f25c..4b6606a 100644
--- a/bindings/matlab/gd_raw_filename.c
+++ b/bindings/matlab/gd_raw_filename.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -38,8 +38,7 @@
 void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
 {
   DIRFILE *D;
-  const char *s;
-  char *field_code;
+  char *s, *field_code;
 
   GDMX_CHECK_RHS(2);
 
@@ -52,4 +51,5 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
   gdmx_err(D, 0);
 
   plhs[0] = mxCreateString(s);
+  mxFree(s);
 }
diff --git a/bindings/matlab/gd_sarrays.c b/bindings/matlab/gd_sarrays.c
new file mode 100644
index 0000000..3236485
--- /dev/null
+++ b/bindings/matlab/gd_sarrays.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_SARRAYS  Fetch all SARRAY values
+ %
+ %   A = GD_SARRAYS(DIRFILE)
+ %             returns a cell array of cell arrays of strings, A, containing
+ %             all the SARRAY 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_sarrays(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MSARRAYS, GD_FIELD_LIST_BY_TYPE, GD_GET_SARRAY_SLICE
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char ***l;
+
+  GDMX_CHECK_RHS(1);
+
+  D = gdmx_to_dirfile(prhs[0]);
+
+  l = gd_sarrays(D);
+
+  gdmx_err(D, 0);
+
+  /* convert to array of arrays */
+  plhs[0] = gdmx_from_sarrays(l);
+}
diff --git a/bindings/matlab/gd_strtok.c b/bindings/matlab/gd_strtok.c
index 0c89a7d..cfa82e1 100644
--- a/bindings/matlab/gd_strtok.c
+++ b/bindings/matlab/gd_strtok.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -57,7 +57,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
 
     sl = ptr;
     sl[n++] = mxCreateString(tok);
-    free(tok);
+    mxFree(tok);
   }
 
   gdmx_err(D, 0);
diff --git a/bindings/matlab/gd_vector_list.m b/bindings/matlab/gd_vector_list.m
index 2b145ba..bda3db0 100644
--- a/bindings/matlab/gd_vector_list.m
+++ b/bindings/matlab/gd_vector_list.m
@@ -10,10 +10,10 @@ function field_list = gd_vector_list(D)
 %   See also GD_ENTRY_LIST, GETDATA_CONSTANTS
 
   GD = getdata_constants();
-  field_list = gd_entry_list(D, 0, GD.VECTOR_ENTRIES, 0);
+  field_list = gd_entry_list(D, 0, GD.VECTOR_ENTRIES);
 end
 
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
diff --git a/bindings/matlab/getdata_constants.m b/bindings/matlab/getdata_constants.m
index 8090715..9118ed6 100644
--- a/bindings/matlab/getdata_constants.m
+++ b/bindings/matlab/getdata_constants.m
@@ -31,49 +31,49 @@ function GD = getdata_constants()
 %   See also GETDATA
 
   GD = struct(...
-    'VERSION', '0.9.4a', ...
+    'VERSION', '0.10.0', ...
     'E_OK', int32(0), ...
-    'E_FORMAT', int32(2), ...
-    'E_CREAT', int32(4), ...
-    'E_BAD_CODE', int32(5), ...
-    'E_BAD_TYPE', int32(6), ...
-    'E_IO', int32(7), ...
-    'E_INTERNAL_ERROR', int32(9), ...
-    'E_ALLOC', int32(10), ...
-    'E_RANGE', int32(11), ...
-    'E_LUT', 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(5), ...
-    'E_BOUNDS', int32(35), ...
-    'E_LINE_TOO_LONG', int32(36), ...
-    'E_BAD_ENDIANNESS', int32(27), ...
-    'E_BAD_PROTECTION', int32(27), ...
-    'E_BAD_VERSION', int32(27), ...
-    'E_OPEN_LINFILE', int32(12), ...
-    'E_FLUSH', int32(7), ...
-    'E_OPEN', int32(7), ...
-    'E_OPEN_FRAGMENT', int32(7), ...
-    'E_OPEN_INCLUDE', int32(7), ...
-    'E_RAW_IO', int32(7), ...
-    'E_TRUNC', int32(7), ...
+    'E_FORMAT', int32(-1), ...
+    'E_CREAT', int32(-2), ...
+    'E_BAD_CODE', int32(-3), ...
+    'E_BAD_TYPE', int32(-4), ...
+    'E_IO', int32(-5), ...
+    'E_INTERNAL_ERROR', int32(-6), ...
+    'E_ALLOC', int32(-7), ...
+    'E_RANGE', int32(-8), ...
+    'E_LUT', int32(-9), ...
+    'E_RECURSE_LEVEL', int32(-10), ...
+    'E_BAD_DIRFILE', int32(-11), ...
+    'E_BAD_FIELD_TYPE', int32(-12), ...
+    'E_ACCMODE', int32(-13), ...
+    'E_UNSUPPORTED', int32(-14), ...
+    'E_UNKNOWN_ENCODING', int32(-15), ...
+    'E_BAD_ENTRY', int32(-16), ...
+    'E_DUPLICATE', int32(-17), ...
+    'E_DIMENSION', int32(-18), ...
+    'E_BAD_INDEX', int32(-19), ...
+    'E_BAD_SCALAR', int32(-20), ...
+    'E_BAD_REFERENCE', int32(-21), ...
+    'E_PROTECTED', int32(-22), ...
+    'E_DELETE', int32(-23), ...
+    'E_ARGUMENT', int32(-24), ...
+    'E_CALLBACK', int32(-25), ...
+    'E_EXISTS', int32(-26), ...
+    'E_UNCLEAN_DB', int32(-27), ...
+    'E_DOMAIN', int32(-28), ...
+    'E_BAD_REPR', int32(-3), ...
+    'E_BOUNDS', int32(-29), ...
+    'E_LINE_TOO_LONG', int32(-30), ...
+    'E_BAD_ENDIANNESS', int32(-24), ...
+    'E_BAD_PROTECTION', int32(-24), ...
+    'E_BAD_VERSION', int32(-24), ...
+    'E_OPEN_LINFILE', int32(-9), ...
+    'E_FLUSH', int32(-5), ...
+    'E_OPEN', int32(-5), ...
+    'E_OPEN_FRAGMENT', int32(-5), ...
+    'E_OPEN_INCLUDE', int32(-5), ...
+    'E_RAW_IO', int32(-5), ...
+    'E_TRUNC', int32(-5), ...
     'RDONLY', int32(0), ...
     'RDWR', int32(1), ...
     'FORCE_ENDIAN', int32(2), ...
@@ -117,8 +117,11 @@ function GD = getdata_constants()
     'RECIP_ENTRY', int32(11), ...
     'WINDOW_ENTRY', int32(12), ...
     'MPLEX_ENTRY', int32(13), ...
+    'INDIR_ENTRY', int32(14), ...
+    'SINDIR_ENTRY', int32(15), ...
     'CONST_ENTRY', int32(16), ...
     'CARRAY_ENTRY', int32(18), ...
+    'SARRAY_ENTRY', int32(19), ...
     'STRING_ENTRY', int32(17), ...
     'NULL', int32(0), ...
     'UINT8', int32(1), ...
@@ -133,6 +136,7 @@ function GD = getdata_constants()
     'FLOAT64', int32(136), ...
     'COMPLEX64', int32(264), ...
     'COMPLEX128', int32(272), ...
+    'STRING', int32(520), ...
     'DEL_META', int32(1), ...
     'DEL_DATA', int32(2), ...
     'DEL_DEREF', int32(4), ...
@@ -196,12 +200,18 @@ function GD = getdata_constants()
     'ALIAS_ENTRIES', int32(-1), ...
     'ENTRIES_HIDDEN', int32(1), ...
     'ENTRIES_NOALIAS', int32(2), ...
+    'REGEX_PCRE', int32(4), ...
+    'REGEX_EXTENDED', int32(8), ...
+    'REGEX_ICASE', int32(16), ...
+    'REGEX_CASELESS', int32(16), ...
+    'REGEX_JAVASCRIPT', int32(32), ...
+    'REGEX_UNICODE', int32(64), ...
     'EN_CALC', int32(2), ...
     'EN_HIDDEN', int32(4), ...
     'EN_COMPSCAL', int32(1), ...
     'ALL_FRAGMENTS', int32(-1), ...
     'DEFAULT_LOOKBACK', int32(10), ...
-    'DIRFILE_STANDARDS_VERSION', int32(9), ...
+    'DIRFILE_STANDARDS_VERSION', int32(10), ...
     'HERE', int32(-1), ...
     'LOOKBACK_ALL', int32(-1), ...
     'MAX_LINE_LENGTH', int32(4096) ...
diff --git a/bindings/matlab/matlab.c b/bindings/matlab/matlab.c
index 1b0e9c4..d0a415a 100644
--- a/bindings/matlab/matlab.c
+++ b/bindings/matlab/matlab.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2013, 2014, 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -51,18 +51,25 @@
 #endif
 #include <string.h>
 
+void gdmx_initialise(void)
+{
+  static int initialised = 0;
+
+  if (!initialised) {
+    gd_alloc_funcs(mxMalloc, mxFree);
+    initialised = 1;
+  }
+}
+
 #define GD_LIBCOMP "GetData:Lib:"
 static const char *gdmx_msgid[GD_N_ERROR_CODES] =
 {
   NULL, /* GD_E_OK */
-  GD_LIBCOMP "Error01", /* unused */
   GD_LIBCOMP "Format",
-  GD_LIBCOMP "Error03", /* unused */
   GD_LIBCOMP "Creat",
   GD_LIBCOMP "BadCode",
   GD_LIBCOMP "BadType",
   GD_LIBCOMP "IO",
-  GD_LIBCOMP "Error08", /* unused */
   GD_LIBCOMP "InternalError",
   GD_LIBCOMP "Alloc",
   GD_LIBCOMP "Range",
@@ -86,17 +93,10 @@ static const char *gdmx_msgid[GD_N_ERROR_CODES] =
   GD_LIBCOMP "Exists",
   GD_LIBCOMP "UncleanDB",
   GD_LIBCOMP "Domain",
-  GD_LIBCOMP "Error32", /* unused */
-  GD_LIBCOMP "Error33", /* unused */
-  GD_LIBCOMP "Error34", /* unused */
   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;
@@ -137,13 +137,10 @@ const char *gdmx_context(const struct gdmx_context_t *x, int uc)
 /* doesn't return on error */
 void gdmx_err(DIRFILE *D, int discard)
 {
+  char *gdmx_estring;
+  int gdmx_errno;
   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) {
@@ -160,7 +157,8 @@ void gdmx_err(DIRFILE *D, int discard)
   gd_colclear();
 #endif
 
-  mexErrMsgIdAndTxt(gdmx_msgid[gdmx_errno], gdmx_estring);
+  mexErrMsgIdAndTxt(gdmx_msgid[-gdmx_errno], gdmx_estring);
+  mxFree(gdmx_estring);
 }
 
 static gd_type_t gdmx_type(const mxArray *a, const struct gdmx_context_t *ctx,
@@ -857,6 +855,8 @@ mxArray *gdmx_from_entry(const gd_entry_t *E)
   const int recip_nfields = GDMX_NSCALAR + 2;
   const char *recip_fields[] = {GDMX_COMMON_FIELDS, "in_fields", "dividend",
     GDMX_SCALAR_FIELDS};
+  const int sarray_nfields = 1;
+  const char *sarray_fields[] = {GDMX_COMMON_FIELDS, "array_len"};
   const int window_nfields = GDMX_NSCALAR + 3;
   const char *window_fields[] = {GDMX_COMMON_FIELDS, "in_fields", "windop",
     "threshold", GDMX_SCALAR_FIELDS};
@@ -870,6 +870,10 @@ mxArray *gdmx_from_entry(const gd_entry_t *E)
       nfields = GDMX_NCOMMON + bit_nfields;
       field_names = bit_fields;
       break;
+    case GD_SARRAY_ENTRY:
+      nfields = GDMX_NCOMMON + sarray_nfields;
+      field_names = sarray_fields;
+      break;
     case GD_CARRAY_ENTRY:
       nfields = GDMX_NCOMMON + carray_nfields;
       field_names = carray_fields;
@@ -897,6 +901,8 @@ mxArray *gdmx_from_entry(const gd_entry_t *E)
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       nfields = GDMX_NCOMMON + multiply_nfields;
       field_names = multiply_fields;
       break;
@@ -979,6 +985,8 @@ mxArray *gdmx_from_entry(const gd_entry_t *E)
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       mxSetField(lhs, 0, "in_fields",
           gdmx_from_nstring_list((const char**)E->in_fields, 2));
       break;
@@ -1020,6 +1028,10 @@ mxArray *gdmx_from_entry(const gd_entry_t *E)
             E->EN(window,windop)));
       nscalar = 1;
       break;
+    case GD_SARRAY_ENTRY:
+      mxSetField(lhs, 0, "array_len",
+          gdmx_from_size_t(E->EN(scalar,array_len)));
+      break;
     default:
       GDMX_INTERNAL_ERROR;
   }
@@ -1080,6 +1092,27 @@ mxArray *gdmx_from_carrays(const gd_carray_t *c, gd_type_t type)
   return lhs;
 }
 
+mxArray *gdmx_from_sarrays(const char ***l)
+{
+  mxArray *lhs;
+  size_t i, n;
+
+  dtrace("%p", l);
+
+  /* count */
+  for (n = 0; l[n]; ++n)
+    ;
+
+  /* create and populate cell array of cell arrays */
+  lhs = mxCreateCellMatrix(1, n);
+  for (i = 0; i < n; ++i)
+    mxSetCell(lhs, i, gdmx_from_string_list(l[i]));
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+
 #define GDMX_MXDIRFILE_FMT "MXDIRFILE:%p;"
 mxArray *gdmx_from_dirfile(const DIRFILE *D)
 {
@@ -1138,6 +1171,8 @@ void gdmx_free_entry(gd_entry_t *E)
         break;
       case GD_DIVIDE_ENTRY:
       case GD_MULTIPLY_ENTRY:
+      case GD_INDIR_ENTRY:
+      case GD_SINDIR_ENTRY:
         ni = 2;
         break;
       case GD_BIT_ENTRY:
@@ -1272,6 +1307,10 @@ gd_entry_t *gdmx_to_entry(const mxArray **rhs, int n, unsigned flags)
       gdmx_convert_struct_scalar(rhs[n], &ctx, "numbits", GD_INT_TYPE,
           &E->EN(bit,numbits));
       break;
+    case GD_SARRAY_ENTRY:
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "array_len", GD_UINT64, &s);
+      E->EN(scalar,array_len) = (size_t)s;
+      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;
@@ -1282,6 +1321,8 @@ gd_entry_t *gdmx_to_entry(const mxArray **rhs, int n, unsigned flags)
       break;
     case GD_DIVIDE_ENTRY:
     case GD_MULTIPLY_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       gdmx_convert_in_fields(rhs[n], &ctx, E);
       break;
     case GD_LINCOM_ENTRY:
diff --git a/bindings/matlab/test/Makefile.in b/bindings/matlab/test/Makefile.in
index f241026..1aa5ad6 100644
--- a/bindings/matlab/test/Makefile.in
+++ b/bindings/matlab/test/Makefile.in
@@ -180,6 +180,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/matlab/test/big_test.m b/bindings/matlab/test/big_test.m
index 8ee741b..1fe729d 100644
--- a/bindings/matlab/test/big_test.m
+++ b/bindings/matlab/test/big_test.m
@@ -1,4 +1,4 @@
-% Copyright (C) 2013 D. V. Wiebe
+% Copyright (C) 2013, 2016 D. V. Wiebe
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
@@ -49,13 +49,17 @@ try
   'window WINDOW linterp mult LT 4.1\n'...
   '/ALIAS alias data\n'...
   'string STRING "Zaphod Beeblebrox"\n'...
+  'sarray SARRAY one two three four five six seven\n'...
+  'data/msarray SARRAY eight nine ten eleven twelve\n'...
+  'indir INDIR data carray\n'...
+  'sindir SINDIR data sarray\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;
+  fields = { 'bit'; 'div'; 'data'; 'mult'; 'sbit'; 'INDEX'; 'alias'; ...
+  'const'; 'indir'; 'mplex'; 'phase'; 'recip'; 'carray'; 'lincom'; 'sarray'; ...
+  'sindir'; 'string'; 'window'; 'linterp'; 'polynom'; };
+  nfields = 20;
 
   % Create the dirfile
   mkdir(filedir);
@@ -144,7 +148,7 @@ try
   % 26: gd_nmfields check
   try
     d = gd_nmfields(D, 'data');
-    ne = ne + check_num(26, d, 4);
+    ne = ne + check_num(26, d, 5);
   catch exc
     ne = ne + check_ok(exc, 26);
   end
@@ -153,7 +157,7 @@ try
   try
     d = gd_mfield_list(D, 'data');
     ne = ne + check_sarray(27, d, ...
-    { 'mstr'; 'mconst'; 'mcarray'; 'mlut'; });
+    { 'mstr'; 'mconst'; 'mcarray'; 'mlut'; 'msarray' });
   catch exc
     ne = ne + check_ok(exc, 27);
   end
@@ -565,7 +569,7 @@ try
   % 68: field_list_by_type
   try
     d = gd_field_list_by_type(D, GD.LINCOM_ENTRY);
-    ne = ne + check_sarray(68, d, { 'lincom', 'new2' });
+    ne = ne + check_sarray(68, d, { 'new2', 'lincom' });
   catch exc
     ne = ne + check_ok(exc, 68);
   end
@@ -573,7 +577,7 @@ try
   % 69: nfields_by_type
   try
     d = gd_nvectors(D);
-    ne = ne + check_num(69, d, 22);
+    ne = ne + check_num(69, d, 23);
   catch exc
     ne = ne + check_ok(exc, 69);
   end
@@ -581,10 +585,10 @@ try
   % 70: vector_list check
   try
     d = gd_vector_list(D);
-    ne = ne + check_sarray(70, d, ...
-    {'INDEX'; 'alias'; 'bit'; 'data'; 'div'; 'lincom'; 'linterp'; ...
-    'mplex'; 'mult'; 'new1'; 'new10'; 'new2'; 'new5'; 'new6'; 'new7'; ...
-    'new8'; 'new9'; 'phase'; 'polynom'; 'recip'; 'sbit'; 'window'});
+    ne = ne + check_sarray(70, d, { 'bit'; 'div'; 'data'; 'mult'; 'new1'; ...
+    'new2'; 'new5'; 'new6'; 'new7'; 'new8'; 'new9'; 'sbit'; 'INDEX'; ...
+    'alias'; 'indir'; 'mplex'; 'new10'; 'phase'; 'recip'; 'lincom'; ...
+    'window'; 'linterp'; 'polynom' });
   catch exc
     ne = ne + check_ok(exc, 70);
   end
@@ -1807,16 +1811,16 @@ try
   % 222: aliases
   try
     d = gd_aliases(D, 'data');
-    ne = ne + check_sarray(222, d, {'data'; 'alias'; 'data/mnew20'; 'new20'});
+    ne = ne + check_sarray(222, d, { 'data'; 'alias'; 'new20'; 'data/mnew20' });
   catch exc
     ne = ne + check_ok(exc, 222);
   end
 
   % 223: include_affix
   try
-    gd_include(D, 'format1', 0, GD.CREAT + GD.EXCL, 'A', 'Z');
+    gd_include_affix(D, 'format1', 0, 'A', 'Z', GD.CREAT + GD.EXCL);
   catch exc
-    ne = ne + check_ok2(exc, 41, 1);
+    ne = ne + check_ok2(exc, 223, 1);
   end
 
   % 226: fragment_affixes
@@ -1953,16 +1957,16 @@ try
   try
     d = gd_nentries(D, 'data', GD.SCALAR_ENTRIES, ...
     GD.ENTRIES_HIDDEN + GD.ENTRIES_NOALIAS);
-    ne = ne + check_num(237, d, 6);
+    ne = ne + check_num(237, d, 7);
   catch exc
     ne = ne + check_ok(exc, 237);
   end
 
-  % 239: gd_nentries
+  % 239: gd_entry_list
   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', ...
+    ne = ne + check_sarray(239, d, {'mstr', 'mconst', 'mcarray', 'msarray', ...
     'mnew11', 'mnew12', 'mnew17'});
   catch exc
     ne = ne + check_ok(exc, 239);
@@ -2027,6 +2031,314 @@ try
     ne = ne + check_ok(exc, 274);
   end
 
+  % 277: gd_entry (SARRAY)
+  try
+    d = gd_entry(D, 'sarray');
+    ne = ne + check_string2(277, 1, d.field, 'sarray');
+    ne = ne + check_num2(277, 2, d.field_type, GD.SARRAY_ENTRY);
+    ne = ne + check_num2(277, 3, d.fragment_index, 0);
+    ne = ne + check_num2(277, 4, d.array_len, 7);
+  catch exc
+    ne = ne + check_ok(exc, 277);
+  end
+
+  % 278: get_sarray
+  try
+    d = gd_get_sarray(D, 'sarray');
+    ne = ne + check_sarray(278, d, {'one'; 'two'; 'three'; 'four'; 'five'; ...
+    'six'; 'seven'});
+  catch exc
+    ne = ne + check_ok(exc, 278);
+  end
+
+  % 279: gd_sarray_slice
+  try
+    d = gd_get_sarray_slice(D, 'sarray', 2, 2);
+    ne = ne + check_sarray(279, d, {'three'; 'four'});
+  catch exc
+    ne = ne + check_ok(exc, 279);
+  end
+
+  % 280: gd_sarrays
+  try
+    d = gd_sarrays(D);
+    ne = ne + check_num(280, length(d), 1);
+    ne = ne + check_sarray(280, d{1}, {'one'; 'two'; 'three'; 'four'; ...
+    'five'; 'six'; 'seven'});
+  catch exc
+    ne = ne + check_ok(exc, 280);
+  end
+
+  % 281: gd_put_sarray
+  try
+    gd_put_sarray(D, 'sarray', ...
+    {'eka'; 'dvi'; 'tri'; 'catur'; 'panca'; 'sas'; 'sapta'});
+  catch exc
+    ne = ne + check_ok2(exc, 281, 0);
+  end
+
+  try
+    d = gd_get_sarray(D, 'sarray');
+    ne = ne + check_sarray(281, d, ...
+    {'eka'; 'dvi'; 'tri'; 'catur'; 'panca'; 'sas'; 'sapta'});
+  catch exc
+    ne = ne + check_ok2(exc, 281, 1);
+  end
+
+  % 282: gd_put_sarray
+  try
+    gd_put_sarray_slice(D, 'sarray', 2, {'asta'; 'nava'});
+  catch exc
+    ne = ne + check_ok2(exc, 282, 0);
+  end
+
+  try
+    d = gd_get_sarray(D, 'sarray');
+    ne = ne + check_sarray(282, d, ...
+    {'eka'; 'dvi'; 'asta'; 'nava'; 'panca'; 'sas'; 'sapta'});
+  catch exc
+    ne = ne + check_ok2(exc, 282, 1);
+  end
+
+  % 283: add_sarray
+  try
+    gd_add_sarray(D, 'new283', {'eins'; 'zwei'; 'drei'}, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 283, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new283');
+    ne = ne + check_string2(283, 1, d.field, 'new283');
+    ne = ne + check_num2(283, 2, d.field_type, GD.SARRAY_ENTRY);
+    ne = ne + check_num2(283, 3, d.fragment_index, 0);
+    ne = ne + check_num2(283, 4, d.array_len, 3);
+  catch exc
+    ne = ne + check_ok2(exc, 283, 2);
+  end
+
+  try
+    d = gd_get_sarray(D, 'new283');
+    ne = ne + check_sarray(283, d, {'eins'; 'zwei'; 'drei'});
+  catch exc
+    ne = ne + check_ok2(exc, 283, 3);
+  end
+
+  % 285: madd_sarray
+  try
+    gd_madd_sarray(D, 'data', 'mnew285', {'un'; 'deux'; 'trois'});
+  catch exc
+    ne = ne + check_ok2(exc, 285, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew285');
+    ne = ne + check_string2(285, 1, d.field, 'data/mnew285');
+    ne = ne + check_num2(285, 2, d.field_type, GD.SARRAY_ENTRY);
+    ne = ne + check_num2(285, 3, d.fragment_index, 0);
+    ne = ne + check_num2(285, 4, d.array_len, 3);
+  catch exc
+    ne = ne + check_ok2(exc, 285, 2);
+  end
+
+  try
+    d = gd_get_sarray(D, 'data/mnew285');
+    ne = ne + check_sarray(285, d, {'un'; 'deux'; 'trois'});
+  catch exc
+    ne = ne + check_ok2(exc, 285, 3);
+  end
+
+  % 286: alter_sarray
+  try
+    gd_alter_sarray(D, 'new283', 2);
+  catch exc
+    ne = ne + check_ok2(exc, 286, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new283');
+    ne = ne + check_string2(286, 1, d.field, 'new283');
+    ne = ne + check_num2(286, 2, d.field_type, GD.SARRAY_ENTRY);
+    ne = ne + check_num2(286, 3, d.fragment_index, 0);
+    ne = ne + check_num2(286, 4, d.array_len, 2);
+  catch exc
+    ne = ne + check_ok2(exc, 286, 2);
+  end
+
+  % 287: gd_msarrays
+  try
+    d = gd_msarrays(D, 'data');
+    ne = ne + check_num(287, length(d), 2);
+    ne = ne + check_sarray2(287, 1, d{1}, ...
+    {'eight'; 'nine'; 'ten'; 'eleven'; 'twelve'});
+    ne = ne + check_sarray2(287, 2, d{2}, {'un'; 'deux'; 'trois'});
+  catch exc
+    ne = ne + check_ok(exc, 287);
+  end
+
+  % 288: entry (INDIR) check
+  try
+    d = gd_entry(D, 'indir');
+    ne = ne + check_string2(288, 1, d.field, 'indir');
+    ne = ne + check_num2(288, 2, d.field_type, GD.INDIR_ENTRY);
+    ne = ne + check_num2(288, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(288, 4, d.in_fields, { 'data'; 'carray'; });
+  catch exc
+    ne = ne + check_ok(exc, 288);
+  end
+
+  % 289: add entry (INDIR) check
+  try
+    gd_add_indir(D, 'new289', 'in1', 'in2', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 289, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new289');
+    ne = ne + check_string2(289, 1, d.field, 'new289');
+    ne = ne + check_num2(289, 2, d.field_type, GD.INDIR_ENTRY);
+    ne = ne + check_num2(289, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(289, 4, d.in_fields, { 'in1'; 'in2'; });
+  catch exc
+    ne = ne + check_ok2(exc, 289, 2);
+  end
+
+  % 290: madd entry (INDIR) check
+  try
+    gd_madd_indir(D, 'data', 'mnew290', 'in1', 'in2');
+  catch exc
+    ne = ne + check_ok2(exc, 290, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew290');
+    ne = ne + check_string2(290, 1, d.field, 'data/mnew290');
+    ne = ne + check_num2(290, 2, d.field_type, GD.INDIR_ENTRY);
+    ne = ne + check_num2(290, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(290, 4, d.in_fields, { 'in1'; 'in2'; });
+  catch exc
+    ne = ne + check_ok2(exc, 290, 2);
+  end
+
+  % 291: gd_alter_indir
+  try
+    gd_alter_indir(D, 'new289', 0, 'in6');
+  catch exc
+    ne = ne + check_ok2(exc, 291, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new289');
+    ne = ne + check_string2(291, 1, d.field, 'new289');
+    ne = ne + check_num2(291, 2, d.field_type, GD.INDIR_ENTRY);
+    ne = ne + check_num2(291, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(291, 4, d.in_fields, { 'in1'; 'in6'; });
+  catch exc
+    ne = ne + check_ok2(exc, 291, 2);
+  end
+
+  % 292: entry (SINDIR) check
+  try
+    d = gd_entry(D, 'sindir');
+    ne = ne + check_string2(292, 1, d.field, 'sindir');
+    ne = ne + check_num2(292, 2, d.field_type, GD.SINDIR_ENTRY);
+    ne = ne + check_num2(292, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(292, 4, d.in_fields, { 'data'; 'sarray'; });
+  catch exc
+    ne = ne + check_ok(exc, 292);
+  end
+
+  % 293: add entry (SINDIR) check
+  try
+    gd_add_sindir(D, 'new293', 'in1', 'in2', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 293, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new293');
+    ne = ne + check_string2(293, 1, d.field, 'new293');
+    ne = ne + check_num2(293, 2, d.field_type, GD.SINDIR_ENTRY);
+    ne = ne + check_num2(293, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(293, 4, d.in_fields, { 'in1'; 'in2'; });
+  catch exc
+    ne = ne + check_ok2(exc, 293, 2);
+  end
+
+  % 294: madd entry (SINDIR) check
+  try
+    gd_madd_sindir(D, 'data', 'mnew294', 'in1', 'in2');
+  catch exc
+    ne = ne + check_ok2(exc, 294, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew294');
+    ne = ne + check_string2(294, 1, d.field, 'data/mnew294');
+    ne = ne + check_num2(294, 2, d.field_type, GD.SINDIR_ENTRY);
+    ne = ne + check_num2(294, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(294, 4, d.in_fields, { 'in1'; 'in2'; });
+  catch exc
+    ne = ne + check_ok2(exc, 294, 2);
+  end
+
+  % 295: gd_alter_sindir
+  try
+    gd_alter_sindir(D, 'new293', 0, 'in6');
+  catch exc
+    ne = ne + check_ok2(exc, 295, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new293');
+    ne = ne + check_string2(295, 1, d.field, 'new293');
+    ne = ne + check_num2(295, 2, d.field_type, GD.SINDIR_ENTRY);
+    ne = ne + check_num2(295, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(295, 4, d.in_fields, { 'in1'; 'in6'; });
+  catch exc
+    ne = ne + check_ok2(exc, 295, 2);
+  end
+
+  % 296: gd_getdata (SINDIR)
+  try
+    d = gd_getdata(D, 'sindir', 0, 0, 1, 0);
+    ne = ne + check_sarray(296, d, ...
+    {'eka'; 'eka'; 'eka'; 'eka'; 'eka'; 'eka'; 'eka'; 'eka';});
+  catch exc
+    ne = ne + check_ok(exc, 296);
+  end
+
+  % 302: gd_include_ns
+  try
+    gd_include(D, 'format2', 0, 'ns', GD.CREAT + GD.EXCL);
+  catch exc
+    ne = ne + check_ok2(exc, 302, 1);
+  end
+
+  % 303: gd_fragment_namespace (read)
+  try
+    d = gd_fragment_namespace(D, 2);
+    ne = ne + check_string(303, d, 'ns');
+  catch exc
+    ne = ne + check_ok(exc, 303);
+  end
+
+  % 304: gd_fragment_namespace (alter)
+  try
+    d = gd_fragment_namespace(D, 2, 'ns2');
+    ne = ne + check_string(304, d, 'ns2');
+  catch exc
+    ne = ne + check_ok(exc, 304);
+  end
+
+  % 305: gd_match_entries
+  try
+    d = gd_match_entries(D, '^lin', 0);
+    ne = ne + check_sarray(305, d, {'lincom'; 'linterp'});
+  catch exc
+    ne = ne + check_ok(exc, 305);
+  end
 
 
 
diff --git a/bindings/perl/GetData.pm.in b/bindings/perl/GetData.pm.in
index 5c081fa..9ae4670 100644
--- a/bindings/perl/GetData.pm.in
+++ b/bindings/perl/GetData.pm.in
@@ -519,14 +519,22 @@ 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)
+=item $dirfile->match_entries ($REGEX, $FRAGMENT, $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:
+In list context, returns an array of the names of the entries.  If C<$REGEX> is
+not undef, it is a regular expression which is matched against entry names.
+
+B<NB:> The regular expression handling is done in the underlying C library,
+not in Perl.  As a result, using Perl's regex grammar in C<$REGEX> usually won't
+work as desired.  If the C GetData library has Perl-Compatible Regular
+Expression (PCRE) support, the C<$GetData::REGEX_PCRE> flag can be used to
+select a regular expression grammar which is very similar to Perl's own.
+
+If C<$FRAGMENT> is not $GetData::ALL_FRAGMENTS or undef, only entries defined in
+the specified fragment are searched.  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
 
@@ -543,11 +551,26 @@ should be zero or more of the following flags:
 =over
 
 $GetData::ENTRIES_HIDDEN,
-$GetData::ENTRIES_NOALIAS.
+$GetData::ENTRIES_NOALIAS,
+$GetData::REGEX_PCRE,
+$GetData::REGEX_EXTENDED,
+$GetData::REGEX_ICASE,
+$GetData::REGEX_CASELESS,
+$GetData::REGEX_JAVASCRIPT,
+$GetData::REGEX_UNICODE
 
 =back
 
-See gd_nentries(3) and gd_entry_list(3) for the meaning of these symbols.
+See gd_match_entries(3) for the meaning of these symbols.
+
+=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.  For C<$TYPE> and C<$FLAGS>, see
+C<$dirfile->match_entries> above (the regex flags listed there are ignored by
+this function), and also gd_nentries(3) and gd_entry_list(3).
 
 =item $dirfile->error ()
 
diff --git a/bindings/perl/Makefile.in b/bindings/perl/Makefile.in
index ed08476..d087d01 100644
--- a/bindings/perl/Makefile.in
+++ b/bindings/perl/Makefile.in
@@ -191,6 +191,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/perl/simple_funcs.pl b/bindings/perl/simple_funcs.pl
index 3a3dcc1..32b2fb9 100644
--- a/bindings/perl/simple_funcs.pl
+++ b/bindings/perl/simple_funcs.pl
@@ -61,13 +61,13 @@ sub printfmt {
     return "%g;%g";
   } elsif ($_ eq "double") {
     return "%g";
-  } elsif ($_ eq "gdp_bitnum_t" or $_ eq "gdp_numbits_t"
+  } elsif ($_ eq "gdp_ffff_t" or $_ eq "gdp_numbits_t"
       or $_ eq "gd_windop_t")
   {
     return "%i";
   } elsif ($_ eq "gd_entype_t") {
     return "0x%02X";
-  } elsif ($_ eq "gd_shift_t" or $_ eq "gdp_shift_t") {
+  } elsif ($_ eq "gd_int64_t" or $_ eq "gdp_int64_t") {
     return "%\" PRId64 \"";
   } elsif ($_ eq "gdp_uint_t") {
     return "%u";
diff --git a/bindings/perl/simple_funcs.xsin b/bindings/perl/simple_funcs.xsin
index 31fe513..7975917 100644
--- a/bindings/perl/simple_funcs.xsin
+++ b/bindings/perl/simple_funcs.xsin
@@ -15,13 +15,13 @@ int add_linterp(DIRFILE *dirfile, const char *field_code, const char *in_field,
 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)
+    gd_int64_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,
-    gdp_char *in_field=NULL, gdp_bitnum_t bitnum=-1, gdp_numbits_t numbits=0)
+    gdp_char *in_field=NULL, gdp_ffff_t bitnum=-1, gdp_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,
@@ -36,9 +36,9 @@ int alter_divide(DIRFILE *dirfile, const char *field_code,
 int alter_multiply(DIRFILE *dirfile, const char *field_code,
     gdp_char *in_field1=NULL, gdp_char *in_field2=NULL)
 int alter_phase(DIRFILE *dirfile, const char *field_code,
-    gdp_char *in_field, gdp_shift_t shift)
+    gdp_char *in_field, gdp_int64_t shift)
 int alter_sbit(DIRFILE *dirfile, const char *field_code,
-    gdp_char *in_field=NULL, gdp_bitnum_t bitnum=-1, gdp_numbits_t numbits=0)
+    gdp_char *in_field=NULL, gdp_ffff_t bitnum=-1, gdp_numbits_t numbits=0)
 size_t array_len(DIRFILE *dirfile, const char *field_code)
 unsigned long int encoding(DIRFILE *dirfile, int fragment)
 unsigned long int endianness(DIRFILE *dirfile, int fragment)
@@ -62,7 +62,7 @@ int madd_linterp(DIRFILE *dirfile, const char *parent, const char *field_code,
 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)
+    const char *in_field, gd_int64_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)
@@ -77,7 +77,7 @@ int protection(DIRFILE *dirfile, int fragment_index)
 const char *raw_filename(DIRFILE *dirfile, const char *field_code)
 const char *reference(DIRFILE *dirfile, gdp_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 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,
@@ -153,3 +153,20 @@ unsigned long int flags(DIRFILE *dirfile, unsigned long int set=0,
 int verbose_prefix(DIRFILE *dirfile, gdp_char *prefix=NULL)
 void mplex_lookback(DIRFILE *dirfile, int lookback)
 char *linterp_tablename(DIRFILE *dirfile, const char *field_code)
+int alter_sarray(DIRFILE* dirfile, const char* field_code, size_t array_len)
+int add_indir(DIRFILE *dirfile, const char *field_code, const char *in_field1,
+    const char *in_field2, int fragment_index=0)
+int add_sindir(DIRFILE *dirfile, const char *field_code, const char *in_field1,
+    const char *in_field2, int fragment_index=0)
+int alter_indir(DIRFILE *dirfile, const char *field_code,
+    gdp_char *in_field1=NULL, gdp_char *in_field2=NULL)
+int alter_sindir(DIRFILE *dirfile, const char *field_code,
+    gdp_char *in_field1=NULL, gdp_char *in_field2=NULL)
+int madd_indir(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *in_field1, const char *in_field2)
+int madd_sindir(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *in_field1, const char *in_field2)
+int include_affix(DIRFILE *dirfile, const char *file, int fragment_index,
+    gdp_char *prefix=NULL, gdp_char *suffix=NULL, unsigned long int flags=0);
+const char *fragment_namespace(DIRFILE *dirfile, int fragment,
+    gdp_char *namespace=NULL);
diff --git a/bindings/perl/src/GetData.xs b/bindings/perl/src/GetData.xs
index 4d573aa..b86408e 100644
--- a/bindings/perl/src/GetData.xs
+++ b/bindings/perl/src/GetData.xs
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2016 D. V. Wiebe
+/* Copyright (C) 2011-2017 D. V. Wiebe
  *
  **************************************************************************
  *
@@ -45,9 +45,9 @@
 typedef GD_DCOMPLEXP_t gdp_complex_in;
 typedef GD_DCOMPLEXP_t gdp_complex_undef;
 typedef GD_DCOMPLEXA(gdp_complex);
-typedef int gdp_bitnum_t;
+typedef int gdp_ffff_t;
 typedef int gdp_numbits_t;
-typedef gd_shift_t gdp_shift_t;
+typedef gd_int64_t gdp_int64_t;
 typedef unsigned int gdp_uint_t;
 typedef gd_type_t gdp_type_t;
 typedef int gdp_int;
@@ -60,16 +60,16 @@ typedef gd_entry_t gdp_pentry_t;
 #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)))
+#define GDP_PUSHpvn(s)       PUSHs(sv_2mortal(newSVpvn(s, sizeof(s) - 1)))
+#define GDP_PUSHpvz(s)       PUSHs(sv_2mortal(newSVpv(s, 0)))
+#define GDP_PUSHuv(s)        PUSHs(sv_2mortal(newSVuv(s)))
+#define GDP_PUSHiv(s)        PUSHs(sv_2mortal(newSViv(s)))
+#define GDP_PUSHnv(s)        PUSHs(sv_2mortal(newSVnv(s)))
+#define GDP_PUSHrv(s)        PUSHs(sv_2mortal(newRV_noinc((SV*)s)))
+#define GDP_PUSHcmp(r,i)     PUSHs(sv_2mortal(gdp_newSVcmp(r,i)))
+#define GDP_PUSHrvavpv(s,n)  PUSHs(sv_2mortal(gdp_newRVavpv((const char**)s,n)))
+#define GDP_PUSHrvavcmp(s,n) PUSHs(sv_2mortal(gdp_newRVavcmp(s,n)))
+#define GDP_PUSHrvavnv(s,n)  PUSHs(sv_2mortal(gdp_newRVavnv(s,n)))
 
 struct gdp_callback_stuff_t {
   SV *func;
@@ -83,6 +83,17 @@ struct gdp_dirfile_t {
 
 static DIRFILE *gdp_invalid = NULL;
 
+/* Newx wrapper for the C library to use */
+static void *gdp_malloc(size_t n)
+{
+  void *ptr;
+  dtrace("%zu", n);
+
+  Newx(ptr, n, char);
+
+  dreturn("%p", ptr);
+  return ptr;
+}
 
 /* sv might be NULL, indicating undef */
 static gd_type_t gdp_get_type(SV **sv, const char *pkg, const char *func)
@@ -120,7 +131,7 @@ static const char **gdp_convert_const_avpv(SV *src, size_t *len_out,
     AV *av = (AV*)SvRV(src);
     I32 i, len = av_len(av);
 
-    dst = safemalloc(sizeof(char*) * (1 + len));
+    Newx(dst, 1 + len, const char*);
     for (i = 0; i <= len; ++i) {
       SV **sv = av_fetch(av, i, 0);
       if (sv == NULL || SvTYPE(*sv) != SVt_PV) {
@@ -152,7 +163,7 @@ static const char **gdp_convert_strarr(size_t *len_out,  I32 items, I32 ax,
   if (items - offs > 1 || SvTYPE(ST(offs)) == SVt_PVAV) {
     I32 i, len;
     len = items - offs;
-    dst = safemalloc(sizeof(char*) * (items - offs));
+    Newx(dst, items - offs, const char*);
     for (i = 0; i < len; ++i) {
       SV *sv = ST(offs + i);
       if (SvTYPE(sv) != SVt_PV) {
@@ -278,7 +289,7 @@ static int gdp_fetch_cmp_list(GD_DCOMPLEXV(c), HV *hv, int partial, char key,
         key);
   }
 
-  memset(have, 0, sizeof(int) * (GD_MAX_POLYORD + 1));
+  Zero(have, GD_MAX_POLYORD + 1, int);
   for (i = 0; i < max; ++i)
     if (mask & (1 << i))
       have[i] = 1;
@@ -346,7 +357,7 @@ static int gdp_fetch_in_fields(char **in_fields, SV *sv, int partial, int min,
   } else {
     int have[GD_MAX_LINCOM * 2];
 
-    memset(have, 0, sizeof(int) * GD_MAX_LINCOM * 2);
+    Zero(have, GD_MAX_LINCOM * 2, int);
 
     for (i = 0; i < GD_MAX_LINCOM; ++i) {
       v = av_fetch((AV*)vv, i, 0);
@@ -447,9 +458,9 @@ static void gdp_to_entry(gd_entry_t *E, SV *sv, const gd_entry_t *old_E,
   const int partial = (old_E != NULL);
 
   if (partial)
-    memcpy(E, old_E, sizeof(gd_entry_t));
+    StructCopy(old_E, E, gd_entry_t);
   else
-    memset(E, 0, sizeof(gd_entry_t));
+    Zero(E, 1, gd_entry_t);
 
   /* de-reference as needed */
   while (SvROK(sv))
@@ -480,8 +491,11 @@ static void gdp_to_entry(gd_entry_t *E, SV *sv, const gd_entry_t *old_E,
       }
 
       break;
+    case GD_SARRAY_ENTRY:
+      GDP_EHASH_FETCH_UV(partial, "array_len", EN(scalar,array_len), size_t);
+      break;
     case GD_CARRAY_ENTRY:
-      GDP_EHASH_FETCH_IV(partial, "array_len", E->EN(scalar,array_len), size_t);
+      GDP_EHASH_FETCH_UV(partial, "array_len", EN(scalar,array_len), size_t);
       /* fallthrough */
     case GD_CONST_ENTRY:
       GDP_EHASH_FETCH_UV(partial, "const_type", EN(scalar,const_type),
@@ -530,6 +544,8 @@ static void gdp_to_entry(gd_entry_t *E, SV *sv, const gd_entry_t *old_E,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       gdp_fetch_in_fields(E->in_fields, sv, partial, 2, 2, pkg, func);
       break;
     case GD_PHASE_ENTRY:
@@ -538,7 +554,7 @@ static void gdp_to_entry(gd_entry_t *E, SV *sv, const gd_entry_t *old_E,
       mask = gdp_fetch_scalars(E, (HV*)sv, 1, pkg, func);
 
       if (!(mask & 1))
-        GDP_EHASH_FETCH_IV(partial, "shift", E->EN(phase,shift), gd_shift_t);
+        GDP_EHASH_FETCH_IV(partial, "shift", E->EN(phase,shift), gd_int64_t);
       break;
     case GD_POLYNOM_ENTRY:
       gdp_fetch_in_fields(E->in_fields, sv, partial, 1, 1, pkg, func);
@@ -688,6 +704,7 @@ static void gdp_convert_from_perl(void *dest, SV *src, gd_type_t type,
       break;
     case GD_NULL:
     case GD_UNKNOWN:
+    case GD_STRING:
       ;
   }
 
@@ -758,7 +775,7 @@ static struct gdp_din gdp_convert_data(SV *d, I32 items, I32 ax, size_t idx,
   }
 
   if (din.arg_type != GDP_DATA_IN_PACK)
-    din.data_in = safemalloc(din.nsamp * GD_SIZE(din.type));
+    Newx(din.data_in, din.nsamp * GD_SIZE(din.type), char);
 
   if (din.arg_type == GDP_DATA_IN_LIST) {
     for (i = idx; i < items; ++i)
@@ -789,7 +806,7 @@ static gd_type_t gdp_to_voidp(void *dest, SV *src, gd_type_t hint,
 
   /* treat undef as zero */
   if (src == undef) {
-    memset(dest, 0, 1);
+    Zero(dest, 1, char);
     type = GD_UINT8;
   } else {
     int cmp = 0;
@@ -926,6 +943,7 @@ static SV **gdp_store_scalars(SV **sp, const gd_entry_t *E, unsigned int mask)
       else
         av_store(scalar_ind, i, newSViv(E->scalar_ind[i]));
     }
+  EXTEND(sp, 4);
   GDP_PUSHpvn("scalar");
   GDP_PUSHrv(scalar);
   GDP_PUSHpvn("scalar_ind");
@@ -942,7 +960,6 @@ static int gdp_parser_callback(gd_parser_data_t *pdata, void *extra)
   SV *callback_data = ((struct gdp_callback_stuff_t *)extra)->data;
   SV *ret, **dummy;
   int n, sem = GD_SYNTAX_ABORT;
-  int was_rv = 0;
   AV *av;
   int len;
 
@@ -964,9 +981,11 @@ static int gdp_parser_callback(gd_parser_data_t *pdata, void *extra)
 
   /* create stack frame */
   PUSHMARK(SP);
+  EXTEND(SP, 2);
 
-  XPUSHs(sv_2mortal(newRV_noinc((SV *)phash)));
-  XPUSHs(callback_data);
+  /* push args */
+  PUSHs(sv_2mortal(newRV_noinc((SV *)phash)));
+  PUSHs(callback_data);
 
   /* finalise stack frame */
   PUTBACK;
@@ -992,7 +1011,6 @@ static int gdp_parser_callback(gd_parser_data_t *pdata, void *extra)
   /* de-reference as needed */
   while (SvROK(ret)) {
     ret = SvRV(ret);
-    was_rv = 1;
   }
 
   /* ferret out response */
@@ -1020,7 +1038,7 @@ static int gdp_parser_callback(gd_parser_data_t *pdata, void *extra)
         if (SvTYPE(*val) == SVt_IV) {
           sem = SvIV(*val);
         } else if (SvTYPE(*val) == SVt_PV) {
-          pdata->line = strdup(SvPV_nolen(*val));
+          pdata->line = savepv(SvPV_nolen(*val));
           sem = GD_SYNTAX_RESCAN;
         } else {
           croak("GetData: bad data type in array returned by parser callback.");
@@ -1037,7 +1055,7 @@ static int gdp_parser_callback(gd_parser_data_t *pdata, void *extra)
 
         if (SvTYPE(*val0) == SVt_IV && SvTYPE(*val1) == SVt_PV) {
           sem = SvIV(*val0);
-          pdata->line = strdup(SvPV_nolen(*val1));
+          pdata->line = savepv(SvPV_nolen(*val1));
         } else {
           croak("GetData: bad data type in array returned by parser callback.");
           return GD_SYNTAX_ABORT; /* ca'n't get here */
@@ -1045,7 +1063,7 @@ static int gdp_parser_callback(gd_parser_data_t *pdata, void *extra)
       }
       break;
     case SVt_PV:
-    pdata->line = strdup(SvPV_nolen(ret));
+    pdata->line = savepv(SvPV_nolen(ret));
     sem = GD_SYNTAX_RESCAN;
     break;
     default:
@@ -1065,23 +1083,31 @@ static int gdp_parser_callback(gd_parser_data_t *pdata, void *extra)
 }
 
 #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]));
+  if (sp) { \
+    EXTEND(sp, n); \
+    for (i = 0; i < n; ++i) PUSHs(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]));
+  if (sp) { \
+    EXTEND(sp, n); \
+    for (i = 0; i < n; ++i) PUSHs(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]));
+  if (sp) { \
+    EXTEND(sp, n); \
+    for (i = 0; i < n; ++i) PUSHs(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], \
+  if (sp) { \
+    EXTEND(sp, n); \
+    for (i = 0; i < n; ++i) \
+      PUSHs(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]));
+  } 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 */
@@ -1140,6 +1166,7 @@ static void * gdp_unpack(SV **sp, const void *data, size_t n, gd_type_t type)
       break;
     case GD_UNKNOWN:
     case GD_NULL:
+    case GD_STRING:
       break;
   }
 
@@ -1152,19 +1179,20 @@ MODULE = GetData  PACKAGE = GetData
 PROTOTYPES: ENABLE
 
 BOOT:
+  gd_alloc_funcs(gdp_malloc, safefree);
   gdp_invalid = gd_invalid_dirfile();
 
 void
-DESTROY(dirfile)
-  DIRFILE * dirfile
+DESTROY(gdp_dirfile)
+  struct gdp_dirfile_t * gdp_dirfile
   PREINIT:
     GDP_DIRFILE_ALIAS;
   ALIAS:
     GetData::Dirfile::DESTROY = 1
   CODE:
-    dtrace("%p", dirfile);
-    if (dirfile != gdp_invalid)
-      gd_discard(dirfile);
+    dtrace("%p", gdp_dirfile);
+    if (gdp_dirfile->D != NULL)
+      gd_discard(gdp_dirfile->D);
     safefree(gdp_dirfile);
   CLEANUP:
     dreturnvoid();
@@ -1186,49 +1214,45 @@ error(dirfile)
     dreturn("%i", RETVAL);
 
 
-DIRFILE *
+struct gdp_dirfile_t *
 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);
+    Newx(RETVAL, 1, struct gdp_dirfile_t);
     if (sehandler == undef) {
-      gdp_dirfile->cbdata.func = NULL;
-      gdp_dirfile->cbdata.data = NULL;
+      RETVAL->cbdata.func = NULL;
+      RETVAL->cbdata.data = NULL;
 
-      RETVAL = gd_cbopen(dirfilename, flags, NULL, NULL);
+      RETVAL->D = gd_cbopen(dirfilename, flags, NULL, NULL);
     } else {
-      gdp_dirfile->cbdata.func = sehandler;
-      gdp_dirfile->cbdata.data = extra;
+      RETVAL->cbdata.func = sehandler;
+      RETVAL->cbdata.data = extra;
 
-      RETVAL = gd_cbopen(dirfilename, flags, gdp_parser_callback,
-          &gdp_dirfile->cbdata);
+      RETVAL->D = gd_cbopen(dirfilename, flags, gdp_parser_callback,
+          &RETVAL->cbdata);
     }
   OUTPUT:
     RETVAL
   CLEANUP:
-    dreturn("%p", gdp_dirfile);
+    dreturn("%p", RETVAL);
 
-DIRFILE *
+struct gdp_dirfile_t *
 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;
+    Newx(RETVAL, 1, struct gdp_dirfile_t);
+    RETVAL->cbdata.func = NULL;
+    RETVAL->cbdata.data = NULL;
 
-    RETVAL = gd_invalid_dirfile();
+    RETVAL->D = gd_invalid_dirfile();
   OUTPUT:
     RETVAL
   CLEANUP:
-    dreturn("%p", gdp_dirfile);
+    dreturn("%p", RETVAL);
 
 void
 get_carray(dirfile, field_code, return_type)
@@ -1255,7 +1279,7 @@ get_carray(dirfile, field_code, return_type)
       }
     } else {
       size_t len = gd_array_len(dirfile, field_code);
-      data_out = safemalloc(GD_SIZE(return_type) * len);
+      Newx(data_out, GD_SIZE(return_type) * len, char);
       gd_get_carray(dirfile, field_code, return_type, data_out);
 
       GDP_UNDEF_ON_ERROR(safefree(data_out));
@@ -1296,7 +1320,7 @@ get_carray_slice(dirfile, field_code, start, len, return_type)
         XSRETURN_UNDEF;
       }
     } else {
-      data_out = safemalloc(GD_SIZE(return_type) * len);
+      Newx(data_out, GD_SIZE(return_type) * len, char);
       gd_get_carray_slice(dirfile, field_code, start, len, return_type,
         data_out);
 
@@ -1317,14 +1341,13 @@ get_constant(dirfile, field_code, return_type)
   const char * field_code
   gd_type_t return_type
   PREINIT:
-    void *data_out = NULL;
+    char data_out[16];
     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_NULL)
       type = GD_NULL;
@@ -1339,10 +1362,9 @@ get_constant(dirfile, field_code, return_type)
 
     gd_get_constant(dirfile, field_code, type, data_out);
 
-    GDP_UNDEF_ON_ERROR(safefree(data_out));
+    GDP_UNDEF_ON_ERROR();
 
     if (type == GD_NULL) {
-      safefree(data_out);
       dreturnvoid();
       XSRETURN_UNDEF;
     } else if (type == GD_COMPLEX128)
@@ -1356,7 +1378,6 @@ get_constant(dirfile, field_code, return_type)
   OUTPUT:
     RETVAL
   CLEANUP:
-    safefree(data_out);
     dreturn("%p", RETVAL);
 
 void
@@ -1400,11 +1421,12 @@ carrays(dirfile, return_type)
 
     /* 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)
+    if (GIMME_V == G_ARRAY) {
+      EXTEND(sp, len);
       for (i = 0; i < len; ++i)
-        XPUSHs(sv_2mortal(newRV_noinc((SV *)gdp_unpack(NULL, data_out[i].d,
+        PUSHs(sv_2mortal(newRV_noinc((SV *)gdp_unpack(NULL, data_out[i].d,
                   data_out[i].n, return_type))));
-    else {
+    } else {
       AV *av = newAV();
       for (i = 0; i < len; ++i)
         av_store(av, i, newSVpvn(data_out[i].d,
@@ -1432,6 +1454,7 @@ entry(dirfile, field_code)
       GDP_UNDEF_ON_ERROR();
 
       /* push the hash onto the stack */
+      EXTEND(sp, 6);
       GDP_PUSHpvn("field");
       GDP_PUSHpvz(E.field);
       GDP_PUSHpvn("field_type");
@@ -1441,6 +1464,7 @@ entry(dirfile, field_code)
       switch (E.field_type) {
         case GD_BIT_ENTRY:
         case GD_SBIT_ENTRY:
+          EXTEND(sp, 6);
           GDP_PUSHpvn("in_fields");
           GDP_PUSHpvz(E.in_fields[0]);
           GDP_PUSHpvn("bitnum");
@@ -1449,15 +1473,23 @@ entry(dirfile, field_code)
           GDP_PUSHuv(E.EN(bit,numbits));
           sp = gdp_store_scalars(sp, &E, 0x3);
           break;
+        case GD_SARRAY_ENTRY:
+          EXTEND(sp, 2);
+          GDP_PUSHpvn("array_len");
+          GDP_PUSHuv(E.EN(scalar,array_len));
+          break;
         case GD_CARRAY_ENTRY:
+          EXTEND(sp, 2);
           GDP_PUSHpvn("array_len");
           GDP_PUSHuv(E.EN(scalar,array_len));
           /* fallthrough */
         case GD_CONST_ENTRY:
+          EXTEND(sp, 2);
           GDP_PUSHpvn("const_type");
           GDP_PUSHuv(E.EN(scalar,const_type));
           break;
         case GD_LINCOM_ENTRY:
+          EXTEND(sp, 8);
           GDP_PUSHpvn("n_fields");
           GDP_PUSHiv(E.EN(lincom,n_fields));
           GDP_PUSHpvn("in_fields");
@@ -1470,6 +1502,7 @@ entry(dirfile, field_code)
               ((1 << E.EN(lincom,n_fields)) - 1) * 9);
           break;
         case GD_LINTERP_ENTRY:
+          EXTEND(sp, 4);
           GDP_PUSHpvn("in_fields");
           GDP_PUSHpvz(E.in_fields[0]);
           GDP_PUSHpvn("table");
@@ -1477,10 +1510,14 @@ entry(dirfile, field_code)
           break;
         case GD_MULTIPLY_ENTRY:
         case GD_DIVIDE_ENTRY:
+        case GD_INDIR_ENTRY:
+        case GD_SINDIR_ENTRY:
+          EXTEND(sp, 2);
           GDP_PUSHpvn("in_fields");
           GDP_PUSHrvavpv(E.in_fields, 2);
           break;
         case GD_PHASE_ENTRY:
+          EXTEND(sp, 4);
           GDP_PUSHpvn("in_fields");
           GDP_PUSHpvz(E.in_fields[0]);
           GDP_PUSHpvn("shift");
@@ -1488,6 +1525,7 @@ entry(dirfile, field_code)
           sp = gdp_store_scalars(sp, &E, 1);
           break;
         case GD_POLYNOM_ENTRY:
+          EXTEND(sp, 6);
           GDP_PUSHpvn("poly_ord");
           GDP_PUSHiv(E.EN(polynom,poly_ord));
           GDP_PUSHpvn("in_fields");
@@ -1498,6 +1536,7 @@ entry(dirfile, field_code)
               (1 << (E.EN(polynom,poly_ord) + 1)) - 1);
           break;
         case GD_RECIP_ENTRY:
+          EXTEND(sp, 4);
           GDP_PUSHpvn("in_fields");
           GDP_PUSHpvz(E.in_fields[0]);
           GDP_PUSHpvn("dividend");
@@ -1506,6 +1545,7 @@ entry(dirfile, field_code)
           sp = gdp_store_scalars(sp, &E, 1);
           break;
         case GD_RAW_ENTRY:
+          EXTEND(sp, 4);
           GDP_PUSHpvn("spf");
           GDP_PUSHuv(E.EN(raw,spf));
           GDP_PUSHpvn("data_type");
@@ -1513,6 +1553,7 @@ entry(dirfile, field_code)
           sp = gdp_store_scalars(sp, &E, 1);
           break;
         case GD_WINDOW_ENTRY:
+          EXTEND(sp, 6);
           GDP_PUSHpvn("in_fields");
           GDP_PUSHrvavpv(E.in_fields, 2);
           GDP_PUSHpvn("windop");
@@ -1534,6 +1575,7 @@ entry(dirfile, field_code)
           sp = gdp_store_scalars(sp, &E, 1);
           break;
         case GD_MPLEX_ENTRY:
+          EXTEND(sp, 6);
           GDP_PUSHpvn("in_fields");
           GDP_PUSHrvavpv(E.in_fields, 2);
           GDP_PUSHpvn("count_val");
@@ -1555,6 +1597,7 @@ entry(dirfile, field_code)
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHiv(t);
     }
     dreturnvoid();
@@ -1574,7 +1617,7 @@ error_string(dirfile)
   OUTPUT:
     RETVAL
   CLEANUP:
-    free(s);
+    safefree(s);
     dreturn("%p", RETVAL);
 
 AV *
@@ -1596,11 +1639,12 @@ mcarrays(dirfile, parent, return_type)
 
     /* 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)
+    if (GIMME_V == G_ARRAY) {
+      EXTEND(sp, len);
       for (i = 0; i < len; ++i)
-        XPUSHs(sv_2mortal(newRV_noinc((SV *)gdp_unpack(NULL, data_out[i].d,
+        PUSHs(sv_2mortal(newRV_noinc((SV *)gdp_unpack(NULL, data_out[i].d,
                   data_out[i].n, return_type))));
-    else {
+    } else {
       AV *av = newAV();
       for (i = 0; i < len; ++i)
         av_store(av, i, newSVpvn(data_out[i].d,
@@ -1635,8 +1679,8 @@ mconstants(dirfile, parent, return_type)
     dreturnvoid();
 
 void
-parser_callback(dirfile, sehandler, extra=undef)
-  DIRFILE * dirfile
+parser_callback(gdp_dirfile, sehandler, extra=undef)
+  struct gdp_dirfile_t * gdp_dirfile
   SV *sehandler
   SV *extra
   PREINIT:
@@ -1644,17 +1688,20 @@ parser_callback(dirfile, sehandler, extra=undef)
   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;
+    dtrace("%p, %p, %p", gdp_dirfile, sehandler, extra);
+    if (gdp_dirfile->D) {
+      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(gdp_dirfile->D, NULL, NULL);
+      } else {
+        gdp_dirfile->cbdata.func = sehandler;
+        gdp_dirfile->cbdata.data = extra;
 
-      gd_parser_callback(dirfile, gdp_parser_callback, &gdp_dirfile->cbdata);
+        gd_parser_callback(gdp_dirfile->D, gdp_parser_callback,
+            &gdp_dirfile->cbdata);
+      }
     }
   CLEANUP:
     dreturnvoid();
@@ -1672,7 +1719,7 @@ get_string(dirfile, field_code)
 
     /* get string length */
     size_t len = gd_get_string(dirfile, field_code, 0, NULL);
-    RETVAL = safemalloc(len);
+    Newx(RETVAL, len, char);
 
     /* get string */
     gd_get_string(dirfile, field_code, len, RETVAL);
@@ -1683,17 +1730,17 @@ get_string(dirfile, field_code)
     safefree(RETVAL);
 
 int
-close(dirfile)
-  DIRFILE * dirfile
+close(gdp_dirfile)
+  struct gdp_dirfile_t * gdp_dirfile
   PREINIT:
     GDP_DIRFILE_ALIAS;
   ALIAS:
     GetData::Dirfile::close = 1
   CODE:
-    dtrace("%p", dirfile);
+    dtrace("%p", gdp_dirfile);
 
-    if (dirfile != gdp_invalid) {
-      RETVAL = gd_close(dirfile);
+    if (gdp_dirfile->D != NULL) {
+      RETVAL = gd_close(gdp_dirfile->D);
 
       if (!RETVAL)
         gdp_dirfile->D = NULL;
@@ -1705,17 +1752,17 @@ close(dirfile)
     dreturn("%i", RETVAL);
 
 int
-discard(dirfile)
-  DIRFILE * dirfile
+discard(gdp_dirfile)
+  struct gdp_dirfile_t * gdp_dirfile
   PREINIT:
     GDP_DIRFILE_ALIAS;
   ALIAS:
     GetData::Dirfile::discard = 1
   CODE:
-    dtrace("%p", dirfile);
+    dtrace("%p", gdp_dirfile);
 
-    if (dirfile != gdp_invalid) {
-      RETVAL = gd_discard(dirfile);
+    if (gdp_dirfile->D != NULL) {
+      RETVAL = gd_discard(gdp_dirfile->D);
 
       if (!RETVAL)
         gdp_dirfile->D = NULL;
@@ -1761,10 +1808,27 @@ getdata(dirfile, field_code, first_frame, first_samp, num_frames, num_samp, \
       GDP_UNDEF_ON_ERROR();
     }
 
-    if (return_type == GD_UNKNOWN)
-      croak("%s::getdata() - No return type specified", gdp_package);
+    if (t == GD_SINDIR_ENTRY) {
+      const char **data_out;
+      Newx(data_out, num_samp, const char*);
 
-    if (return_type == GD_NULL) {
+      len = gd_getdata64(dirfile, field_code, first_frame, first_samp, 0,
+          num_samp, GD_STRING, data_out);
+
+      GDP_UNDEF_ON_ERROR(safefree(data_out));
+
+      /* In array context return the array; in scalar context return a reference
+       * to an array */
+      if (GIMME_V == G_ARRAY)
+        for (i = 0; i < len; ++i)
+          GDP_PUSHpvz(data_out[i]);
+      else
+        XPUSHs(sv_2mortal(gdp_newRVavpv(data_out, len)));
+
+      safefree(data_out);
+    } else if (return_type == GD_UNKNOWN)
+      croak("%s::getdata() - No return type specified", gdp_package);
+    else if (return_type == GD_NULL) {
       len = gd_getdata64(dirfile, field_code, first_frame, first_samp, 0,
           num_samp, GD_NULL, NULL);
 
@@ -1774,10 +1838,12 @@ getdata(dirfile, field_code, first_frame, first_samp, num_frames, num_samp, \
        * in array context */
       if (GIMME_V == G_ARRAY)
         ; /* nothing to return */
-      else
+      else {
+        EXTEND(sp, 1);
         GDP_PUSHuv(len);
+      }
     } else {
-      data_out = safemalloc(GD_SIZE(return_type) * num_samp);
+      Newx(data_out, GD_SIZE(return_type) * num_samp, char);
 
       len = gd_getdata64(dirfile, field_code, first_frame, first_samp, 0,
           num_samp, return_type, data_out);
@@ -1813,13 +1879,16 @@ field_list(dirfile)
 
       GDP_UNDEF_ON_ERROR();
 
-      for (i = 0; fl[i]; ++i)
+      for (i = 0; fl[i]; ++i) {
+        EXTEND(sp, 1);
         GDP_PUSHpvz(fl[i]);
+      }
     } else {
       unsigned int nf = gd_nfields(dirfile);
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHuv(nf);
     }
 
@@ -1843,13 +1912,16 @@ field_list_by_type(dirfile, type)
 
       GDP_UNDEF_ON_ERROR();
 
-      for (i = 0; fl[i]; ++i)
+      for (i = 0; fl[i]; ++i) {
+        EXTEND(sp, 1);
         GDP_PUSHpvz(fl[i]);
+      }
     } else {
       unsigned int nf = gd_nfields_by_type(dirfile, type);
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHuv(nf);
     }
 
@@ -1867,7 +1939,7 @@ entry_list(dirfile, parent, type, flags)
     GetData::Dirfile::entry_list = 1
   PPCODE:
     dtrace("%p, \"%s\", %i, %u; %i", dirfile, parent, type, flags,
-      (int)GIMME_V);
+        (int)GIMME_V);
 
     /* in array context, return the field list, otherwise return nfields */
     if (GIMME_V == G_ARRAY) {
@@ -1876,13 +1948,52 @@ entry_list(dirfile, parent, type, flags)
 
       GDP_UNDEF_ON_ERROR();
 
-      for (i = 0; el[i]; ++i)
+      for (i = 0; el[i]; ++i) {
+        EXTEND(sp, 1);
         GDP_PUSHpvz(el[i]);
+      }
     } else {
       unsigned int ne = gd_nentries(dirfile, parent, type, flags);
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
+      GDP_PUSHuv(ne);
+    }
+
+    dreturnvoid();
+
+void
+match_entries(dirfile, regex, fragment=-1, type=0, flags=0)
+    DIRFILE * dirfile
+    gdp_char * regex
+    gdp_ffff_t fragment
+    gdp_int    type
+    gdp_uint_t flags
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+    const char **el;
+    unsigned int ne;
+  ALIAS:
+    GetData::Dirfile::match_entries = 1
+  PPCODE:
+    dtrace("%p, \"%s\", %i, %i, %u; %i", dirfile, regex, fragment, type, flags,
+        (int)GIMME_V);
+
+    ne = gd_match_entries(dirfile, regex, fragment, type, flags, &el);
+
+    GDP_UNDEF_ON_ERROR();
+
+    /* in array context, return the field list, otherwise return nfields */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+
+      for (i = 0; el[i]; ++i) {
+        EXTEND(sp, 1);
+        GDP_PUSHpvz(el[i]);
+      }
+    } else {
+      EXTEND(sp, 1);
       GDP_PUSHuv(ne);
     }
 
@@ -1905,13 +2016,16 @@ vector_list(dirfile)
 
       GDP_UNDEF_ON_ERROR();
 
-      for (i = 0; fl[i]; ++i)
+      for (i = 0; fl[i]; ++i) {
+        EXTEND(sp, 1);
         GDP_PUSHpvz(fl[i]);
+      }
     } else {
       unsigned int nf = gd_nvectors(dirfile);
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHuv(nf);
     }
 
@@ -1934,13 +2048,16 @@ strings(dirfile)
 
       GDP_UNDEF_ON_ERROR();
 
-      for (i = 0; fl[i]; ++i)
+      for (i = 0; fl[i]; ++i) {
+        EXTEND(sp, 1);
         GDP_PUSHpvz(fl[i]);
+      }
     } else {
       unsigned int nf = gd_nfields_by_type(dirfile, GD_STRING_ENTRY);
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHuv(nf);
     }
 
@@ -1964,13 +2081,16 @@ mfield_list(dirfile, field_code)
 
       GDP_UNDEF_ON_ERROR();
 
-      for (i = 0; fl[i]; ++i)
+      for (i = 0; fl[i]; ++i) {
+        EXTEND(sp, 1);
         GDP_PUSHpvz(fl[i]);
+      }
     } else {
       unsigned int nf = gd_nmfields(dirfile, field_code);
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHuv(nf);
     }
 
@@ -1995,13 +2115,16 @@ mfield_list_by_type(dirfile, parent, type)
 
       GDP_UNDEF_ON_ERROR();
 
-      for (i = 0; fl[i]; ++i)
+      for (i = 0; fl[i]; ++i) {
+        EXTEND(sp, 1);
         GDP_PUSHpvz(fl[i]);
+      }
     } else {
       unsigned int nf = gd_nmfields_by_type(dirfile, parent, type);
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHuv(nf);
     }
 
@@ -2025,13 +2148,16 @@ mvector_list(dirfile, parent)
 
       GDP_UNDEF_ON_ERROR();
 
-      for (i = 0; fl[i]; ++i)
+      for (i = 0; fl[i]; ++i) {
+        EXTEND(sp, 1);
         GDP_PUSHpvz(fl[i]);
+      }
     } else {
       unsigned int nf = gd_nmvectors(dirfile, parent);
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHuv(nf);
     }
 
@@ -2055,14 +2181,17 @@ mstrings(dirfile, field_code)
 
       GDP_UNDEF_ON_ERROR();
 
-      for (i = 0; fl[i]; ++i)
+      for (i = 0; fl[i]; ++i) {
+        EXTEND(sp, 1);
         GDP_PUSHpvz(fl[i]);
+      }
     } else {
       unsigned int nf = gd_nmfields_by_type(dirfile, field_code,
           GD_STRING_ENTRY);
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHuv(nf);
     }
 
@@ -2302,7 +2431,7 @@ fragments(dirfile)
   DIRFILE * dirfile
   PREINIT:
     GDP_DIRFILE_ALIAS;
-    unsigned int nf;
+    int nf;
   ALIAS:
     GetData::Dirfile::fragments = 1
   PPCODE:
@@ -2311,11 +2440,16 @@ fragments(dirfile)
     nf = gd_nfragments(dirfile);
 
     if (GIMME_V == G_ARRAY) {
-      unsigned int i;
+      int i;
+      GDP_UNDEF_ON_ERROR();
+
+      EXTEND(sp, nf);
       for (i = 0; i < nf; ++i)
         GDP_PUSHpvz(gd_fragmentname(dirfile, i));
-    } else
-      GDP_PUSHuv(nf);
+    } else {
+      EXTEND(sp, 1);
+      GDP_PUSHiv(nf);
+    }
 
     dreturnvoid();
 
@@ -2337,13 +2471,16 @@ aliases(dirfile, field_code)
 
       GDP_UNDEF_ON_ERROR();
 
-      for (i = 0; fl[i]; ++i)
+      for (i = 0; fl[i]; ++i) {
+        EXTEND(sp, 1);
         GDP_PUSHpvz(fl[i]);
+      }
     } else {
       unsigned int nf = gd_naliases(dirfile, field_code);
 
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHuv(nf);
     }
 
@@ -2366,6 +2503,7 @@ fragment_affixes(dirfile, fragment_index)
 
     GDP_UNDEF_ON_ERROR();
 
+    EXTEND(sp, 2);
     GDP_PUSHpvz(prefix);
     GDP_PUSHpvz(suffix);
 
@@ -2376,7 +2514,6 @@ strtok(dirfile, string)
   DIRFILE * dirfile
   const char * string
   PREINIT:
-    int i;
     char *token;
     GDP_DIRFILE_ALIAS;
   ALIAS:
@@ -2390,29 +2527,29 @@ strtok(dirfile, string)
     {
       GDP_UNDEF_ON_ERROR();
 
+      EXTEND(sp, 1);
       GDP_PUSHpvz(token);
-      free(token);
+      safefree(token);
     }
 
     dreturnvoid();
 
 int
-include(dirfile, file, fragment_index, flags, prefix=NULL, suffix=NULL)
+include(dirfile, file, fragment_index, namespace=NULL, flags=0)
 	DIRFILE * dirfile
 	const char * file
 	int fragment_index
 	unsigned long int flags
-	gdp_char * prefix
-	gdp_char * suffix
+	gdp_char * namespace
 	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);
+		dtrace("%p, \"%s\", %i, \"%s\", %lu", dirfile, file, fragment_index,
+        namespace, flags);
+
+		RETVAL = gd_include_ns(dirfile, file, fragment_index, namespace, flags);
 		GDP_UNDEF_ON_ERROR();
 	OUTPUT:
 		RETVAL
@@ -2437,4 +2574,229 @@ carray_len(dirfile, field_code)
 	CLEANUP:
 		dreturn("%" PRIuSIZE, RETVAL);
 
+void
+get_sarray(dirfile, field_code)
+  DIRFILE * dirfile
+  const char * field_code
+  PREINIT:
+    size_t i, len;
+    const char **data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::get_sarray = 1
+  PPCODE:
+    dtrace("%p, \"%s\"; %i", dirfile, field_code, (int)GIMME_V);
+    len = gd_array_len(dirfile, field_code);
+    Newx(data_out, len, const char*);
+    gd_get_sarray(dirfile, field_code, data_out);
+
+    GDP_UNDEF_ON_ERROR(safefree(data_out));
+
+    /* In array context return the array; in scalar context return a reference
+     * to an array */
+    if (GIMME_V == G_ARRAY)
+      for (i = 0; i < len; ++i)
+        GDP_PUSHpvz(data_out[i]);
+    else
+      XPUSHs(sv_2mortal(gdp_newRVavpv(data_out, len)));
+
+    safefree(data_out);
+    dreturnvoid();
+
+void
+get_sarray_slice(dirfile, field_code, start, len);
+  DIRFILE * dirfile
+  const char * field_code
+  unsigned int start
+  size_t len
+  PREINIT:
+    size_t i;
+    const char **data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::get_sarray_slice = 1
+  PPCODE:
+    dtrace("%p, \"%s\", %u, %" PRIuSIZE "; %i", dirfile, field_code, start, len,
+        (int)GIMME_V);
+    Newx(data_out, len, const char*);
+    gd_get_sarray_slice(dirfile, field_code, start, len, data_out);
+
+    GDP_UNDEF_ON_ERROR(safefree(data_out));
+
+    if (GIMME_V == G_ARRAY)
+      for (i = 0; i < len; ++i)
+        GDP_PUSHpvz(data_out[i]);
+    else
+      XPUSHs(sv_2mortal(gdp_newRVavpv(data_out, len)));
+
+    safefree(data_out);
+    dreturnvoid();
+
+void
+sarrays(dirfile)
+  DIRFILE * dirfile
+  PREINIT:
+    int i;
+    const char ***data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::sarrays = 1
+  PPCODE:
+    dtrace("%p; %i", dirfile, (int)GIMME_V);
+    data_out = gd_sarrays(dirfile);
+
+    GDP_UNDEF_ON_ERROR();
+
+    /* in array context, return an array of arrays of strings.
+     * Otherwise, return a reference to the same. */
+    if (GIMME_V == G_ARRAY)
+      for (i = 0; data_out[i]; ++i)
+        XPUSHs(sv_2mortal(gdp_newRVavpv0(data_out[i])));
+    else {
+      AV *av = newAV();
+      for (i = 0; data_out[i]; ++i)
+        av_store(av, i, gdp_newRVavpv0(data_out[i]));
+      XPUSHs(sv_2mortal(newRV_noinc((SV*)av)));
+    }
+
+    dreturnvoid();
+
+int
+put_sarray(dirfile, field_code, sv_in, ...)
+    DIRFILE * dirfile
+    const char * field_code
+    SV *sv_in
+  PREINIT:
+    const char **data_in;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::put_sarray = 1
+  CODE:
+    dtrace("%p, \"%s\", %p ...[%li]", dirfile, field_code, sv_in,
+        (long)items - 3);
+
+    data_in = gdp_convert_strarr(NULL, items, ax, 2, gdp_package, "put_sarray");
+
+    RETVAL = gd_put_sarray(dirfile, field_code, data_in);
+
+    GDP_UNDEF_ON_ERROR(safefree(data_in));
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    safefree(data_in);
+    dreturn("%i", RETVAL);
+
+int
+put_sarray_slice(dirfile, field_code, start, sv_in, ...)
+    DIRFILE * dirfile
+    const char * field_code
+    gd_off64_t start
+    SV *sv_in
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+    size_t len;
+    const char **data_in;
+  ALIAS:
+    GetData::Dirfile::put_sarray_slice = 1
+  CODE:
+    dtrace("%p, \"%s\", %lli, %p ...[%li]", dirfile, field_code,
+        (long long)start, sv_in, (long)items - 4);
+
+    data_in = gdp_convert_strarr(&len, items, ax, 3, gdp_package,
+        "put_sarray_slice");
+
+    RETVAL = gd_put_sarray_slice(dirfile, field_code, start, len, data_in);
+
+    GDP_UNDEF_ON_ERROR(safefree(data_in));
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    safefree(data_in);
+    dreturn("%i", RETVAL);
+
+int
+add_sarray(dirfile, field_code, fragment_index, sv_in, ...)
+    DIRFILE * dirfile
+    const char * field_code
+    int fragment_index
+    SV *sv_in
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+    size_t len;
+    const char **data_in;
+  ALIAS:
+    GetData::Dirfile::add_sarray = 1
+  CODE:
+    dtrace("%p, \"%s\", %i, %p, ...[%li]", dirfile, field_code, fragment_index,
+        sv_in, (long)items - 4);
+
+    data_in = gdp_convert_strarr(&len, items, ax, 3, gdp_package, "add_sarray");
+
+    RETVAL = gd_add_sarray(dirfile, field_code, len, data_in, fragment_index);
+
+    GDP_UNDEF_ON_ERROR(safefree(data_in));
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    safefree(data_in);
+    dreturn("%i", RETVAL);
+
+int
+madd_sarray(dirfile, parent, field_code, sv_in, ...)
+    DIRFILE * dirfile
+    const char * parent
+    const char * field_code
+    SV *sv_in
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+    size_t len;
+    const char **data_in;
+  ALIAS:
+    GetData::Dirfile::madd_sarray = 1
+  CODE:
+    dtrace("%p, \"%s\", \"%s\", %p, ...[%li]", dirfile, parent, field_code,
+        sv_in, (long)items - 4);
+
+    data_in = gdp_convert_strarr(&len, items, ax, 3, gdp_package,
+        "madd_sarray");
+
+    RETVAL = gd_madd_sarray(dirfile, parent, field_code, len, data_in);
+
+    GDP_UNDEF_ON_ERROR(safefree(data_in));
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    safefree(data_in);
+    dreturn("%i", RETVAL);
+
+void
+msarrays(dirfile, parent)
+  DIRFILE * dirfile
+  const char * parent
+  PREINIT:
+    int i;
+    const char ***data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::msarrays = 1
+  PPCODE:
+    dtrace("%p, \"%s\"; %i", dirfile, parent, (int)GIMME_V);
+    data_out = gd_msarrays(dirfile, parent);
+
+    GDP_UNDEF_ON_ERROR();
+
+    /* in array context, return an array of arrays of strings.
+     * Otherwise, return a reference to the same. */
+    if (GIMME_V == G_ARRAY)
+      for (i = 0; data_out[i]; ++i)
+        XPUSHs(sv_2mortal(gdp_newRVavpv0(data_out[i])));
+    else {
+      AV *av = newAV();
+      for (i = 0; data_out[i]; ++i)
+        av_store(av, i, gdp_newRVavpv0(data_out[i]));
+      XPUSHs(sv_2mortal(newRV_noinc((SV*)av)));
+    }
+
+    dreturnvoid();
+
 INCLUDE: simple_funcs.xs
diff --git a/bindings/perl/src/Makefile.PL.in b/bindings/perl/src/Makefile.PL.in
index be767a1..d19a39f 100644
--- a/bindings/perl/src/Makefile.PL.in
+++ b/bindings/perl/src/Makefile.PL.in
@@ -25,10 +25,8 @@ WriteMakefile(
   INC => '-I at top_srcdir@/src',
   LICENSE => 'lgpl_2_1',
   NAME => "GetData",
-#  OBJECT => 'GetData.o',
   PREREQ_PM => {
     perl => '5.6.0',
     'Math::Complex' => '1.34'
   },
-#  XS => { 'GetData.xs' => 'GetData.c' }
 );
diff --git a/bindings/perl/src/typemap b/bindings/perl/src/typemap
index b516608..082ff1d 100644
--- a/bindings/perl/src/typemap
+++ b/bindings/perl/src/typemap
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2013 D. V. Wiebe
+# Copyright (C) 2011-2013, 2017 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -24,11 +24,12 @@ _Complex double T_COMPLEX
 unsigned long int T_UV
 
 # GetData types
+struct gdp_dirfile_t * T_GDP_DIRFILE
 DIRFILE * T_DIRFILE
 gd_entry_t T_ENTRY
 gd_entype_t T_UV
 gd_off64_t T_IV
-gd_shift_t T_IV
+gd_int64_t T_IV
 gd_triplet_t T_TRIPLET
 gd_type_t T_IV
 gd_windop_t T_IV
@@ -36,11 +37,11 @@ gd_windop_t T_IV
 # GetData Perl pseudotypes
 gdp_complex_in T_COMPLEXIN
 gdp_complex_undef T_COMPLEX_UNDEF
-gdp_bitnum_t T_IV_FFFF
 gdp_char * T_PV_NULL
+gdp_ffff_t T_IV_FFFF
 gdp_int T_IV_ZERO
 gdp_numbits_t T_IV_ZERO
-gdp_shift_t T_IV_ZERO
+gdp_int64_t T_IV_ZERO
 gdp_uint_t T_UV_ZERO
 gdp_type_t T_IV_ZERO
 gdp_complex T_COMPLEX_ZERO
@@ -48,15 +49,22 @@ gdp_pentry_t T_PENTRY
 
 
 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
+T_GDP_DIRFILE
+  if (sv_isa($arg, \"${Package}::Dirfile\"))
+    $var = INT2PTR(struct gdp_dirfile_t*, SvIV((SV*)SvRV($arg)));
+  else
     croak(\"%s::${func_name}() - Invalid dirfile object\", gdp_package);
+T_DIRFILE
+  {
+    struct gdp_dirfile_t *gdp_dirfile;
+    if (sv_isa($arg, \"${Package}::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 (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV) {
     AV *av = (AV*)SvRV($arg);
@@ -161,6 +169,5 @@ T_TRIPLET
  
 
 OUTPUT
-T_DIRFILE
-  gdp_dirfile->D = $var;
-  sv_setref_uv($arg, \"${Package}::Dirfile\", PTR2UV(gdp_dirfile));
+T_GDP_DIRFILE
+  sv_setref_uv($arg, \"${Package}::Dirfile\", PTR2UV($var));
diff --git a/bindings/perl/t/big_test.t b/bindings/perl/t/big_test.t
index d43a170..67c03e7 100644
--- a/bindings/perl/t/big_test.t
+++ b/bindings/perl/t/big_test.t
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# Copyright (C) 2011-2015 D. V. Wiebe
+# Copyright (C) 2011-2016 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -22,7 +22,7 @@
 use GetData;
 use Math::Complex;
 use strict;
-use Test::More tests => 1533;
+use Test::More tests => 1754;
 
 my $ne = 0;
 my ($s, @a, %h);
@@ -113,9 +113,7 @@ sub CheckNum2 {
 
 sub CheckString {
   print "\n";
-  is ($_[1], $_[2], "s[$_[0]] = \"" .
-    ((defined $_[1]) ? "\"" . $_[1] . "\"" : "undef") . ", expected " .
-    ((defined $_[2]) ? "\"" . $_[2] . "\"" : "undef"));
+  is ($_[1], $_[2], "s[$_[0]] = \"$_[1]\", expected \"$_[2]\"");
   print "#";
 }
 
@@ -146,9 +144,9 @@ sub CheckEOSArray {
 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));
+my $nfields = 20;
+my @fields = (qw(bit div data mult sbit INDEX alias const indir mplex phase
+  recip carray lincom sarray sindir string window linterp polynom));
 
 #create the dirfile
 system "rm -rf dirfile" if (-e "dirfile");
@@ -179,6 +177,10 @@ recip RECIP div 6.5;4.3
 phase PHASE data 11
 window WINDOW linterp mult LT 4.1
 ALIAS alias data
+sarray SARRAY one two three four five six seven
+data/msarray SARRAY eight nine ten eleven twelve
+indir INDIR data carray
+sindir SINDIR data sarray
 string STRING \"Zaphod Beeblebrox\"
 EOF
   or die;
@@ -246,12 +248,12 @@ CheckSArray(25, \@a, @fields);
 # 26: nmfields check
 $s = $_->mfield_list("data");
 CheckOK(26);
-CheckNum(26, $s, 4);
+CheckNum(26, $s, 5);
 
 # 27: mfield_list check
 @a = $_->mfield_list("data");
 CheckOK(27);
-CheckSArray(27, \@a, qw(mstr mconst mcarray mlut));
+CheckSArray(27, \@a, qw(mstr mconst mcarray mlut msarray));
 
 # 28: nframes check
 $s = $_->nframes;
@@ -594,7 +596,7 @@ CheckOK(65);
 CheckNum(65, $s, 1);
 
 # 66: include
-$s = $_->include("form2", 0, 0);
+$s = $_->include("form2", 0);
 CheckOK2(66, 1);
 CheckNum2(66, 2, $s, 1);
 
@@ -610,19 +612,19 @@ CheckNum(67, $s, 2);
 # 68: field_list_by_type
 @a = $_->field_list_by_type($GetData::LINCOM_ENTRY);
 CheckOK(68);
-CheckSArray(68, \@a, qw(lincom new3));
+CheckSArray(68, \@a, qw(new3 lincom));
 
 # 69: nvectors
 $s = $_->vector_list;
 CheckOK(69);
-CheckNum(69, $s, 22);
+CheckNum(69, $s, 23);
 
 # 70: vector_list
 @a = $_->vector_list;
 CheckOK(70);
-CheckSArray(70, \@a, qw(INDEX alias bit data div lincom linterp mplex
-  mult new1 new10 new3 new4 new6 new7 new8 new9 phase polynom recip sbit
-  window));
+CheckSArray(70, \@a, qw(bit div data mult new1 new3 new4 new6 new7 new8 new9
+  sbit INDEX alias indir mplex new10 phase recip lincom window linterp
+  polynom));
 
 #72: madd_lincom check
 $s = $_->madd_lincom("data", "mnew2", 2, [ qw(in1 in2) ], [ 9.9+8.8*i, 7.7 ],
@@ -823,7 +825,7 @@ CheckNum2(86, 4, $s, 86.);
 # 94: put_string
 $s = $_->put_string("string", "Arthur Dent");
 CheckOK2(94, 1);
-CheckNum2(94, 2, $s, 12);
+CheckNum2(94, 2, $s, 0);
 
 $s = $_->get_string("string");
 CheckOK2(94, 3);
@@ -1329,7 +1331,7 @@ $_ = &GetData::invalid_dirfile;
 CheckOK2(156, 0);
 $s = $_->fragments;
 CheckError2(156, 1, $GetData::E_BAD_DIRFILE);
-CheckNum2(156, 2, $s, 0);
+CheckNum2(156, 2, $s, $GetData::E_BAD_DIRFILE);
 $_->close;
 $_ = $d;
 
@@ -1610,10 +1612,11 @@ CheckNum(221, $s, 4);
 # 222: gd_aliases check
 @a = $_->aliases('data');
 CheckOK(222);
-CheckSArray(222, \@a, "data", "alias", "data/mnew20", "new20");
+CheckSArray(222, \@a, "data", "alias", "new20", "data/mnew20");
 
 # 223: gd_include_affix check
-$s = $_->include('format1', 0, $GetData::CREAT | $GetData::EXCL, 'A', 'Z');
+$s = $_->include_affix('format1', 0, 'A', 'Z',
+  $GetData::CREAT | $GetData::EXCL);
 CheckOK(223);
 
 # 226: gd_fragment_affixes check
@@ -1702,19 +1705,19 @@ CheckNum(236, $s, 0);
 $s = $_->entry_list("data", $GetData::SCALAR_ENTRIES,
   $GetData::ENTRIES_HIDDEN | $GetData::ENTRIES_NOALIAS);
 CheckOK2(237, 1);
-CheckNum2(237, 1, $s, 6);
+CheckNum2(237, 1, $s, 7);
 $s = $_->entry_list(undef, $GetData::VECTOR_ENTRIES,
   $GetData::ENTRIES_HIDDEN | $GetData::ENTRIES_NOALIAS);
 CheckOK2(237, 2);
-CheckNum2(237, 2, $s, 24);
+CheckNum2(237, 2, $s, 25);
 
 # 239: gd_entry_list
 @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
-  new135 new14 new16 new18 new21 new3 new4 new6 new7 new8 phase polynom recip
-  sbit window));
+CheckSArray(239, \@a, qw(bit div data mult new1 new3 new4 new6 new7 new8 sbit
+  INDEX indir mplex new14 new16 new18 new21 phase recip lincom new135 window
+  linterp polynom));
 
 # 240: gd_mplex_lookback
 $_->mplex_lookback($GetData::LOOKBACK_ALL);
@@ -2013,7 +2016,7 @@ CheckArray2(259, 13, $h{'scalar_ind'}, undef, -1, -1, 4, undef, -1);
 
   $s = $_->reference();
   CheckOK2(272, 2);
-  CheckString(272, $s, undef);
+  CheckNum(272, $s, undef);
 }
 
 # 273: get_carray (GD_NULL)
@@ -2032,8 +2035,254 @@ CheckNum(273, $s, undef);
 CheckOK(274);
 CheckArray(274, \@a);
 
+# 277: sarray entry
+%h = $_->entry("sarray");
+CheckOK2(277, 1);
+CheckSArray2(277, 2, [ sort keys %h ],
+  qw(array_len field field_type fragment_index));
+CheckNum2(277, 3, $h{'array_len'}, 7);
+CheckString2(277, 4, $h{'field'}, "sarray");
+CheckNum2(277, 5, $h{'field_type'}, $GetData::SARRAY_ENTRY);
+CheckNum2(277, 6, $h{'fragment_index'}, 0);
+
+# 278: get_sarray
+$s = $_->get_sarray("sarray");
+CheckOK(278);
+CheckSArray(278, $s, qw(one two three four five six seven));
+
+# 279: get_sarray_slice
+ at a = $_->get_sarray_slice("sarray", 2, 2);
+CheckOK(279);
+CheckSArray(279, \@a, qw(three four));
+
+# 280: sarrays
+ at a = $_->sarrays();
+CheckOK(280);
+CheckNum(280, $#a, 0);
+CheckSArray(280, $a[0], qw(one two three four five six seven));
+
+# 281: put sarray
+$s = $_->put_sarray("sarray", qw(eka dvi tri catur panca sas sapta));
+CheckOK2(281, 1);
+CheckNum2(281, 2, $s, 0);
+
+ at a = $_->get_sarray("sarray");
+CheckOK2(281, 3);
+CheckSArray2(281, 4, \@a, qw(eka dvi tri catur panca sas sapta));
+
+# 282: put sarray slice
+$s = $_->put_sarray_slice("sarray", 2, [ "asta", "nava" ]);
+CheckOK2(282, 1);
+CheckNum2(282, 2, $s, 0);
+
+$s = $_->get_sarray("sarray");
+CheckOK2(282, 3);
+CheckSArray2(282, 4, $s, qw(eka dvi asta nava panca sas sapta));
+
+# 283: add sarray
+$s = $_->add_sarray("new283", 0, qw(eins zwei drei));
+CheckOK2(283, 1);
+CheckNum2(283, 2, $s, 0);
+
+%h = $_->entry("new283");
+CheckOK2(283, 3);
+CheckNum2(283, 4, $h{'array_len'}, 3);
+CheckString2(283, 6, $h{'field'}, "new283");
+CheckNum2(283, 7, $h{'field_type'}, $GetData::SARRAY_ENTRY);
+CheckNum2(283, 8, $h{'fragment_index'}, 0);
+
+$s = $_->get_sarray("new283");
+CheckOK2(283, 9);
+CheckSArray2(283, 10, $s, qw(eins zwei drei));
+
+# 285: madd sarray
+$s = $_->madd_sarray("data", "mnew285", [qw(un deux trois)]);
+CheckOK2(285, 1);
+CheckNum2(285, 2, $s, 0);
+
+%h = $_->entry("data/mnew285");
+CheckOK2(285, 3);
+CheckNum2(285, 4, $h{'array_len'}, 3);
+CheckString2(285, 6, $h{'field'}, "data/mnew285");
+CheckNum2(285, 7, $h{'field_type'}, $GetData::SARRAY_ENTRY);
+CheckNum2(285, 8, $h{'fragment_index'}, 0);
+
+$s = $_->get_sarray("data/mnew285");
+CheckOK2(285, 9);
+CheckSArray2(285, 10, $s, qw(un deux trois));
+
+# 286 alter sarray
+$s = $_->alter_sarray("new283", 2);
+CheckOK2(286, 0);
+CheckNum2(286, 1, $s, 0);
+
+%h = $_->entry("new283");
+CheckOK2(286, 3);
+CheckNum2(286, 4, $h{'array_len'}, 2);
+CheckString2(286, 6, $h{'field'}, "new283");
+CheckNum2(286, 7, $h{'field_type'}, $GetData::SARRAY_ENTRY);
+
+# 287: msarrays
+ at a = $_->msarrays("data");
+CheckOK(287);
+CheckNum(287, $#a, 1);
+CheckSArray2(287, 1, $a[0], qw(eight nine ten eleven twelve));
+CheckSArray2(287, 2, $a[1], qw(un deux trois));
+
+# 288 indir entry
+%h = $_->entry("indir");
+CheckOK(288);
+CheckSArray2(288, 0, [ sort keys %h ], qw(field field_type fragment_index),
+  "in_fields");
+CheckString2(288, 1, $h{'field'}, "indir");
+CheckNum2(288, 2, $h{'field_type'}, $GetData::INDIR_ENTRY);
+CheckNum2(288, 3, $h{'fragment_index'}, 0);
+CheckSArray2(288, 4, $h{'in_fields'}, qw(data carray));
+
+# 289: add indir
+$s = $_->add_indir(qw(new289 in2 in3));
+CheckOK2(289, 0);
+CheckNum2(289, 1, $s, 0);
+
+%h = $_->entry("new289");
+CheckOK(289);
+CheckString2(289, 1, $h{'field'}, "new289");
+CheckNum2(289, 2, $h{'field_type'}, $GetData::INDIR_ENTRY);
+CheckNum2(289, 3, $h{'fragment_index'}, 0);
+CheckSArray2(289, 4, $h{'in_fields'}, qw(in2 in3));
+
+# 291 madd indir
+$s = $_->madd_indir(qw(data new291 in1 in8));
+CheckOK2(291, 0);
+CheckNum2(291, 1, $s, 0);
+
+%h = $_->entry("data/new291");
+CheckOK(291);
+CheckString2(291, 1, $h{'field'}, "data/new291");
+CheckNum2(291, 2, $h{'field_type'}, $GetData::INDIR_ENTRY);
+CheckNum2(291, 3, $h{'fragment_index'}, 0);
+CheckSArray2(291, 4, $h{'in_fields'}, qw(in1 in8));
+
+# 291 alter_indir
+$s = $_->alter_indir("new289", "in5");
+CheckOK2(291, 1);
+CheckNum2(291, 2, $s, 0);
+
+%h = $_->entry("new289");
+CheckOK2(291, 3);
+CheckString2(291, 4, $h{'field'}, "new289");
+CheckNum2(291, 5, $h{'field_type'}, $GetData::INDIR_ENTRY);
+CheckNum2(291, 6, $h{'fragment_index'}, 0);
+CheckSArray2(291, 7, $h{'in_fields'}, qw(in5 in3));
+
+# 292 sindir entry
+%h = $_->entry("sindir");
+CheckOK(292);
+CheckSArray2(292, 0, [ sort keys %h ], qw(field field_type fragment_index),
+  "in_fields");
+CheckString2(292, 1, $h{'field'}, "sindir");
+CheckNum2(292, 2, $h{'field_type'}, $GetData::SINDIR_ENTRY);
+CheckNum2(292, 3, $h{'fragment_index'}, 0);
+CheckSArray2(292, 4, $h{'in_fields'}, qw(data sarray));
+
+# 293 add sindir
+$s = $_->add_sindir(qw(new293 in2 in3));
+CheckOK2(293, 0);
+CheckNum2(293, 1, $s, 0);
+
+%h = $_->entry("new293");
+CheckOK(293);
+CheckString2(293, 1, $h{'field'}, "new293");
+CheckNum2(293, 2, $h{'field_type'}, $GetData::SINDIR_ENTRY);
+CheckNum2(293, 3, $h{'fragment_index'}, 0);
+CheckSArray2(293, 4, $h{'in_fields'}, qw(in2 in3));
+
+# 294 madd sindir
+$s = $_->madd_sindir(qw(data new294 in1 in8));
+CheckOK2(294, 0);
+CheckNum2(294, 1, $s, 0);
+
+%h = $_->entry("data/new294");
+CheckOK(294);
+CheckString2(294, 1, $h{'field'}, "data/new294");
+CheckNum2(294, 2, $h{'field_type'}, $GetData::SINDIR_ENTRY);
+CheckNum2(294, 3, $h{'fragment_index'}, 0);
+CheckSArray2(294, 4, $h{'in_fields'}, qw(in1 in8));
+
+# 295 alter_sindir
+$s = $_->alter_sindir("new293", "in5");
+CheckOK2(295, 1);
+CheckNum2(295, 2, $s, 0);
+
+%h = $_->entry("new293");
+CheckOK2(295, 3);
+CheckString2(295, 4, $h{'field'}, "new293");
+CheckNum2(295, 5, $h{'field_type'}, $GetData::SINDIR_ENTRY);
+CheckNum2(295, 6, $h{'fragment_index'}, 0);
+CheckSArray2(295, 7, $h{'in_fields'}, qw(in5 in3));
+
+# 296 getstrdata
+$s = $_->getdata("sindir", 0, 0, 1, 0);
+CheckOK(296);
+CheckSArray(296, $s, qw(eka eka eka eka eka eka eka eka));
+
+# 300 add indir
+$s = $_->add({
+    field          => "new300",
+    field_type     => $GetData::INDIR_ENTRY,
+    fragment_index => 0,
+    in_fields      => [ qw(in3 in4) ],
+  });
+CheckOK2(300,1);
+CheckNum2(300, 2, $s, 0);
 
+%h = $_->entry("new300");
+CheckOK(300);
+CheckString2(300, 1, $h{'field'}, "new300");
+CheckNum2(300, 2, $h{'field_type'}, $GetData::INDIR_ENTRY);
+CheckNum2(300, 3, $h{'fragment_index'}, 0);
+CheckSArray2(300, 4, $h{'in_fields'}, qw(in3 in4));
 
+# 301 add sindir
+$s = $_->add({
+    field          => "new301",
+    field_type     => $GetData::SINDIR_ENTRY,
+    fragment_index => 0,
+    in_fields      => [ qw(in3 in4) ],
+  });
+CheckOK2(301,1);
+CheckNum2(301, 2, $s, 0);
+
+%h = $_->entry("new301");
+CheckOK(301);
+CheckString2(301, 1, $h{'field'}, "new301");
+CheckNum2(301, 2, $h{'field_type'}, $GetData::SINDIR_ENTRY);
+CheckNum2(301, 3, $h{'fragment_index'}, 0);
+CheckSArray2(301, 4, $h{'in_fields'}, qw(in3 in4));
+
+# 302: include namespace
+$s = $_->include('format2', 0, 'ns', $GetData::CREAT | $GetData::EXCL);
+CheckOK(302);
+CheckNum(302, $s, 2);
+
+# 303: fragment_namespace (read)
+$s = $_->fragment_namespace(2);
+CheckOK(303);
+CheckString(303, $s, "ns");
+
+# 304: fragment_namespace (alter)
+$s = $_->fragment_namespace(2, 'ns2');
+CheckOK(304);
+CheckString(304, $s, "ns2");
+
+# 305: match_entries
+$s = scalar $_->match_entries('^lin', 0);
+CheckOK2(305, 0);
+CheckNum2(305, 1, $s, 2);
+
+ at a = $_->match_entries('^lin', 0);
+CheckOK2(305, 2);
+CheckSArray2(292, 3, \@a, qw(lincom linterp));
 
 
 
diff --git a/bindings/php/Makefile.in b/bindings/php/Makefile.in
index e95c314..14a1a61 100644
--- a/bindings/php/Makefile.in
+++ b/bindings/php/Makefile.in
@@ -282,6 +282,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/php/getdata.c b/bindings/php/getdata.c
index fdea031..cf6270e 100644
--- a/bindings/php/getdata.c
+++ b/bindings/php/getdata.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2014, 2015, 2016 D. V. Wiebe
+/* Copyright (C) 2013, 2014, 2015, 2016, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -568,6 +568,9 @@ static void gdphp_from_entry(zval *z, gd_entry_t *E)
       add_assoc_long(z, "numbits", E->EN(bit,numbits));
       gdphp_add_assoc_scalars(z, E, 0x3);
       break;
+    case GD_SARRAY_ENTRY:
+      add_assoc_long(z, "array_len", E->EN(scalar,array_len));
+      break;
     case GD_CARRAY_ENTRY:
       add_assoc_long(z, "array_len", E->EN(scalar,array_len));
       /* fallthrough */
@@ -590,6 +593,8 @@ static void gdphp_from_entry(zval *z, gd_entry_t *E)
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       gdphp_add_assoc_string_arr(z, "in_fields", E->in_fields, 2);
       break;
     case GD_PHASE_ENTRY:
@@ -883,7 +888,7 @@ static int gdphp_convert_cmparray(double *out, zval *z, int min, int max,
   GDPHP_ZVALP d = NULL;
   int n = -1;
   GDPHP_HASH_KEY_DECL(key);
-  long index;
+  unsigned long index;
 
   int *have;
 
@@ -905,8 +910,8 @@ static int gdphp_convert_cmparray(double *out, zval *z, int min, int max,
     /* check key */
     if (GDPHP_HASH_GET_CURRENT_KEY(a, key, index, i) == HASH_KEY_IS_STRING) {
       GDPHP_DIE(ctx, "cannot use associative array");
-    } else if (index < 0 || index >= max)
-      GDPHP_DIE2(ctx, "bad array index (%li)", index);
+    } else if (index >= max)
+      GDPHP_DIE2(ctx, "bad array index (%lu/%lu)", index, max);
 
     if (!have[index]) {
       gdphp_to_datum(out + index * 2, GD_COMPLEX128, ZP(d), 1, ctx);
@@ -915,7 +920,8 @@ static int gdphp_convert_cmparray(double *out, zval *z, int min, int max,
   }
 
   /* check for holes and calculate n */
-  for (index = max - 1; index >= 0; --index) {
+  index = max;
+  while (index-- > 0) {
     if (have[index] == 0 && n != -1)
       GDPHP_DIE(ctx, "uninitialised data in numeric array");
     else if (have[index] && n == -1)
@@ -931,6 +937,66 @@ static int gdphp_convert_cmparray(double *out, zval *z, int min, int max,
   return n;
 }
 
+/* convert a PHP array to an array of strings; returns the number of elements */
+static size_t gdphp_convert_sarray(const char ***out, const zval *z, int p)
+{
+  HashTable *a = Z_ARRVAL_P(z);
+  HashPosition i;
+  GDPHP_ZVALP d = NULL;
+  size_t j, n = 0;
+  GDPHP_HASH_KEY_DECL(key);
+  unsigned long index;
+
+  GDPHP_CONTEXTp(ctx,p);
+
+  dtrace("%p, %p, %i", out, z, p);
+
+  /* count and check */
+  for (zend_hash_internal_pointer_reset_ex(a, &i);
+      GDPHP_HASH_GET_CURRENT_DATA(d, a, i);
+      zend_hash_move_forward_ex(a, &i))
+  {
+    /* check key */
+    if (GDPHP_HASH_GET_CURRENT_KEY(a, key, index, i) == HASH_KEY_IS_STRING)
+      GDPHP_DIE(&ctx, "cannot use associative array");
+
+    if (Z_TYPE_P(ZP(d)) != IS_STRING)
+      GDPHP_DIE(&ctx, "string array required");
+
+    if (n < index + 1)
+      n = index + 1;
+  }
+
+  if (n == 0) {
+    *out = NULL;
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* allocate and zero */
+  *out = emalloc(sizeof(**out) * n);
+  for (j = 0; j < n; ++j)
+    (*out)[j] = NULL;
+
+  /* convert */
+  for (zend_hash_internal_pointer_reset_ex(a, &i);
+			GDPHP_HASH_GET_CURRENT_DATA(d, a, i);
+      zend_hash_move_forward_ex(a, &i))
+  {
+    GDPHP_HASH_GET_CURRENT_KEY(a, key, index, i);
+
+    (*out)[index] = Z_STRVAL_P(ZP(d));
+  }
+
+  /* look for holes */
+  for (j = 0; j < n; ++j)
+    if ((*out)[j] == NULL)
+      GDPHP_DIE2(&ctx, "missing array index (%li)", j);
+
+  dreturn("%zu", n);
+  return n;
+}
+
 /* convert a PHP array to a bounded array of strings; returns the number of
  * elements */
 static int gdphp_convert_nsarray(char **out, zval *z, int min, int max,
@@ -941,7 +1007,7 @@ static int gdphp_convert_nsarray(char **out, zval *z, int min, int max,
   GDPHP_ZVALP d = NULL;
   int n = -1;
   GDPHP_HASH_KEY_DECL(key);
-  long index;
+  unsigned long index;
 
   dtracectx("%p, %p, %i, %i", out, z, min, max);
 
@@ -955,10 +1021,9 @@ static int gdphp_convert_nsarray(char **out, zval *z, int min, int max,
   {
     /* check key */
     if (GDPHP_HASH_GET_CURRENT_KEY(a, key, index, i) == HASH_KEY_IS_STRING)
-    {
       GDPHP_DIE(ctx, "cannot use associative array");
-    } else if (index < 0 || index >= max)
-      GDPHP_DIE2(ctx, "bad array index (%li)", index);
+    else if (index >= max)
+      GDPHP_DIE2(ctx, "bad array index (%lu/%i)", index, max);
 
     if (Z_TYPE_P(ZP(d)) != IS_STRING)
       GDPHP_DIE(ctx, "string array required");
@@ -967,7 +1032,8 @@ static int gdphp_convert_nsarray(char **out, zval *z, int min, int max,
   }
 
   /* check for holes and calculate n */
-  for (index = max - 1; index >= 0; --index) {
+  index = max;
+  while (index-- > 0) {
     if (out[index] == NULL && n != -1)
       GDPHP_DIE(ctx, "uninitialised data in string array");
     else if (out[index] && n == -1)
@@ -989,7 +1055,7 @@ static void gdphp_convert_array(struct gdphp_din *din, zval *zdata,
   HashPosition i;
   GDPHP_ZVALP d = NULL;
   GDPHP_HASH_KEY_DECL(key);
-  long index;
+  unsigned long index;
 
   dtracectx("%p, %p", din, zdata);
 
@@ -1001,13 +1067,10 @@ static void gdphp_convert_array(struct gdphp_din *din, zval *zdata,
       zend_hash_move_forward_ex(a, &i))
   {
     /* make sure this isn't an associative array */
-    if (GDPHP_HASH_GET_CURRENT_KEY(a, key, index, i) == HASH_KEY_IS_STRING) {
+    if (GDPHP_HASH_GET_CURRENT_KEY(a, key, index, i) == HASH_KEY_IS_STRING)
       GDPHP_DIE(ctx, "cannot use associative arrays");
-    } else if (index < 0) /* does zend_hash_get_current_key_ex return ulong
-                             or a long? */
-      GDPHP_DIE(ctx, "bad array index");
 
-    if ((unsigned long)index + 1 > din->ns)
+    if (index + 1 > din->ns)
       din->ns = index + 1;
 
     if (din->type == GD_UNKNOWN) {
@@ -1410,6 +1473,10 @@ static void gdphp_to_entry(gd_entry_t *E, zval *z, const gd_entry_t *old_E,
           E->EN(bit,numbits) = 1;
       }
       break;
+    case GD_SARRAY_ENTRY:
+      E->EN(scalar,array_len) = gdphp_entry_long(a, "array_len", NULL, partial,
+          ctx);
+			break;
     case GD_CARRAY_ENTRY:
       E->EN(scalar,array_len) = gdphp_entry_long(a, "array_len", NULL, partial,
           ctx);
@@ -1473,6 +1540,8 @@ static void gdphp_to_entry(gd_entry_t *E, zval *z, const gd_entry_t *old_E,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+		case GD_INDIR_ENTRY:
+		case GD_SINDIR_ENTRY:
       gdphp_entry_infields((char**)E->in_fields, a, 2, 2, partial, ctx);
       break;
     case GD_PHASE_ENTRY:
@@ -1564,7 +1633,7 @@ static zval *gdphp_to_string_array(zval *z, const char **l, int n)
 
   array_init(z);
 
-  for (i = 0; (l[i] && n == 0) || (n > 0 && i < n); ++i)
+  for (i = 0; (n == 0) ? l[i] != NULL : i < n; ++i)
     if (l[i] == NULL)
       add_index_null(z, i);
     else
@@ -1925,6 +1994,31 @@ PHP_FUNCTION(gd_add_carray)
   GDPHP_RETURN_BOOL(r);
 }
 
+PHP_FUNCTION(gd_add_sarray)
+{
+  char *field_code;
+  GDPHP_SLEN field_code_len;
+  zval *zdata;
+  DIRFILE *D;
+
+  int r;
+  size_t n;
+  const char **d;
+  long index = 0;
+
+  dtracephp();
+
+  GDPHP_PARSED("szl", &field_code, &field_code_len, &zdata, &index);
+
+  n = gdphp_convert_sarray(&d, zdata, 1);
+
+  r = gd_add_sarray(D, field_code, n, d, index);
+  efree(d);
+
+  GDPHP_RETURN_BOOL(r);
+}
+
+
 PHP_FUNCTION(gd_add_const)
 {
   char *field_code;
@@ -1963,6 +2057,38 @@ PHP_FUNCTION(gd_add_divide)
   GDPHP_RETURN_BOOL(gd_add_divide(D, field_code, in1, in2, index));
 }
 
+PHP_FUNCTION(gd_add_indir)
+{
+  char *field_code, *in1, *in2;
+  GDPHP_SLEN field_code_len, in1_len, in2_len;
+  GDPHP_LONG index = 0;
+
+  DIRFILE *D;
+
+  dtracephp();
+
+  GDPHP_PARSED("sss|l", &field_code, &field_code_len, &in1, &in1_len, &in2,
+      &in2_len, &index);
+
+  GDPHP_RETURN_BOOL(gd_add_indir(D, field_code, in1, in2, index));
+}
+
+PHP_FUNCTION(gd_add_sindir)
+{
+  char *field_code, *in1, *in2;
+  GDPHP_SLEN field_code_len, in1_len, in2_len;
+  GDPHP_LONG index = 0;
+
+  DIRFILE *D;
+
+  dtracephp();
+
+  GDPHP_PARSED("sss|l", &field_code, &field_code_len, &in1, &in1_len, &in2,
+      &in2_len, &index);
+
+  GDPHP_RETURN_BOOL(gd_add_sindir(D, field_code, in1, in2, index));
+}
+
 PHP_FUNCTION(gd_add_lincom)
 {
   char *field_code;
@@ -2301,6 +2427,21 @@ PHP_FUNCTION(gd_alter_carray)
   GDPHP_RETURN_BOOL(gd_alter_carray(D, field_code, type, len));
 }
 
+PHP_FUNCTION(gd_alter_sarray)
+{
+  char *field_code;
+  GDPHP_SLEN field_code_len;
+  GDPHP_LONG len = 0;
+
+  DIRFILE *D;
+
+  dtracephp();
+
+  GDPHP_PARSED("s|l", &field_code, &field_code_len, &len);
+
+  GDPHP_RETURN_BOOL(gd_alter_sarray(D, field_code, len));
+}
+
 PHP_FUNCTION(gd_alter_const)
 {
   char *field_code;
@@ -2403,6 +2544,44 @@ PHP_FUNCTION(gd_alter_divide)
   GDPHP_RETURN_BOOL(gd_alter_divide(D, field_code, in_field1p, in_field2p));
 }
 
+PHP_FUNCTION(gd_alter_indir)
+{
+  char *field_code, *in_field1 = NULL, *in_field2 = NULL;
+  GDPHP_SLEN field_code_len, in_field1_len, in_field2_len;
+  
+  DIRFILE *D;
+  char *in_field1p, *in_field2p;
+
+  dtracephp();
+
+  GDPHP_PARSED("s|ss", &field_code, &field_code_len, &in_field1,
+      &in_field1_len, &in_field2, &in_field2_len);
+
+  in_field1p = gdphp_check_null_string(in_field1);
+  in_field2p = gdphp_check_null_string(in_field2);
+  
+  GDPHP_RETURN_BOOL(gd_alter_indir(D, field_code, in_field1p, in_field2p));
+}
+
+PHP_FUNCTION(gd_alter_sindir)
+{
+  char *field_code, *in_field1 = NULL, *in_field2 = NULL;
+  GDPHP_SLEN field_code_len, in_field1_len, in_field2_len;
+  
+  DIRFILE *D;
+  char *in_field1p, *in_field2p;
+
+  dtracephp();
+
+  GDPHP_PARSED("s|ss", &field_code, &field_code_len, &in_field1,
+      &in_field1_len, &in_field2, &in_field2_len);
+
+  in_field1p = gdphp_check_null_string(in_field1);
+  in_field2p = gdphp_check_null_string(in_field2);
+  
+  GDPHP_RETURN_BOOL(gd_alter_sindir(D, field_code, in_field1p, in_field2p));
+}
+
 PHP_FUNCTION(gd_alter_lincom)
 {
   char *field_code;
@@ -2841,6 +3020,31 @@ PHP_FUNCTION(gd_carrays)
   dreturnvoid();
 }
 
+PHP_FUNCTION(gd_sarrays)
+{
+  DIRFILE *D;
+  size_t i;
+  const char ***s;
+	GDPHP_ZVAL_NULL(tmp);
+
+  dtracephp();
+
+  GDPHP_PARSED_ONLY();
+
+  s = gd_sarrays(D);
+
+  if (s == NULL)
+    GDPHP_RETURN_F;
+
+  /* convert */
+  array_init(return_value);
+
+  for (i = 0; s[i]; ++i)
+    add_index_zval(return_value, i, gdphp_to_string_array(RZ(tmp), s[i], 0));
+
+  dreturnvoid();
+}
+
 PHP_FUNCTION(gd_close)
 {
   zval *z;
@@ -3082,6 +3286,31 @@ PHP_FUNCTION(gd_entry_list)
   dreturnvoid();
 }
 
+PHP_FUNCTION(gd_match_entries)
+{
+  char *regex;
+  GDPHP_SLEN regex_len;
+  GDPHP_LONG type = 0, flags = 0, fragment = GD_ALL_FRAGMENTS;
+  DIRFILE *D;
+
+  const char **fl = NULL;
+  char *regexp;
+  dtracephp();
+
+  GDPHP_PARSED("|slll", &regex, &regex_len, &fragment, &type, &flags);
+
+  regexp = gdphp_check_null_string(regex);
+
+  gd_match_entries(D, regexp, fragment, type, flags, &fl);
+
+  if (fl == NULL)
+    GDPHP_RETURN_F;
+
+  gdphp_to_string_array(return_value, fl, 0);
+
+  dreturnvoid();
+}
+
 PHP_FUNCTION(gd_entry_type)
 {
   char *field_code;
@@ -3231,6 +3460,27 @@ PHP_FUNCTION(gd_flush)
   GDPHP_RETURN_BOOL(gd_flush(D, field_codep));
 }
 
+PHP_FUNCTION(gd_fragment_namespace)
+{
+  GDPHP_LONG index;
+  const char *nsin = NULL;
+  GDPHP_SLEN nsin_len;
+  const char *nsout;
+  DIRFILE *D;
+
+  dtracephp();
+
+  GDPHP_PARSED("l|s", &index, &nsin, &nsin_len);
+
+  nsout = gd_fragment_namespace(D, index, nsin);
+
+  if (nsout) {
+    dreturn("\"%s\"", nsout);
+    GDPHP_RET_STR_COPY(nsout);
+  } else
+    GDPHP_RETURN_F;
+}
+
 PHP_FUNCTION(gd_fragment_affixes)
 {
   GDPHP_LONG index;
@@ -3359,12 +3609,13 @@ PHP_FUNCTION(gd_get_carray)
   }
 
   if (len == -1) {
-    len = gd_array_len(D, field_code) - start;
+    len = gd_array_len(D, field_code);
     if (len == 0) /* error */
       GDPHP_RETURN_F;
+		len -= start;
   }
 
-  if (len == 0) { /* explicit request for no data */
+  if (len <= 0) { /* explicit request for no data */
     dreturnvoid();
     if (unpack) {
       array_init(return_value);
@@ -3385,6 +3636,49 @@ PHP_FUNCTION(gd_get_carray)
   dreturn("%li", len);
 }
 
+PHP_FUNCTION(gd_get_sarray)
+{
+  char *field_code;
+  GDPHP_SLEN field_code_len;
+  GDPHP_LONG start = 0;
+  zval *zlen = NULL;
+
+  long len;
+  const char **data = NULL;
+  DIRFILE *D;
+  GDPHP_CONTEXTp(ctx,3);
+
+  dtracephp();
+
+  GDPHP_PARSED("s|lz", &field_code, &field_code_len, &start, &zlen);
+
+  len = gdphp_long_from_zval_null(zlen, -1);
+
+  if (len == -1) {
+    len = gd_array_len(D, field_code);
+    if (len == 0) /* error */
+      GDPHP_RETURN_F;
+		len -= start;
+  }
+
+	if (len <= 0) { /* explicit request for no data */
+    dreturnvoid();
+    array_init(return_value);
+    return;
+  }
+
+  data = emalloc(len * sizeof(*data));
+
+  if (gd_get_sarray_slice(D, field_code, start, len, data)) {
+    efree(data);
+    GDPHP_RETURN_F;
+  }
+
+  gdphp_to_string_array(return_value, data, len);
+  efree(data);
+  dreturn("%li", len);
+}
+
 PHP_FUNCTION(gd_get_constant)
 {
   GDPHP_LONG data_type;
@@ -3503,26 +3797,40 @@ PHP_FUNCTION(gd_getdata)
     } else
       ns = num_samples;
 
-    /* get the type, if needed */
-    if (data_type == GD_UNKNOWN)
-      data_type = gd_native_type(D, field_code);
-
-    /* allocate a buffer */
-    gdphp_validate_type(data_type, &ctx);
-    data = emalloc(ns * GD_SIZE(data_type));
+		if (gd_entry_type(D, field_code) == GD_SINDIR_ENTRY) {
+			const char **data = emalloc(ns * sizeof(*data));
+			n = gd_getdata(D, field_code, first_frame, first_sample, 0, ns, GD_STRING,
+				data);
 
-    n = gd_getdata(D, field_code, first_frame, first_sample, 0, ns, data_type,
-        data);
+			if (gd_error(D)) {
+				efree(data);
+				GDPHP_RETURN_F;
+      }
 
-    if (gd_error(D)) {
+      gdphp_to_string_array(return_value, data, n);
       efree(data);
-      GDPHP_RETURN_F;
-    }
+    } else {
+      /* get the type, if needed */
+      if (data_type == GD_UNKNOWN)
+        data_type = gd_native_type(D, field_code);
 
-    gdphp_from_data(return_value, n, data_type, data, 0, unpack);
+      /* allocate a buffer */
+      gdphp_validate_type(data_type, &ctx);
+      data = emalloc(ns * GD_SIZE(data_type));
 
-    dreturn("%" PRIuSIZE, n);
+      n = gd_getdata(D, field_code, first_frame, first_sample, 0, ns, data_type,
+          data);
+
+      if (gd_error(D)) {
+        efree(data);
+        GDPHP_RETURN_F;
+      }
+
+      gdphp_from_data(return_value, n, data_type, data, 0, unpack);
+    }
   }
+
+  dreturn("%" PRIuSIZE, n);
 }
 
 PHP_FUNCTION(gd_hidden)
@@ -3561,7 +3869,7 @@ PHP_FUNCTION(gd_hide)
   GDPHP_RETURN_BOOL(gd_hide(D, field_code));
 }
 
-PHP_FUNCTION(gd_include)
+PHP_FUNCTION(gd_include_affix)
 {
   char *path, *prefix = NULL, *suffix = NULL;
   GDPHP_SLEN path_len, prefix_len, suffix_len;
@@ -3571,8 +3879,8 @@ PHP_FUNCTION(gd_include)
 
   dtracephp();
 
-  GDPHP_PARSED("sl|lss", &path, &path_len, &parent, &flags, &prefix,
-      &prefix_len, &suffix, &suffix_len);
+  GDPHP_PARSED("sl|ssl", &path, &path_len, &parent, &prefix, &prefix_len,
+      &suffix, &suffix_len, &flags);
 
   i = gd_include_affix(D, path, parent, prefix, suffix, flags);
 
@@ -3583,6 +3891,27 @@ PHP_FUNCTION(gd_include)
   RETURN_LONG(i);
 }
 
+PHP_FUNCTION(gd_include)
+{
+  char *path, *ns = NULL;
+  GDPHP_SLEN path_len, ns_len;
+  GDPHP_LONG i, parent, flags = 0;
+
+  DIRFILE *D;
+
+  dtracephp();
+
+  GDPHP_PARSED("sl|sl", &path, &path_len, &parent, &ns, &ns_len, &flags);
+
+  i = gd_include_ns(D, path, parent, ns, flags);
+
+  if (i < 0)
+    GDPHP_RETURN_F;
+
+  dreturn("%li", i);
+  RETURN_LONG(i);
+}
+
 PHP_FUNCTION(gd_invalid_dirfile)
 {
   gdphp_dirfile *r;
@@ -3610,17 +3939,20 @@ PHP_FUNCTION(gd_linterp_tablename)
   GDPHP_SLEN field_code_len;
 
   DIRFILE *D;
-  const char *s;
+  char *s;
 
   dtracephp();
 
   GDPHP_PARSED("s", &field_code, &field_code_len);
 
-  if ((s = gd_linterp_tablename(D, field_code)) == NULL)
-    GDPHP_RETURN_F;
+  s = gd_linterp_tablename(D, field_code);
 
-  dreturn("\"%s\"", s);
-  GDPHP_RET_STR_COPY(s);
+  if (s) {
+    GDPHP_RETVAL_STRING(s);
+    dreturn("\"%s\"", s);
+    free(s);
+  } else
+    GDPHP_RETURN_F;
 }
 
 PHP_FUNCTION(gd_madd)
@@ -3708,6 +4040,30 @@ PHP_FUNCTION(gd_madd_carray)
   GDPHP_RETURN_BOOL(r);
 }
 
+PHP_FUNCTION(gd_madd_sarray)
+{
+  char *field_code, *parent;
+  GDPHP_SLEN field_code_len, parent_len;
+  zval *zdata;
+  DIRFILE *D;
+
+  int r;
+  size_t n;
+  const char **d;
+
+  dtracephp();
+
+  GDPHP_PARSED("ssz", &parent, &parent_len, &field_code, &field_code_len,
+      &zdata);
+
+  n = gdphp_convert_sarray(&d, zdata, 2);
+
+  r = gd_madd_sarray(D, parent, field_code, n, d);
+  efree(d);
+
+  GDPHP_RETURN_BOOL(r);
+}
+
 PHP_FUNCTION(gd_madd_const)
 {
   char *field_code, *parent;
@@ -3746,6 +4102,36 @@ PHP_FUNCTION(gd_madd_divide)
   GDPHP_RETURN_BOOL(gd_madd_divide(D, parent, field_code, in1, in2));
 }
 
+PHP_FUNCTION(gd_madd_indir)
+{
+  char *field_code, *in1, *in2, *parent;
+  GDPHP_SLEN field_code_len, in1_len, in2_len, parent_len;
+
+  DIRFILE *D;
+
+  dtracephp();
+
+  GDPHP_PARSED("ssss", &parent, &parent_len, &field_code, &field_code_len, &in1,
+      &in1_len, &in2, &in2_len);
+
+  GDPHP_RETURN_BOOL(gd_madd_indir(D, parent, field_code, in1, in2));
+}
+
+PHP_FUNCTION(gd_madd_sindir)
+{
+  char *field_code, *in1, *in2, *parent;
+  GDPHP_SLEN field_code_len, in1_len, in2_len, parent_len;
+
+  DIRFILE *D;
+
+  dtracephp();
+
+  GDPHP_PARSED("ssss", &parent, &parent_len, &field_code, &field_code_len, &in1,
+      &in1_len, &in2, &in2_len);
+
+  GDPHP_RETURN_BOOL(gd_madd_sindir(D, parent, field_code, in1, in2));
+}
+
 PHP_FUNCTION(gd_madd_lincom)
 {
   char *field_code, *parent;
@@ -4005,6 +4391,34 @@ PHP_FUNCTION(gd_mcarrays)
   dreturnvoid();
 }
 
+PHP_FUNCTION(gd_msarrays)
+{
+  char *parent;
+  GDPHP_SLEN parent_len;
+	GDPHP_ZVAL_NULL(tmp);
+
+  DIRFILE *D;
+  int i;
+  const char ***s;
+
+  dtracephp();
+
+  GDPHP_PARSED("s", &parent, &parent_len);
+
+  s = gd_msarrays(D, parent);
+
+  if (s == NULL)
+    GDPHP_RETURN_F;
+
+  /* convert */
+  array_init(return_value);
+
+  for (i = 0; s[i]; ++i)
+    add_index_zval(return_value, i, gdphp_to_string_array(RZ(tmp), s[i], 0));
+
+  dreturnvoid();
+}
+
 PHP_FUNCTION(gd_mconstants)
 {
   char *parent;
@@ -4525,6 +4939,37 @@ PHP_FUNCTION(gd_put_carray)
   GDPHP_RETURN_BOOL(r);
 }
 
+PHP_FUNCTION(gd_put_sarray)
+{
+  char *field_code;
+  GDPHP_SLEN field_code_len;
+  zval *z1, *z2 = NULL;
+
+  DIRFILE *D;
+  int r;
+  long start = 0;
+  size_t n;
+  const char **d;
+
+  dtracephp();
+
+  GDPHP_PARSED("sz|z", &field_code, &field_code_len, &z1, &z2);
+
+  /* if z2 exists, it's the data and z1 is the start, otherwise z1 is the data
+   */
+  if (z2 == NULL)
+    n = gdphp_convert_sarray(&d, z1, 2);
+  else {
+    start = Z_LVAL_P(z1);
+    n = gdphp_convert_sarray(&d, z2, 3);
+  }
+
+  r = gd_put_sarray_slice(D, field_code, start, n, d);
+  efree(d);
+
+  GDPHP_RETURN_BOOL(r);
+}
+
 PHP_FUNCTION(gd_put_constant)
 {
   char *field_code;
@@ -4613,17 +5058,20 @@ PHP_FUNCTION(gd_raw_filename)
   GDPHP_SLEN field_code_len;
 
   DIRFILE *D;
-  const char *s;
+  char *s;
 
   dtracephp();
 
   GDPHP_PARSED("s", &field_code, &field_code_len);
 
-  if ((s = gd_raw_filename(D, field_code)) == NULL)
-    GDPHP_RETURN_F;
+  s = gd_raw_filename(D, field_code);
 
-  dreturn("\"%s\"", s);
-  GDPHP_RET_STR_COPY(s);
+  if (s) {
+    GDPHP_RETVAL_STRING(s);
+    dreturn("\"%s\"", s);
+    free(s);
+  } else
+    GDPHP_RETURN_F;
 }
 
 PHP_FUNCTION(gd_reference)
@@ -4908,6 +5356,7 @@ static const zend_function_entry getdata_functions[] = {
     PHP_FE(gd_add_carray, NULL)
     PHP_FE(gd_add_const, NULL)
     PHP_FE(gd_add_divide, NULL)
+		PHP_FE(gd_add_indir, NULL)
     PHP_FE(gd_add_lincom, NULL)
     PHP_FE(gd_add_linterp, NULL)
     PHP_FE(gd_add_mplex, NULL)
@@ -4916,7 +5365,9 @@ static const zend_function_entry getdata_functions[] = {
     PHP_FE(gd_add_polynom, NULL)
     PHP_FE(gd_add_raw, NULL)
     PHP_FE(gd_add_recip, NULL)
+    PHP_FE(gd_add_sarray, NULL)
     PHP_FE(gd_add_sbit, NULL)
+		PHP_FE(gd_add_sindir, NULL)
     PHP_FE(gd_add_spec, NULL)
     PHP_FE(gd_add_string, NULL)
     PHP_FE(gd_add_window, NULL)
@@ -4931,6 +5382,7 @@ static const zend_function_entry getdata_functions[] = {
     PHP_FE(gd_alter_endianness, NULL)
     PHP_FE(gd_alter_entry, NULL)
     PHP_FE(gd_alter_frameoffset, NULL)
+    PHP_FE(gd_alter_indir, NULL)
     PHP_FE(gd_alter_lincom, NULL)
     PHP_FE(gd_alter_linterp, NULL)
     PHP_FE(gd_alter_mplex, NULL)
@@ -4940,7 +5392,9 @@ static const zend_function_entry getdata_functions[] = {
     PHP_FE(gd_alter_protection, NULL)
     PHP_FE(gd_alter_raw, NULL)
     PHP_FE(gd_alter_recip, NULL)
+    PHP_FE(gd_alter_sarray, NULL)
     PHP_FE(gd_alter_sbit, NULL)
+    PHP_FE(gd_alter_sindir, NULL)
     PHP_FE(gd_alter_spec, NULL)
     PHP_FE(gd_alter_window, NULL)
     PHP_FE(gd_array_len, NULL)
@@ -4970,16 +5424,19 @@ static const zend_function_entry getdata_functions[] = {
     PHP_FE(gd_flush, NULL)
     PHP_FE(gd_fragment_affixes, NULL)
     PHP_FE(gd_fragment_index, NULL)
+    PHP_FE(gd_fragment_namespace, NULL)
     PHP_FE(gd_fragmentname, NULL)
     PHP_FE(gd_framenum, NULL)
     PHP_FE(gd_frameoffset, NULL)
     PHP_FE(gd_get_carray, NULL)
     PHP_FE(gd_get_constant, NULL)
+    PHP_FE(gd_get_sarray, NULL)
     PHP_FE(gd_get_string, NULL)
     PHP_FE(gd_getdata, NULL)
     PHP_FE(gd_hidden, NULL)
     PHP_FE(gd_hide, NULL)
     PHP_FE(gd_include, NULL)
+    PHP_FE(gd_include_affix, NULL)
     PHP_FE(gd_invalid_dirfile, NULL)
     PHP_FE(gd_linterp_tablename, NULL)
     PHP_FE(gd_madd, NULL)
@@ -4988,6 +5445,7 @@ static const zend_function_entry getdata_functions[] = {
     PHP_FE(gd_madd_carray, NULL)
     PHP_FE(gd_madd_const, NULL)
     PHP_FE(gd_madd_divide, NULL)
+    PHP_FE(gd_madd_indir, NULL)
     PHP_FE(gd_madd_lincom, NULL)
     PHP_FE(gd_madd_linterp, NULL)
     PHP_FE(gd_madd_mplex, NULL)
@@ -4995,11 +5453,14 @@ static const zend_function_entry getdata_functions[] = {
     PHP_FE(gd_madd_phase, NULL)
     PHP_FE(gd_madd_polynom, NULL)
     PHP_FE(gd_madd_recip, NULL)
+    PHP_FE(gd_madd_sarray, NULL)
     PHP_FE(gd_madd_sbit, NULL)
+    PHP_FE(gd_madd_sindir, NULL)
     PHP_FE(gd_madd_spec, NULL)
     PHP_FE(gd_madd_string, NULL)
     PHP_FE(gd_madd_window, NULL)
     PHP_FE(gd_malter_spec, NULL)
+    PHP_FE(gd_match_entries, NULL)
     PHP_FE(gd_mcarrays, NULL)
     PHP_FE(gd_mconstants, NULL)
     PHP_FE(gd_metaflush, NULL)
@@ -5007,6 +5468,7 @@ static const zend_function_entry getdata_functions[] = {
     PHP_FE(gd_mfield_list_by_type, NULL)
     PHP_FE(gd_move, NULL)
     PHP_FE(gd_mplex_lookback, NULL)
+    PHP_FE(gd_msarrays, NULL)
     PHP_FE(gd_mstrings, NULL)
     PHP_FE(gd_mvector_list, NULL)
     PHP_FE(gd_naliases, NULL)
@@ -5026,6 +5488,7 @@ static const zend_function_entry getdata_functions[] = {
     PHP_FE(gd_protection, NULL)
     PHP_FE(gd_put_carray, NULL)
     PHP_FE(gd_put_constant, NULL)
+    PHP_FE(gd_put_sarray, NULL)
     PHP_FE(gd_put_string, NULL)
     PHP_FE(gd_putdata, NULL)
     PHP_FE(gd_raw_close, NULL)
@@ -5033,6 +5496,7 @@ static const zend_function_entry getdata_functions[] = {
     PHP_FE(gd_reference, NULL)
     PHP_FE(gd_rename, NULL)
     PHP_FE(gd_rewrite_fragment, NULL)
+    PHP_FE(gd_sarrays, NULL)
     PHP_FE(gd_seek, NULL)
     PHP_FE(gd_spf, NULL)
     PHP_FE(gd_strings, NULL)
diff --git a/bindings/php/test/Makefile.in b/bindings/php/test/Makefile.in
index da00896..ad4c50d 100644
--- a/bindings/php/test/Makefile.in
+++ b/bindings/php/test/Makefile.in
@@ -180,6 +180,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/php/test/big_test.php b/bindings/php/test/big_test.php
index d127746..d1d65bb 100644
--- a/bindings/php/test/big_test.php
+++ b/bindings/php/test/big_test.php
@@ -41,6 +41,9 @@ if (is_file('dirfile/format')) {
 if (is_file('dirfile/format1')) {
   unlink('dirfile/format1');
 }
+if (is_file('dirfile/format2')) {
+  unlink('dirfile/format2');
+}
 if (is_file('dirfile/form2')) {
   unlink('dirfile/form2');
 }
@@ -128,10 +131,10 @@ function check_ok($t, $D)
   check_error($t, $D, 0);
 }
 
-$nfields = 17;
-$fields = array('INDEX', 'alias', 'bit', 'carray', 'const', 'data', 'div',
-  'lincom', 'linterp', 'mplex', 'mult', 'phase', 'polynom', 'recip', 'sbit',
-  'string', 'window');
+$nfields = 20;
+$fields = array( 'bit', 'div', 'data', 'mult', 'sbit', 'INDEX', 'alias',
+  'const', 'indir', 'mplex', 'phase', 'recip', 'carray', 'lincom', 'sarray',
+  'sindir', 'string', 'window', 'linterp', 'polynom');
 
 # make the dirfile
 mkdir('dirfile', 0700);
@@ -157,6 +160,10 @@ phase PHASE data 11
 window WINDOW linterp mult LT 4.1
 ALIAS alias data
 string STRING "Zaphod Beeblebrox"
+sarray SARRAY one two three four five six seven
+data/msarray SARRAY eight nine ten eleven twelve
+indir INDIR data carray
+sindir SINDIR data sarray
 ');
 file_put_contents('dirfile/form2', "const2 CONST INT8 -19\n");
 
@@ -192,11 +199,6 @@ $v = gd_getdata($D, 'data', 5, 0, 1, 0, GD_COMPLEX128, TRUE);
 check_ok(10, $D);
 check_var(10, $v, array(41., 42., 43., 44., 45., 46., 47., 48.));
 
-# 11: getdata (NULL)
-$v = gd_getdata($D, 'data', 5, 0, 1, 0, GD_NULL);
-check_ok(11, $D);
-check_var(11, $v, 8);
-
 # 12: gd_get_constant (INT8)
 $v = gd_get_constant($D, 'const', GD_UINT8);
 check_ok(12, $D);
@@ -207,11 +209,6 @@ $v = gd_get_constant($D, 'const', GD_COMPLEX128);
 check_ok(19, $D);
 check_var(19, $v, 5.5);
 
-# 20: gd_get_constant (NULL)
-$v = gd_get_constant($D, 'const', GD_NULL);
-check_ok(20, $D);
-check_var(20, $v, true);
-
 # 23: nfields
 $v = gd_nfields($D);
 check_ok(23, $D);
@@ -225,12 +222,12 @@ check_var(25, $v, $fields);
 # 26: nmfields
 $v = gd_nmfields($D, 'data');
 check_ok(26, $D);
-check_var(26, $v, 4);
+check_var(26, $v, 5);
 
 # 27: mfield_list
 $v = gd_mfield_list($D, 'data');
 check_ok(27, $D);
-check_var(27, $v, array('mstr', 'mconst', 'mcarray', 'mlut'));
+check_var(27, $v, array('mstr', 'mconst', 'mcarray', 'mlut', 'msarray'));
 
 # 28: nframes
 $v = gd_nframes($D);
@@ -497,19 +494,19 @@ check_var(67, $v, 2);
 # 68: field list by type
 $v = gd_field_list_by_type($D, GD_LINCOM_ENTRY);
 check_ok(68, $D);
-check_var(68, $v, array('lincom', 'new3'));
+check_var(68, $v, array('new3', 'lincom'));
 
 # 69: nfields by type
 $v = gd_nvectors($D);
 check_ok(69, $D);
-check_var(69, $v, 22);
+check_var(69, $v, 23);
 
 # 70: field list by type
 $v = gd_vector_list($D);
 check_ok(70, $D);
-check_var(70, $v, array('INDEX', 'alias', 'bit', 'data', 'div', 'lincom',
-  'linterp', 'mplex', 'mult', 'new1', 'new10', 'new3', 'new4', 'new6', 'new7',
-  'new8', 'new9', 'phase', 'polynom', 'recip', 'sbit', 'window'));
+check_var(70, $v, array( 'bit', 'div', 'data', 'mult', 'new1', 'new3', 'new4',
+  'new6', 'new7', 'new8', 'new9', 'sbit', 'INDEX', 'alias', 'indir', 'mplex',
+  'new10', 'phase', 'recip', 'lincom', 'window', 'linterp', 'polynom'));
 
 # 72: madd lincom
 $v = gd_madd_lincom($D, 'data', 'mnew3', array('in1', 'in2'),
@@ -1360,10 +1357,10 @@ check_var(221, $v, 4);
 # 222: aliases
 $v = gd_aliases($D, 'data');
 check_ok(222, $D);
-check_var(222, $v, array('data', 'alias', 'data/mnew20', 'new20'));
+check_var(222, $v, array( 'data', 'alias', 'new20', 'data/mnew20' ));
 
 # 223: gd_include_affix
-$v = gd_include($D, 'format1', 0, GD_CREAT | GD_EXCL, 'A', 'Z');
+$v = gd_include_affix($D, 'format1', 0, 'A', 'Z', GD_CREAT | GD_EXCL);
 check_ok2(223, 0, $D);
 check_var2(223, 1, $v, 1);
 
@@ -1451,15 +1448,15 @@ check_var(236, $v, TRUE);
 $v = gd_nentries($D, 'data', GD_SCALAR_ENTRIES,
   GD_ENTRIES_HIDDEN | GD_ENTRIES_NOALIAS);
 check_ok(237, $D);
-check_var(237, $v, 6);
+check_var(237, $v, 7);
 
 # 239: entry_list
 $v = gd_entry_list($D, null, GD_VECTOR_ENTRIES, GD_ENTRIES_NOALIAS);
 check_ok(239, $D);
-check_var(239, $v, array('INDEX', 'bit', 'data', 'div', 'lincom', 'linterp',
-  'mplex', 'mult', 'new1', 'new135', 'new14', 'new16', 'new18', 'new21', 'new3',
-  'new4', 'new6', 'new7', 'new8', 'phase', 'polynom', 'recip', 'sbit',
-  'window'));
+check_var(239, $v, array( 'bit', 'div', 'data', 'mult', 'new1', 'new3', 'new4',
+  'new6', 'new7', 'new8', 'sbit', 'INDEX', 'indir', 'mplex', 'new14', 'new16',
+  'new18', 'new21', 'phase', 'recip', 'lincom', 'new135', 'window', 'linterp',
+  'polynom' ));
 
 # 240: mplex lookback
 $v = gd_mplex_lookback($D, GD_LOOKBACK_ALL);
@@ -1688,6 +1685,236 @@ $v = gd_get_carray($D, 'carray', GD_NULL, 2, 2);
 check_ok(274, $D);
 check_var(274, $v, true);
 
+# 277: gd_entry (SARRAY)
+$v = gd_entry($D, 'sarray');
+check_ok(277, $D);
+check_var(277, $v, array('field' => 'sarray', 'field_type' => GD_SARRAY_ENTRY,
+  'fragment_index' => 0, 'array_len' => 7));
+
+# 278: get carray
+$v = gd_get_sarray($D, 'sarray');
+check_ok(278, $D);
+check_var(278, $v, array('one', 'two', 'three', 'four', 'five', 'six',
+  'seven'));
+
+# 279: get sarray slice
+$v = gd_get_sarray($D, 'sarray', 2, 2);
+check_ok(279, $D);
+check_var(279, $v, array('three', 'four'));
+
+# 280: gd_sarrays
+$v = gd_sarrays($D);
+check_ok(280, $D);
+check_var(280, $v, array(array('one', 'two', 'three', 'four', 'five', 'six',
+    'seven')));
+
+# 281: gd_put_sarray
+$v = gd_put_sarray($D, 'sarray', array('eka', 'dvi', 'tri', 'catur', 'panca',
+  'sas', 'sapta'));
+check_ok2(281, 0, $D);
+check_var2(281, 1, $v, TRUE);
+
+$v = gd_get_sarray($D, 'sarray');
+check_ok2(281, 2, $D);
+check_var2(168, 3, $v, array('eka', 'dvi', 'tri', 'catur', 'panca', 'sas',
+  'sapta'));
+
+# 282: gd_put_sarray_slice
+$v = gd_put_sarray($D, 'sarray', 2, array('asta', 'nava'));
+check_ok2(282, 0, $D);
+check_var2(282, 1, $v, TRUE);
+
+$v = gd_get_sarray($D, 'sarray');
+check_ok2(282, 2, $D);
+check_var2(282, 3, $v, array('eka', 'dvi', 'asta', 'nava', 'panca', 'sas',
+    'sapta'));
+
+# 283: add sarray
+$v = gd_add_sarray($D, 'new283', array('eins', 'zwei', 'drei'), 0);
+check_ok2(283, 0, $D);
+check_var2(283, 1, $v, TRUE);
+
+$v = gd_entry($D, 'new283');
+check_ok2(283, 2, $D);
+check_var2(283, 3, $v, array('field' => 'new283',
+  'field_type' => GD_SARRAY_ENTRY, 'fragment_index' => 0, 'array_len' => 3));
+
+$v = gd_get_sarray($D, 'new283');
+check_ok2(283, 4, $D);
+check_var2(283, 5, $v, array('eins', 'zwei', 'drei'));
+
+# 284: add (SARRAY)
+$v = gd_add($D, array('field' => 'new284', 'field_type' => GD_SARRAY_ENTRY,
+  'fragment_index' => 0, 'array_len' => 5));
+check_ok2(284, 0, $D);
+check_var2(284, 1, $v, TRUE);
+
+$v = gd_entry($D, 'new284');
+check_ok2(284, 2, $D);
+check_var2(284, 3, $v, array('field' => 'new284',
+  'field_type' => GD_SARRAY_ENTRY, 'fragment_index' => 0, 'array_len' => 5));
+
+$v = gd_get_sarray($D, 'new284');
+check_ok2(284, 4, $D);
+check_var2(284, 5, $v, array('', '', '', '', ''));
+
+# 285: madd sarray
+$v = gd_madd_sarray($D, 'data', 'mnew285', array('un', 'deux', 'trois'));
+check_ok2(285, 0, $D);
+check_var2(285, 1, $v, TRUE);
+
+$v = gd_entry($D, 'data/mnew285');
+check_ok2(285, 2, $D);
+check_var2(285, 3, $v, array('field' => 'data/mnew285',
+  'field_type' => GD_SARRAY_ENTRY, 'fragment_index' => 0, 'array_len' => 3));
+
+$v = gd_get_sarray($D, 'data/mnew285');
+check_ok2(285, 4, $D);
+check_var2(285, 5, $v, array('un', 'deux', 'trois'));
+
+# 286: alter sarray
+$v = gd_alter_sarray($D, 'new283', 2);
+check_ok2(286, 0, $D);
+check_var2(286, 1, $v, TRUE);
+
+$v = gd_entry($D, 'new283');
+check_ok2(286, 2, $D);
+check_var2(286, 3, $v, array('field' => 'new283',
+  'field_type' => GD_SARRAY_ENTRY, 'fragment_index' => 0, 'array_len' => 2));
+
+# 287: msarrays
+$v = gd_msarrays($D, 'data');
+check_ok(287, $D);
+check_var(287, $v, array(array('eight', 'nine', 'ten', 'eleven', 'twelve'),
+  array('un', 'deux', 'trois')));
+
+# 288: INDIR entry
+$v = gd_entry($D, 'indir');
+check_ok(288, $D);
+check_var(288, $v, array('field' => 'indir', 'field_type' => GD_INDIR_ENTRY,
+  'fragment_index' => 0, 'in_fields' => array('data', 'carray')));
+
+# 289: add indir
+$v = gd_add_indir($D, 'new289', 'in2', 'in3');
+check_ok2(289, 0, $D);
+check_var2(289, 1, $v, TRUE);
+
+$v = gd_entry($D, 'new289');
+check_ok2(289, 2, $D);
+check_var2(289, 3, $v, array('field' => 'new289',
+  'field_type' => GD_INDIR_ENTRY, 'fragment_index' => 0,
+  'in_fields' => array('in2', 'in3')));
+
+# 290: madd indir
+$v = gd_madd_indir($D, 'data', 'mnew290', 'in2', 'in3');
+check_ok2(290, 0, $D);
+check_var2(290, 1, $v, TRUE);
+
+$v = gd_entry($D, 'data/mnew290');
+check_ok2(290, 2, $D);
+check_var2(290, 3, $v, array('field' => 'data/mnew290',
+  'field_type' => GD_INDIR_ENTRY, 'fragment_index' => 0,
+  'in_fields' => array('in2', 'in3')));
+
+# 291: alter_indir
+$v = gd_alter_indir($D, 'new289', 'in1');
+check_ok2(291, 0, $D);
+check_var2(291, 1, $v, TRUE);
+
+$v = gd_entry($D, 'new289');
+check_ok2(291, 2, $D);
+check_var2(291, 3, $v, array('field' => 'new289',
+  'field_type' => GD_INDIR_ENTRY, 'fragment_index' => 0,
+  'in_fields' => array('in1', 'in3')));
+
+# 292: SINDIR entry
+$v = gd_entry($D, 'sindir');
+check_ok(292, $D);
+check_var(292, $v, array('field' => 'sindir', 'field_type' => GD_SINDIR_ENTRY,
+  'fragment_index' => 0, 'in_fields' => array('data', 'sarray')));
+
+# 293: add sindir
+$v = gd_add_sindir($D, 'new293', 'in2', 'in3');
+check_ok2(293, 0, $D);
+check_var2(293, 1, $v, TRUE);
+
+$v = gd_entry($D, 'new293');
+check_ok2(293, 2, $D);
+check_var2(293, 3, $v, array('field' => 'new293',
+  'field_type' => GD_SINDIR_ENTRY, 'fragment_index' => 0,
+  'in_fields' => array('in2', 'in3')));
+
+# 294: madd sindir
+$v = gd_madd_sindir($D, 'data', 'mnew294', 'in2', 'in3');
+check_ok2(294, 0, $D);
+check_var2(294, 1, $v, TRUE);
+
+$v = gd_entry($D, 'data/mnew294');
+check_ok2(294, 2, $D);
+check_var2(294, 3, $v, array('field' => 'data/mnew294',
+  'field_type' => GD_SINDIR_ENTRY, 'fragment_index' => 0,
+  'in_fields' => array('in2', 'in3')));
+
+# 295: alter_sindir
+$v = gd_alter_sindir($D, 'new293', 'in1');
+check_ok2(295, 0, $D);
+check_var2(295, 1, $v, TRUE);
+
+$v = gd_entry($D, 'new293');
+check_ok2(295, 2, $D);
+check_var2(295, 3, $v, array('field' => 'new293',
+  'field_type' => GD_SINDIR_ENTRY, 'fragment_index' => 0,
+  'in_fields' => array('in1', 'in3')));
+
+# 296: getdata (SINDIR)
+$v = gd_getdata($D, 'sindir', 0, 0, 1, 0);
+check_ok(296, $D);
+check_var(296, $v, array('eka', 'eka', 'eka', 'eka', 'eka', 'eka', 'eka',
+  'eka'));
+
+# 300: add indir
+$v = gd_add($D, array('field' => 'new300', 'in_fields' => array('in3', 'in0'),
+  'fragment_index' => 0, 'field_type' => GD_INDIR_ENTRY));
+check_ok2(300, 0, $D);
+check_var2(300, 1, $v, TRUE);
+
+$v = gd_entry($D, 'new300');
+check_ok2(300, 2, $D);
+check_var2(300, 3, $v, array('field' => 'new300',
+  'field_type' => GD_INDIR_ENTRY, 'fragment_index' => 0,
+  'in_fields' => array('in3', 'in0')));
+
+# 301: add indir
+$v = gd_add($D, array('field' => 'new301', 'in_fields' => array('in3', 'in1'),
+  'fragment_index' => 0, 'field_type' => GD_SINDIR_ENTRY));
+check_ok2(301, 0, $D);
+check_var2(301, 1, $v, TRUE);
+
+$v = gd_entry($D, 'new301');
+check_ok2(301, 2, $D);
+check_var2(301, 3, $v, array('field' => 'new301',
+  'field_type' => GD_SINDIR_ENTRY, 'fragment_index' => 0,
+  'in_fields' => array('in3', 'in1')));
+
+# 302: gd_include
+$v = gd_include($D, 'format2', 0, 'ns', GD_CREAT | GD_EXCL);
+check_ok2(302, 0, $D);
+check_var2(302, 1, $v, 2);
+
+# 303: gd_fragment_namespace (read)
+$v = gd_fragment_namespace($D, 2);
+check_ok2(303, 0, $D);
+check_var2(303, 1, $v, 'ns');
+
+# 304: gd_fragment_namespace (alter)
+$v = gd_fragment_namespace($D, 2, 'ns2');
+check_ok2(304, 0, $D);
+check_var2(304, 1, $v, 'ns2');
+
+# 305: gd_match_entries
+$v = gd_match_entries($D, "^lin", 0);
+check_ok2(305, 0, $D);
+check_var2(305, 1, $v, array('lincom', 'linterp'));
 
 
 
@@ -1703,6 +1930,7 @@ unlink('dirfile/new1');
 unlink('dirfile/new135');
 unlink('dirfile/format');
 unlink('dirfile/format1');
+unlink('dirfile/format2');
 unlink('dirfile/form2');
 rmdir('dirfile');
 
diff --git a/bindings/python/Makefile.in b/bindings/python/Makefile.in
index bc60350..26ec659 100644
--- a/bindings/python/Makefile.in
+++ b/bindings/python/Makefile.in
@@ -252,6 +252,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/python/gdpy_intern.h b/bindings/python/gdpy_intern.h
index fd88c30..f547f87 100644
--- a/bindings/python/gdpy_intern.h
+++ b/bindings/python/gdpy_intern.h
@@ -96,7 +96,6 @@
     } \
   } while(0)
 
-extern PyObject *gdpy_exceptions[GD_N_ERROR_CODES];
 extern PyTypeObject gdpy_dirfile;
 extern PyTypeObject gdpy_entry;
 extern PyTypeObject gdpy_fragment;
@@ -198,6 +197,7 @@ extern DIRFILE *gdpy_dirfile_dirfile(struct gdpy_dirfile_t *);
 extern int gdpy_dirfile_raise(struct gdpy_dirfile_t *);
 #endif
 
+extern char *gdpy_strdup(const char*);
 extern int gdpy_report_error(DIRFILE*, char*);
 extern char *gdpy_copy_global_charenc(void);
 extern PyObject *gdpyobj_from_string(const char*, const char*);
diff --git a/bindings/python/pydirfile.c b/bindings/python/pydirfile.c
index 7352b12..3c53ed8 100644
--- a/bindings/python/pydirfile.c
+++ b/bindings/python/pydirfile.c
@@ -22,18 +22,19 @@
 #define GDPY_INCLUDE_NUMPY
 #include "gdpy_intern.h"
 
-/* Create an array of strings from a NULL-terminated string list */
-static PyObject *gdpyobj_from_strarr(const char **list,
-    const char *char_enc)
+/* Create an array of strings from a either a NULL-terminated string list 
+ * or one with a known len. */
+static PyObject *gdpyobj_from_strarr2(const char **list, size_t len,
+    int use_len, const char *char_enc)
 {
   PyObject *pyobj;
   size_t i;
 
-  dtrace("%p, %p", list, char_enc);
+  dtrace("%p, %" PRIuSIZE ", %i, %p", list, len, use_len, char_enc);
 
   pyobj = PyList_New(0);
   if (pyobj)
-    for (i = 0; list[i] != NULL; ++i) {
+    for (i = 0; use_len ? (i < len) : (list[i] != NULL); ++i) {
       PyObject *str = gdpyobj_from_string(list[i], char_enc);
       if (str == NULL) {
         Py_DECREF(pyobj);
@@ -52,6 +53,33 @@ static PyObject *gdpyobj_from_strarr(const char **list,
   return pyobj;
 }
 
+/* Create an array of strings from a NULL-terminated string list */
+static PyObject *gdpyobj_from_strarr(const char **list, const char *char_enc)
+{
+  PyObject *pyobj;
+
+  dtrace("%p, %p", list, char_enc);
+
+  pyobj = gdpyobj_from_strarr2(list, 0, 0, char_enc);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+/* Create an array of strings from a fixed-length string list */
+static PyObject *gdpyobj_from_strarr_len(const char **list,
+    size_t len, const char *char_enc)
+{
+  PyObject *pyobj;
+
+  dtrace("%p, %" PRIuSIZE ", %p", list, len, char_enc);
+
+  pyobj = gdpyobj_from_strarr2(list, len, 1, char_enc);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
 #ifdef PYGETDATA_CAPI
 /* Dirfile CAPI */
 DIRFILE *gdpy_dirfile_dirfile(struct gdpy_dirfile_t *self)
@@ -95,7 +123,7 @@ static int gdpy_callback_func(gd_parser_data_t *pdata, void *extra)
         "suberror", pdata->suberror, "line", pdata->line, "linenum",
         pdata->linenum, "filename", pdata->filename, self->callback_data);
 
-    free(estring);
+    PyMem_Free(estring);
 
     /* an exception results in an abort */
     if (arglist == NULL) {
@@ -179,10 +207,10 @@ static void gdpy_dirfile_delete(struct gdpy_dirfile_t *self)
   dtrace("%p", self);
 
   gd_close(self->D);
-  free(self->verbose_prefix);
+  PyMem_Free(self->verbose_prefix);
   Py_XDECREF(self->callback);
   Py_XDECREF(self->callback_data);
-  free(self->char_enc);
+  PyMem_Free(self->char_enc);
   PyObject_Del(self);
 
   dreturnvoid();
@@ -280,7 +308,7 @@ static int gdpy_dirfile_init(struct gdpy_dirfile_t *self, PyObject *args,
   self->D = gd_cbopen(dirfilename, (unsigned int)flags,
       (pycallback == NULL) ? NULL : gdpy_callback_func, self);
 
-  free(dirfilename);
+  PyMem_Free(dirfilename);
 
   if (self->callback_exception) {
     dreturn("%i", -1);
@@ -529,7 +557,7 @@ static PyObject *gdpy_dirfile_getcarray(struct gdpy_dirfile_t *self,
       pyobj = PyArray_SimpleNew(1, dims, gdpy_npytype_from_type(return_type));
       data = PyArray_DATA(pyobj);
     } else
-      data = malloc((size_t)len * GD_SIZE(return_type));
+      data = PyMem_Malloc((size_t)len * GD_SIZE(return_type));
 
     gd_get_carray_slice(self->D, field_code, start, (size_t)len, return_type,
         data);
@@ -538,10 +566,10 @@ static PyObject *gdpy_dirfile_getcarray(struct gdpy_dirfile_t *self,
     if (!as_list)
       GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
     else {
-      GDPY_CHECK_ERROR2(self->D, NULL, free(data), self->char_enc);
+      GDPY_CHECK_ERROR2(self->D, NULL, PyMem_Free(data), self->char_enc);
       pyobj = gdpy_convert_to_pylist(data, return_type, (size_t)len);
 
-      free(data);
+      PyMem_Free(data);
     }
   }
 
@@ -549,6 +577,51 @@ static PyObject *gdpy_dirfile_getcarray(struct gdpy_dirfile_t *self,
   return pyobj;
 }
 
+static PyObject *gdpy_dirfile_getsarray(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
+{
+  char *keywords[] = {"field_code", "start", "len", NULL};
+  const char *field_code;
+  unsigned int start = 0;
+  unsigned PY_LONG_LONG len = 0;
+  PyObject *pyobj = NULL;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "et|IK:pygetdata.dirfile.get_sarray", keywords, self->char_enc,
+				&field_code, &start, &len))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  if (len == 0) {
+    len = gd_array_len(self->D, field_code);
+    if (len > start)
+      len -= start;
+    else
+      len = 0;
+  }
+
+  if (len == 0)
+    pyobj = Py_BuildValue("[]");
+  else {
+    const char **data = PyMem_Malloc(len * sizeof(*data));
+
+    gd_get_sarray_slice(self->D, field_code, start, (size_t)len, data);
+
+    GDPY_CHECK_ERROR2(self->D, NULL, PyMem_Free(data), self->char_enc);
+
+    pyobj = gdpyobj_from_strarr_len(data, len, self->char_enc);
+
+    PyMem_Free(data);
+  }
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
 static PyObject *gdpy_dirfile_getconstant(struct gdpy_dirfile_t *self,
     void *args, void *keys)
 {
@@ -693,6 +766,52 @@ static PyObject *gdpy_dirfile_carrays(struct gdpy_dirfile_t *self,
   return pyobj;
 }
 
+static PyObject *gdpy_dirfile_sarrays(struct gdpy_dirfile_t *self)
+{
+  const char **fields;
+  size_t i;
+  const char ***sarrays;
+  PyObject *pyobj;
+
+  dtrace("%p", self);
+
+  fields = gd_field_list_by_type(self->D, GD_SARRAY_ENTRY);
+
+  GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
+
+  sarrays = gd_sarrays(self->D);
+
+  GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
+
+  pyobj = PyList_New(0);
+
+  for (i = 0; sarrays[i] != NULL; ++i) {
+    PyObject *pydata, *name;
+    
+    pydata = gdpyobj_from_strarr(sarrays[i], self->char_enc);
+
+    if (pydata == NULL) {
+      Py_DECREF(pyobj);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+
+    name = gdpyobj_from_string(fields[i], self->char_enc);
+
+    if (name == NULL) {
+      Py_DECREF(pydata);
+      Py_DECREF(pyobj);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+
+    gdpylist_append(pyobj, Py_BuildValue("NN", name, pydata));
+  }
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
 static PyObject *gdpy_dirfile_getconstants(struct gdpy_dirfile_t *self,
     void *args, void *keys)
 {
@@ -751,7 +870,7 @@ static PyObject *gdpy_dirfile_getdata(struct gdpy_dirfile_t *self,
   PyObject *return_type_obj = NULL;
   PY_LONG_LONG num_frames = 0, num_samples = 0;
   size_t ns;
-  int as_list = 0, read_to_end = 0;
+  int as_list = 0, read_to_end = 0, is_sindir = 0;
   gd_type_t return_type = GD_NULL;
   unsigned int spf = 1;
   PyObject *pyobj = NULL;
@@ -768,6 +887,12 @@ static PyObject *gdpy_dirfile_getdata(struct gdpy_dirfile_t *self,
     return NULL;
   }
 
+  /* Check for SINDIR */
+  if (gd_entry_type(self->D, field_code) == GD_SINDIR_ENTRY) {
+    is_sindir = 1;
+    as_list = 1;
+  }
+
   /* get return type */
   if (return_type_obj) {
     return_type = (gd_type_t)gdpy_long_from_pyobj(return_type_obj);
@@ -849,6 +974,15 @@ static PyObject *gdpy_dirfile_getdata(struct gdpy_dirfile_t *self,
       pyobj = PyArray_ZEROS(1, dims, gdpy_npytype_from_type(return_type), 0);
     else
       pyobj = Py_BuildValue("[]");
+  } else if (is_sindir) {
+    const char** data = PyMem_Malloc(num_samples * sizeof(*data));
+
+    ns = gd_getdata(self->D, field_code, first_frame, first_sample, 0,
+        (size_t)num_samples, return_type, data);
+
+    pyobj = gdpyobj_from_strarr_len(data, ns, self->char_enc);
+
+    PyMem_Free(data);
   } else {
     void *data;
     if (!as_list) {
@@ -856,7 +990,7 @@ static PyObject *gdpy_dirfile_getdata(struct gdpy_dirfile_t *self,
       pyobj = PyArray_SimpleNew(1, dims, gdpy_npytype_from_type(return_type));
       data = PyArray_DATA(pyobj);
     } else
-      data = malloc((size_t)num_samples * GD_SIZE(return_type));
+      data = PyMem_Malloc((size_t)num_samples * GD_SIZE(return_type));
 
     ns = gd_getdata64(self->D, field_code, first_frame, first_sample, 0,
         (size_t)num_samples, return_type, data);
@@ -881,10 +1015,10 @@ static PyObject *gdpy_dirfile_getdata(struct gdpy_dirfile_t *self,
                              INCREF'd Py_None on success */
       }
     } else {
-      GDPY_CHECK_ERROR2(self->D, NULL, free(data), self->char_enc);
+      GDPY_CHECK_ERROR2(self->D, NULL, PyMem_Free(data), self->char_enc);
       pyobj = gdpy_convert_to_pylist(data, return_type, ns);
 
-      free(data);
+      PyMem_Free(data);
     }
   }
 
@@ -909,7 +1043,7 @@ static PyObject *gdpy_dirfile_getentry(struct gdpy_dirfile_t *self,
     return NULL;
   }
 
-  E = malloc(sizeof(gd_entry_t));
+  E = PyMem_Malloc(sizeof(gd_entry_t));
 
   if (E == NULL) {
     PyMem_Free(field_code);
@@ -921,14 +1055,14 @@ static PyObject *gdpy_dirfile_getentry(struct gdpy_dirfile_t *self,
   gd_entry(self->D, field_code, E);
   PyMem_Free(field_code);
 
-  GDPY_CHECK_ERROR2(self->D, NULL, free(E), self->char_enc);
+  GDPY_CHECK_ERROR2(self->D, NULL, PyMem_Free(E), self->char_enc);
 
   obj = (struct gdpy_entry_t*)gdpy_entry.tp_alloc(&gdpy_entry, 0);
 
   if (obj == NULL) {
-    PyErr_NoMemory();
     gd_free_entry_strings(E);
-    free(E);
+    PyMem_Free(E);
+    PyErr_NoMemory();
     dreturn("%p", NULL);
     return NULL;
   }
@@ -938,8 +1072,16 @@ static PyObject *gdpy_dirfile_getentry(struct gdpy_dirfile_t *self,
   /* These entry objects copy the dirfile's character_encoding, not the global
    * pygetdata.character_encoding
    */
-  obj->char_enc = self->char_enc;
-  Py_INCREF(obj);
+  if (self->char_enc) {
+    obj->char_enc = gdpy_strdup(self->char_enc);
+    if (obj->char_enc == NULL) {
+      Py_DECREF(obj);
+      PyErr_NoMemory();
+      obj = NULL;
+    }
+  } else
+    obj->char_enc = NULL;
+
   dreturn("%p", obj);
   return (PyObject*)obj;
 }
@@ -995,9 +1137,9 @@ static PyObject *gdpy_dirfile_getfragment(struct gdpy_dirfile_t *self,
   }
 
   obj->n = fragment_index;
+  Py_INCREF(self);
   obj->dirfile = self;
 
-  Py_INCREF(obj);
   dreturn("%p", obj);
   return (PyObject*)obj;
 }
@@ -1041,7 +1183,7 @@ static PyObject *gdpy_dirfile_geterrorstring(struct gdpy_dirfile_t *self,
 
   estring = gd_error_string(self->D, NULL, 0);
   pyobj = gdpyobj_from_estring(estring, self->char_enc);
-  free(estring);
+  PyMem_Free(estring);
 
   dreturn("%p", pyobj);
   return pyobj;
@@ -1173,21 +1315,21 @@ static PyObject *gdpy_dirfile_raw_close(struct gdpy_dirfile_t *self,
 static PyObject *gdpy_dirfile_include(struct gdpy_dirfile_t *self,
     PyObject *args, PyObject *keys)
 {
-  char *keywords[] = { "file", "fragment_index", "flags", "prefix", "suffix",
-    NULL };
+  char *keywords[] = { "file", "fragment_index", "flags", "namespace", "prefix",
+    "suffix", NULL };
   char *file = NULL;
   int fragment_index = 0;
   unsigned long flags = 0;
-  char *prefix = NULL, *suffix = NULL;
+  char *prefix = NULL, *suffix = NULL, *namespace = NULL;
   long index;
   PyObject *pyobj;
 
   dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
-        "et|iketet:pygetdata.dirfile.include", keywords, self->char_enc, &file,
-        &fragment_index, &flags, self->char_enc, &prefix, self->char_enc,
-        &suffix))
+        "et|iketetet:pygetdata.dirfile.include", keywords, self->char_enc,
+        &file, &fragment_index, &flags, self->char_enc, &namespace,
+        self->char_enc, &prefix, self->char_enc, &suffix))
   {
     dreturn("%p", NULL);
     return NULL;
@@ -1195,8 +1337,51 @@ static PyObject *gdpy_dirfile_include(struct gdpy_dirfile_t *self,
 
   self->callback_exception = 0;
 
+  /* Deal with namespace */
+  if (namespace && prefix) {
+    const size_t nsl = strlen(namespace);
+    const char *fmt = "%s.%s";
+    char *str = PyMem_Malloc(nsl + strlen(prefix) + 2);
+
+    if (str == NULL) {
+      PyMem_Free(file);
+      PyMem_Free(prefix);
+      PyMem_Free(suffix);
+
+      dreturn("%p", NULL);
+      return PyErr_NoMemory();
+    }
+
+    if (namespace[nsl - 1] == '.')
+      fmt = "%s%s";
+
+    sprintf(str, fmt, namespace, prefix);
+
+    PyMem_Free(prefix);
+    PyMem_Free(namespace);
+    prefix = str;
+  } else if (namespace) {
+    const size_t nsl = strlen(namespace);
+    if (namespace[nsl - 1] != '.') {
+      prefix = PyMem_Malloc(nsl + 2);
+
+      if (prefix == NULL) {
+        PyMem_Free(file);
+        PyMem_Free(suffix);
+
+        dreturn("%p", NULL);
+        return PyErr_NoMemory();
+      }
+      sprintf(prefix, "%s.", namespace);
+
+      PyMem_Free(namespace);
+    } else
+      prefix = namespace;
+  }
+
   index = gd_include_affix(self->D, file, fragment_index, prefix, suffix,
       flags);
+
   PyMem_Free(file);
   PyMem_Free(prefix);
   PyMem_Free(suffix);
@@ -1324,6 +1509,8 @@ static PyObject *gdpy_dirfile_mcarrays(struct gdpy_dirfile_t *self,
   carrays = gd_mcarrays(self->D, parent, (gd_type_t)return_type);
   PyMem_Free(parent);
 
+  GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
+
   pyobj = PyList_New(0);
 
   for (i = 0; carrays[i].n != 0; ++i) {
@@ -1356,6 +1543,63 @@ static PyObject *gdpy_dirfile_mcarrays(struct gdpy_dirfile_t *self,
   return pyobj;
 }
 
+static PyObject *gdpy_dirfile_msarrays(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
+{
+  char *keywords[] = {"parent", NULL};
+  const char **fields;
+  char *parent;
+  int i;
+  const char ***sarrays;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "et:pygetdata.dirfile.msarrays",
+        keywords, self->char_enc, &parent))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  fields = gd_mfield_list_by_type(self->D, parent, GD_SARRAY_ENTRY);
+
+  GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
+
+  sarrays = gd_msarrays(self->D, parent);
+  PyMem_Free(parent);
+
+  GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
+
+  pyobj = PyList_New(0);
+
+  for (i = 0; sarrays[i] != NULL; ++i) {
+    PyObject *pydata, *name;
+    
+    pydata = gdpyobj_from_strarr(sarrays[i], self->char_enc);
+
+    if (pydata == NULL) {
+      Py_DECREF(pyobj);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+
+    name = gdpyobj_from_string(fields[i], self->char_enc);
+
+    if (name == NULL) {
+      Py_DECREF(pydata);
+      Py_DECREF(pyobj);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+
+    gdpylist_append(pyobj, Py_BuildValue("NN", name, pydata));
+  }
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
 static PyObject *gdpy_dirfile_getmconstants(struct gdpy_dirfile_t *self,
     void *args, void *keys)
 {
@@ -1575,7 +1819,7 @@ static PyObject *gdpy_dirfile_getrawfilename(struct gdpy_dirfile_t *self,
   GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
 
   pyobj = gdpyobj_from_path(filename);
-  free(filename);
+  PyMem_Free(filename);
   dreturn("%p", pyobj);
   return pyobj;
 }
@@ -1888,7 +2132,7 @@ static int gdpy_dirfile_setreference(struct gdpy_dirfile_t *self,
   }
 
   gd_reference(self->D, ref);
-  free(ref);
+  PyMem_Free(ref);
 
   GDPY_CHECK_ERROR(self->D, -1, self->char_enc);
 
@@ -1919,7 +2163,7 @@ static PyObject *gdpy_dirfile_getstring(struct gdpy_dirfile_t *self,
 
   GDPY_CHECK_ERROR2(self->D, NULL, PyMem_Free(field_code), self->char_enc);
 
-  data = malloc(len);
+  data = PyMem_Malloc(len);
   if (data == NULL) {
     PyMem_Free(field_code);
     PyErr_NoMemory();
@@ -1930,11 +2174,11 @@ static PyObject *gdpy_dirfile_getstring(struct gdpy_dirfile_t *self,
   gd_get_string(self->D, field_code, len, data);
   PyMem_Free(field_code);
 
-  GDPY_CHECK_ERROR2(self->D, NULL, free(data), self->char_enc);
+  GDPY_CHECK_ERROR2(self->D, NULL, PyMem_Free(data), self->char_enc);
 
   pyobj = gdpyobj_from_string(data, self->char_enc);
 
-  free(data);
+  PyMem_Free(data);
 
   dreturn("%p", pyobj);
   return pyobj;
@@ -2105,13 +2349,13 @@ static PyObject *gdpy_dirfile_putcarray(struct gdpy_dirfile_t *self,
 
       data = PyArray_DATA(pyobj);
     } else {
-      data = malloc(len * 16);
+      data = PyMem_Malloc(len * 16);
       type = gdpy_convert_from_pylist(pyobj, data, type, len);
 
       if (type == GD_UNKNOWN) {
         PyErr_SetString(PyExc_ValueError,
             "pygetdata.dirfile.put_carray() unknown data type for argument 2.");
-        free(data);
+        PyMem_Free(data);
         PyMem_Free(field_code);
         dreturn ("%p", NULL);
         return NULL;
@@ -2121,13 +2365,71 @@ static PyObject *gdpy_dirfile_putcarray(struct gdpy_dirfile_t *self,
     gd_put_carray_slice(self->D, field_code, start, len, type, data);
     PyMem_Free(field_code);
 
-    if (have_ndarray)
-      GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
+    if (!have_ndarray)
+      PyMem_Free(data);
+
+    GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
+  }
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_putsarray(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", "data", "start", NULL };
+  const char *field_code;
+  unsigned int start = 0, len = 1, i;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "sO|I:pygetdata.dirfile.put_sarray", keywords, &field_code, &pyobj,
+        &start)) {
+    dreturn ("%p", NULL);
+    return NULL;
+  }
+
+  if (PyList_Check(pyobj))
+    len = PyList_Size(pyobj);
+
+  if (len > 0) {
+    char **data = PyMem_Malloc(len * sizeof(*data));
+
+    if (PyList_Check(pyobj))
+      for (i = 0; i < len; ++i) {
+        data[i] = gdpy_string_from_pyobj(PyList_GetItem(pyobj, i),
+						self->char_enc, "sarray data must be strings");
+
+				if (data[i] == NULL) {
+					unsigned int j;
+					for (j = 0; j < i; ++j)
+						PyMem_Free(data[j]);
+					PyMem_Free(data);
+					dreturn ("%p", NULL);
+					return NULL;
+				}
+			}
     else {
-      GDPY_CHECK_ERROR2(self->D, NULL, free(data), self->char_enc);
+      data[0] = gdpy_string_from_pyobj(pyobj, self->char_enc,
+          "sarray data must be strings");
+      if (data[0] == NULL) {
+        PyMem_Free(data);
+        dreturn ("%p", NULL);
+        return NULL;
+      }
+		}
 
-      free(data);
-    }
+    gd_put_sarray_slice(self->D, field_code, start, len, (const char**)data);
+
+		for (i = 0; i < len; ++i)
+			PyMem_Free(data[i]);
+    PyMem_Free(data);
+
+    GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
   }
 
   Py_INCREF(Py_None);
@@ -2213,13 +2515,13 @@ static PyObject *gdpy_dirfile_putdata(struct gdpy_dirfile_t *self,
 
       data = PyArray_DATA(pyobj);
     } else {
-      data = malloc(ns * 16);
+      data = PyMem_Malloc(ns * 16);
       type = gdpy_convert_from_pylist(pyobj, data, type, ns);
 
       if (type == GD_UNKNOWN) {
         PyErr_SetString(PyExc_ValueError,
             "pygetdata.dirfile.putdata() unknown data type for argument 2.");
-        free(data);
+        PyMem_Free(data);
         PyMem_Free(field_code);
         dreturn ("%p", NULL);
         return NULL;
@@ -2231,7 +2533,7 @@ static PyObject *gdpy_dirfile_putdata(struct gdpy_dirfile_t *self,
     PyMem_Free(field_code);
 
     if (!have_ndarray)
-      free(data);
+      PyMem_Free(data);
 
     GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
   }
@@ -2815,7 +3117,7 @@ static PyObject *gdpy_dirfile_strtok(struct gdpy_dirfile_t *self,
   PyMem_Free(string); /* gd_strtok make a copy of the string */
 
   pyobj = gdpyobj_from_string(token, self->char_enc);
-  free(token);
+  PyMem_Free(token);
 
   dreturn("%p", pyobj);
   return pyobj;
@@ -2908,13 +3210,20 @@ static int gdpy_dirfile_setverboseprefix(struct gdpy_dirfile_t *self,
 {
   dtrace("%p, %p, %p", self, value, closure);
 
-  free(self->verbose_prefix);
+  PyMem_Free(self->verbose_prefix);
   if (value == NULL || value == Py_None)
     self->verbose_prefix = NULL;
-  else
-    self->verbose_prefix = gdpy_string_from_pyobj(value, self->char_enc,
+  else {
+    char *new_prefix = gdpy_string_from_pyobj(value, self->char_enc,
         "prefix must be string");
 
+    if (new_prefix == NULL) {
+      dreturn("%i", -1);
+      return -1;
+    }
+    self->verbose_prefix = new_prefix;
+  }
+
   gd_verbose_prefix(self->D, self->verbose_prefix);
 
   GDPY_CHECK_ERROR(self->D, -1, self->char_enc);
@@ -3023,6 +3332,37 @@ static PyObject *gdpy_dirfile_entrylist(struct gdpy_dirfile_t *self,
   return pyobj;
 }
 
+static PyObject *gdpy_dirfile_matchentries(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
+{
+  const char **entries;
+  char *keywords[] = { "regex", "fragment", "type", "flags", NULL };
+  int type = 0, fragment = GD_ALL_FRAGMENTS;
+  unsigned int flags = 0;
+  char *regex = NULL;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "|etiiI:pygetdata.dirfile.entry_list", keywords, self->char_enc, &regex,
+        &fragment, &type, &flags))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  gd_match_entries(self->D, regex, fragment, type, flags, &entries);
+  PyMem_Free(regex);
+
+  GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
+
+  pyobj = gdpyobj_from_strarr(entries, self->char_enc);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
 static PyObject *gdpy_dirfile_linterptablename(struct gdpy_dirfile_t *self,
     PyObject *args, PyObject *keys)
 {
@@ -3047,7 +3387,7 @@ static PyObject *gdpy_dirfile_linterptablename(struct gdpy_dirfile_t *self,
   GDPY_CHECK_ERROR(self->D, NULL, self->char_enc);
 
   pyobj = gdpyobj_from_path(filename);
-  free(filename);
+  PyMem_Free(filename);
   dreturn("%p", pyobj);
   return pyobj;
 }
@@ -3122,7 +3462,6 @@ static PyGetSetDef gdpy_dirfile_getset[] = {
     (setter)gdpy_dirfile_setreference,
     "The reference field for the dirfile, which may be set to any\n"
       "existing RAW field.  If no RAW fields are defined in the dirfile,\n"
-      /*--- handy ruler: closing quote as indicated (or earlier)---------\n" */
       "this will be None.  See gd_reference(3).",
     NULL },
   { "standards", (getter)gdpy_dirfile_getstandards,
@@ -3233,6 +3572,16 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "given by 'len'.  If omitted or zero, all elements from 'start' to\n"
       "the end of the array are returned.  See gd_get_carray_slice(3)."
   },
+  {"get_sarray", (PyCFunction)gdpy_dirfile_getsarray,
+    METH_VARARGS | METH_KEYWORDS,
+    "get_sarray(field_code [, start, len])\n\n"
+      "Retrieve the value of the SARRAY field specified by 'field_code'.\n"
+      "A list of values will be returned.\n\n"
+      "The first element returned is given by 'start', counting from zero.\n"
+      "If omitted, zero is assumed.  The number of elements returned is\n"
+      "given by 'len'.  If omitted or zero, all elements from 'start' to\n"
+      "the end of the array are returned.  See gd_get_sarray_slice(3)."
+  },
   {"get_constant", (PyCFunction)gdpy_dirfile_getconstant,
     METH_VARARGS | METH_KEYWORDS,
     "get_constant(field_code [, return_type])\n\n"
@@ -3404,6 +3753,14 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "only the metafields of the given type are returned.  See\n"
       "gd_mfield_list(3) and gd_mfield_list_by_type(3)."
   },
+  {"msarrays", (PyCFunction)gdpy_dirfile_msarrays, METH_VARARGS | METH_KEYWORDS,
+    "msarrays(parent)\n\n"
+      "Retrieve all SARRAY metafields, and their values, for the parent\n"
+      "field 'parent'.  A list of tuples will be returned, each tuple\n"
+      "containing the name and a list of values of the field.  See\n"
+      "gd_mcarrays(3), but note that this method returns both names\n"
+      "and values, unlike the C API counterpart."
+  },
   {"mstrings", (PyCFunction)gdpy_dirfile_getmstrings,
     METH_VARARGS | METH_KEYWORDS,
     "mstrings(parent, return_type)\n\n"
@@ -3447,8 +3804,8 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "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)."
+      "collection of zero or more of the pygetdata.ENTRIES_* flags.  See\n"
+      "gd_nentries(3)."
   },
   {"nfields", (PyCFunction)gdpy_dirfile_getnfields,
     METH_VARARGS | METH_KEYWORDS,
@@ -3517,15 +3874,16 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "gd_vector_list(3)."
   },
   {"include", (PyCFunction)gdpy_dirfile_include, METH_VARARGS | METH_KEYWORDS,
-    "include(filename [, fragment_index, flags, prefix, suffix])\n\n"
+    "include(filename [, fragment_index, flags, namespace, 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"
       "it should be a bitwise or'd collection of flags listed in the\n"
-      "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)."
+      "gd_include manual page.  If 'namespace' is given, it will be used\n"
+      "as the fragment's root namespace.  If 'prefix' or 'suffix' are\n"
+      "given, they will be applied to the field codes defined in the\n"
+      "file.  See gd_include(3)."
   },
   {"madd", (PyCFunction)gdpy_dirfile_madd, METH_VARARGS | METH_KEYWORDS,
     "madd(entry, parent)\n\n"
@@ -3599,6 +3957,14 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "the storage type of the field, merely how the data is transferred to\n"
       "the C API.  See gd_putdata(3)."
   },
+  {"put_sarray", (PyCFunction)gdpy_dirfile_putsarray,
+    METH_VARARGS | METH_KEYWORDS,
+    "put_sarray(field_code, data [, start])\n\n"
+      "Store the list 'data' in the SARRAY given by 'field_code'.  The\n"
+      "parameter 'start' indicates where the first sample in which the data\n"
+      "will be stored.  Zero is assumed if not given.  See\n"
+      "gd_put_sarray_slice(3)."
+  },
   {"put_string", (PyCFunction)gdpy_dirfile_putstring,
     METH_VARARGS | METH_KEYWORDS,
     "put_string(field_code, value)\n\n"
@@ -3611,6 +3977,14 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "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)."
   },
+  {"sarrays", (PyCFunction)gdpy_dirfile_sarrays, METH_NOARGS,
+    "sarrays()\n\n"
+      "Retrieve all SARRAY fields, and their values.  A list of tuples\n"
+      /*--- handy ruler: closing quote as indicated (or earlier)---------\n" */
+      "will be returned, each tuple containing the name and list of\n\n"
+      "values.  See gd_sarrays(3), but note that this method returns both\n"
+      "names and values, unlike the C API counterpart."
+  },
   {"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"
@@ -3670,7 +4044,6 @@ static PyMethodDef gdpy_dirfile_methods[] = {
   },
   {"naliases", (PyCFunction)gdpy_dirfile_naliases, METH_VARARGS | METH_KEYWORDS,
     "naliases(field_code)\n\n"
-      /*--- handy ruler: closing quote as indicated (or earlier)---------\n" */
       "This function returns the number of aliases defined for the\n"
       "specified field.  If field_code is valid, this will be at least\n"
       "one.  See gd_naliases(3)."
@@ -3719,7 +4092,7 @@ static PyMethodDef gdpy_dirfile_methods[] = {
     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"
+      "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"
@@ -3727,6 +4100,20 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "or'd collection of zero or more of the pygetdata.ENTRIES_* flags.\n"
       "See gd_entry_list(3)."
   },
+  {"match_entries", (PyCFunction)gdpy_dirfile_matchentries,
+    METH_VARARGS | METH_KEYWORDS,
+    "match_entries([regex, fragment, type, flags])\n\n"
+      /*--- handy ruler: closing quote as indicated (or earlier)---------\n" */
+      "Return a list of entry names in the database.  If 'regex' is\n"
+      "given, it is a regular expression to match against the entry names\n"
+      "If given and not pygetdata.ALL_FRAGMENTS, only the fragment\n"
+      "indexed by 'fragment' is searched.  If given, 'type' should be\n"
+      "either one of the the pygetdata.*_ENTRY symbols, or else one of\n"
+      "the special pygetdata.*_ENTRIES symbols; if not given, 'type'\n"
+      "defaults to pygetdata.ALL_ENTRIES.  If given 'flags' should be a\n"
+      "bitwise or'd collection of zero or more of the pygetdata.ENTRIES_*\n"
+      "and pygetdata.REGEX_* flags.  See gd_match_entries(3)."
+  },
   { NULL, NULL, 0, NULL }
 };
 
diff --git a/bindings/python/pyentry.c b/bindings/python/pyentry.c
index bf502b4..8048dd9 100644
--- a/bindings/python/pyentry.c
+++ b/bindings/python/pyentry.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2016 D. V. Wiebe
+/* Copyright (C) 2009-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -36,14 +36,16 @@ static const char *gdpy_entry_type_names[] =
   "RECIP_ENTRY",    /* 0x0B */
   "WINDOW_ENTRY",   /* 0x0C */
   "MPLEX_ENTRY",    /* 0x0D */
-  NULL,             /* 0x0E */
-  NULL,             /* 0x0F */
+  "INDIR_ENTRY",    /* 0x0E */
+  "SINDIR_ENTRY",   /* 0x0F */
   "CONST_ENTRY",    /* 0x10 */
   "STRING_ENTRY",   /* 0x11 */
   "CARRAY_ENTRY",   /* 0x12 */
+  "SARRAY_ENTRY"    /* 0x13 */
 };
-#define GDPY_N_ENTYPES 0x12
+#define GDPY_LAST_ENTYPE 0x13
 
+/* Routine unicode failure check routines */
 #define S1CHECK do { \
   if (s1 == NULL) { dreturn("%p", NULL); return NULL; } \
 } while(0)
@@ -67,8 +69,8 @@ static void gdpy_entry_delete(struct gdpy_entry_t *self)
   dtrace("%p", self);
 
   gd_free_entry_strings(self->E);
-  free(self->E);
-  free(self->char_enc);
+  PyMem_Free(self->E);
+  PyMem_Free(self->char_enc);
   PyObject_Del(self);
 
   dreturnvoid();
@@ -101,7 +103,7 @@ static PyObject *gdpyobj_from_scalar(const gd_entry_t *E, int i, gd_type_t type,
   if (E->scalar[i]) {
     /* Return the scalar field code */
     if (E->scalar_ind[i] >= 0) {
-      char *buffer = malloc(strlen(E->scalar[i]) + 23);
+      char *buffer = PyMem_Malloc(strlen(E->scalar[i]) + 23);
       if (buffer == NULL) {
         PyErr_NoMemory();
         dreturn("%p", NULL);
@@ -109,7 +111,7 @@ static PyObject *gdpyobj_from_scalar(const gd_entry_t *E, int i, gd_type_t type,
       }
       sprintf(buffer, "%s<%i>", E->scalar[i], E->scalar_ind[i]);
       pyobj = gdpyobj_from_string(buffer, char_enc);
-      free(buffer);
+      PyMem_Free(buffer);
     } else
       pyobj = gdpyobj_from_string(E->scalar[i], char_enc);
   } else /* If scalar is NULL, return the number */
@@ -161,6 +163,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       min = 0;
       break;
     case GD_CONST_ENTRY:
+    case GD_SARRAY_ENTRY:
       min = 1;
       break;
     case GD_RAW_ENTRY:
@@ -169,6 +172,8 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
     case GD_SBIT_ENTRY:
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
     case GD_RECIP_ENTRY:
     case GD_PHASE_ENTRY:
     case GD_POLYNOM_ENTRY:
@@ -241,7 +246,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
         E->in_fields[i] = gdpy_string_from_pyobj(PyTuple_GetItem(parm1, i),
             char_enc, "in_fields must be string");
 
-        if (PyErr_Occurred()) {
+        if (E->in_fields[i] == NULL) {
           dreturnvoid();
           return;
         }
@@ -289,7 +294,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       E->in_fields[0] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 0),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[0] == NULL) {
         dreturnvoid();
         return;
       }
@@ -307,7 +312,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       E->in_fields[0] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 0),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[0] == NULL) {
         dreturnvoid();
         return;
       }
@@ -324,10 +329,12 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       E->in_fields[0] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 0),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[0] == NULL) {
         dreturnvoid();
         return;
       }
@@ -335,7 +342,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       E->in_fields[1] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 1),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[1] == NULL) {
         dreturnvoid();
         return;
       }
@@ -344,7 +351,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       E->in_fields[0] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 0),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[0] == NULL) {
         dreturnvoid();
         return;
       }
@@ -371,7 +378,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       E->in_fields[0] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 0),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[0] == NULL) {
         dreturnvoid();
         return;
       }
@@ -395,7 +402,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       E->in_fields[0] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 0),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[0] == NULL) {
         dreturnvoid();
         return;
       }
@@ -425,7 +432,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       E->in_fields[0] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 0),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[0] == NULL) {
         dreturnvoid();
         return;
       }
@@ -433,7 +440,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       E->in_fields[1] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 1),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[1] == NULL) {
         dreturnvoid();
         return;
       }
@@ -471,7 +478,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       E->in_fields[0] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 0),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[0] == NULL) {
         dreturnvoid();
         return;
       }
@@ -479,7 +486,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       E->in_fields[1] = gdpy_string_from_pyobj(PyTuple_GetItem(tuple, 1),
           char_enc, "in_fields must be string");
 
-      if (PyErr_Occurred()) {
+      if (E->in_fields[1] == NULL) {
         dreturnvoid();
         return;
       }
@@ -490,6 +497,10 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
       gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 3), GD_INT_TYPE,
           &E->scalar[1], char_enc, &E->EN(mplex,period), NULL);
       break;
+    case GD_SARRAY_ENTRY:
+      E->EN(scalar,array_len) =
+        (size_t)gdpy_ulong_from_pyobj(PyTuple_GetItem(tuple, 0));
+      break;
     case GD_CARRAY_ENTRY:
       E->EN(scalar,array_len) =
         (size_t)gdpy_ulong_from_pyobj(PyTuple_GetItem(tuple, 1));
@@ -529,12 +540,15 @@ static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject *parms,
    * PHASE:    in_field, shift             = 2
    * MULTIPLY: in_field1, in_field2        = 2
    * DIVIDE:   in_field1, in_field2        = 2
+   * INDIR:    in_field1, in_field2        = 2
+   * SINDIR:   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
+   * SARRAY:   array_len                   = 1
    * STRING:   (none)                      = 0
    * INDEX:    (none)                      = 0
    */
@@ -569,6 +583,8 @@ static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject *parms,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       key[0] = "in_field1";
       key[1] = "in_field2";
       size = 2;
@@ -607,6 +623,10 @@ static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject *parms,
       key[1] = "array_len";
       size = 2;
       break;
+    case GD_SARRAY_ENTRY:
+      key[0] = "array_len";
+      size = 1;
+      break;
     case GD_CONST_ENTRY:
       key[0] = "type";
       size = 1;
@@ -675,7 +695,7 @@ static int gdpy_entry_init(struct gdpy_entry_t *self, PyObject *args,
   E.field = gdpy_string_from_pyobj(field_name, self->char_enc,
       "field name should be string");
 
-  if (PyErr_Occurred()) {
+  if (E.field == NULL) {
     dreturn("%i", -1);
     return -1;
   }
@@ -683,7 +703,7 @@ static int gdpy_entry_init(struct gdpy_entry_t *self, PyObject *args,
   E.field_type = field_type;
 
   /* check for valid field type */
-  if (E.field_type > GDPY_N_ENTYPES || E.field_type <= 0 ||
+  if (E.field_type > GDPY_LAST_ENTYPE || E.field_type <= 0 ||
       gdpy_entry_type_names[E.field_type] == NULL)
   {
     PyErr_SetString(PyExc_ValueError,
@@ -714,9 +734,10 @@ static int gdpy_entry_init(struct gdpy_entry_t *self, PyObject *args,
   }
 
   if (self->E == NULL) {
-    self->E = malloc(sizeof(gd_entry_t));
+    self->E = PyMem_Malloc(sizeof(gd_entry_t));
 
     if (self->E == NULL) {
+      PyErr_NoMemory();
       dreturn("%i", -1);
       return -1;
     }
@@ -757,12 +778,12 @@ static int gdpy_entry_setname(struct gdpy_entry_t *self, PyObject *value,
   s = gdpy_string_from_pyobj(value, self->char_enc,
       "field name should be string");
 
-  if (PyErr_Occurred()) {
+  if (s == NULL) {
     dreturn("%i", -1);
     return -1;
   }
 
-  free(self->E->field);
+  PyMem_Free(self->E->field);
   self->E->field = s;
 
   dreturn("%i", 0);
@@ -863,10 +884,11 @@ static PyObject *gdpy_entry_getinfields(struct gdpy_entry_t *self,
       s1 = gdpyobj_from_string(self->E->in_fields[0], self->char_enc);
       S1CHECK;
       tuple = Py_BuildValue("(N)", s1);
-      S1CHECK;
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
     case GD_WINDOW_ENTRY:
     case GD_MPLEX_ENTRY:
       s1 = gdpyobj_from_string(self->E->in_fields[0], self->char_enc);
@@ -881,6 +903,7 @@ static PyObject *gdpy_entry_getinfields(struct gdpy_entry_t *self,
     case GD_INDEX_ENTRY:
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_STRING_ENTRY:
       PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
           "attribute 'in_fields' not available for entry type %s",
@@ -925,17 +948,18 @@ static int gdpy_entry_setinfields(struct gdpy_entry_t *self, PyObject *value,
         return -1;
       }
 
-      for (i = 0; i < self->E->EN(lincom,n_fields); ++i)
+      for (i = 0; i < self->E->EN(lincom,n_fields); ++i) {
         s[i] = gdpy_string_from_pyobj(PyTuple_GetItem(value, i), self->char_enc,
             "in_fields should be strings");
 
-      if (PyErr_Occurred()) {
-        dreturn("%i", -1);
-        return -1;
+        if (s[i] == NULL) {
+          dreturn("%i", -1);
+          return -1;
+        }
       }
 
       for (i = 0; i < self->E->EN(lincom,n_fields); ++i) {
-        free(self->E->in_fields[i]);
+        PyMem_Free(self->E->in_fields[i]);
         self->E->in_fields[i] = s[i];
       }
       break;
@@ -966,16 +990,18 @@ static int gdpy_entry_setinfields(struct gdpy_entry_t *self, PyObject *value,
             "in_fields should be strings");
       }
 
-      if (PyErr_Occurred()) {
+      if (s[0] == NULL) {
         dreturn("%i", -1);
         return -1;
       }
 
-      free(self->E->in_fields[0]);
+      PyMem_Free(self->E->in_fields[0]);
       self->E->in_fields[0] = s[0];
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
     case GD_WINDOW_ENTRY:
     case GD_MPLEX_ENTRY:
       if (value == NULL) {
@@ -999,17 +1025,18 @@ static int gdpy_entry_setinfields(struct gdpy_entry_t *self, PyObject *value,
         return -1;
       }
 
-      for (i = 0; i < 2; ++i)
+      for (i = 0; i < 2; ++i) {
         s[i] = gdpy_string_from_pyobj(PyTuple_GetItem(value, i), self->char_enc,
             "in_fields should be strings");
 
-      if (PyErr_Occurred()) {
-        dreturn("%i", -1);
-        return -1;
+        if (s[i] == NULL) {
+          dreturn("%i", -1);
+          return -1;
+        }
       }
 
       for (i = 0; i < 2; ++i) {
-        free(self->E->in_fields[i]);
+        PyMem_Free(self->E->in_fields[i]);
         self->E->in_fields[i] = s[i];
       }
       break;
@@ -1019,6 +1046,7 @@ static int gdpy_entry_setinfields(struct gdpy_entry_t *self, PyObject *value,
     case GD_INDEX_ENTRY:
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_STRING_ENTRY:
       PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
           "attribute 'in_fields' not available for entry type %s",
@@ -1166,12 +1194,12 @@ static int gdpy_entry_setspf(struct gdpy_entry_t *self, PyObject *value,
       &spf, "spf");
 
   if (PyErr_Occurred()) {
-    free(scalar);
+    PyMem_Free(scalar);
     dreturn("%i", -1);
     return -1;
   }
 
-  free(self->E->scalar[0]);
+  PyMem_Free(self->E->scalar[0]);
   self->E->scalar[0] = scalar;
   self->E->EN(raw,spf) = spf;
 
@@ -1186,7 +1214,9 @@ static PyObject *gdpy_entry_getarraylen(struct gdpy_entry_t *self,
 
   dtrace("%p, %p", self, closure);
 
-  if (self->E->field_type == GD_CARRAY_ENTRY) {
+  if (self->E->field_type == GD_CARRAY_ENTRY ||
+      self->E->field_type == GD_SARRAY_ENTRY)
+  {
       obj = PyLong_FromUnsignedLong(self->E->EN(scalar,array_len));
   } else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
@@ -1282,11 +1312,11 @@ static int gdpy_entry_setnfields(struct gdpy_entry_t *self, PyObject *value,
 
   /* free extra terms */
   for (i = n; i < self->E->EN(lincom,n_fields); ++i)
-    free(self->E->in_fields[i]);
+    PyMem_Free(self->E->in_fields[i]);
 
   /* initialise new terms */
   for (i = self->E->EN(lincom,n_fields); i < n; ++i) {
-    self->E->in_fields[i] = strdup("");
+    self->E->in_fields[i] = gdpy_strdup("");
     self->E->EN(lincom,m)[i] = self->E->EN(lincom,b)[i] = 0;
   }
 
@@ -1383,7 +1413,7 @@ static int gdpy_entry_setm(struct gdpy_entry_t *self, PyObject *value,
 
   if (PyErr_Occurred()) {
     for (i = 0; i < GD_MAX_LINCOM; ++i)
-      free(scalar[i]);
+      PyMem_Free(scalar[i]);
     dreturn("%i", -1);
     return -1;
   }
@@ -1394,7 +1424,7 @@ static int gdpy_entry_setm(struct gdpy_entry_t *self, PyObject *value,
       comp_scal = GD_EN_COMPSCAL;
     gd_cs2cs_(self->E->EN(lincom,cm)[i], cm[i]);
     self->E->EN(lincom,m)[i] = m[i];
-    free(self->E->scalar[i]);
+    PyMem_Free(self->E->scalar[i]);
     self->E->scalar[i] = scalar[i];
   }
   self->E->flags |= comp_scal;
@@ -1490,7 +1520,7 @@ static int gdpy_entry_setb(struct gdpy_entry_t *self, PyObject *value,
 
   if (PyErr_Occurred()) {
     for (i = 0; i < GD_MAX_LINCOM; ++i)
-      free(scalar[i]);
+      PyMem_Free(scalar[i]);
     dreturn("%i", -1);
     return -1;
   }
@@ -1501,7 +1531,7 @@ static int gdpy_entry_setb(struct gdpy_entry_t *self, PyObject *value,
       comp_scal = GD_EN_COMPSCAL;
     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]);
+    PyMem_Free(self->E->scalar[i + GD_MAX_LINCOM]);
     self->E->scalar[i + GD_MAX_LINCOM] = scalar[i];
   }
   self->E->flags |= comp_scal;
@@ -1555,7 +1585,7 @@ static int gdpy_entry_settable(struct gdpy_entry_t *self, PyObject *value,
     return -1;
   }
 
-  free(self->E->EN(linterp,table));
+  PyMem_Free(self->E->EN(linterp,table));
   self->E->EN(linterp,table) = s;
 
   dreturn("%i", 0);
@@ -1602,13 +1632,13 @@ static int gdpy_entry_setbitnum(struct gdpy_entry_t *self, PyObject *value,
   gdpy_set_scalar_from_pyobj(value, GD_INT_TYPE, &scalar, self->char_enc,
       &bitnum, "bitnum");
   if (PyErr_Occurred()) {
-    free(scalar);
+    PyMem_Free(scalar);
     dreturn("%i", -1);
     return -1;
   }
 
   self->E->EN(bit,bitnum) = bitnum;
-  free(self->E->scalar[0]);
+  PyMem_Free(self->E->scalar[0]);
   self->E->scalar[0] = scalar;
 
   dreturn("%i", 0);
@@ -1662,7 +1692,7 @@ static int gdpy_entry_setnumbits(struct gdpy_entry_t *self, PyObject *value,
   }
 
   self->E->EN(bit,numbits) = numbits;
-  free(self->E->scalar[1]);
+  PyMem_Free(self->E->scalar[1]);
   self->E->scalar[1] = scalar;
 
   dreturn("%i", 0);
@@ -1738,7 +1768,7 @@ static int gdpy_entry_setdividend(struct gdpy_entry_t *self, PyObject *value,
   self->E->flags |= comp_scal;
   gd_cs2cs_(self->E->EN(recip,cdividend), cdividend);
   self->E->EN(recip,dividend) = dividend;
-  free(self->E->scalar[0]);
+  PyMem_Free(self->E->scalar[0]);
   self->E->scalar[0] = scalar;
 
   dreturn("%i", 0);
@@ -1788,7 +1818,7 @@ static int gdpy_entry_setshift(struct gdpy_entry_t *self, PyObject *value,
   }
 
   self->E->EN(phase,shift) = shift;
-  free(self->E->scalar[0]);
+  PyMem_Free(self->E->scalar[0]);
   self->E->scalar[0] = scalar;
 
   dreturn("%i", 0);
@@ -1839,7 +1869,7 @@ static int gdpy_entry_setcountval(struct gdpy_entry_t *self, PyObject *value,
   }
 
   self->E->EN(mplex,count_val) = count_val;
-  free(self->E->scalar[0]);
+  PyMem_Free(self->E->scalar[0]);
   self->E->scalar[0] = scalar;
 
   dreturn("%i", 0);
@@ -1890,7 +1920,7 @@ static int gdpy_entry_setperiod(struct gdpy_entry_t *self, PyObject *value,
   }
 
   self->E->EN(mplex,period) = period;
-  free(self->E->scalar[1]);
+  PyMem_Free(self->E->scalar[1]);
   self->E->scalar[1] = scalar;
 
   dreturn("%i", 0);
@@ -1908,7 +1938,7 @@ static PyObject *gdpy_entry_geta(struct gdpy_entry_t *self, void *closure)
     obj = PyTuple_New(self->E->EN(polynom,poly_ord) + 1);
     for (i = 0; i <= self->E->EN(polynom,poly_ord); ++i) {
       PyObject *scalar = gdpyobj_from_scalar(self->E, i, GD_COMPLEX128,
-          &self->E->EN(lincom,ca)[i], self->char_enc);
+          &self->E->EN(polynom,ca)[i], self->char_enc);
       if (scalar == NULL) {
         Py_DECREF(obj);
         obj = NULL;
@@ -1990,7 +2020,7 @@ static int gdpy_entry_seta(struct gdpy_entry_t *self, PyObject *value,
   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]);
+    PyMem_Free(self->E->scalar[i]);
     self->E->scalar[i] = scalar[i];
   }
   self->E->flags |= comp_scal;
@@ -2077,6 +2107,9 @@ static PyObject *gdpy_entry_getparms(struct gdpy_entry_t *self, void *closure)
       tuple = Py_BuildValue("(iI)", self->E->EN(scalar,const_type),
           self->E->EN(scalar,array_len));
       break;
+    case GD_SARRAY_ENTRY:
+      tuple = Py_BuildValue("(I)", self->E->EN(scalar,array_len));
+      break;
     case GD_RAW_ENTRY:
       s1 = gdpyobj_from_scalar(self->E, 0, GD_UINT_TYPE, &self->E->EN(raw,spf),
           self->char_enc);
@@ -2092,6 +2125,8 @@ static PyObject *gdpy_entry_getparms(struct gdpy_entry_t *self, void *closure)
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       s1 = gdpyobj_from_string(self->E->in_fields[0], self->char_enc);
       S1CHECK;
       s2 = gdpyobj_from_string(self->E->in_fields[1], self->char_enc);
@@ -2367,7 +2402,7 @@ static int gdpy_entry_setthreshold(struct gdpy_entry_t *self, PyObject *value,
     return -1;
   }
 
-  free(self->E->scalar[0]);
+  PyMem_Free(self->E->scalar[0]);
   self->E->scalar[0] = scalar;
   self->E->EN(window,threshold) = t;
 
@@ -2413,6 +2448,7 @@ static PyObject *gdpy_entry_repr(struct gdpy_entry_t *self)
   /* the parameter tuple */
   parms = gdpy_entry_getparms(self, NULL);
   if (PyErr_Occurred()) {
+    Py_DECREF(name);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -2429,9 +2465,13 @@ static PyObject *gdpy_entry_repr(struct gdpy_entry_t *self)
         gdpy_entry_type_names[self->E->field_type], name,
         self->E->fragment_index, parms, self->char_enc);
 
+#if PY_MAJOR_VERSION < 3
   /* now encode */
   repr = PyUnicode_AsEncodedString(urepr, "ascii", "backslashreplace");
   Py_DECREF(urepr);
+#else
+  repr = urepr;
+#endif
   Py_DECREF(name);
   Py_DECREF(parms);
 
diff --git a/bindings/python/pyfragment.c b/bindings/python/pyfragment.c
index 647a461..f61da31 100644
--- a/bindings/python/pyfragment.c
+++ b/bindings/python/pyfragment.c
@@ -301,6 +301,24 @@ static int gdpy_fragment_setprotection(struct gdpy_fragment_t *self,
   return 0;
 }
 
+static PyObject *gdpy_fragment_getns(struct gdpy_fragment_t *self,
+    void *closure)
+{
+  const char *ns;
+  PyObject *pyobj;
+
+  dtrace("%p, %p", self, closure);
+
+  ns = gd_fragment_namespace(self->dirfile->D, self->n, NULL);
+
+  GDPY_CHECK_ERROR(self->dirfile->D, NULL, self->dirfile->char_enc);
+
+  pyobj = gdpyobj_from_string(ns, self->dirfile->char_enc);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
 static PyObject *gdpy_fragment_getprefix(struct gdpy_fragment_t *self,
     void *closure)
 {
@@ -313,7 +331,7 @@ static PyObject *gdpy_fragment_getprefix(struct gdpy_fragment_t *self,
 
   GDPY_CHECK_ERROR(self->dirfile->D, NULL, self->dirfile->char_enc);
 
-  free(suffix);
+  PyMem_Free(suffix);
   if (prefix == NULL) {
     Py_INCREF(Py_None);
     dreturn("%p", Py_None);
@@ -321,12 +339,41 @@ static PyObject *gdpy_fragment_getprefix(struct gdpy_fragment_t *self,
   }
 
   pyobj = gdpyobj_from_string(prefix, self->dirfile->char_enc);
-  free(prefix);
+  PyMem_Free(prefix);
 
   dreturn("%p", pyobj);
   return pyobj;
 }
 
+static int gdpy_fragment_setns(struct gdpy_fragment_t *self,
+    PyObject *value, void *closure)
+{
+  char *ns;
+
+  dtrace("%p, %p, %p", self, value, closure);
+
+  /* deleting namespace is equivalent to setting it to "" */
+  if (value == NULL)
+    ns = gdpy_strdup("");
+  else
+    ns = gdpy_string_from_pyobj(value, self->dirfile->char_enc,
+        "namespace must be string");
+
+  if (ns == NULL) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  gd_fragment_namespace(self->dirfile->D, self->n, ns);
+
+  PyMem_Free(ns);
+
+  GDPY_CHECK_ERROR(self->dirfile->D, -1, self->dirfile->char_enc);
+
+  dreturn("%i", 0);
+  return 0;
+}
+
 static int gdpy_fragment_setprefix(struct gdpy_fragment_t *self,
     PyObject *value, void *closure)
 {
@@ -336,29 +383,28 @@ static int gdpy_fragment_setprefix(struct gdpy_fragment_t *self,
 
   if (value == NULL) {
     if (self->n == 0) {
-      prefix = strdup("");
+      prefix = gdpy_strdup("");
       if (prefix == NULL)
         PyErr_NoMemory();
     } else {
-      char *suffix;
+      char *suffix = NULL;
       gd_fragment_affixes(self->dirfile->D, self->n, &prefix, &suffix);
+      PyMem_Free(suffix);
 
       GDPY_CHECK_ERROR(self->dirfile->D, -1, self->dirfile->char_enc);
-
-      free(suffix);
     }
   } else
     prefix = gdpy_string_from_pyobj(value, self->dirfile->char_enc,
         "prefix must be string");
 
-  if (PyErr_Occurred()) {
+  if (prefix == NULL) {
     dreturn("%i", -1);
     return -1;
   }
 
   gd_alter_affixes(self->dirfile->D, self->n, prefix, NULL);
 
-  free(prefix);
+  PyMem_Free(prefix);
 
   GDPY_CHECK_ERROR(self->dirfile->D, -1, self->dirfile->char_enc);
 
@@ -378,7 +424,7 @@ static PyObject *gdpy_fragment_getsuffix(struct gdpy_fragment_t *self,
 
   GDPY_CHECK_ERROR(self->dirfile->D, NULL, self->dirfile->char_enc);
 
-  free(prefix);
+  PyMem_Free(prefix);
   if (suffix == NULL) {
     Py_INCREF(Py_None);
     dreturn("%p", Py_None);
@@ -386,7 +432,7 @@ static PyObject *gdpy_fragment_getsuffix(struct gdpy_fragment_t *self,
   }
 
   pyobj = gdpyobj_from_string(suffix, self->dirfile->char_enc);
-  free(suffix);
+  PyMem_Free(suffix);
 
   dreturn("%p", pyobj);
   return pyobj;
@@ -401,29 +447,28 @@ static int gdpy_fragment_setsuffix(struct gdpy_fragment_t *self,
 
   if (value == NULL) {
     if (self->n == 0) {
-      suffix = strdup("");
+      suffix = gdpy_strdup("");
       if (suffix == NULL)
         PyErr_NoMemory();
     } else {
-      char *prefix;
+      char *prefix = NULL;
       gd_fragment_affixes(self->dirfile->D, self->n, &prefix, &suffix);
+      PyMem_Free(prefix);
 
       GDPY_CHECK_ERROR(self->dirfile->D, -1, self->dirfile->char_enc);
-
-      free(prefix);
     }
   } else
     suffix = gdpy_string_from_pyobj(value, self->dirfile->char_enc,
         "suffix must be string");
 
-  if (PyErr_Occurred()) {
+  if (suffix == NULL) {
     dreturn("%i", -1);
     return -1;
   }
 
   gd_alter_affixes(self->dirfile->D, self->n, NULL, suffix);
 
-  free(suffix);
+  PyMem_Free(suffix);
 
   GDPY_CHECK_ERROR(self->dirfile->D, -1, self->dirfile->char_enc);
 
@@ -455,6 +500,9 @@ static PyGetSetDef gdpy_fragment_getset[] = {
     "The pathname of this fragment.  This attribute cannot be changed.\n"
       "See gd_fragmentname(3).",
     NULL },
+  { "namespace", (getter)gdpy_fragment_getns, (setter)gdpy_fragment_setns,
+    "The root namespace of the fragment.  See gd_fragment_affix(3).\n",
+    NULL },
   { "parent", (getter)gdpy_fragment_getparent, NULL,
     "The fragment index of this fragment's parent.  Since the primary\n"
       "format file has no parent, an error will occur if an attempt is made\n"
diff --git a/bindings/python/pygetdata.c b/bindings/python/pygetdata.c
index a69f891..50c948d 100644
--- a/bindings/python/pygetdata.c
+++ b/bindings/python/pygetdata.c
@@ -28,17 +28,14 @@ static struct {
   char *doc;
 } gdpy_exception_list[GD_N_ERROR_CODES] = {
   { NULL, NULL },
-  { NULL, NULL }, /* 1 */
   { "Format", "Syntax error in Dirfile metadata (GD_E_FORMAT)." },
-  { NULL, NULL }, /* 3 */
   { "Creation", "Unable to create a Dirfile. (GD_E_CREAT)." },
   { "BadCode", "Bad field code. (GD_E_BAD_CODE)." },
   { "BadType", "Bad data type. (GD_E_BAD_TYPE)." },
   { "IO", "I/O error encountered. (GD_E_IO)." },
-  { NULL, NULL }, /* 8 */
-  { "Internal", "Internal library error (GD_E_INTERNAL_ERROR).\nPlease report "
-    "to <" PACKAGE_BUGREPORT ">" },
-  { NULL, NULL }, /* 10 -- GD_E_ALLOC.  Reported via PyErr_NoMemory() */
+  { "Internal", "Internal library error (GD_E_INTERNAL_ERROR).\n"
+    "Please report to <" PACKAGE_BUGREPORT ">" },
+  { NULL, NULL }, /* GD_E_ALLOC.  Reported via PyErr_NoMemory() */
   { "Range", "Invalid frame or sample number (GD_E_RANGE)." },
   { "LUT", "Malformed LINTERP table file (GD_E_LUT)." },
   { "RecurseLevel", "Recursion too deep (GD_E_RECURSE_LEVEL)." },
@@ -63,13 +60,10 @@ static struct {
   { "UncleanDatabase",
     "Error updating Dirfile: database is unclean (GD_E_UNCLEAN_DB)." },
   { "Domain", "Improper domain (GD_E_DOMAIN)." },
-  { NULL, NULL }, /* 32 */
-  { NULL, NULL }, /* 33 */
-  { NULL, NULL }, /* 34 */
   { "Bounds", "CARRAY access out-of-bounds (GD_E_BOUNDS)." },
   { "LineTooLong", "Metadata line is too long (GD_E_LINE_TOO_LONG)." }
 };
-PyObject *gdpy_exceptions[GD_N_ERROR_CODES];
+static PyObject *gdpy_exceptions[GD_N_ERROR_CODES];
 
 /* These are unused but for backwards compatibility are defined as aliases of
  * current exceptions */
@@ -77,21 +71,39 @@ static struct {
   const char *name;
   int e;
 } gdpy_dead_exceptions[] = {
-  { "BadEndianness", GD_E_ARGUMENT },
-  { "BadProtection", GD_E_ARGUMENT },
-  { "BadRepr", GD_E_BAD_CODE },
-  { "BadVersion", GD_E_ARGUMENT },
-  { "OpenLinfile", GD_E_LUT },
-  { "Flush", GD_E_IO },
-  { "Open", GD_E_IO },
-  { "OpenFragment", GD_E_IO },
-  { "OpenFragment", GD_E_IO },
-  { "OpenInclude", GD_E_IO },
-  { "RawIO", GD_E_IO },
-  { "Trunc", GD_E_IO },
+  { "BadEndianness", -GD_E_ARGUMENT },
+  { "BadProtection", -GD_E_ARGUMENT },
+  { "BadRepr", -GD_E_BAD_CODE },
+  { "BadVersion", -GD_E_ARGUMENT },
+  { "OpenLinfile", -GD_E_LUT },
+  { "Flush", -GD_E_IO },
+  { "Open", -GD_E_IO },
+  { "OpenFragment", -GD_E_IO },
+  { "OpenFragment", -GD_E_IO },
+  { "OpenInclude", -GD_E_IO },
+  { "RawIO", -GD_E_IO },
+  { "Trunc", -GD_E_IO },
   { NULL, 0}
 };
 
+char *gdpy_strdup(const char *str)
+{
+  char *ptr = NULL;
+
+  dtrace("\"%s\"", str);
+
+  if (str) {
+    size_t len = strlen(str) + 1;
+    ptr = PyMem_Malloc(len);
+
+    if (ptr)
+      memcpy(ptr, str, len);
+  }
+
+  dreturn("%p", ptr);
+  return ptr;
+}
+
 int gdpylist_append(PyObject *list, PyObject *item)
 {
   int ret;
@@ -258,23 +270,27 @@ long gdpy_long_from_pyobj(PyObject *pyobj)
   return v;
 }
 
-/* Convert a Python string-like object to a C string, returns a malloc'd
- * string in all cases */
+/* Convert a Python string-like object to a C string, returns a PyMem_Malloc'd
+ * string except on error */
 char *gdpy_string_from_pyobj(PyObject *pyobj, const char *char_enc,
     const char *err_string)
 {
+  PyObject *encobj = NULL;
   char *s = NULL;
-  int del_pyobj = 0;
 
   dtrace("%p, \"%s\"", pyobj, char_enc);
 
   if (PyUnicode_Check(pyobj)) {
-    del_pyobj = 1;
     /* Encode string */
     if (char_enc == NULL)
-      pyobj = PyUnicode_AsUTF8String(pyobj);
+      encobj = PyUnicode_AsUTF8String(pyobj);
     else
-      pyobj = PyUnicode_AsEncodedString(pyobj, char_enc, "strict");
+      encobj = PyUnicode_AsEncodedString(pyobj, char_enc, "strict");
+
+    if (encobj == NULL) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
   } else if (!gdpy_encobj_check(pyobj)) {
     if (err_string)
       PyErr_SetString(PyExc_TypeError, err_string);
@@ -283,19 +299,20 @@ char *gdpy_string_from_pyobj(PyObject *pyobj, const char *char_enc,
   }
 
   /* now convert to python object */
-  s = gdpy_string_from_encobj(pyobj);
+  if (encobj) {
+    s = gdpy_string_from_encobj(encobj);
+    Py_DECREF(encobj);
+  } else
+    s = gdpy_string_from_encobj(pyobj);
 
   /* strdup */
   if (s) {
-    s = strdup(s);
+    s = gdpy_strdup(s);
 
     if (s == NULL)
       PyErr_NoMemory();
   }
 
-  if (del_pyobj)
-    Py_DECREF(pyobj);
-
   dreturn("\"%s\"", s);
   return s;
 }
@@ -361,7 +378,7 @@ char *gdpy_path_from_pyobj_(PyObject *pyobj, int dup)
 
   /* strdup, if requested */
   if (s && dup) {
-    s = strdup(s);
+    s = gdpy_strdup(s);
 
     if (s == NULL)
       PyErr_NoMemory();
@@ -570,7 +587,7 @@ gd_type_t gdpy_type_from_npytype(int npytype)
       break;
   }
 
-  dreturn("0x%03x\n", type);
+  dreturn("0x%03x", type);
   return type;
 }
 
@@ -650,14 +667,14 @@ int gdpy_report_error(DIRFILE *D, char *char_enc)
 
   e = gd_error(D);
 
-  if (e == GD_E_ALLOC) {
+  if (e == GD_E_ALLOC)
     PyErr_NoMemory();
-  } else if (e) {
+  else if (e) {
     char *buffer = gd_error_string(D, NULL, 0);
     if (buffer) {
-      PyErr_SetObject(gdpy_exceptions[e], gdpyobj_from_estring(buffer,
+      PyErr_SetObject(gdpy_exceptions[-e], gdpyobj_from_estring(buffer,
             char_enc));
-      free(buffer); 
+      PyMem_Free(buffer); 
     } else
       PyErr_NoMemory(); /* Errors with errors */
   }
@@ -748,6 +765,7 @@ PyObject *gdpy_convert_to_pylist(const void *data, gd_type_t type, size_t ns)
         if (gdpylist_append(pyobj, gdpy_from_complexp(((double*)data) + 2 * i)))
           return NULL;
       break;
+    case GD_STRING:
     case GD_NULL:
     case GD_UNKNOWN: /* prevent compiler warning */
       break;
@@ -808,6 +826,7 @@ PyObject *gdpy_convert_to_pyobj(const void *data, gd_type_t type,
       pyobj = gdpy_maybe_complex(((double*)data)[0], ((double*)data)[1],
           force_complex);
       break;
+    case GD_STRING:
     case GD_UNKNOWN: /* prevent compiler warning */
       break;
   }
@@ -816,24 +835,25 @@ PyObject *gdpy_convert_to_pyobj(const void *data, gd_type_t type,
   return pyobj;
 }
 
-/* If value is a valid encoding (or None), free the old *char_enc and update */
+/* If value is a valid encoding (or None), PyMem_Free the old *char_enc and
+ * update */
 int gdpy_parse_charenc(char** char_enc, PyObject *value)
 {
   dtrace("%p, %p", char_enc, value);
 
   if (value == NULL || value == Py_None) {
-    free(*char_enc);
+    PyMem_Free(*char_enc);
     *char_enc = NULL;
   } else {
     char *new_enc = gdpy_string_from_pyobj(value, NULL,
         "character_encoding must be string or None");
   
-    if (PyErr_Occurred()) {
+    if (new_enc == NULL) {
       dreturn("%i", -1);
       return -1;
     }
 
-    free(*char_enc);
+    PyMem_Free(*char_enc);
     *char_enc = new_enc;
   }
 
@@ -1145,5 +1165,8 @@ GDPY_MODINITFUNC
     PyModule_AddObject(gdpy_mod, "__CAPI", capi);
 #endif
 
+  /* Tell GetData to use Python's heap (in places) */
+  gd_alloc_funcs(PyMem_Malloc, PyMem_Free);
+
   GDPY_MODINITSUCCESS;
 }
diff --git a/bindings/python/test/Makefile.in b/bindings/python/test/Makefile.in
index 25dfe9d..6a6f454 100644
--- a/bindings/python/test/Makefile.in
+++ b/bindings/python/test/Makefile.in
@@ -180,6 +180,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/bindings/python/test/big_test.py b/bindings/python/test/big_test.py
index cb6da8a..a97ddb9 100644
--- a/bindings/python/test/big_test.py
+++ b/bindings/python/test/big_test.py
@@ -101,11 +101,12 @@ file.close()
 
 ne = 0
 
-fields = [B("INDEX"), B("alias"), B("bit"), B("carray"), B("const"), B("data"),
-    B("div"), B("lincom"), B("linterp"), B("mplex"), B("mult"), B("phase"),
-    B("polynom"), B("recip"), B("sbit"), B("string"), B("window")]
+fields = [ B("bit"), B("div"), B("data"), B("mult"), B("sbit"), B("INDEX"),
+        B("alias"), B("const"), B("indir"), B("mplex"), B("phase"), B("recip"),
+        B("carray"), B("lincom"), B("sarray"), B("sindir"), B("string"),
+        B("window"), B("linterp"), B("polynom"), ]
 
-nfields = 17
+nfields = 20
 file=open("dirfile/format", 'w')
 file.write(
     "/ENDIAN little\n"
@@ -129,6 +130,10 @@ file.write(
     "window WINDOW linterp mult LT 4.1\n"
     "/ALIAS alias data\n"
     "string STRING \"Zaphod Beeblebrox\"\n"
+    "sarray SARRAY one two three four five six seven\n"
+    "data/msarray SARRAY eight nine ten eleven twelve\n"
+    "indir INDIR data carray\n"
+    "sindir SINDIR data sarray\n"
     )
 file.close()
 
@@ -248,14 +253,15 @@ try:
   n = d.nmfields("data")
 except:
   CheckOK(26)
-CheckSimple(26,n,4)
+CheckSimple(26,n,5)
 
 # 27: mfield_list check
 try:
   n = d.mfield_list("data")
 except:
   CheckOK(27)
-CheckSimple(27,n,[B("mstr"), B("mconst"), B("mcarray"), B("mlut")])
+CheckSimple(27,n,[B("mstr"), B("mconst"), B("mcarray"), B("mlut"),
+    B("msarray")])
 
 # 28: nframes check
 try:
@@ -668,24 +674,24 @@ try:
   n = d.field_list(pygetdata.LINCOM_ENTRY)
 except:
   CheckOK(68)
-CheckSimple(68,n,[B("lincom"), B("new2")])
+CheckSimple(68,n,[B("new2"), B("lincom")])
 
 # 69: nvectors check
 try:
   n = d.nvectors()
 except:
   CheckOK(69)
-CheckSimple(69,n,22)
+CheckSimple(69,n,23)
 
-# 70: field_list check
+# 70: vector_list check
 try:
   n = d.vector_list()
 except:
   CheckOK(70)
-CheckSimple(70,n,[B('INDEX'), B('alias'), B('bit'), B('data'), B('div'),
-    B('lincom'), B('linterp'), B('mplex'), B('mult'), B('new1'), B('new10'),
-    B('new2'), B('new4'), B('new6'), B('new7'), B('new8'), B('new9'),
-    B('phase'), B('polynom'), B('recip'), B('sbit'), B('window')])
+CheckSimple(70,n,[ B('bit'), B('div'), B('data'), B('mult'), B('new1'),
+    B('new2'), B('new4'), B('new6'), B('new7'), B('new8'), B('new9'), B('sbit'),
+    B('INDEX'), B('alias'), B('indir'), B('mplex'), B('new10'), B('phase'),
+    B('recip'), B('lincom'), B('window'), B('linterp'), B('polynom') ])
 
 # 71: add / entry (lincom) check
 ent = pygetdata.entry(pygetdata.LINCOM_ENTRY, "mnew1", 0,
@@ -1778,7 +1784,7 @@ try:
   n = d.aliases('data')
 except:
   CheckOK(222)
-CheckSimple(222, n, [ B('data'), B('alias'), B('data/mnew20'), B('new20') ])
+CheckSimple(222, n, [ B('data'), B('alias'), B('new20'), B('data/mnew20') ])
 
 # 223: gd_include_affix check
 try:
@@ -1929,14 +1935,14 @@ try:
       pygetdata.ENTRIES_HIDDEN | pygetdata.ENTRIES_NOALIAS)
 except:
   CheckOK2(237, 1)
-CheckSimple2(237, 1, n, 5)
-#n = d.nentries(type = pygetdata.VECTOR_ENTRIES, flags = pygetdata.ENTRIES_HIDDEN | pygetdata.ENTRIES_NOALIAS)
+CheckSimple2(237, 1, n, 6)
+
 try:
   n = d.nentries(type = pygetdata.VECTOR_ENTRIES,
       flags = pygetdata.ENTRIES_HIDDEN | pygetdata.ENTRIES_NOALIAS)
 except:
   CheckOK2(237, 2)
-CheckSimple2(237, 2, n, 23)
+CheckSimple2(237, 2, n, 24)
 
 # 239: gd_entry_list check
 try:
@@ -1944,10 +1950,11 @@ try:
       flags = pygetdata.ENTRIES_HIDDEN | pygetdata.ENTRIES_NOALIAS)
 except:
   CheckOK(239)
-CheckSimple(239,n, [B('INDEX'), B('bit'), B('data'), B('div'), B('lincom'),
-    B('linterp'), B('mplex'), B('mult'), B('new1'), B('new14'), B('new16'),
-    B('new18'), B('new2'), B('new21'), B('new4'), B('new6'), B('new7'),
-    B('new8'), B('phase'), B('polynom'), B('recip'), B('sbit'), B('window')])
+CheckSimple(239,n, [ B('bit'), B('div'), B('data'), B('mult'), B('new1'),
+    B('new2'), B('new4'), B('new6'), B('new7'), B('new8'), B('sbit'),
+    B('INDEX'), B('indir'), B('mplex'), B('new14'), B('new16'), B('new18'),
+    B('new21'), B('phase'), B('recip'), B('lincom'), B('window'), B('linterp'),
+    B('polynom') ])
 
 # 240: gd_mplex_lookback check
 try:
@@ -2004,6 +2011,243 @@ except:
   CheckOK(274)
 CheckSimple(274, n, None)
 
+# 277: gd_entry (SARRAY)
+try:
+  ent = d.entry("sarray")
+except:
+  CheckOK(277)
+CheckSimple2(277,1,ent.field_type,pygetdata.SARRAY_ENTRY)
+CheckSimple2(277,2,ent.field_type_name,"SARRAY_ENTRY")
+CheckSimple2(277,3,ent.fragment,0)
+CheckSimple2(277,4,ent.array_len,7)
+
+# 278: gd_get_sarray
+try:
+  n = d.get_sarray("sarray")
+except:
+  CheckOK(278)
+
+CheckSimple(278,n,['one', 'two', 'three', 'four', 'five', 'six', 'seven'])
+
+# 279: gd_get_sarray_slice
+try:
+  n = d.get_sarray("sarray", start=2, len=2)
+except:
+  CheckOK(279)
+
+CheckSimple(279,n,['three', 'four'])
+
+# 280: gd_sarrays
+try:
+  n = d.sarrays()
+except:
+  CheckOK(280)
+
+CheckSimple2(280,1,len(n),1)
+CheckSimple2(280,2,n,[("sarray",
+  ['one', 'two', 'three', 'four', 'five', 'six', 'seven'])])
+
+# 281: gd_put_sarray
+try:
+  d.put_sarray("sarray",
+      ['eka', 'dvi', 'tri', 'catur', 'panca', 'sas', 'sapta'])
+except:
+  CheckOK2(281,1)
+
+try:
+  n = d.get_sarray("sarray")
+except:
+  CheckOK2(281,2)
+
+CheckSimple(281,n,['eka', 'dvi', 'tri', 'catur', 'panca', 'sas', 'sapta'])
+
+# 282: gd_put_sarray_slice
+try:
+  d.put_sarray("sarray", ['asta', 'nava'], start=2)
+except:
+  CheckOK2(282,1)
+
+try:
+  n = d.get_sarray("sarray")
+except:
+  CheckOK2(282,2)
+
+CheckSimple(282,n,['eka', 'dvi', 'asta', 'nava', 'panca', 'sas', 'sapta'])
+
+# 283: gd_add_sarray
+ent = pygetdata.entry(pygetdata.SARRAY_ENTRY, "new283", 0, (2,))
+try:
+  d.add(ent)
+except:
+  CheckOK2(283,1)
+
+try:
+  ent = d.entry("new283")
+except:
+  CheckOK2(283,2)
+CheckSimple2(283,1,ent.field_type,pygetdata.SARRAY_ENTRY)
+CheckSimple2(283,2,ent.field_type_name,"SARRAY_ENTRY")
+CheckSimple2(283,3,ent.fragment,0)
+CheckSimple2(283,4,ent.array_len,2)
+
+# 285: gd_madd_sarray
+ent = pygetdata.entry(pygetdata.SARRAY_ENTRY, "mnew285", 0, {"array_len": 2})
+try:
+  d.madd(ent,"data")
+except:
+  CheckOK2(285,1)
+
+try:
+  ent = d.entry("data/mnew285")
+except:
+  CheckOK2(285,2)
+CheckSimple2(285,1,ent.field_type,pygetdata.SARRAY_ENTRY)
+CheckSimple2(285,2,ent.field_type_name,"SARRAY_ENTRY")
+CheckSimple2(285,3,ent.fragment,0)
+CheckSimple2(285,4,ent.array_len,2)
+
+# 287: gd_msarrays
+try:
+  n = d.msarrays("data")
+except:
+  CheckOK(287)
+
+CheckSimple2(287,1,len(n),2)
+CheckSimple2(287,2,n,[
+  ("msarray", ['eight', 'nine', 'ten', 'eleven', 'twelve']),
+  ("mnew285", ['', ''])])
+
+# 288: entry (indir) check
+try:
+  ent = d.entry("indir")
+except:
+  CheckOK(288)
+CheckSimple2(288,1,ent.field_type,pygetdata.INDIR_ENTRY)
+CheckSimple2(288,2,ent.field_type_name,"INDIR_ENTRY")
+CheckSimple2(288,3,ent.fragment,0)
+CheckSimple2(288,4,ent.in_fields,( "data", "carray"))
+
+# 289: add / entry (indir) check
+ent = pygetdata.entry(pygetdata.INDIR_ENTRY, "new289", 0, ("in1", "in2"))
+try:
+  d.add(ent)
+except:
+  CheckOK2(289,1)
+
+try:
+  ent = d.entry("new289")
+except:
+  CheckOK2(289,2)
+CheckSimple2(289,1,ent.field_type,pygetdata.INDIR_ENTRY)
+CheckSimple2(289,2,ent.fragment,0)
+CheckSimple2(289,3,ent.in_fields,( "in1", "in2"))
+
+# 290: madd / entry (indir) check
+ent = pygetdata.entry(pygetdata.INDIR_ENTRY, "mnew290", 0,
+    {"in_field1": "in3", "in_field2": "in2"})
+try:
+  d.madd(ent,"data")
+except:
+  CheckOK2(290,1)
+
+try:
+  ent = d.entry("data/mnew290")
+except:
+  CheckOK2(290,2)
+CheckSimple2(290,1,ent.field_type,pygetdata.INDIR_ENTRY)
+CheckSimple2(290,2,ent.fragment,0)
+CheckSimple2(290,3,ent.in_fields,( "in3", "in2"))
+
+# 292: entry (sindir) check
+try:
+  ent = d.entry("sindir")
+except:
+  CheckOK(292)
+CheckSimple2(292,1,ent.field_type,pygetdata.SINDIR_ENTRY)
+CheckSimple2(292,2,ent.field_type_name,"SINDIR_ENTRY")
+CheckSimple2(292,3,ent.fragment,0)
+CheckSimple2(292,4,ent.in_fields,( "data", "sarray"))
+
+# 293: add / entry (dindir) check
+ent = pygetdata.entry(pygetdata.SINDIR_ENTRY, "new293", 0, ("in1", "in2"))
+try:
+  d.add(ent)
+except:
+  CheckOK2(293,1)
+
+try:
+  ent = d.entry("new293")
+except:
+  CheckOK2(293,2)
+CheckSimple2(293,1,ent.field_type,pygetdata.SINDIR_ENTRY)
+CheckSimple2(293,2,ent.fragment,0)
+CheckSimple2(293,3,ent.in_fields,( "in1", "in2"))
+
+# 294: madd / entry (sindir) check
+ent = pygetdata.entry(pygetdata.SINDIR_ENTRY, "mnew294", 0,
+    {"in_field1": "in3", "in_field2": "in2"})
+try:
+  d.madd(ent,"data")
+except:
+  CheckOK2(294,1)
+
+try:
+  ent = d.entry("data/mnew294")
+except:
+  CheckOK2(294,2)
+CheckSimple2(294,1,ent.field_type,pygetdata.SINDIR_ENTRY)
+CheckSimple2(294,2,ent.fragment,0)
+CheckSimple2(294,3,ent.in_fields,( "in3", "in2"))
+
+# 296: getstrdata
+try:
+  n = d.getdata("sindir", num_frames=1)
+except:
+  CheckOK(296)
+CheckSimple(296,n,[ "eka", "eka", "eka", "eka", "eka", "eka", "eka", "eka"])
+
+# 302: gd_include_affix check
+try:
+  d.include('format2', 0, namespace='N', flags=pygetdata.CREAT | pygetdata.EXCL)
+except:
+  CheckOK(302)
+
+# 303: get namespace
+try:
+  n = d.fragment(2).namespace
+except:
+  CheckOK(303)
+
+# 304: set namespace
+try:
+  d.fragment(2).namespace = 'S'
+except:
+  CheckOK2(304, 0)
+
+try:
+  n = d.fragment(2).namespace
+except:
+  CheckOK2(304, 1)
+CheckSimple2(304, 2, n, B("S"))
+
+try:
+  del d.fragment(2).namespace
+except:
+  CheckOK2(304, 3)
+
+try:
+  n = d.fragment(2).namespace
+except:
+  CheckOK2(304, 4)
+CheckSimple2(304, 5, n, B(""))
+
+# 305: gd_match_entries
+try:
+  n = d.match_entries(regex='^lin', fragment=0)
+except:
+  CheckOK2(305, 0)
+CheckSimple2(305, 1, n, [ B('lincom'), B('linterp') ])
+
 
 
 
diff --git a/configure b/configure
index b726151..1cc6a66 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GetData 0.9.4.
+# Generated by GNU Autoconf 2.69 for GetData 0.10.0.
 #
 # Report bugs to <getdata-devel at lists.sourceforge.net>.
 #
@@ -598,8 +598,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='GetData'
 PACKAGE_TARNAME='getdata'
-PACKAGE_VERSION='0.9.4'
-PACKAGE_STRING='GetData 0.9.4'
+PACKAGE_VERSION='0.10.0'
+PACKAGE_STRING='GetData 0.10.0'
 PACKAGE_BUGREPORT='getdata-devel at lists.sourceforge.net'
 PACKAGE_URL='http://getdata.sourceforge.net/'
 
@@ -662,6 +662,8 @@ TEST_PYTHON_FALSE
 TEST_PYTHON_TRUE
 USE_MODULES_FALSE
 USE_MODULES_TRUE
+MAKE_UTIL_FALSE
+MAKE_UTIL_TRUE
 MAKE_PHPBINDINGS_FALSE
 MAKE_PHPBINDINGS_TRUE
 MAKE_MATLABBINDINGS_FALSE
@@ -690,6 +692,8 @@ HAVE_SED_FALSE
 HAVE_SED_TRUE
 GETDATA_DEBUG_FALSE
 GETDATA_DEBUG_TRUE
+DEFINE_GD_NO_PCRE
+DEFINE_GD_NO_REGEX
 absolute_docdir
 PRIVATE_LIBS
 USE_ZZIP_FALSE
@@ -934,8 +938,8 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+enable_util
 enable_legacy_api
-enable_assert
 enable_debug
 enable_ansi_c
 enable_large_tests
@@ -1548,7 +1552,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.9.4 to adapt to many kinds of systems.
+\`configure' configures GetData 0.10.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1618,7 +1622,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of GetData 0.9.4:";;
+     short | recursive ) echo "Configuration of GetData 0.10.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1626,8 +1630,9 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-util          don't build or install the utilities in the util/
+                          subdirectory (checkdirfile and dirfile2ascii)
   --enable-legacy-api     include the legacy API wrapper in the library
-  --enable-assert         enable assertions
   --enable-debug          enable debugging messages
   --enable-ansi-c         use ANSI C (C89) work-arounds for C99 code
   --disable-large-tests   don't run tests that write large amounts of
@@ -1643,9 +1648,9 @@ Optional Features:
   --disable-perl          don't build the Perl bindings (GetData)
   --disable-python        don't build the Python bindings (pygetdata)
   --disable-php           don't build the PHP bindings
-  --enable-modules        build external encodings in dynamically loaded
-                          modules instead of directly into the core GetData
-                          library
+  --disable-modules       put support for external encodings directly in the
+                          core GetData library, instead of in dynamically
+                          loaded modules
   --enable-silent-rules   less verbose build output (undo: "make V=1")
   --disable-silent-rules  verbose build output (undo: "make V=0")
   --enable-fast-unaligned use fast loads and stores with non-aligned data.
@@ -1708,7 +1713,9 @@ Optional Packages:
                           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]
+                          module directory. [default: if a --prefix is
+                          specified: PREFIX/lib/perl/<perl_version>,
+                          otherwise: `site']
   --with-php-config=PATH  use PATH as php-config. [default: autodetect]
   --with-php-dir=DIR      install the GetData PHP extension into DIR [default:
                           autodetect]
@@ -1839,7 +1846,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-GetData configure 0.9.4
+GetData configure 0.10.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -3014,7 +3021,7 @@ 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.9.4, which was
+It was created by GetData $as_me 0.10.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3369,10 +3376,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 $as_echo "#define GETDATA_MAJOR 0" >>confdefs.h
 
 
-$as_echo "#define GETDATA_MINOR 9" >>confdefs.h
+$as_echo "#define GETDATA_MINOR 10" >>confdefs.h
 
 
-$as_echo "#define GETDATA_REVISION 4" >>confdefs.h
+$as_echo "#define GETDATA_REVISION 0" >>confdefs.h
 
 
 $as_echo "#define GETDATA_VERSION_SUFFIX \"\"" >>confdefs.h
@@ -3380,13 +3387,13 @@ $as_echo "#define GETDATA_VERSION_SUFFIX \"\"" >>confdefs.h
 
 GETDATA_MAJOR=0
 
-GETDATA_MINOR=9
+GETDATA_MINOR=10
 
-GETDATA_REVISION=4
+GETDATA_REVISION=0
 
 GETDATA_VERSION_SUFFIX=
 
-GETDATA_LIB_VERSION=0.9.4
+GETDATA_LIB_VERSION=0.10.0
 
 
 
@@ -3396,19 +3403,19 @@ GETDATA_LIB_VERSION=0.9.4
 
 
 
-GETDATA_IFACE_VERSION=7
+GETDATA_IFACE_VERSION=8
 
-GETDATA_IMPL_REVISION=4
+GETDATA_IMPL_REVISION=0
 
 GETDATA_IFACE_AGE=0
 
-GETDATAXX_VERSION=6:1:0
+GETDATAXX_VERSION=7:0:0
 
-FGETDATA_VERSION=5:0:0
+FGETDATA_VERSION=6:0:0
 
-F95GETDATA_VERSION=6:0:0
+F95GETDATA_VERSION=7:0:0
 
-MATLABGETDATA_VERSION=1:1:1
+MATLABGETDATA_VERSION=2:0:2
 
 
 
@@ -3525,6 +3532,26 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build the utilities" >&5
+$as_echo_n "checking whether to build the utilities... " >&6; }
+# Check whether --enable-util was given.
+if test "${enable_util+set}" = set; then :
+  enableval=$enable_util;
+               if test "x${enableval}" = "xno"; then
+                 make_util=no
+               else
+                 make_util=yes
+               fi
+
+else
+   make_util=yes
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $make_util" >&5
+$as_echo "$make_util" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include the legacy API" >&5
+$as_echo_n "checking whether to include the legacy API... " >&6; }
 # Check whether --enable-legacy-api was given.
 if test "${enable_legacy_api+set}" = set; then :
   enableval=$enable_legacy_api;
@@ -3537,8 +3564,6 @@ else
    include_legacy_api="no"
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include the legacy API" >&5
-$as_echo_n "checking whether to include the legacy API... " >&6; }
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $include_legacy_api" >&5
 $as_echo "$include_legacy_api" >&6; }
 
@@ -3549,18 +3574,6 @@ else
 fi
 
 
-# Check whether --enable-assert was given.
-if test "${enable_assert+set}" = set; then :
-  enableval=$enable_assert;
-               case "${enableval}" in
-                 yes) enable_assert="yes" ;;
-                 *) enable_assert="no" ;;
-               esac
-
-else
-   enable_assert="no"
-fi
-
 # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then :
   enableval=$enable_debug;
@@ -3582,23 +3595,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
-$as_echo "$enable_assert" >&6; }
-if test "x$enable_assert" = "xno"; then
-
-$as_echo "#define NDEBUG 1" >>confdefs.h
-
-fi
-
 # Check whether --enable-ansi-c was given.
 if test "${enable_ansi_c+set}" = set; then :
   enableval=$enable_ansi_c;
@@ -3805,7 +3807,7 @@ if test "${enable_modules+set}" = set; then :
                 esac
 
 else
-   use_modules="no"
+   use_modules="yes"
 fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable getdata modules" >&5
@@ -4350,7 +4352,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='getdata'
- VERSION='0.9.4'
+ VERSION='0.10.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4817,9 +4819,9 @@ _ACEOF
 fi
 
 
-DEFINE_GD_GETDATA_VERSION="#define GD_GETDATA_VERSION \"0.9.4\""
+DEFINE_GD_GETDATA_VERSION="#define GD_GETDATA_VERSION \"0.10.0\""
 
-DEFINE_GD_GETDATA_INT_VERSION="#define GD_GETDATA_INT_VERSION `${PRINTF} %i%02i 9 4`"
+DEFINE_GD_GETDATA_INT_VERSION="#define GD_GETDATA_INT_VERSION `${PRINTF} %i%02i 10 0`"
 
 echo
 echo "*** Checking host environment"
@@ -26176,7 +26178,7 @@ Usage: $0 [OPTIONS]
 Report bugs to <bug-libtool at gnu.org>."
 
 lt_cl_version="\
-GetData config.lt 0.9.4
+GetData config.lt 0.10.0
 configured by $0, generated by GNU Autoconf 2.69.
 
 Copyright (C) 2011 Free Software Foundation, Inc.
@@ -27857,7 +27859,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 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-ltdl=PREFIX or else disable the building of modules by using --disable-modules." "$LINENO" 5
   fi
 
   if test "x$ltdl_prefix" != "x"; then
@@ -29262,15 +29264,144 @@ if test "$ac_res" != no; then :
 
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing regcomp" >&5
+$as_echo_n "checking for library containing regcomp... " >&6; }
+if ${ac_cv_search_regcomp+:} 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 regcomp ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return regcomp ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' regex; 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_regcomp=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_regcomp+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_regcomp+:} false; then :
+
+else
+  ac_cv_search_regcomp=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_regcomp" >&5
+$as_echo "$ac_cv_search_regcomp" >&6; }
+ac_res=$ac_cv_search_regcomp
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pcre_compile" >&5
+$as_echo_n "checking for library containing pcre_compile... " >&6; }
+if ${ac_cv_search_pcre_compile+:} 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 pcre_compile ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return pcre_compile ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' pcre; 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_pcre_compile=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_pcre_compile+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_pcre_compile+:} false; then :
+
+else
+  ac_cv_search_pcre_compile=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pcre_compile" >&5
+$as_echo "$ac_cv_search_pcre_compile" >&6; }
+ac_res=$ac_cv_search_pcre_compile
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
 
 echo
 echo "*** Looking for additional header files"
 echo
 for ac_header in asm/unaligned.h Availability.h byteswap.h crtdefs.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/resource.h sys/stat.h sys/time.h \
-                  sys/types.h sys/wait.h unistd.h
+                  features.h fcntl.h float.h inttypes.h io.h libgen.h \
+                  libkern/OSByteOrder.h math.h pcre.h regex.h signal.h \
+                  stddef.h stdint.h sys/endian.h sys/file.h sys/param.h \
+                  sys/resource.h sys/stat.h sys/time.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"
@@ -30714,14 +30845,15 @@ DEFINE_gd_uint64_t="# define gd_uint64_t $gd_uint64_t";
 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 setrlimit \
-                snprintf _snprintf stat64 _stat64 _strtoi64 strtoll strtoq \
-                _strtoui64 strtoull strtouq symlink _unlink unlinkat _write
+for ac_func in basename _chsize _chsize_s _commit dup2 fchmod _fdopen \
+                fdopendir _finite fpathconf fseeko fseeko64 _fstat fstat64 \
+                _fstat64 fstatat fstatat64 fsync ftello ftello64 ftruncate \
+                ftruncate64 getcwd _getcwd getdelim gmtime_r kill isnan _isnan \
+                lseek64 _lseeki64 lstat lstat64 _mkdir nan _open openat \
+                pathconf pcre_compile pipe _read readdir_r readlink regcomp \
+                renameat _rmdir setrlimit 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"
@@ -31996,7 +32128,6 @@ $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*$//"`
 
 
@@ -32062,7 +32193,6 @@ do
 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*$//"`
 
 
@@ -32131,12 +32261,10 @@ $as_echo "$PERL" >&6; }
 $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
 
 
@@ -32150,7 +32278,7 @@ if test "${with_perl_dir+set}" = set; then :
     esac
 
 else
-   perl_inst_type="site"
+   perl_inst_type="auto"
 fi
 
 
@@ -32195,23 +32323,32 @@ if test "$HAVE_Math__Complex$HAVE_ExtUtils__MakeMaker" != "yesyes"; then
 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 = "auto"; then
+    if test $prefix = "NONE" -a $exec_prefix = "NONE"; then
+      perl_inst_type=site
+    elif test $prefix = "NONE"; then
+      perl_inst_type=local
+      local_perl_path="\${exec_prefix}/lib/perl/$PERL_VERSION"
+    else
+      perl_inst_type=local
+      local_perl_path="\${prefix}/lib/perl/$PERL_VERSION"
+    fi
+  fi
+
   if test $perl_inst_type = "vendor"; then
 
 perl_int=$PERL
-# 3=
 perlprefix=`$perl_int -V::vendorprefix: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
 
 
 perl_int=$PERL
-# 3=
 prefixed_perldir=`$perl_int -V::vendorarchexp: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
 
 
 perl_int=$PERL
-# 3=
 prefixed_perlmandir=`$perl_int -V::vendorman3direxp: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
 
     if test perldir = "UNKNOWN"; then
@@ -32222,17 +32359,14 @@ prefixed_perlmandir=`$perl_int -V::vendorman3direxp: | sed -e "s/'//g" | sed -e
   if test $perl_inst_type = "site"; then
 
 perl_int=$PERL
-# 3=
 perlprefix=`$perl_int -V::siteprefix: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
 
 
 perl_int=$PERL
-# 3=
 prefixed_perldir=`$perl_int -V::sitearchexp: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
 
 
 perl_int=$PERL
-# 3=
 prefixed_perlmandir=`$perl_int -V::siteman3direxp: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
 
   fi
@@ -34645,6 +34779,26 @@ EOF
 absolute_docdir=`$SHELL conftest.sh`
 
 
+if test "x$ac_cv_func_regcomp$ac_cv_header_regex_h" = "xyesyes"; then
+  regices=" posix"
+  DEFINE_GD_NO_REGEX="/* #undef GD_NO_REGEX */"
+else
+  DEFINE_GD_NO_REGEX="#define GD_NO_REGEX"
+fi
+
+
+if test "x$ac_cv_func_pcre_compile$ac_cv_header_pcre_h" = "xyesyes"; then
+  regices="${regices} pcre"
+  DEFINE_GD_NO_PCRE="/* #undef GD_NO_PCRE */"
+else
+  DEFINE_GD_NO_PCRE="#define GD_NO_PCRE"
+fi
+
+
+if test "x$regices" = "x"; then
+  regices = " none"
+fi
+
 echo
 echo "*** Writing configure output"
 echo
@@ -34692,11 +34846,11 @@ ac_config_files="$ac_config_files doc/Makefile"
 
 ac_config_files="$ac_config_files man/Makefile"
 
-ac_config_files="$ac_config_files man/gd_alter_encoding.3"
+ac_config_files="$ac_config_files man/gd_alter_encoding.3in"
 
-ac_config_files="$ac_config_files man/gd_alter_endianness.3"
+ac_config_files="$ac_config_files man/gd_alter_endianness.3in"
 
-ac_config_files="$ac_config_files man/gd_alter_frameoffset.3"
+ac_config_files="$ac_config_files man/gd_alter_frameoffset.3in"
 
 ac_config_files="$ac_config_files src/Makefile"
 
@@ -34823,6 +34977,14 @@ else
   MAKE_PHPBINDINGS_FALSE=
 fi
 
+ if test "x$make_util" = "xyes"; then
+  MAKE_UTIL_TRUE=
+  MAKE_UTIL_FALSE='#'
+else
+  MAKE_UTIL_TRUE='#'
+  MAKE_UTIL_FALSE=
+fi
+
  if test "x$use_modules" != "xno"; then
   USE_MODULES_TRUE=
   USE_MODULES_FALSE='#'
@@ -35126,6 +35288,10 @@ if test -z "${MAKE_PHPBINDINGS_TRUE}" && test -z "${MAKE_PHPBINDINGS_FALSE}"; th
   as_fn_error $? "conditional \"MAKE_PHPBINDINGS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${MAKE_UTIL_TRUE}" && test -z "${MAKE_UTIL_FALSE}"; then
+  as_fn_error $? "conditional \"MAKE_UTIL\" 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
@@ -35559,7 +35725,7 @@ 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.9.4, which was
+This file was extended by GetData $as_me 0.10.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -35626,7 +35792,7 @@ _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.9.4
+GetData config.status 0.10.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -36334,9 +36500,9 @@ do
     "bindings/python/test/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/python/test/Makefile" ;;
     "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
     "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
-    "man/gd_alter_encoding.3") CONFIG_FILES="$CONFIG_FILES man/gd_alter_encoding.3" ;;
-    "man/gd_alter_endianness.3") CONFIG_FILES="$CONFIG_FILES man/gd_alter_endianness.3" ;;
-    "man/gd_alter_frameoffset.3") CONFIG_FILES="$CONFIG_FILES man/gd_alter_frameoffset.3" ;;
+    "man/gd_alter_encoding.3in") CONFIG_FILES="$CONFIG_FILES man/gd_alter_encoding.3in" ;;
+    "man/gd_alter_endianness.3in") CONFIG_FILES="$CONFIG_FILES man/gd_alter_endianness.3in" ;;
+    "man/gd_alter_frameoffset.3in") CONFIG_FILES="$CONFIG_FILES man/gd_alter_frameoffset.3in" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "src/getdata.h.in2") CONFIG_FILES="$CONFIG_FILES src/getdata.h.in2:src/getdata.h.in" ;;
     "src/getdata.h") CONFIG_HEADERS="$CONFIG_HEADERS src/getdata.h:src/getdata.h.in2" ;;
@@ -38151,10 +38317,6 @@ if test "x$ENCODINGS_LEFT" = "x"; then
   ENCODINGS_LEFT=" none"
 fi
 
-if test "x$enable_debug$enable_assert" = "xnoyes"; then
-  enable_debug="assert only"
-fi
-
 echo
 echo "Configuration summary: "
 echo "  Build platform:                ${build}"
@@ -38165,6 +38327,7 @@ 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 "  Regular expression support:   ${regices}"
 echo "  Use modules:                   ${use_modules}"
 if test "x${use_modules}" != "xno"; then
   echo "  Thread-safe dynamic loading:   ${use_pthread}"
diff --git a/configure.ac b/configure.ac
index 0d8c055..227b57a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,8 +80,23 @@ dnl Build/Host triplets
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
+dnl Utils
+AC_MSG_CHECKING([whether to build the utilities])
+AC_ARG_ENABLE([util], AS_HELP_STRING([--disable-util],
+              [don't build or install the utilities in the util/ ] dnl'
+              [subdirectory (checkdirfile and dirfile2ascii)]),
+              [
+               if test "x${enableval}" = "xno"; then
+                 make_util=no
+               else
+                 make_util=yes
+               fi
+               ], [ make_util=yes ])
+AC_MSG_RESULT([$make_util])
+
 dnl Legacy API
-AC_ARG_ENABLE(legacy-api, AS_HELP_STRING([--enable-legacy-api],
+AC_MSG_CHECKING([whether to include the legacy API])
+AC_ARG_ENABLE([legacy-api], AS_HELP_STRING([--enable-legacy-api],
               [include the legacy API wrapper in the library]), dnl'
               [
                case "${enableval}" in
@@ -89,7 +104,6 @@ AC_ARG_ENABLE(legacy-api, AS_HELP_STRING([--enable-legacy-api],
                  *) include_legacy_api="yes" ;;
                esac
               ], [ include_legacy_api="no" ])
-AC_MSG_CHECKING([whether to include the legacy API])
 AC_MSG_RESULT([$include_legacy_api])
 
 if test "x$include_legacy_api" != "xno"; then
@@ -100,15 +114,7 @@ fi
 AC_SUBST([DEFINE_GD_LEGACY_API])
 
 dnl debugging
-AC_ARG_ENABLE(assert, AS_HELP_STRING([--enable-assert],
-              [enable assertions]),
-              [
-               case "${enableval}" in
-                 yes) enable_assert="yes" ;;
-                 *) enable_assert="no" ;;
-               esac
-              ], [ enable_assert="no" ])
-AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
+AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],
               [enable debugging messages]),
               [
                case "${enableval}" in
@@ -122,21 +128,14 @@ AC_MSG_RESULT([$enable_debug])
 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])
-if test "x$enable_assert" = "xno"; then
-  AC_DEFINE(NDEBUG, 1, [ Define to disable assertions ])
-fi
-
 dnl C99 stuff
-AC_ARG_ENABLE(ansi-c, AS_HELP_STRING([--enable-ansi-c],
+AC_ARG_ENABLE([ansi-c], AS_HELP_STRING([--enable-ansi-c],
               [use ANSI C (C89) work-arounds for C99 code]),
               [
                if test "x${enableval}" != "xno"; then
@@ -174,8 +173,8 @@ make_idlbindings="yes"
 make_perlbindings="yes"
 make_matlabbindings="yes"
 make_phpbindings="yes"
-AC_ARG_ENABLE(bindings, AS_HELP_STRING([--disable-bindings],
-              [don't build any bindings; just build the C library]),
+AC_ARG_ENABLE([bindings], AS_HELP_STRING([--disable-bindings],
+              [don't build any bindings; just build the C library]), dnl'
               [
                if test "x${enableval}" = "xno"; then
                  make_cxxbindings="no"
@@ -189,8 +188,8 @@ AC_ARG_ENABLE(bindings, AS_HELP_STRING([--disable-bindings],
               ])
 
 dnl C++ bindings
-AC_ARG_ENABLE(cplusplus, AS_HELP_STRING([--disable-cplusplus],
-              [don't build the C++ bindings (libgetdata++)]),
+AC_ARG_ENABLE([cplusplus], AS_HELP_STRING([--disable-cplusplus],
+              [don't build the C++ bindings (libgetdata++)]), dnl'
               [
                case "${enableval}" in
                  no) make_cxxbindings="no" ;;
@@ -201,7 +200,7 @@ AC_MSG_CHECKING([whether to include the C++ bindings])
 AC_MSG_RESULT([$make_cxxbindings])
 
 dnl Fortran 77 bindings
-AC_ARG_ENABLE(fortran, AS_HELP_STRING([--disable-fortran],
+AC_ARG_ENABLE([fortran], AS_HELP_STRING([--disable-fortran],
               [don't build the Fortran 77 bindings (libfgetdata) nor ]dnl'
               [the Fortran 95 bindings (libf95getdata)]),
               [
@@ -212,7 +211,7 @@ AC_ARG_ENABLE(fortran, AS_HELP_STRING([--disable-fortran],
               ])
 
 dnl Fortran 95 bindings
-AC_ARG_ENABLE(fortran95, AS_HELP_STRING([--disable-fortran95],
+AC_ARG_ENABLE([fortran95], AS_HELP_STRING([--disable-fortran95],
               [don't build the Fortran 95 bindings (libf95getdata)]),dnl'
               [
                case "${enableval}" in
@@ -232,7 +231,7 @@ AC_MSG_CHECKING([whether to include the Fortran 77 bindings])
 AC_MSG_RESULT([$make_f77bindings])
 
 dnl IDL bindings
-AC_ARG_ENABLE(idl, AS_HELP_STRING([--disable-idl],
+AC_ARG_ENABLE([idl], AS_HELP_STRING([--disable-idl],
               [don't build the Interactive Data Language (IDL) bindings ]dnl'
               [(IDL_GetData)]),
               [
@@ -246,7 +245,7 @@ AC_MSG_CHECKING([whether to include the IDL bindings])
 AC_MSG_RESULT([$make_idlbindings])
 
 dnl MATLAB bindings
-AC_ARG_ENABLE(matlab, AS_HELP_STRING([--disable-matlab],
+AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab],
               [don't build the MATLAB bindings]),dnl'
               [
                case "${enableval}" in
@@ -259,7 +258,7 @@ AC_MSG_CHECKING([whether to include the MATLAB bindings])
 AC_MSG_RESULT([$make_matlabbindings])
 
 dnl Perl bindings
-AC_ARG_ENABLE(perl, AS_HELP_STRING([--disable-perl],
+AC_ARG_ENABLE([perl], AS_HELP_STRING([--disable-perl],
               [don't build the Perl bindings (GetData)]),dnl'
               [
                case "${enableval}" in
@@ -272,7 +271,7 @@ AC_MSG_CHECKING([whether to include the Perl bindings])
 AC_MSG_RESULT([$make_perlbindings])
 
 dnl Python bindings
-AC_ARG_ENABLE(python, AS_HELP_STRING([--disable-python],
+AC_ARG_ENABLE([python], AS_HELP_STRING([--disable-python],
               [don't build the Python bindings (pygetdata)]),dnl'
               [
                case "${enableval}" in
@@ -285,7 +284,7 @@ AC_MSG_CHECKING([whether to include the Python bindings])
 AC_MSG_RESULT([$make_pybindings])
 
 dnl PHP bindings
-AC_ARG_ENABLE(php, AS_HELP_STRING([--disable-php],
+AC_ARG_ENABLE([php], AS_HELP_STRING([--disable-php],
               [don't build the PHP bindings]),dnl'
               [
                case "${enableval}" in
@@ -298,15 +297,15 @@ AC_MSG_CHECKING([whether to include the PHP bindings])
 AC_MSG_RESULT([$make_phpbindings])
 
 dnl Modules
-AC_ARG_ENABLE(modules, AS_HELP_STRING([--enable-modules],
-              [build external encodings in dynamically loaded modules instead
-               of directly into the core GetData library]),
+AC_ARG_ENABLE([modules], AS_HELP_STRING([--disable-modules],
+              [put support for external encodings directly in the core GetData
+               library, instead of in dynamically loaded modules]),
                [
                 case "${enableval}" in
                   no) use_modules="no" ;;
                   *) use_modules="yes" ;;
                 esac
-                ], [ use_modules="no" ])
+                ], [ use_modules="yes" ])
 AC_MSG_CHECKING([whether to enable getdata modules])
 AC_MSG_RESULT([$use_modules])
 if test "x$use_modules" != "xno"; then
@@ -570,7 +569,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 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-ltdl=PREFIX or else disable the building of modules by using --disable-modules.])
   fi
 
   if test "x$ltdl_prefix" != "x"; then
@@ -671,16 +670,19 @@ echo
 echo "*** Looking for additional libraries"
 echo
 AC_SEARCH_LIBS([ceil],[m])
+AC_SEARCH_LIBS([regcomp],[regex])
+AC_SEARCH_LIBS([pcre_compile],[pcre])
 
 dnl headers
 echo
 echo "*** Looking for additional header files"
 echo
 AC_CHECK_HEADERS([asm/unaligned.h Availability.h byteswap.h crtdefs.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/resource.h sys/stat.h sys/time.h \
-                  sys/types.h sys/wait.h unistd.h])
+                  features.h fcntl.h float.h inttypes.h io.h libgen.h \
+                  libkern/OSByteOrder.h math.h pcre.h regex.h signal.h \
+                  stddef.h stdint.h sys/endian.h sys/file.h sys/param.h \
+                  sys/resource.h sys/stat.h sys/time.h sys/types.h sys/wait.h \
+                  unistd.h])
 if test "x$disable_c99" = "xno"; then
 AC_CHECK_HEADERS([complex.h])
 fi
@@ -797,14 +799,15 @@ 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 setrlimit \
-                snprintf _snprintf stat64 _stat64 _strtoi64 strtoll strtoq \
-                _strtoui64 strtoull strtouq symlink _unlink unlinkat _write])
+AC_CHECK_FUNCS([basename _chsize _chsize_s _commit dup2 fchmod _fdopen \
+                fdopendir _finite fpathconf fseeko fseeko64 _fstat fstat64 \
+                _fstat64 fstatat fstatat64 fsync ftello ftello64 ftruncate \
+                ftruncate64 getcwd _getcwd getdelim gmtime_r kill isnan _isnan \
+                lseek64 _lseeki64 lstat lstat64 _mkdir nan _open openat \
+                pathconf pcre_compile pipe _read readdir_r readlink regcomp \
+                renameat _rmdir setrlimit 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
@@ -1008,7 +1011,7 @@ GD_CHECK_ENCODING([slim],[slim],[slimopen],[slimlib.h], [slimdata slim],
 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],
+AC_ARG_ENABLE([zzslim], AS_HELP_STRING([--enable-zzslim],
               [skip probing for zzslim required features and enable the zzslim
                encoding.  Note: zzslim encoding support requires both slim and
                zzip encoding support.  [default: autodetect]]),
@@ -1108,6 +1111,27 @@ EOF
 absolute_docdir=`$SHELL conftest.sh`
 AC_SUBST([absolute_docdir])
 
+dnl Figure out regex support
+if test "x$ac_cv_func_regcomp$ac_cv_header_regex_h" = "xyesyes"; then
+  regices=" posix"
+  DEFINE_GD_NO_REGEX="/* #undef GD_NO_REGEX */"
+else
+  DEFINE_GD_NO_REGEX="#define GD_NO_REGEX"
+fi
+AC_SUBST([DEFINE_GD_NO_REGEX])
+
+if test "x$ac_cv_func_pcre_compile$ac_cv_header_pcre_h" = "xyesyes"; then
+  regices="${regices} pcre"
+  DEFINE_GD_NO_PCRE="/* #undef GD_NO_PCRE */"
+else
+  DEFINE_GD_NO_PCRE="#define GD_NO_PCRE"
+fi
+AC_SUBST([DEFINE_GD_NO_PCRE])
+
+if test "x$regices" = "x"; then
+  regices = " none"
+fi
+
 dnl output
 echo
 echo "*** Writing configure output"
@@ -1134,9 +1158,9 @@ AC_CONFIG_FILES([bindings/python/setup.py])
 AC_CONFIG_FILES([bindings/python/test/Makefile])
 AC_CONFIG_FILES([doc/Makefile])
 AC_CONFIG_FILES([man/Makefile])
-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([man/gd_alter_encoding.3in])
+AC_CONFIG_FILES([man/gd_alter_endianness.3in])
+AC_CONFIG_FILES([man/gd_alter_frameoffset.3in])
 AC_CONFIG_FILES([src/Makefile])
 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.
@@ -1163,6 +1187,7 @@ 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(MAKE_PHPBINDINGS, [test "x$make_phpbindings" = "xyes"])
+AM_CONDITIONAL(MAKE_UTIL, [test "x$make_util" = "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"])
@@ -1245,10 +1270,6 @@ if test "x$ENCODINGS_LEFT" = "x"; then
   ENCODINGS_LEFT=" none"
 fi
 
-if test "x$enable_debug$enable_assert" = "xnoyes"; then
-  enable_debug="assert only"
-fi
-
 echo
 echo "Configuration summary: "
 echo "  Build platform:                ${build}"
@@ -1259,6 +1280,8 @@ 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}"
+dnl ${regices} contains a leading space
+echo "  Regular expression support:   ${regices}"
 echo "  Use modules:                   ${use_modules}"
 if test "x${use_modules}" != "xno"; then
   echo "  Thread-safe dynamic loading:   ${use_pthread}"
diff --git a/doc/Makefile.in b/doc/Makefile.in
index fee1d53..0df41aa 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -192,6 +192,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/doc/README.cxx b/doc/README.cxx
index 56996d2..7f1531e 100644
--- a/doc/README.cxx
+++ b/doc/README.cxx
@@ -261,6 +261,9 @@ are available:
     const char* target)
 * int Dirfile::MAddSpec(const char *spec, const char *parent)
 * int Dirfile::MAlterSpec(const char *line, const char *parent)
+* unsigned int MatchEntries(const char *regex = NULL,
+    int fragment = GD_ALL_FRAGMENTS, int type = 0, unsigned int flags = 0,
+    const char ***entries = NULL);
 * const gd_carray_t *Dirfile::MCarrays(GetData::DataType type = Float64)
 * const void *Dirfile::MConstants(const char *parent, GetData::DataType type)
 * int Dirfile::MetaFlush()
@@ -290,7 +293,7 @@ are available:
 * size_t Dirfile::PutData(const char *field_code, off_t first_frame,
     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 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,
diff --git a/doc/README.f77 b/doc/README.f77
index fd3a8ca..c4f7095 100644
--- a/doc/README.f77
+++ b/doc/README.f77
@@ -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
-are not be available in the Fortran 77 bindings.
+is 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
@@ -359,10 +359,8 @@ Subroutines interacting with data
   should contain the string length of the field_code).  The data_type parameter
   should be one of the parameters defined in getdata.f.
 
-* GDPTST(size, dirfile_unit, field_code, field_code_len, len, data_out)
+* GDPTST(dirfile_unit, field_code, field_code_len, len, data_out)
 
-  Output:
-    INTEGER size
   Input:
     INTEGER dirfile_unit, field_code_len, len
     CHARACTER*<field_code_len> field_code
@@ -370,8 +368,7 @@ Subroutines interacting with data
 
   This wraps gd_put_string(3), with the same input arguments (field_code_len
   should contain the string length of the field_code, and len should contain the
-  string length of data_in).  The number of characters actually written is
-  returned in size.
+  string length of data_in).
 
 * GDVLDT(invalid, dirfile_unit, field_code, field_code_len)
 
@@ -445,6 +442,19 @@ Subroutines interacting with data
 Subroutines interacting with global metadata
 --------------------------------------------
 
+* GDNMAT(nentries, dirfile_unit, regex, regex_len, fragment, type, flags)
+
+  Output:
+    INTEGER nentries
+  Input:
+    INTEGER dirfile_unit, regex_len, type, flags
+    CHARACTER*<regex_len> regex
+
+  This wraps gd_match_entries(3).  It returns the number of entries in the
+  dirfile satisfying the supplied criteria.  If regex_len is zero, regex itself
+  is ignored.  To access the matched field names themselves, use GDMATN (see
+  below).
+
 * GDNENT(nentries dirfile_unit, parent, parent_len, type, flags)
 
   Output:
@@ -480,6 +490,19 @@ Subroutines interacting with global metadata
   This wraps gd_naliases(3).  It returns the number of aliases of field_code
   (including field_code itself).
 
+* GDMATX(entry_max, dirfile_unit, regex, regex_len, fragment, type, flags)
+
+  Output:
+    INTEGER entry_max
+  Input:
+    INTEGER dirfile_unit, regex_len, fragment, type, flags
+    CHARACTER*<regex_len> regex
+
+  This subroutine, which has no direct analogue in the C API, returns in
+  entry_max the length (in characters) of the longest entry name in the
+  dirfile in which satisfies the given criteria.  If regex_len is zero,
+  regex itself is ignored.  See gd_match_entries(3).
+
 * GDENTX(entry_max, dirfile_unit, parent, parent_len, type, flags)
 
   Output:
@@ -488,10 +511,9 @@ Subroutines interacting with global metadata
     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 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,
+  This subroutine, which has no direct analogue in the C API, returns in
+  entry_max the length (in characters) of the longest entry name in the
+  dirfile in 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.
  
@@ -501,6 +523,25 @@ Subroutines interacting with global metadata
   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.
  
+* GDMATN(name, name_len, dirfile_unit, regex, regex_len, fragment, type,
+  flags, entry_num)
+
+  Output:
+    CHARACTER*<name_len> name
+  Input/Output:
+    INTEGER name_len
+  Input:
+    INTEGER dirfile_unit, regex_len, fragment, type, flags, entry_num
+    CHARACTER*<regex_len> regex
+
+  This subroutine is the replacement for gd_match_entries(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 GDNMAT).
+  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
+  entry_num is out of range, name_len will be set to zero, and name will not be
+  modified.
+
 * GDENTN(name, name_len, dirfile_unit, parent, parent_len, type, flags,
   entry_num)
 
diff --git a/doc/README.f95 b/doc/README.f95
index cb1193f..08d443e 100644
--- a/doc/README.f95
+++ b/doc/README.f95
@@ -56,8 +56,7 @@ 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 function fgd_desync (dirfile_unit, flags)
   integer, intent(in) :: dirfile, flags
 
 * subroutine fgd_discard (dirfile_unit)
@@ -92,11 +91,9 @@ 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 function fgd_nentries (dirfile, parent, entype, flags)
   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
@@ -144,7 +141,7 @@ unit numbers in place of C's DIRFILE pointers are:
   character (len=*), intent(in) :: field_code
   character (len=*), intent(out) :: data_out
 
-* integer function fgd_put_string (dirfile, field_code, data_in)
+* subroutine fgd_put_string (dirfile, field_code, data_in)
   integer, intent(in) :: dirfile
   character (len=*), intent(in) :: field_code, data_in
 
@@ -747,11 +744,17 @@ 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 function fgd_match_entries_max (dirfile, regex, fragment, entype, flags)
+  integer, intent(in) :: dirfile, fragment, entype, flags
+  character (len=*), intent(in) :: regex
+
+  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_match_entries.
+
+* integer function fgd_entry_name_max (dirfile, parent, entype, flags)
   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
@@ -790,13 +793,26 @@ function fgd_entry_name_max (dirfile, parent, entype, flags)
   This function returns the length of the longest alias for the given
   field_code.
 
+* integer function fgd_match_entries (entry_list, dirfile, regex, fragment,
+  entype, flags, entry_len)
+  character(len=*), dimension(:), intent(out) :: entry_list
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: regex
+  integer, intent(inout) :: entry_len
+
+  This function behave analogously to gd_match_entries(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_match_entries_max) and entry_list
+  will remain untouched.
+
 * 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
diff --git a/doc/README.idl b/doc/README.idl
index 26d31b4..f06c161 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.8.0, Build Date: Thu Apr 12 00:00:00 UTC 2012, Source: The GetData Project <getdata-devel at lists.sourceforge.net>
+      Version: 0.10.0, Build Date: Tue Jan 25 00:00:00 PST 2017, 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
@@ -595,18 +595,6 @@ 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'.
@@ -758,6 +746,31 @@ FUNCTION GD_INVALID_DIRFILE()
   This functions returns a dirfile unit number corresponding to a newly created
   invalid dirfile.  See gd_invalid_dirfile(3).
 
+FUNCTION GD_MATCH_ENTRIES(dirfile_unit, /ALIASES, /CASELESS, /EXTENDED,
+    FRAGMENT=fragment, /HIDDEN, /ICASE, /JAVASCRIPT, /NOALIAS, PARENT=parent,
+    /PCRE, REGEX=regex, /SCALARS, TYPE=type, /UNICODE, /VECTORS)
+
+  This function returns a list of entry names defined by the dirfile which
+  satisfy the provided criteria.  Not all criteria may be used at the same time:
+  if PARENT is given, then neither REGEX nor FRAGMENT may be supplied.
+
+  The flags /CASELESS, /EXTENDED, /ICASE, /JAVASCRIPT, /PCRE, and /UNICODE affect
+  the interpretation of REGEX.  If REGEX is not given, these flags are ignored.
+
+  If REGEX is given, it is a regular expression which is matched against entry
+  names.  If FRAGMENT is given, matching will be restricted to the entries
+  defined in that fragment.  Otherwise, if PARENT is given, a list of metafields
+  for the given parent will be returned otherwise top-level fields are considered.
+
+  In both cases, 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) and gd_match_entries(3).
+
+  This function may also be called as GD_ENTRY_LIST without change in parameters
+  or behaviour.
+
 PROCEDURE GD_METAFLUSH, dirfile_unit
 
   This procedure flushes pending metadata changes to the dirfile to disk.  See
diff --git a/doc/README.python b/doc/README.python
index 5a56fe8..ba16f94 100644
--- a/doc/README.python
+++ b/doc/README.python
@@ -3,8 +3,9 @@ PYTHON BINDINGS FOR GETDATA
 
 The python bindings consist of a python extension module, pygetdata.  They
 should work with:
-* Python2: version 2.4, or later
-* Python3: version 3.2, or later
+
+  * Python2: version 2.4, or later
+  * Python3: version 3.2, or later
 
 Numerical Python (NumPy) is required to build and use the bindings.  By default,
 data returned from the bindings will be returned in NumPy arrays, but the
diff --git a/m4/perl.m4 b/m4/perl.m4
index 7f6d681..a2d2153 100644
--- a/m4/perl.m4
+++ b/m4/perl.m4
@@ -25,7 +25,6 @@ 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]*$//"`
 ])
 
@@ -130,21 +129,21 @@ if test "x${have_perl}" != "xno"; then
   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] ]),
+site-specific module directory.  [default: if a --prefix is specified:
+PREFIX/lib/perl/<perl_version>, otherwise: `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" ])
+    ], [ perl_inst_type="auto" ])
 
 if test "x${have_perl}" != "xno"; then
   GD_PERL_CHECK_MODULE([ExtUtils::MakeMaker])
@@ -157,9 +156,22 @@ if test "$HAVE_Math__Complex$HAVE_ExtUtils__MakeMaker" != "yesyes"; then
 fi
 
 if test "x${have_perl}" != "xno"; then
-
   dnl calculate the extension module directory
   AC_MSG_CHECKING([Perl module directory])
+
+  dnl sensible defaults
+  if test $perl_inst_type = "auto"; then
+    if test $prefix = "NONE" -a $exec_prefix = "NONE"; then
+      perl_inst_type=site
+    elif test $prefix = "NONE"; then
+      perl_inst_type=local
+      local_perl_path="\${exec_prefix}/lib/perl/$PERL_VERSION"
+    else
+      perl_inst_type=local
+      local_perl_path="\${prefix}/lib/perl/$PERL_VERSION"
+    fi
+  fi
+
   if test $perl_inst_type = "vendor"; then
     GD_PERL_CONFIG([perlprefix], [vendorprefix])
     GD_PERL_CONFIG([prefixed_perldir], [vendorarchexp])
diff --git a/m4/version.m4 b/m4/version.m4
index 42a1ba7..93d31b4 100644
--- a/m4/version.m4
+++ b/m4/version.m4
@@ -1,4 +1,4 @@
-dnl Copyright (C) 2011-2016 D. V. Wiebe
+dnl Copyright (C) 2011-2017 D. V. Wiebe
 dnl
 dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
 dnl
@@ -19,8 +19,8 @@ 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,    9)
-m4_define(getdata_revision, 4)
+m4_define(getdata_minor,    10)
+m4_define(getdata_revision, 0)
 m4_define(getdata_extra,    [])
 m4_define(getdata_pkg_extra,[])
 m4_define(getdata_version,
@@ -29,20 +29,22 @@ m4_define(getdata_pkg_version,
           getdata_version[]getdata_pkg_extra)
 
 dnl libgetdata current interface version
-m4_define(getdata_iface_version,    7)
+m4_define(getdata_iface_version,    8)
 dnl libgetdata current interface implementation revision
-m4_define(getdata_impl_revision,    4)
+m4_define(getdata_impl_revision,    0)
 dnl libgetdata interface age (current interface - oldest supported interface)
 m4_define(getdata_iface_age,        0)
 
+dnl The rest of these are all CURRENT:REVISION:AGE
+
 dnl libgetdata++ interface version info
-m4_define(getdataxx_version, 6:1:0)
+m4_define(getdataxx_version, 7:0:0)
 
 dnl libfgetdata interface version info
-m4_define(fgetdata_version, 5:0:0)
+m4_define(fgetdata_version, 6:0:0)
 
 dnl libf95getdata interface version info
-m4_define(f95getdata_version, 6:0:0)
+m4_define(f95getdata_version, 7:0:0)
 
 dnl libgetdata-matlab interface version info
-m4_define(matlabgetdata_version, 1:1:1)
+m4_define(matlabgetdata_version, 2:0:2)
diff --git a/man/GD_SIZE.3 b/man/GD_SIZE.3
index 6818fe5..c021e02 100644
--- a/man/GD_SIZE.3
+++ b/man/GD_SIZE.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" GD_SIZE.3.  The GD_SIZE man page.
 .\"
-.\" Copyright (C) 2013 D. V. Wiebe
+.\" Copyright (C) 2013, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,47 +88,56 @@
 .\" 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"
+.TH GD_SIZE 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 GD_SIZE \(em report the size of a GetData data sample
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int GD_SIZE(gd_type_t " type );
-.hy
-.ad n
+.EC
+
 .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
+.FN GD_SIZE
+preprocessor macro returns the size in bytes of a single sample of data of the
+type specified by
+.ARG type ,
+which should be one of the symbols:
 .IP
-.nh
-.ad l
+.SC
 .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
+.BR GD_COMPLEX128 ", " GD_STRING ", " GD_UNKNOWN .
+.EC
 .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.,
+to this macro will return zero.  Passing
+.B GD_STRING
+will return
+.BR "sizeof(const char*)" .
+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 :
+.ARG type :
 behaviour resulting from passing something other than the symbols listed above to this macro is unspecified.
 See
-.BR gd_getdata (3)
+.F3 gd_getdata
 for the meaning of the above symbols.
+
+.SH HISTORY
+The
+.FN GD_SIZE
+macro appeared in GetData-0.3.0
+
 .SH SEE ALSO
-.BR gd_getdata (3)
+.F3 gd_getdata
diff --git a/man/Makefile.am b/man/Makefile.am
index e1761e8..e97f0b8 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -20,44 +20,49 @@
 #
 AUTOMAKE_OPTIONS = foreign
 
+EXTRA_DIST = header.tmac
+
 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_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_array_len.3 gd_bof.3 \
-								gd_bof64.3 gd_carrays.3 gd_cbopen.3 gd_close.3 gd_constants.3 \
-								gd_delete.3 gd_desync.3 gd_dirfile_standards.3 \
+								gd_alloc_funcs.3 gd_alter_affixes.3 gd_alter_bit.3 \
+								gd_alter_entry.3 gd_alter_protection.3 gd_alter_spec.3 \
+								gd_array_len.3 gd_bof.3 gd_bof64.3 gd_carrays.3 gd_close.3 \
+								gd_constants.3 gd_delete.3 gd_desync.3 gd_dirfile_standards.3 \
 								gd_dirfilename.3 gd_encoding.3 gd_encoding_support.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_eof.3 gd_eof64.3 gd_error.3 gd_error_count.3 gd_flags.3 \
+								gd_flush.3 gd_fragment_affixes.3 gd_fragment_index.3 \
+								gd_fragment_namespace.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_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_free_entry_strings.3 gd_get_carray_slice.3 \
+								gd_get_sarray_slice.3 gd_get_string.3 gd_getdata.3 \
+								gd_getdata64.3 gd_hidden.3 gd_hide.3 gd_include.3 \
+								gd_invalid_dirfile.3 gd_linterp_tablename.3 gd_madd_bit.3 \
+								gd_match_entries.3 gd_metaflush.3 gd_move.3 \
+								gd_mplex_lookback.3 gd_naliases.3 gd_native_type.3 \
+								gd_nentries.3 gd_nfragments.3 gd_nframes.3 gd_nframes64.3 \
+								gd_open.3 gd_parent_fragment.3 gd_parser_callback.3 \
+								gd_protection.3 gd_put_carray_slice.3 gd_put_sarray_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
+								gd_reference.3 gd_rename.3 gd_rewrite_fragment.3 gd_sarrays.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_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_add_bit.3:gd_add_indir.3 gd_add_bit.3:gd_add_lincom.3 \
+	gd_add_bit.3:gd_add_linterp.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_sarray.3 \
+	gd_add_bit.3:gd_add_sbit.3 gd_add_bit.3:gd_add_sindir.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 \
@@ -68,10 +73,10 @@ MAN3ALIASES=gd_add_bit.3:gd_add_carray.3 gd_add_bit.3:gd_add_clincom.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_open.3:gd_cbopen.3 \
 	gd_close.3:gd_discard.3 \
 	gd_constants.3:gd_mconstants.3 \
-	gd_include_affix.3:gd_include.3 \
+	gd_include.3:gd_include_affix.3 gd_include.3:gd_include_ns.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 \
@@ -86,7 +91,8 @@ MAN3ALIASES=gd_add_bit.3:gd_add_carray.3 gd_add_bit.3:gd_add_clincom.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_get_sarray_slice.3:gd_get_sarray.3 \
+	gd_put_sarray_slice.3:gd_put_sarray.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 \
@@ -97,18 +103,31 @@ MAN3ALIASES=gd_add_bit.3:gd_add_carray.3 gd_add_bit.3:gd_add_clincom.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 \
-	gd_array_len.3:gd_carray_len.3
+	gd_array_len.3:gd_carray_len.3 \
+	gd_error.3:gd_error_string.3 \
+	gd_carrays.3:gd_mcarrays.3 \
+	gd_sarrays.3:gd_msarrays.3 \
+	gd_strings.3:gd_mstrings.3
 
 #man conversion
 HTMLMANS=$(addsuffix .html,${nodist_man_MANS}) \
 				 $(addsuffix .html,${dist_man_MANS})
 
-%.html: % make_html.pl
+%.3: header.tmac %.3in
+	cat $^ > $@
+
+%.1.html: %.1 make_html.pl
+	./make_html.pl $< > $@
+
+%.3.html: %.3in make_html.pl
+	./make_html.pl $< > $@
+
+%.5.html: %.5 make_html.pl
 	./make_html.pl $< > $@
 
 htmlman: $(HTMLMANS)
 	for m in $(MAN3ALIASES); do \
-		./make_html.pl `echo $$m | $(SED) -e 's/:\\(.*\\).3/ \\1/'` \
+		./make_html.pl `echo $$m | $(SED) -e 's/\\(.*\\).3:.*/\\1.3in/'` \
 			> `echo $$m | $(SED) -e 's/3/3.html/g' | $(SED) -e 's/.*://'`; \
 	 done
 
@@ -126,5 +145,4 @@ uninstall-hook:
 		done
 
 clean-local:
-	rm -f *~ *.html
-	rm -f $(nodist_man_MANS)
+	rm -f *~ *.html [Gg]*.3
diff --git a/man/Makefile.in b/man/Makefile.in
index 1e844ae..1dd545d 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -104,8 +104,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 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_FILES = gd_alter_encoding.3in gd_alter_endianness.3in \
+	gd_alter_frameoffset.3in
 CONFIG_CLEAN_VPATH_FILES =
 AM_V_P = $(am__v_P_ at AM_V@)
 am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
@@ -162,9 +162,9 @@ NROFF = nroff
 MANS = $(dist_man_MANS) $(nodist_man_MANS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
-	$(srcdir)/gd_alter_encoding.3.in \
-	$(srcdir)/gd_alter_endianness.3.in \
-	$(srcdir)/gd_alter_frameoffset.3.in
+	$(srcdir)/gd_alter_encoding.3in.in \
+	$(srcdir)/gd_alter_endianness.3in.in \
+	$(srcdir)/gd_alter_frameoffset.3in.in
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -196,6 +196,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
@@ -415,46 +417,50 @@ top_srcdir = @top_srcdir@
 # 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 AUTOMAKE_OPTIONS = foreign
+EXTRA_DIST = header.tmac
 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_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_array_len.3 gd_bof.3 \
-								gd_bof64.3 gd_carrays.3 gd_cbopen.3 gd_close.3 gd_constants.3 \
-								gd_delete.3 gd_desync.3 gd_dirfile_standards.3 \
+								gd_alloc_funcs.3 gd_alter_affixes.3 gd_alter_bit.3 \
+								gd_alter_entry.3 gd_alter_protection.3 gd_alter_spec.3 \
+								gd_array_len.3 gd_bof.3 gd_bof64.3 gd_carrays.3 gd_close.3 \
+								gd_constants.3 gd_delete.3 gd_desync.3 gd_dirfile_standards.3 \
 								gd_dirfilename.3 gd_encoding.3 gd_encoding_support.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_eof.3 gd_eof64.3 gd_error.3 gd_error_count.3 gd_flags.3 \
+								gd_flush.3 gd_fragment_affixes.3 gd_fragment_index.3 \
+								gd_fragment_namespace.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_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_free_entry_strings.3 gd_get_carray_slice.3 \
+								gd_get_sarray_slice.3 gd_get_string.3 gd_getdata.3 \
+								gd_getdata64.3 gd_hidden.3 gd_hide.3 gd_include.3 \
+								gd_invalid_dirfile.3 gd_linterp_tablename.3 gd_madd_bit.3 \
+								gd_match_entries.3 gd_metaflush.3 gd_move.3 \
+								gd_mplex_lookback.3 gd_naliases.3 gd_native_type.3 \
+								gd_nentries.3 gd_nfragments.3 gd_nframes.3 gd_nframes64.3 \
+								gd_open.3 gd_parent_fragment.3 gd_parser_callback.3 \
+								gd_protection.3 gd_put_carray_slice.3 gd_put_sarray_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
+								gd_reference.3 gd_rename.3 gd_rewrite_fragment.3 gd_sarrays.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_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_add_bit.3:gd_add_indir.3 gd_add_bit.3:gd_add_lincom.3 \
+	gd_add_bit.3:gd_add_linterp.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_sarray.3 \
+	gd_add_bit.3:gd_add_sbit.3 gd_add_bit.3:gd_add_sindir.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 \
@@ -465,10 +471,10 @@ MAN3ALIASES = gd_add_bit.3:gd_add_carray.3 gd_add_bit.3:gd_add_clincom.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_open.3:gd_cbopen.3 \
 	gd_close.3:gd_discard.3 \
 	gd_constants.3:gd_mconstants.3 \
-	gd_include_affix.3:gd_include.3 \
+	gd_include.3:gd_include_affix.3 gd_include.3:gd_include_ns.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 \
@@ -483,7 +489,8 @@ MAN3ALIASES = gd_add_bit.3:gd_add_carray.3 gd_add_bit.3:gd_add_clincom.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_get_sarray_slice.3:gd_get_sarray.3 \
+	gd_put_sarray_slice.3:gd_put_sarray.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 \
@@ -494,7 +501,11 @@ MAN3ALIASES = gd_add_bit.3:gd_add_carray.3 gd_add_bit.3:gd_add_clincom.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 \
-	gd_array_len.3:gd_carray_len.3
+	gd_array_len.3:gd_carray_len.3 \
+	gd_error.3:gd_error_string.3 \
+	gd_carrays.3:gd_mcarrays.3 \
+	gd_sarrays.3:gd_msarrays.3 \
+	gd_strings.3:gd_mstrings.3
 
 
 #man conversion
@@ -533,11 +544,11 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-gd_alter_encoding.3: $(top_builddir)/config.status $(srcdir)/gd_alter_encoding.3.in
+gd_alter_encoding.3in: $(top_builddir)/config.status $(srcdir)/gd_alter_encoding.3in.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-gd_alter_endianness.3: $(top_builddir)/config.status $(srcdir)/gd_alter_endianness.3.in
+gd_alter_endianness.3in: $(top_builddir)/config.status $(srcdir)/gd_alter_endianness.3in.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-gd_alter_frameoffset.3: $(top_builddir)/config.status $(srcdir)/gd_alter_frameoffset.3.in
+gd_alter_frameoffset.3in: $(top_builddir)/config.status $(srcdir)/gd_alter_frameoffset.3in.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 mostlyclean-libtool:
@@ -837,12 +848,21 @@ uninstall-man: uninstall-man1 uninstall-man3 uninstall-man5
 .PRECIOUS: Makefile
 
 
-%.html: % make_html.pl
+%.3: header.tmac %.3in
+	cat $^ > $@
+
+%.1.html: %.1 make_html.pl
+	./make_html.pl $< > $@
+
+%.3.html: %.3in make_html.pl
+	./make_html.pl $< > $@
+
+%.5.html: %.5 make_html.pl
 	./make_html.pl $< > $@
 
 htmlman: $(HTMLMANS)
 	for m in $(MAN3ALIASES); do \
-		./make_html.pl `echo $$m | $(SED) -e 's/:\\(.*\\).3/ \\1/'` \
+		./make_html.pl `echo $$m | $(SED) -e 's/\\(.*\\).3:.*/\\1.3in/'` \
 			> `echo $$m | $(SED) -e 's/3/3.html/g' | $(SED) -e 's/.*://'`; \
 	 done
 
@@ -860,8 +880,7 @@ uninstall-hook:
 		done
 
 clean-local:
-	rm -f *~ *.html
-	rm -f $(nodist_man_MANS)
+	rm -f *~ *.html [Gg]*.3
 
 # 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/man/dirfile-encoding.5 b/man/dirfile-encoding.5
index 370647b..5bac3c2 100644
--- a/man/dirfile-encoding.5
+++ b/man/dirfile-encoding.5
@@ -312,9 +312,10 @@ This manual page was written by D. V. Wiebe
 .hy 1
 
 .SH SEE ALSO
-.BR dirfile (5),
-.BR dirfile\-format (5),
 .BR bzip2 (1),
+.BR flac (1),
 .BR gzip (1),
 .BR xz (1),
-.BR zlib (3).
+.BR zlib (3),
+.BR dirfile (5),
+.BR dirfile\-format (5)
diff --git a/man/dirfile-format.5 b/man/dirfile-format.5
index 131fdc1..5d043ca 100644
--- a/man/dirfile-format.5
+++ b/man/dirfile-format.5
@@ -1,6 +1,7 @@
 .\" dirfile-format.5.  The dirfile format specification man page.
 .\"
-.\" Copyright (C) 2005, 2006, 2008, 2009, 2010, 2012, 2013 D. V. Wiebe
+.\" Copyright (C) 2005, 2006, 2008, 2009, 2010, 2012, 2013, 2016, 2017
+.\"               D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +14,8 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH dirfile\-format 5 "3 April 2013" "Standards Version 9" "DATA FORMATS"
+.hw name-space
+.TH dirfile\-format 5 "19 January 2017" "Standards Version 10" "DATA FORMATS"
 .SH NAME
 dirfile\-format \(em the dirfile database format specification file
 .SH DESCRIPTION
@@ -39,11 +41,11 @@ 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
+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
+10); differences with previous versions are noted where relevant.  A complete
 list of changes between versions is given in the
 .B HISTORY
 section below.
@@ -207,8 +209,8 @@ 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
+.IP
 .B /ALIAS
 .I <name> <target>
 .RE
@@ -225,25 +227,37 @@ 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
+.IP
+aaaa \fBRAW UINT8\fR 1
 .br
-field1/meta \fBCONST FLOAT64\fR 0.0
+aaaa/bbbb \fBCONST FLOAT64\fR 0.0
 .br
-field2 \fBRAW UINT8\fR 1
+cccc \fBRAW UINT8\fR 1
 .br
-\fB/ALIAS\fR field2/alias field1
+\fB/ALIAS\fR cccc/dddd aaaa
 .RE
 .IP
 the metafield
-.I field1/meta
+.I aaaa/bbbb
 may not be referred to as
-.IR field2/alias/meta ,
+.IR cccc/dddd/bbbb ,
 even though
-.I field2/alias
+.I cccc/dddd
 is a valid field code referring to
-.IR field1 .
+.IR aaaa .
+.IP
+This is not true of top-level aliases: if 
+.I eeee
+is an alias of
+.IR ffff ,
+then 
+.IR ffff/gggg ,
+a metafield of
+.IR ffff ,
+may be referred to as
+.I eeee/gggg
+as well.
 .IP
 The /ALIAS directive has no scope: it is processed immediately.  It appeared in
 Standards Version 9.
@@ -262,6 +276,9 @@ The dirfile is unencoded.
 .B bzip2
 The dirfile is compressed using the bzip2 compression scheme.
 .TP
+.B flac
+The dirfile is compressed using the flac compression scheme.
+.TP
 .B gzip
 The dirfile is compressed using the gzip compression scheme.
 .TP
@@ -393,18 +410,54 @@ binary files associated with
 fields.  Syntax is:
 .RS
 .IP
-.B /INCLUDE \fI<file> \fR[\fI<prefix> \fR[\fI<suffix>\fR]]
+\fB/INCLUDE \fI<file> \fR[\fI<namespace>\fB.\fR][\fI<prefix>\fR]
+[\fI<suffix>\fR]
 .PP
-To specify only a suffix, use the null-token
+To specify only
+.IR suffix ,
+the null-token
 .RB ( """""" )
-as
+may be used as
+.IR prefix .
+.PP
+A
+.I namespace
+may also be specified in an /INCLUDE directive by prepending it to
 .IR prefix .
+The namespace and prefix are separated by a dot
+.RB ( . ).
+The dot is required whenever a namespace is specified: if the prefix is empty,
+the third token should be just the namespace followed by a trailing dot.  If a
+namespace is specified, that namespace, relative to the including fragment's
+root namespace, becomes the root namespace of the included fragment.  If no
+namespace is specified in the /INCLUDE directive, then the current namespace
+(specified by a previous /NAMESPACE directive) is used as the root namespace
+of the included fragment.  That is, if the current namespace is
+.IR current_space ,
+then the statement:
+.IP
+.B /INCLUDE \fIfile newspace\fB.
+.PP
+is equivalent to
+.IP
+.B /NAMESPACE \fInewspace
+.br
+.B /INCLUDE \fIfile
+.br
+.B /NAMESPACE \fIcurrent_space
+.PP
+As a result, if no namespace is provided, and there
+has been no previous /NAMESPACE directive, the included fragment will have the
+same root namespace as the including fragment.
+
 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.
+appeared in Standards Version 9.  The optional
+.I namespace
+appeared in Standards Version 10.
 .RE
 .TP
 .B /META
@@ -460,6 +513,45 @@ The /META directive has no scope: it is processed immediately.  It appeared in
 Standards Version 6.
 .RE
 .TP
+.B /NAMESPACE
+The /NAMESPACE directive changes the
+.IR "current namespace" for subsequent field specification lines.
+Syntax is:
+.RS
+.IP
+.BI /NAMESPACE\~ <subspace>
+.PP
+The
+.I subspace
+specified is relative to the current fragment's root namespace.  If
+.I subspace
+is the null-token
+.RB ( """""" )
+the current namespace will be set back to the root namespace.  Otherwise, the
+current namespace will be changed to the concatenation of the root namespace
+with subspace, with the two parts separated by a dot:
+.IP
+.IB rootspace . subspace
+.PP
+If
+.I rootspace
+is empty, the intervening dot is omitted, and the current namespace is simply
+.IR subspace .
+.PP
+By default, all field codes, both field names for newly specified fields, and
+field codes used as inputs to fields or targets for aliases, are placed in the
+current namespace, unless they start with an initial dot, in which case the
+current namespace is ignored, and they're placed instead in the
+fragment's root namespace.  See the
+.B Namespaces
+section for further details.
+.PP
+The /NAMESPACE directive has no scope: it is processed immediately.  For the
+effects of changing the current namespace on included fragments, see the
+/INCLUDE directive above.  The effects of a /NAMESPACE directive never propagate
+upwards to parent fragments.  It appeared in Standards Version 10.
+.RE
+.TP
 .B /PROTECT
 The /PROTECT directive specifies the advisory protection level of the current
 fragment and of the
@@ -552,8 +644,9 @@ Subsequent tokens are field parameters.  The meaning and number these parameters
 depends on the field type specified.
 
 .SS Field Names
-The first token in a field
-specification line is the field name.  The field name consists of one or more
+The first token in a field specification line is the
+.IR "field name" .
+The field name consists of one or more
 characters, excluding both ASCII control characters (the bytes 0x01 through
 0x1F), and the characters
 .IP
@@ -562,10 +655,10 @@ characters, excluding both ASCII control characters (the bytes 0x01 through
 which are reserved (but see below for the use of
 .B /
 to specify metafields).
-The full stop
+The dot
 .RB ( . )
-is allowed in Standards Version 5 and earlier.  The ampersand, semicolon, less
-than, greater than, and vertical line
+is allowed in Standards Version 5 and earlier.  The ampersand, semicolon,
+less-than sign, greater-than sign, and vertical line
 .RB ( "& ; < > |" )
 are allowed in Standards Version 4 and earlier.  Furthermore, due to the lack
 of an escape or quoting mechanism (see 
@@ -590,28 +683,141 @@ and acceptable characters of a
 field name, regardless of Standards Version. 
 
 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
+specification line contains exactly one forward slash character
+.RB ( / ),
+the line is assumed to specify a metafield.  See the
 .B /META
 directive above for further details.  A field name may not contain more than one
-.BR / .
+forward slash.
+
+Starting in Standards Version 10, any field name may be preceded by a
+.IR "namespace tag" .
+The namespace tag and the field name are separated by a dot
+.RB ( . ).
+See the
+.B Namespaces
+section, following, for details.
+
+.SS Namespaces
+Beginning with Standards Version 10, every field in a Dirfile is contained in a
+namespace.  Every namespace is identified by a
+.I namespace tag
+which consist of the same restricted set of characters used for field names.
+Namespaces nest arbitrarily deep.  Subnamespaces are identified by concatenating
+all namespace tags, separating tags by dots
+.RB ( . ),
+with the outermost namespace leftmost:
+.RS
+.IP
+.IB topspace . subspace . subsubspace
+.RE
+.PP
+Each fragment has an immutable
+.IR "root namespace".
+The root namespace of the primary format file is the null namespace, identified
+by the null-token
+.RB ( """""" ).
+The root namespace of other fragments is specified when they are introduced
+(see the /INCLUDE directive).  Each fragment also has a
+.I current namespace
+which may be changed as often as needed using the /NAMESPACE directive, and
+defaults to the root namespace.  The current namespace is always either the root
+namespace or else a subspace under the root namespace.
+
+If a field name or field code starts with a leading dot, then that name or code
+is taken to be relative to the fragment's root space.  If it does not start with
+a dot, it is taken to be relative to the current namespace.
+
+For example, if the both the root namespace and current namespace of a fragment
+start off as
+.IR rootspace ,
+then:
+.IP
+.IB aaaa\~ "RAW UINT8 1"
+.br
+.BI . bbbb\~ "RAW UINT8 1"
+.br
+.IB cccc . dddd\~ "RAW UINT8 1"
+.br
+.BI . eeee . ffff\~ "RAW UINT8 1"
+.br
+.BI /NAMESPACE\~ newspace
+.br
+.IB gggg\~ "RAW UINT8 1"
+.br
+.BI . hhhh\~ "RAW UINT8 1"
+.br
+.IB iiii . jjjj\~ "RAW UINT8 1"
+.br
+.BI . kkkk . llll\~ "RAW UINT8 1"
+.PP
+specifies, respectively, the fields:
+.IP
+.IB rootspace . aaaa\fR,
+.br
+.IB rootspace . bbbb\fR,
+.br
+.IB rootspace . cccc . dddd\fR,
+.br
+.IB rootspace . eeee . ffff\fR,
+.br
+.IB rootspace . newspace . gggg\fR,
+.br
+.IB rootspace . hhhh\fR,
+.br
+.IB rootspace . newspace . iiii . jjjj\fR,
+and
+.br
+.IB rootspace . kkkk . llll\fR.
+.PP
+Note that a field may specify deeper subspaces under either the root namespace
+or the current namespace (meaning it is never necessary to use the /NAMESPACE
+directive). Note also that there is no way for metadata in a given fragment to
+refer to fields outside the fragment's root space.
+
+There is one exception to this namespace scoping rule: the implicit
+.I INDEX
+vector is always in the null (top-level) namespace, and namespace tags specified
+with it, either explicitly or implicitly, even a fragment root namespace, are
+ignored.  So, in a fragment with root namespace
+.IR rootspace ,
+and current namespace
+.IR rootspace\fB.\fIsubspace ,
+.IP
+.IR INDEX ,
+.br
+.BI . INDEX\fR,
+.br
+.IB namespace . INDEX\fR,
+and
+.br
+.BI . namespace . INDEX\fR,
+.PP
+all refer to the same
+.I INDEX
+field.
 
 .SS Field Types
-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
+There are eighteen field types.  Of these, fourteen are of vector type
+.RB ( BIT ", " DIVIDE ", " INDIR ", " LINCOM ", " LINTERP ", " MPLEX ,
+.BR MULTIPLY ", " PHASE ", " POLYNOM ", " RAW ", " RECIP ", " SBIT ,
+.BR SINDIR ", and " WINDOW )
+and four are of scalar type
+.RB ( CARRAY ", " CONST ", " SARRAY ", and " STRING ).
+The thirteen 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.
+since they derive their value from one or more input vector fields.  Any other 
+vector field may be used as an input vector, including the implicit
+.I INDEX
+field, but excluding
+.B SINDIR
+string vectors.
 .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 more than one vector 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
@@ -657,18 +863,20 @@ field as an unsigned number.  Syntax is:
 .PP
 which specifies
 .I fieldname
-to be the value of bits
+to be
+.I num-bits
+bits extracted from the input vector field
+.I input
+starting with bit number
 .I first-bit
-through
-.IR first-bit + num-bits -1
-of the input vector field
-.IR input ,
-when
+(counting from the least-significant bit, which is numbered zero), after
 .I input
-is converted from its native type to an (endianness corrected) unsigned 64-bit
-integer.  If
+has been converted from its native type to an (endianness corrected) unsigned
+64-bit integer.  If
 .I num-bits
-is omitted, it is assumed to be 1.  The
+is omitted, it is assumed to be one.
+
+The extracted bits are interpreted as an unsigned integer; the
 .B SBIT
 field type is a signed version of this field type.  The optional
 .I num-bits
@@ -682,7 +890,7 @@ format specification metadata.  Syntax is:
 .IP
 .I <fieldname>
 .B CARRAY
-.I <type> <value0> <value1> <value2> ...
+.I <type> <value0> <value1> <value2> \fR...
 .PP
 where
 .I type
@@ -698,7 +906,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.)  It appeared in Standards Version 8.
+are not indexed by frames.)  CARRAY appeared in Standards Version 8.
 .RE
 .TP
 .B CONST
@@ -718,7 +926,7 @@ 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.
+CONST appeared in Standards Version 6.
 .RE
 .TP
 .B DIVIDE
@@ -736,6 +944,39 @@ fieldname = field1 / field2.
 It was introduced in Standards Version 8.
 .RE
 .TP
+.B INDIR
+The INDIR vector field type performs an indirect translation of a CARRAY scalar
+field to a derived vector field based on a vector index field.  Syntax is:
+.RS
+.IP
+.I <fieldname>
+.B INDIR
+.I <index> <array>
+.PP
+where
+.I index
+is the vector field, which is converted to an integer type, if necessary, and
+.I array
+is the CARRAY field.  The
+.IR n th
+sample of the INDIR field is the value of the
+.IR m th
+element of
+.IR array
+(counting from zero), where
+.I m
+is the value of the
+.IR n th
+sample of
+.IR index .
+When
+.I index
+is not a valid element number of
+.IR array ,
+the corresponding value of the INDIR is implementation dependent.  INDIR
+appeared in Standards Version 10.
+.RE
+.TP
 .B LINCOM
 The LINCOM vector field type is the linear combination of one, two or three
 input vector fields.  Syntax is:
@@ -887,7 +1128,7 @@ The derived field is computed as:
 .IP
 fieldname = field1 * field2.
 .PP
-It appeared in Standards Version 2.
+MULTIPLY appeared in Standards Version 2.
 .RE
 .TP
 .B PHASE
@@ -953,32 +1194,32 @@ where
 .I sample-rate
 is the number of samples per dirfile frame for the time stream and
 .I type
-is a token specifying the native data format type:
+is a token specifying the native data type:
 .RS
 .TP
 .I UINT8
 unsigned 8-bit integer
 .TP
 .I INT8
-signed (two's complement) 8-bit integer
+two's complement signed 8-bit integer
 .TP
 .I UINT16
 unsigned 16-bit integer
 .TP
 .I INT16
-signed (two's complement) 16-bit integer
+two's complement signed 16-bit integer
 .TP
 .I UINT32
 unsigned 32-bit integer
 .TP
 .I INT32
-signed (two's complement) 32-bit integer
+two's complement signed 32-bit integer
 .TP
 .I UINT64
 unsigned 64-bit integer
 .TP
 .I INT64
-signed (two's complement) 64-bit integer
+two's complement signed 64-bit integer
 .TP
 .I FLOAT32
 IEEE-754 standard 32-bit single precision floating point number
@@ -1065,34 +1306,96 @@ fieldname = dividend / input.
 RECIP appeared in Standards Version 8.
 .RE
 .TP
+.B SARRAY
+The SARRAY scalar field type is a list of strings fully specified in the format
+file metadata.  Syntax is:
+.RS
+.IP
+.I <fieldname>
+.B SARRAY
+.I <string0> <string1> <string2> \fR...
+.PP
+Each
+.I string
+is a single token.  To include whitespace in a string, enclose it in quotation
+marks
+.RB ( """" ),
+or else escape the whitespace with the backslash character
+.RB ( \e ).
+No limit is placed on the number of elements in a 
+.BR SARRAY .
+SARRAY appeared in Standards Version 10.
+.RE
+.TP
 .B SBIT
 The SBIT vector field type extracts one or more bits out of an input vector
-field as a signed number.  Syntax is:
+field as a (two's-complement) signed number.  Syntax is:
 .RS
 .IP
 .I <fieldname>
 .B SBIT
-.I <input> <first-bit> \fR[\fI<bits>\fR]
+.I <input> <first-bit> \fR[\fI<num-bits>\fR]
 .PP
 which specifies
 .I fieldname
-to be the value of bits
+to be
+.I num-bits
+bits extracted from the input vector field
+.I input
+starting with bit number
 .I first-bit
-through
-.IR first-bit + bits -1
-of the input vector field
-.IR input ,
-when
+(counting from the least-significant bit, which is numbered zero), after
 .I input
-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.  The
+has been converted from its native type to an (endianness corrected) two's
+complement signed 64-bit integer.  If
+.I num-bits
+is omitted, it is assumed to be one.
+
+The extracted bits are interpreted as a two's complement signed integer of the
+specified width. (So,
+if
+.I num-bits
+is, for example, one, then the field can take on the value zero or negative
+one.)  The
 .B BIT
 field type is an unsigned version of this field type.  SBIT appeared in
 Standards Version 7.
 .RE
 .TP
+.B SINDIR
+The SINDIR vector field type performs an indirect translation of a SARRAY
+scalar field to a derived vector field of strings based on a vector index field.
+Syntax is:
+.RS
+.IP
+.I <fieldname>
+.B SINDIR
+.I <index> <array>
+.PP
+where
+.I index
+is the vector field, which is converted to an integer type, if necessary, and
+.I array
+is the SARRAY field.  The
+.IR n th
+sample of the SINDIR field is the string value of the
+.IR m th
+element of
+.IR array
+(counting from zero), where
+.I m
+is the value of the
+.IR n th
+sample of
+.IR index .
+When
+.I index
+is not a valid element number of
+.IR array ,
+the corresponding value of the SINDIR is implementation dependent.  SINDIR
+appeared in Standards Version 10.
+.RE
+.TP
 .B STRING
 The STRING scalar field type is a character string fully specified in the format
 file metadata.  Syntax is:
@@ -1100,14 +1403,14 @@ file metadata.  Syntax is:
 .IP
 .I <fieldname>
 .B STRING
-.I <value>
+.I <string>
 .PP
 where
-.I value
+.I string
 is the string value of the field.  Note that
-.I value
+.I string
 is a single token.  To include whitespace in the string, enclose
-.I value
+.I string
 in quotation marks
 .RB ( """" ),
 or else escape the whitespace with the backslash character
@@ -1357,71 +1660,128 @@ vector field,
 .I field codes
 are used.  A
 .I field code
-is one of:
+consists of, in order:
 .IP \(bu 4
-a simple field name, possibly an alias, indicating a vector or scalar field
+(since Standards Version 10:) optonally, a leading dot
+.RB ( . ),
+indicating this field code is relative to the fragment's root namespace.
+Without the leading dot, the field code is taken to be relative to the current
+namespace.  (See the discussion in the 
+.B Namespaces
+section above for details.)
+.IP \(bu 4
+(since Standards Version 10:) optionally, a non-null
+.I subnamespace
+followed by a dot
+.RB ( . )
+indicating a subspace under the current or root namespace.  The subnamespace may
+be made up of any number of namespace tags separated by dots, to nest deeper in
+the namespace tree.
 .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
+(since Standards Version 6:) if the field in question is a metafield
+(see the
 .B /META
-directive above for further details. 
+directive above), the field name of the metafield's parent (which may be an
+alias) followed by a forward slash
+.RB ( / ).
+
 .IP \(bu 4
-either of the above, followed by a period, followed by a
-.IR "representation suffix" ,
-but only if the field or metafield specified is not a
-.B STRING
-type field.
+a simple field name, possibly an alias, indicating a vector or scalar field
+.IP \(bu 4
+(since Standards Version 7:) optionally, a dot
+.RB ( . )
+followed by a
+.IR "representation suffix" .
 .PP
 A 
 .IR "representation suffix"
 may be used used to extract a real number from a complex value.  The available
-suffixes and their meanings are:
+suffixes (listed here with their preceding dot) and their meanings are:
 .TP
 .B .a
-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
-.IR z =0,
-zero is returned.
+the argument of the input, that is, the angle (in radians) between the positive
+real axis and the input.  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
+the input is zero, zero is returned.
 .TP
 .B .i
-This representation indicates the projection of the value onto the imaginary
-axis (ie. the imaginary part of the number).
+the imaginary part of the input
+.RI ( i.e. \~the
+projection of the input onto the imaginary axis)
 .TP
 .B .m
-This representation indicates the modulus of the value (ie. its absolute
-value).
+the modulus of the input
+.RI ( i.e. \~its
+absolue value).
 .TP 
 .B .r
-This representation indicates the projection of the value onto the real axis
-(ie.  the real part of the number).
+the real part of the input
+.RI ( i.e. \~the
+projection of the input onto the real axis)
+.TP
+.B .z
+(since Standards Version 10:) the identity representation: it returns the full
+complex value, equivalent to simply omitting the suffix completely.  It is only
+needed in certain cases to force the correct interpretation of a field code in
+the presence of a namespace tag.  To wit, the field code
+.RS
+.IP
+name.r
 .PP
-If the specified field is purely real, the representations are calculated as
-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 ,
-could be produced with:
+may be interpreted as the real-part (via the
+.B .r
+representation suffix)
+of the field called
+.IR name .
+(if such a field exists).  To refer to a field called
+.I r
+in the
+.I name
+namespace, the field code must be written:
 .IP
-.I re_z
-.B PHASE
-.I z.r
-0
-.PP
-and similarly for the complex field's imaginary part, argument, and absolute
-value.  (Although it should be pointed out this simplistic an example isn't
-strictly necessary, since
-.I z.r
-could be used wherever
-.I re_z
-would be.)
+name.r.z
+.PP
+NB: The first interpretation only occurs with valid representation suffixes; the
+field code:
+.IP
+name.q
+.PP
+is interpreted as the field
+.I q
+in the
+.I name
+namespace because
+.B .q
+is not a valid representation suffix.  Furthermore, ambiguity arises only if
+both fields "name" and "name.r" are defined.  if the field "name" does
+not exist, but the field "name.r" does, then the original field code is not
+ambiguous.  This is the only representation suffix allowed on
+.BR SARRAY ,
+.BR SINDIR ,
+and
+.BR STRING
+field codes.
+.RE
+.PP
+If the specified field is purely real, representations are calculated as
+if the imaginary part were equal to +0.
 
 .SH HISTORY
 
-This document describes Versions 9 and earlier of the Dirfile Standards.
+This document describes Versions 10 and earlier of the Dirfile Standards.
+
+Version 10 of the Standards (January 2017) added the
+.BR INDIR ", " SARRAY ,
+and
+.B SINDIR
+field types, namespaces, the
+.B /NAMESPACE
+directive, the
+.B flac
+encoding scheme, and the
+.I .z
+representation suffix.
 
 Version 9 of the Standards (April 2012) added the
 .B MPLEX
diff --git a/man/dirfile.5 b/man/dirfile.5
index b2dd99f..8d92db3 100644
--- a/man/dirfile.5
+++ b/man/dirfile.5
@@ -1,6 +1,6 @@
 .\" dirfile.5.  The dirfile man page.
 .\"
-.\" Copyright (C) 2005, 2006, 2008, 2009, 2014 D. V. Wiebe
+.\" Copyright (C) 2005, 2006, 2008, 2009, 2014, 2016 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 5 "15 July 2014" "Standards Version 9" "DATA FORMATS"
+.TH dirfile 5 "19 November 2016" "Standards Version 10" "DATA FORMATS"
 .SH NAME
 dirfile \(em a filesystem-based database format for time-ordered binary data
 .SH DESCRIPTION
@@ -21,34 +21,45 @@ The
 .I dirfile
 database format is designed to provide a fast, simple format for storing and
 reading binary time-ordered data.  Dirfiles can be read using the GetData
-library.
+Library, which provides a reference implementaiton of these Standards.
 
 The dirfile database is centred around one or more time-ordered data streams (a
 .IR "time stream" ).
-Each time stream is written to disk in a separate file, in its native binary
-format.  The name of these binary files correspond to the time stream's
+Each time stream is written to the filesystem in a separate file, as binary
+data.  The name of these binary files correspond to the time stream's
 .IR "field name" .
+Dirfiles support binary data fields for signed and unsigned integer types of 8
+to 64 bits, as well as single and double precision floating-point real or
+complex data types.
+
 Two time streams may have different constant sampling frequencies and mechanisms
 exist within the dirfile format to ensure these time streams remain properly
 sequenced in time.
 
 To do this, the time streams in the dirfile are subdivided into
 .IR frames .
-Each frame contains an integer number of samples of each time stream.  When
-synchronous retrieval of data from more than one time stream is required,
+Each frame contains a fixed integer number of samples of each time stream.
+Two time streams in the same dirfile may have different numbers of samples
+per frame, but the number of samples per frame of any given time stream is
+fixed.
+
+When synchronous retrieval of data from more than one time stream is required,
 position in the dirfile can be specified in frames, which will ensure
 synchronicity.
 
-The binary files are all located in a central directory, known as the
+The binary files are all located in one ore more filesystem directories,
+rooted around a central directory, known as the
 .IR "dirfile directory" .
 The dirfile as a whole may be referred to by its dirfile directory path.
 
 Included in the dirfile along with the time streams is the
 .IR "dirfile format specification" ,
-which is an ASCII text file called
+which is one or more ASCII text files containing the dirfile database metadata.
+The primary file is the file called
 .B format
-located in the dirfile directory.  This file fully specifies the dirfile's
-metadata.  For the syntax of this file, see
+located in the dirfile directory.  This file and any additional files that
+it names, fully specify the dirfile's metadata.  For the syntax of these files,
+see
 .BR dirfile\-format (5).
 
 Version 3 of the Dirfile Standards introduced the
@@ -68,8 +79,9 @@ for information on specifying these subdirfiles.
 In addition to the raw fields on disk, the dirfile format specification may
 also specify
 .I derived fields
-which are calculated from one or more raw or derived time streams.  Derived
-fields behave identically to raw fields when read via GetData.  See
+which are calculated by performing simple element-wise operations on one or
+more input fields.  Derived fields behave identically to raw fields when read
+via GetData.  See
 .BR dirfile\-format (5)
 for a complete list of derived field types.  Dirfiles may also contain both
 numerical and character string constant
@@ -79,7 +91,7 @@ also further outlined in
 
 Dirfiles are designed to be written to and read simultaneously. The dirfile
 specification dictates that one particular raw field (specified either
-explicitly or implicitly by the format specification) is to be used as the
+explicitly or implicitly by the dirfile metadata) is to be used as the
 .IR "reference field" :
 all other vector fields are assumed to have at least as many frames as the
 reference field has, and the size (in frames) of the reference field is used as
@@ -88,8 +100,8 @@ the size of the dirfile as a whole.
 Version 6 of the Dirfile Standards added the ability to encode the binary files
 on disk.  Each
 .I fragment
-may have its own encoding scheme. Notably this can be used to compress these
-files.  See
+may have its own encoding scheme.  Most commonly, encodings are used to compress
+the data files to same space.  See
 .BR dirfile\-encoding (5)
 for information on encoding schemes.
 
@@ -121,7 +133,7 @@ purely real data.  See
 
 .SH AUTHORS
 
-The Dirfile format was developed by C. B. Netterfield
+The Dirfile format was created by C. B. Netterfield
 .nh
 <netterfield at astro.utoronto.ca>.
 .hy 1
@@ -133,3 +145,9 @@ It is now maintained by D. V. Wiebe
 .SH SEE ALSO
 .BR dirfile\-encoding (5),
 .BR dirfile\-format (5)
+.PP
+For an introduction to the GetData Library reference implementation, see
+.BR gd_open (3), or
+.BR gd_getdata (3),
+or visit the GetData Project website:
+<http://getdata.sourceforge.net/>.
diff --git a/man/gd_add.3 b/man/gd_add.3
index 40b45da..30e4ec0 100644
--- a/man/gd_add.3
+++ b/man/gd_add.3
@@ -1,6 +1,6 @@
-.\" gd_add.3.  The gd_add man page.
+.\" header.tmac.  GetData manual macros.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014 D. V. Wiebe
+.\" Copyright (C) 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -12,58 +12,134 @@
 .\" 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
+.\" gd_add.3in.  The gd_add man page.
+.\"
+.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014, 2016 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
-.TH gd_add 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.\" 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 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_add, gd_madd \(em add a field to a dirfile
+gd_add, gd_madd \(em add a field to a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_add(DIRFILE *" dirfile ", const gd_entry_t *" entry );
 .HP
 .BI "int gd_madd(DIRFILE *" dirfile ", const gd_entry_t *" entry ,
 .BI "const char *" parent );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_add ()
+.FN gd_add
 function adds the field described by
-.I entry
+.ARG entry
 to the dirfile specified by
-.IR dirfile .
+.ARG dirfile .
 The
-.BR gd_madd ()
+.FN gd_madd
 function behaves similarly, but adds the field as a metafield under the
 field indicated by the field code
-.IR parent .
+.ARG parent .
 
 The form of
-.I entry
+.ARG entry
 is described in detail on the
-.BR gd_entry (3)
+.F3 gd_entry
 man page.  All relevant members of
-.I entry
+.ARG entry
 for the field type specified must be properly initialised.  If
-.I entry
+.ARG entry
 specifies a
 .B CONST
 or
 .B CARRAY
 field, the field's data will be set to zero.  If
-.I entry
+.ARG entry
 specifies a
 .B STRING
 field, the field data will be set to the empty string.
 
 The only flags in the
-.IR entry -> flags
+.SPM entry flags
 member which are honoured are
 .BR GD_EN_HIDDEN ,
 which should be set or cleared to set the hiddenness of the entry (see
-.BR gd_hidden (3)),
+.F3 gd_hidden ),
 and
 .BR GD_EN_COMPSCAL ,
 which indicates whether scalar parameters are initialised from the complex
@@ -73,17 +149,17 @@ valued or purely real member, which both are present
 .BR RECIP ).
 
 A metafield may be added either by calling
-.BR gd_madd ()
+.FN gd_madd
 with
-.IR entry -> field
+.SPM entry field
 containing only the metafield's name, or else by calling
-.BR gd_add ()
+.FN gd_add
 with the fully formed
-.IB <parent-field> / <meta-field>
+.RI """" <parent-field> / <meta-field> """"
 field code in
-.IR entry -> field .
+.SPM entry field .
 Regardless of which interface is used, when adding a metafield the value of
-.IR entry -> fragment_index
+.SPM 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
@@ -91,139 +167,165 @@ substituted.
 
 Fields added with this interface may contain either literal parameters or
 parameters based on scalar fields.  If an element of the
-.IR entry -> scalar
+.SPM entry scalar
 array defined for the specified field type is non-NULL, this element will be
 used as the scalar field code, and the corresponding numerical member will be
 ignored, and need not be initialised.  Conversely, if numerical parameters are
 intended, the corresponding
-.IR entry -> scalar
+.SPM entry scalar
 elements should be set to NULL.  If using an element of a
 .B CARRAY
 field,
-.IR entry -> scalar_ind
+.SPM entry scalar_ind
 should also be set.
 
 .SH RETURN VALUE
 On success,
-.BR gd_add ()
+.FN gd_add
 and
-.BR gd_madd ()
-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
+.FN gd_madd
+return zero.   On error, a negative-valued error code is returned.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field name provided in
-.IR entry -> field
+.SPM entry field
 contained invalid characters; or it or an input field did not contain the
 affected fragment's prefix or suffix. Alternately, the
-.I parent
+.ARG parent
 field code was not found, or was already a metafield.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_ENTRY
+.DD GD_E_BAD_ENTRY
 There was an error in the specification of the field described by
-.IR entry ,
+.ARG entry ,
 or the caller attempted to add a field of type
 .B RAW
 as a metafield.
-.TP
-.B GD_E_BAD_INDEX
+.DD GD_E_BAD_INDEX
 The
-.IR entry -> fragment_index
+.SPM entry fragment_index
 parameter was out of range.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 The
-.IR entry -> data_type
+.SPM entry data_type
 parameter provided with a
 .BR RAW
 entry, or the
-.IR entry -> const_type
+.SPM entry const_type
 parameter provided with a
 .B CONST
 or
 .B CARRAY
 entry, was invalid.
-.TP
-.B GD_E_DUPLICATE
+.DD GD_E_DUPLICATE
 The field name provided in
-.IR entry -> field
+.SPM entry field
 duplicated that of an already existing field.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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_IO
+.DD GD_E_IO
 An I/O error occurred while creating an empty binary file to be associated with
 a newly added
 .B RAW
 field.
-.TP
-.B GD_E_PROTECTED
+.DD 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.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 The encoding scheme of the indicated format specification fragment is not known
 to the library.  As a result, the library was unable to create an empty binary
 file to be associated with a newly added
 .B RAW
 field.
-.TP
-.B GD_E_UNSUPPORTED
+.DD GD_E_UNSUPPORTED
 The encoding scheme of the indicated format specification fragment does not
 support creating an empty binary file to be associated with a newly added
 .B RAW
 field.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The functions
+.FN dirfile_add
+and
+.FN dirfile_madd
+appeared in GetData-0.4.0.
+
+In GetData-0.7.0, the functions were renamed to
+.FN gd_add
+and
+.FN gd_madd .
+
+In GetData-0.8.0,
+.FN gd_add
+first allowed adding metafields by providing the full (slashed) field name.
+This was the first version supporting fragment affixes, and in this version,
+.FN gd_add
+would apply the destination fragment's affixes to the supplied
+.SC
+.SPM entry field
+.EC
+name.  In GetData-0.8.1, this changed:
+.FN gd_add
+now assumes
+.SC
+.SPM entry field
+.EC
+contains the full field name, including any necessary affixes.
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.
+
+See
+.F3 gd_entry
+for the history of the
+.B gd_entry_t
+structure.
 
 .SH SEE ALSO
-.BR gd_add_bit (3),
-.BR gd_add_carray (3),
-.BR gd_add_const (3),
-.BR gd_add_divide (3),
-.BR gd_add_lincom (3),
-.BR gd_add_linterp (3),
-.BR gd_add_multiply (3),
-.BR gd_add_phase (3),
-.BR gd_add_polynom (3),
-.BR gd_add_raw (3),
-.BR gd_add_recip (3),
-.BR gd_add_sbit (3),
-.BR gd_add_spec (3),
-.BR gd_add_string (3),
-.BR gd_entry (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_madd_bit (3),
-.BR gd_madd_carray (3),
-.BR gd_madd_const (3),
-.BR gd_madd_divide (3),
-.BR gd_madd_lincom (3),
-.BR gd_madd_linterp (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_spec (3),
-.BR gd_madd_string (3),
-.BR gd_metaflush (3),
-.BR gd_open (3),
-.BR dirfile-format (5)
+.F3 gd_add_bit ,
+.F3 gd_add_carray ,
+.F3 gd_add_const ,
+.F3 gd_add_divide ,
+.F3 gd_add_lincom ,
+.F3 gd_add_linterp ,
+.F3 gd_add_multiply ,
+.F3 gd_add_phase ,
+.F3 gd_add_polynom ,
+.F3 gd_add_raw ,
+.F3 gd_add_recip ,
+.F3 gd_add_sbit ,
+.F3 gd_add_spec ,
+.F3 gd_add_string ,
+.F3 gd_entry ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_madd_bit ,
+.F3 gd_madd_carray ,
+.F3 gd_madd_const ,
+.F3 gd_madd_divide ,
+.F3 gd_madd_lincom ,
+.F3 gd_madd_linterp ,
+.F3 gd_madd_multiply ,
+.F3 gd_madd_phase ,
+.F3 gd_madd_polynom ,
+.F3 gd_madd_recip ,
+.F3 gd_madd_sbit ,
+.F3 gd_madd_spec ,
+.F3 gd_madd_string ,
+.F3 gd_metaflush ,
+.F3 gd_open ,
+dirfile-format(5)
diff --git a/man/gd_add_alias.3 b/man/gd_add_alias.3
index de290ee..06709a0 100644
--- a/man/gd_add_alias.3
+++ b/man/gd_add_alias.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_add_alias.3.  The gd_add_alias man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,89 +88,94 @@
 .\" 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"
+.TH gd_add_alias 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_add_alias, gd_madd_alias \(em add a field to a dirfile
+gd_add_alias, gd_madd_alias \(em add a field to a Dirfile
+
 .SH SYNOPSIS
+.SC
 .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
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_add_alias ()
+.FN gd_add_alias
 function adds the alias named
-.I alias_name
+.ARG alias_name
 pointing to
-.I target_code
+.ARG target_code
 to the fragment indexed by
-.I fragment_index
+.ARG fragment_index
 in the dirfile specified by
-.IR dirfile .
+.ARG dirfile .
 The
-.BR gd_madd_alias ()
+.FN gd_madd_alias
 function behaves similarly, but adds the field as a meta-entry under the field
 indicated by the field code
-.IR parent .
+.ARG parent .
 
 .SH RETURN VALUE
 On success,
-.BR gd_add_alias ()
+.FN 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
+.FN gd_madd_alias
+return zero.   On error, a negative-valued error code is returned.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD 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
+.DD GD_E_BAD_CODE
+Either the
+.ARG alias_name
+was invalid: containing an invalid character or lacking the containing
+fragment's namespace or affixes, or else the
+.ARG parent
 field code was not found, or was already a metafield.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD GD_E_BAD_INDEX
 The
-.I fragment_index
+.ARG fragment_index
 specified was out of range.
-.TP
-.B GD_E_DUPLICATE
+.DD GD_E_DUPLICATE
 The
-.I alias_name
+.ARG alias_name
 parameter duplicated that of an already existing entry.
-.TP
-.B GD_E_PROTECTED
+.DD 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The functions
+.FN gd_add_alias
+and
+.FN gd_madd_alias
+appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.
 
 .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)
+.F3 gd_add ,
+.F3 gd_alias_target ,
+.F3 gd_entry ,
+.F3 gd_madd ,
+.F3 gd_metaflush ,
+.F3 gd_open ,
+dirfile-format(5)
diff --git a/man/gd_add_bit.3 b/man/gd_add_bit.3
index 5e5ae6b..1158d95 100644
--- a/man/gd_add_bit.3
+++ b/man/gd_add_bit.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_add_bit.3.  The gd_add_bit man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,18 +88,19 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_add_bit 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_add_bit 3 "25 December 2016" "Version 0.10.0" "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,
-gd_add_phase, gd_add_polynom, gd_add_raw, gd_add_recip, gd_add_sbit,
-gd_add_string
-\(em add a field to a dirfile
+gd_add_crecip, gd_add_divide, gd_add_indir, gd_add_lincom, gd_add_linterp,
+gd_add_multiply, gd_add_phase, gd_add_polynom, gd_add_raw, gd_add_recip,
+gd_add_sarray, gd_add_sbit, gd_add_sindir, gd_add_string
+\(em add a field to a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_add_bit(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "const char *" in_field ", int " bitnum ", int " numbits ,
 .BI "int " fragment_index );
@@ -53,6 +129,10 @@ gd_add_string
 .BI "const char *" in_field1 ", const char *" in_field2 ,
 .BI "int " fragment_index );
 .HP
+.BI "int gd_add_indir(DIRFILE *" dirfile ", const char *" field_name ,
+.BI "const char *" index_field ", const char *" carray_field ,
+.BI "int " fragment_index );
+.HP
 .BI "int gd_add_lincom(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "int " n_fields ", const char **" in_fields ", const double *" m ,
 .BI "const double *" b ", int " fragment_index );
@@ -69,7 +149,7 @@ gd_add_string
 .BI "int " fragment_index );
 .HP
 .BI "int gd_add_phase(DIRFILE *" dirfile ", const char *" field_name ,
-.BI "const char *" in_field ", gd_shift_t " shift ", int " fragment_index );
+.BI "const char *" in_field ", gd_int64_t " shift ", int " fragment_index );
 .HP
 .BI "int gd_add_polynom(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "int " poly_ord ", const char *" in_fields ", const double *" a ,
@@ -81,55 +161,60 @@ gd_add_string
 .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_sarray(DIRFILE *" dirfile ", const char *" field_name ,
+.BI "size_t " array_len ", const char **" values ",int " fragment_index );
+.HP
 .BI "int gd_add_sbit(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "const char *" in_field ", int " bitnum ", int " numbits ,
 .BI "int " fragment_index );
 .HP
+.BI "int gd_add_sindir(DIRFILE *" dirfile ", const char *" field_name ,
+.BI "const char *" index_field ", const char *" sarray_field ,
+.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
+.EC
+
 .SH DESCRIPTION
 These functions provide alternatives to using the
-.BR gd_add (3)
+.F3 gd_add
 or
-.BR gd_add_spec (3)
+.F3 gd_add_spec
 functions to add a new field of the indicated type to the dirfile specified by
-.IR dirfile .
+.ARG dirfile .
 .PP
 In all of these calls,
-.I field_name
+.ARG field_name
 indicates the name of the field to be added.  Further,
-.I fragment_index
+.ARG fragment_index
 is the index of the format specification fragment into which the field should be
 added.  (To convert a fragment index to its file name, see
-.BR gd_fragmentname (3).)
-The meaning and valid types of other arguments may be obtained from the
-.BR gd_entry (3)
-and
-.BR dirfile-format (5)
-manual pages.
+.F3 gd_fragmentname .)
+The meaning and allowed types of other arguments may be obtained from the
+.F3 gd_entry
+and dirfile-format(5) manual pages.
 
 The
-.BR gd_add_clincom ()
+.FN gd_add_clincom
 and
-.BR gd_add_cpolynom ()
+.FN gd_add_cpolynom
 functions are identical to
-.BR gd_add_lincom ()
+.FN gd_add_lincom
 and
-.BR gd_add_polynom (),
+.FN gd_add_polynom ,
 except they take complex scalar parameters, instead of purely real values.
 
 The
-.BR gd_add_lincom ()
+.FN gd_add_lincom
 and
-.BR gd_add_clincom ()
+.FN gd_add_clincom
 functions takes pointers to three arrays of length
-.I n_fields
+.ARG n_fields
 containing the input field names
 .RI ( in_fields ),
 the gain factors
@@ -137,35 +222,44 @@ the gain factors
 and the offset terms
 .RI ( b " or " cb ).
 Similarly,
-.BR gd_add_polynom ()
+.FN gd_add_polynom
 and
-.BR gd_add_cpolynom ()
+.FN gd_add_cpolynom
 take an array of length
-.I poly_ord
+.ARG poly_ord
 + 1
 containing the polynomial co-efficients
 .RI ( a " or " ca ).
 
 The
-.BR gd_add_string (),
-.BR gd_add_carry (),
+.FN gd_add_carray ,
+.FN gd_add_const ,
+.FN gd_add_sarray ,
 and
-.BR gd_add_const ()
+.FN gd_add_string
 functions add the field and set the value of the field to
-.IR value .
+.ARG value .
 For
-.BR gd_add_const ()
+.FN gd_add_const
 and
-.BR gd_add_carray (),
+.FN gd_add_carray ,
 the
-.I const_type
+.ARG const_type
 argument specifies the storage type for the const, while
-.I data_type
+.ARG data_type
 specifies the data type of the value pointed to by
-.IR value .
+.ARG value .
+For
+.nh
+.FN gd_add_sarray ,
+.hy
+.ARG value
+should be an array of
+.ARG array_len
+string pointers.
 
 The
-.B gd_shift_t
+.B gd_int64_t
 type is a signed 64-bit integer type.  The
 .B gd_triplet_t
 type is defined as:
@@ -187,17 +281,17 @@ Which element of this
 union to set depends on the operator selected for the
 .B WINDOW
 field.  See
-.BR gd_entry (3)
+.F3 gd_entry
 for details.
 .PP
 A metafield may be added to the dirfile either by calling these functions with
-.I field_name
+.ARG field_name
 containing the fully formed
-.IB <parent-field> / <meta-field>
+.RI """" <parent-field> / <meta-field> """"
 field code, or else by using the corresponding
 .BR gd_madd_ ...()
 function (see
-.BR gd_madd_bit (3),
+.F3 gd_madd_bit ,
 &c.) When adding a metafield with these functions,
 .I fragment_index
 is ignored and GetData will add the new metafield to the same format
@@ -208,109 +302,97 @@ substituted.
 All fields added with this interface must contain literal parameters.  Fields
 with scalar fields as parameters cannot be added with these functions.  Those
 fields must be added with
-.BR gd_add (3)
+.F3 gd_add
 or
-.BR gd_add_spec (3).
+.F3 gd_add_spec .
 
 See
 .B NOTES
 below for information on using
-.BR gd_add_clincom ()", " gd_add_cpolynom (),
+.FN gd_add_clincom ,
+.FN gd_add_cpolynom ,
 and
-.BR gd_add_crecip ()
+.FN 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
-the dirfile error is set to a non-zero error value.  Possible error values are:
-.TP 8
-.B GD_E_ACCMODE
+On success, any of these functions returns zero.   On error, a negative-valued
+error value is returned.  Possible error values are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The
 .IR field_name
 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
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_ENTRY
+.DD GD_E_BAD_ENTRY
 One or more of the field parameters specified was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD GD_E_BAD_INDEX
 The
 .IR fragment_index
 argument was out of range.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 The
 .IR data_type " or " const_type
 argument provided to
-.BR gd_add_raw "()  or " gd_add_const (),
+.FN gd_add_raw
+or
+.FN gd_add_const
 was invalid.
-.TP
-.B GD_E_DUPLICATE
+.DD GD_E_DUPLICATE
 The
 .IR field_name
 provided duplicated that of an already existing field.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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_IO
+.DD GD_E_IO
 .RB ( gd_add_raw ()
 only)  An I/O error occurred while creating an empty binary file to be
 associated with a newly added
 .B RAW
 field.
-.TP
-.B GD_E_PROTECTED
+.DD 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.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 .RB ( gd_add_raw ()
 only) The encoding scheme of the indicated format specification fragment is not
 known to the library.  As a result, the library was unable to create an empty
 binary file to be associated with a newly added
 .B RAW
 field.
-.TP
-.B GD_E_UNSUPPORTED
+.DD GD_E_UNSUPPORTED
 .RB ( gd_add_raw ()
 only) The encoding scheme of the indicated format specification fragment does
 not support creating an empty binary file to be associated with a newly added
 .B RAW
 field.
 .PP
-The dirfile error may be retrieved by calling
-.BR gd_error (3).
+The dirfile error may also be retrieved by calling
+.F3 gd_error .
 A descriptive error string for the last error encountered can be obtained from
 a call to
-.BR gd_error_string (3).
+.F3 gd_error_string .
 
 .SH NOTES
 The C89 GetData API provides different prototypes for
-.BR gd_add_clincom "(), " gd_add_cpolynom (),
+.FN gd_add_clincom ,
+.FN gd_add_cpolynom ,
 and
-.BR gd_add_crecip ():
+.FN gd_add_crecip :
 .PP
-.nf
+.SC
 .B #define GD_C89_API
 .br
 .B #include <getdata.h>
-.fi
 .HP
-.nh
-.ad l
 .BI "int gd_add_clincom(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "int " n_fields ", const char **" in_fields ", const double *" cm ,
 .BI "const double *" cb ", int " fragment_index );
@@ -322,8 +404,7 @@ and
 .BI "int gd_add_crecip(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "const char *" in_field ", const double " cdividend\fR[2] ,
 .BI "int " fragment_index );
-.hy
-.ad n
+.EC
 .PP
 In this case, the array pointers passed as
 .IR cm ", " cb
@@ -343,41 +424,89 @@ the imaginary part of the second co-efficient, and so on.  Similarly, the
 parameter becomes a double precision array of length two.
 .PP
 For
-.BR gd_add_clincom ()
+.FN gd_add_clincom
 and
-.BR gd_add_cpolynom (),
+.FN gd_add_cpolynom ,
 these are simply different (but equivalent) declarations of the C99 function
 entry point.  For
-.BR gd_add_crecip (),
+.FN gd_add_crecip ,
 however, a different entry point is needed (since the
 .I cdividend
 parameter is passed by reference instead of by value).  In the interests of
 portability, the C89 version of
-.BR gd_add_crecip ()
+.FN gd_add_crecip
 is always available, and may be accessed as
-.BR gd_add_crecip89 (),
+.FN gd_add_crecip89 ,
 with the C89 prototype, in both the C99 and C89 APIs.
 
+.SH HISTORY
+The functions
+.FN dirfile_add_bit ,
+.FN dirfile_add_const ,
+.FN dirfile_add_lincom ,
+.FN dirfile_add_linterp ,
+.FN dirfile_add_multiply ,
+.FN dirfile_add_phase ,
+.FN dirfile_add_raw ,
+and
+.FN dirfile_add_string
+appeared in GetData-0.4.0.
+
+The functions
+.FN dirfile_add_clincom ,
+.FN dirfile_add_cpolynom ,
+.FN dirfile_add_polynom ,
+and
+.FN dirfile_add_sbit
+appeared in GetData-0.6.0.
+
+In GetData-0.7.0, the functions were renamed to
+.FN gd_add_bit ,
+.FN gd_add_clincom ,
+.FN gd_add_const ,
+.FN gd_add_cpolynom ,
+.FN gd_add_lincom ,
+.FN gd_add_linterp ,
+.FN gd_add_multiply ,
+.FN gd_add_phase ,
+.FN gd_add_polynom ,
+.FN gd_add_raw ,
+.FN gd_add_sbit ,
+and
+.FN gd_add_string .
+The functions
+.FN gd_add_carray ,
+.FN gd_add_crecip ,
+.FN gd_add_divide ,
+and
+.FN gd_add_recip
+also appeared in this version.
+
+In GetData-0.8.0, these functions first allowed adding metafields by providing
+the full (slashed) field name.  The functions
+.FN gd_add_mplex
+and
+.FN gd_add_window
+also appeared in this version.
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.  The functions
+.FN gd_add_indir ,
+.FN gd_add_sarray ,
+and
+.FN gd_add_sindir
+also appeared in this version.
+
 .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),
-.BR gd_madd_carray (3),
-.BR gd_madd_const (3),
-.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)
+.F3 gd_add ,
+.F3 gd_add_spec ,
+.F3 gd_entry ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+the corresponding
+.BR gd_madd_ <entry-type>
+functions (e.g.
+.F3 gd_madd_bit ),
+.F3 gd_metaflush ,
+.F3 gd_open ,
+dirfile-format(5)
diff --git a/man/gd_add_spec.3 b/man/gd_add_spec.3
index e0c2602..191229b 100644
--- a/man/gd_add_spec.3
+++ b/man/gd_add_spec.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_add_spec.3.  The gd_add_spec man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,46 +88,46 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_add_spec 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_add_spec 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_add_spec, gd_madd_spec \(em add a field to a dirfile
+gd_add_spec, gd_madd_spec \(em add a field to a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_add_spec(DIRFILE *" dirfile ", const char *" line ,
 .BI "int " fragment_index );
 .HP
 .BI "int gd_madd_spec(DIRFILE *" dirfile ", const char *" line ,
 .BI "const char *" parent );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_add_spec ()
+.FN gd_add_spec
 function adds the field described by the field specification line in
-.I line
+.ARG line
 to the dirfile specified by
-.IR dirfile .
+.ARG dirfile .
 The
-.BR gd_madd_spec ()
+.FN gd_madd_spec
 function behaves similarly, but adds the field as a metafield under the
 field indicated by the field
-.IR parent .
-Field specification lines are described in detail in
-.BR dirfile-format (5).
+.ARG parent .
+Field specification lines are described in detail in dirfile-format(5).
 Since Standards Version 7 (see dirfile(5)) permits specifying metafield without
 the use of the
 .B /META
 directive,
-.BR gd_add_spec ()
+.FN gd_add_spec
 may also be used to add metafields, by specifying the metafield's full field
 code.  See dirfile-format(5) for full details.
 
 When using
-.BR gd_madd_spec (),
-.I line
+.FN gd_madd_spec ,
+.ARG line
 should only contain a field specification, and not a
 .B /META
 directive.
@@ -60,105 +135,95 @@ directive.
 Passing these functions a directive line instead of a field specification line
 will result in a syntax error.  These functions never call the registered
 parser callback function, even if
-.IR line 
+.ARG line 
 contains a syntax error.
 
 .SH RETURN VALUE
 On success,
-.BR gd_add_spec ()
+.FN gd_add_spec
 and
-.BR gd_madd_spec ()
-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
+.FN gd_madd_spec
+return zero.   On error, a negative-valued error code is returned.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The
-.I parent
+.ARG parent
 field code was not found, or was already a metafield.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD GD_E_BAD_INDEX
 The
-.IR fragment_index
+.ARG fragment_index
 argument was out of range.
-.TP
-.B GD_E_FORMAT
+.DD GD_E_FORMAT
 A syntax error was encountered in
-.IR line .
-.TP
-.B GD_E_IO
+.ARG line .
+.DD GD_E_IO
 An I/O error occurred while creating an empty binary file to be associated with
 a newly added
 .B RAW
 field.
-.TP
-.B GD_E_LINE_TOO_LONG
+.DD GD_E_LINE_TOO_LONG
 The supplied
-.I line
-was longer than the parser was able to deal with.  Lines are limited by the
-storage size of
-.BR ssize_t .
-On 32-bit systems, this limits
-.I line
-to 2**31 bytes.  The limit is larger on 64-bit systems.
-.TP
-.B GD_E_PROTECTED
+.ARG line
+was longer than the parser was able to deal with.  Line lengths are limited by
+the storage size of
+.BR size_t .
+.DD 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.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 The encoding scheme of the indicated format specification fragment is not known
 to the library.  As a result, the library was unable to create an empty binary
 file to be associated with a newly added
 .B RAW
 field.
-.TP
-.B GD_E_UNSUPPORTED
+.DD GD_E_UNSUPPORTED
 The encoding scheme of the indicated format specification fragment does not
 support creating an empty binary file to be associated with a newly added
 .B RAW
 field.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The functions
+.FN dirfile_add_spec
+and
+.FN dirfile_madd_spec
+appeared in GetData-0.4.0.
+
+In GetData-0.7.0, these functions were renamed to
+.FN gd_add_spec
+and
+.FN gd_madd_spec .
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_add (3),
-.BR gd_add_bit (3),
-.BR gd_add_carray (3),
-.BR gd_add_const (3),
-.BR gd_add_divide (3),
-.BR gd_add_lincom (3),
-.BR gd_add_linterp (3),
-.BR gd_add_multiply (3),
-.BR gd_add_phase (3),
-.BR gd_add_recip (3),
-.BR gd_add_raw (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_madd (3),
-.BR gd_madd_bit (3),
-.BR gd_madd_carray (3),
-.BR gd_madd_const (3),
-.BR gd_madd_divide (3),
-.BR gd_madd_lincom (3),
-.BR gd_madd_linterp (3),
-.BR gd_madd_multiply (3),
-.BR gd_madd_phase (3),
-.BR gd_madd_polynom (3),
-.BR gd_madd_recip (3),
-.BR gd_madd_string (3),
-.BR gd_metaflush (3),
-.BR gd_open (3),
-.BR dirfile-format (5)
+.F3 gd_add ,
+all the
+.BR gd_add_ <entry-type>
+functions (e.g.,
+.F3 gd_add_bit ),
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_madd ,
+all the
+.BR gd_madd_ <entry-type>
+functions (e.g.,
+.F3 gd_madd_bit ),
+.F3 gd_metaflush ,
+.F3 gd_open ,
+dirfile-format(5)
diff --git a/man/gd_alias_target.3 b/man/gd_alias_target.3
index 9565130..7737bd5 100644
--- a/man/gd_alias_target.3
+++ b/man/gd_alias_target.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_alias_target.3.  The gd_alias_target man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,69 +88,74 @@
 .\" 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"
+.TH gd_alias_target 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_alias_target \(em return the target of an alias defined in a dirfile database
+gd_alias_target \(em determine the target of an alias defined in a Dirfile
+database
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "const char *gd_alias_target(DIRFILE *" dirfile ,
 .BI "const char *" alias_name );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_alias_target ()
+.FN 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 .
+.ARG dirfile
+and determines the target field code of the alias specified by
+.ARG alias_name .
 
 The
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 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 ,
+.ARG alias_name ,
 pass it to
-.BR gd_entry (3)
+.F3 gd_entry
 and inspect the
-.I field
+.ARG field
 member of the gd_entry_t structure returned.
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_alias_target ()
+.FN 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 ()
+.FN 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
+.DD GD_E_BAD_CODE
 The name
-.I alias_name
+.ARG 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
+.DD GD_E_BAD_FIELD_TYPE
 The entry specified by
-.I alias_name
+.ARG alias_name
 was not an alias.
 .PP
 The dirfile error may be retrieved by calling
-.BR gd_error (3).
+.F3 gd_error .
 A descriptive error string for the last error encountered can be obtained from
 a call to
-.BR gd_error_string (3).
+.F3 gd_error_string .
+
+.SH HISTORY
+The function
+.FN gd_alias_target
+appeared in GetData-0.8.0.
 
 .SH SEE ALSO
-.BR gd_aliases (3),
-.BR gd_entry (3),
-.BR gd_open (3),
-.BR dirfile (5)
+.F3 gd_aliases ,
+.F3 gd_entry ,
+.F3 gd_open ,
+dirfile(5)
diff --git a/man/gd_aliases.3 b/man/gd_aliases.3
index 1a476a4..fc8365c 100644
--- a/man/gd_aliases.3
+++ b/man/gd_aliases.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_aliases.3.  The gd_aliases man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,72 +88,76 @@
 .\" 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"
+.TH gd_aliases 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_aliases \(em retrieve a list of aliases for a field in a dirfile database
+gd_aliases \(em retrieve a list of aliases for a field in a Dirfile database
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "const char **gd_aliases(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_aliases ()
+.FN gd_aliases
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and returns a read-only list of aliases of the field specified by
-.IR field_code .
+.ARG field_code .
 
 The
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 The array returned will be de-allocated by a call to
-.BR gd_close (3)
+.F3 gd_close
 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).
+.F3 gd_naliases .
 
 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 ()
+.FN gd_aliases
 is called again with the same arguments, or until the array is de-allocated by
 a call to
-.BR gd_close (3).
+.F3 gd_close .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_aliases ()
+.FN 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 .
+.ARG 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
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The specified field code was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
 .PP
 The dirfile error may be retrieved by calling
-.BR gd_error (3).
+.F3 gd_error .
 A descriptive error string for the last error encountered can be obtained from
 a call to
-.BR gd_error_string (3).
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_aliases
+function appeared in GetData-0.8.0.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_open (3),
-.BR gd_alias_target (3),
-.BR gd_naliases (3)
+.F3 gd_open ,
+.F3 gd_alias_target ,
+.F3 gd_naliases ,
+dirfile(5)
diff --git a/man/gd_alloc_funcs.3 b/man/gd_alloc_funcs.3
new file mode 100644
index 0000000..8c3cdc5
--- /dev/null
+++ b/man/gd_alloc_funcs.3
@@ -0,0 +1,164 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
+.\" gd_alloc_funcs.3.  The gd_alloc_funcs man page.
+.\"
+.\" Copyright (C) 2016 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_alloc_funcs 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_alloc_funcs \(em specify an alternate memory manager for GetData's use
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "void gd_alloc_funcs(void *(*" malloc_func ")(size_t),
+.BI "void (*" free_func )(void*));
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_alloc_funcs
+allows the caller to specify an alternate memory manager for GetData to use
+when providing dynamically allocated data to the caller.  The caller should
+specify pointers to two functions which mimic the behaviour of the Standard
+Library's
+.F3 malloc
+and
+.F3 free
+functions.  Passing NULL is equivalent to passing a pointer to the
+corresponding Standard Library function, so the default memory manager can be
+restored by passing all NULLs to this function.
+
+The functions
+.F3 gd_entry ,
+.F3 gd_error_string ,
+.F3 gd_fragment_affixes ,
+.F3 gd_linterp_tablename ,
+.F3 gd_raw_filename ,
+and
+.F3 gd_strtok
+will use
+.ARG malloc_func
+to allocate the buffers they return.  The function
+.F3 gd_free_entry_strings
+will use the specified
+.ARG free_func
+to deallocate entry strings, and that same function will also be used by
+GetData to deallocate strings returned by any registered parser callback
+function (see
+.F3 gd_cbopen ).
+
+Internally, GetData may still allocate buffers on a different heap, and the
+caller should not assume that any other pointer returned by the library were
+allocated with the functions specified by this function.  Neither should the
+caller assume that these functions won't be used by GetData library functions
+to allocate and deallocate temporary buffers.
+
+Changes made to the memory manager are global across GetData.  The caller should
+only call this function when it is certain that no object allocated with the
+old memory manager still exists.
+
+This function always succeeds and returns no value.
+
+.SH HISTORY
+The
+.FN gd_alloc_funcs
+function appeared in GetData-0.10.0.
+
+.SH SEE ALSO
+.F3 free ,
+.F3 gd_cbopen ,
+.F3 gd_entry ,
+.F3 gd_error_string ,
+.F3 gd_fragment_affixes ,
+.F3 gd_free_entry_strings
+.F3 gd_linterp_tablename ,
+.F3 gd_raw_filename ,
+.F3 gd_strtok ,
+.F3 malloc
diff --git a/man/gd_alter_affixes.3 b/man/gd_alter_affixes.3
index 3c0b890..b908f9f 100644
--- a/man/gd_alter_affixes.3
+++ b/man/gd_alter_affixes.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_alter_affixes.3.  The gd_alter_affixes man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016, 2017 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,100 +88,114 @@
 .\" 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"
+.TH gd_alter_affixes 3 "27 January 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_alter_affixes \(em modify the field affixes of a fragments in a dirfile
+gd_alter_affixes \(em modify the field affixes of a fragments in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .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
+.EC
+
 .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
+.FN gd_alter_affixes
+function sets the root namespace, field prefix and suffix of fields defined in
+the format specification fragment given by
+.ARG fragment_index
 to
-.I prefix
+.ARG prefix
 and
-.I suffix
+.ARG suffix
 in the dirfile(5) database specified by
-.IR dirfile .
+.ARG dirfile .
+
+The
+.ARG prefix
+may contain a root namespace for the fragment, separated from the prefix by a
+dot
+.RB ( . ).
+If it does not contain a namespace, the fragment's root namespace is not
+changed.  To remove a root namespace, explicitly specify the null namespace via
+a leading dot in
+.ARG prefix .
 
-The field prefix and suffix are appended to all field codes found in the
+The field prefix and suffix are affixed 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
+.FN gd_alter_affixes .
+If
+.ARG prefix
 or
-.I suffix
+.ARG 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
+.ARG fragment_index
 may not be zero).
 
 The
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .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
+.FN gd_alter_affixes
+returns zero.  On error, it returns a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The supplied
-.I prefix
+.ARG prefix
 or
-.I suffix
+.ARG suffix
 contained invalid characters.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD GD_E_BAD_INDEX
 The supplied index was out of range.
-.TP
-.B GD_E_DUPLICATE
+.DD GD_E_DUPLICATE
 The supplied affixes would result in one or more field codes duplicating an
 existing field code.
-.TP
-.B GD_E_PROTECTED
+.DD 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".
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH NOTES
+The function
+.F3 gd_fragment_namespace
+can also be used to modify the root namespace.
+
+.SH HISTORY
+The function
+.FN gd_alter_affixes
+appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .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)
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_fragment_affixes ,
+.F3 gd_include_affix ,
+.F3 gd_open ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_alter_bit.3 b/man/gd_alter_bit.3
index e6c45ef..90025fd 100644
--- a/man/gd_alter_bit.3
+++ b/man/gd_alter_bit.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_alter_bit.3.  The gd_alter_bit man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,18 +88,20 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_alter_bit 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_alter_bit 3 "25 December 2016" "Version 0.10.0" "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,
-gd_alter_linterp, gd_alter_multiply, gd_alter_phase, gd_alter_polynom,
-gd_alter_raw, gd_alter_recip, gd_alter_sbit
-\(em modify a field in a dirfile
+gd_alter_cpolynom, gd_alter_crecip, gd_alter_divide, gd_alter_indir,
+gd_alter_lincom, gd_alter_linterp, gd_alter_multiply, gd_alter_phase,
+gd_alter_polynom, gd_alter_raw, gd_alter_recip, gd_alter_sarray, gd_alter_sbit,
+gd_alter_sindir
+\(em modify a field in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_alter_bit(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "const char *" in_field ", int " bitnum ", int " numbits );
 .HP
@@ -47,6 +124,9 @@ gd_alter_raw, gd_alter_recip, gd_alter_sbit
 .BI "int gd_alter_divide(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "const char *" in_field1 ", const char *" in_field2 );
 .HP
+.BI "int gd_alter_indir(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "const char *" index_field ", const char *" carray_field );
+.HP
 .BI "int gd_alter_lincom(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "int " n_fields ", const char **" in_fields ", const double *" m ,
 .BI "const double *" b );
@@ -62,7 +142,7 @@ gd_alter_raw, gd_alter_recip, gd_alter_sbit
 .BI "const char *" in_field1 ", const char *" in_field2 );
 .HP
 .BI "int gd_alter_phase(DIRFILE *" dirfile ", const char *" field_code ,
-.BI "const char *" in_field ", gd_shift_t " shift );
+.BI "const char *" in_field ", gd_int64_t " shift );
 .HP
 .BI "int gd_alter_polynom(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "int " poly_ord ", const char *" in_field ", const double *" ca );
@@ -73,31 +153,37 @@ gd_alter_raw, gd_alter_recip, gd_alter_sbit
 .BI "int gd_alter_recip(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "const char *" in_field ", double " dividend );
 .HP
+.BI "int gd_alter_sarray(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "size_t " array_len );
+.HP
 .BI "int gd_alter_sbit(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "const char *" in_field ", int " bitnum ", int " numbits );
 .HP
+.BI "int gd_alter_sindir(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "const char *" index_field ", const char *" sarray_field );
+.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
+.EC
+
 .SH DESCRIPTION
 These functions provide alternatives to using the
-.BR gd_alter_entry (3)
+.F3 gd_alter_entry
 function to modify a field of the indicated type in the dirfile specified by
-.IR dirfile .
+.ARG dirfile .
 .PP
 In all of these calls,
-.I field_code
+.ARG field_code
 indicates the the field to be modified, which may be a regular field, or a
 metafield specified by its full (slashed) field code, but should not contain a
 representation suffix.  The meaning and valid
 types of other arguments may be obtained from the
-.BR get_entry (3)
+.F3 get_entry
 and
-.BR dirfile-format (5)
+dirfile-format(5)
 manual pages.  The
-.B gd_shift_t
+.B gd_int64_t
 type is a signed 64-bit integer type.  The
 .B gd_triplet_t
 type is defined as:
@@ -119,17 +205,17 @@ Which element of this
 union to set depends on the operator selected for the
 .B WINDOW
 field.  See
-.BR gd_entry (3)
+.F3 gd_entry
 for details.
 
 The
-.BR gd_alter_clincom ()
+.FN gd_alter_clincom
 and
-.BR gd_alter_cpolynom ()
+.FN gd_alter_cpolynom
 functions are identical to
-.BR gd_alter_lincom ()
+.FN gd_alter_lincom
 and
-.BR gd_alter_polynom (),
+.FN gd_alter_polynom ,
 except they take complex scalar parameters, instead of purely real values.  This
 only matters for the input of
 .I new
@@ -139,11 +225,11 @@ used interchangeably, regardless of whether the altered field has complex scalar
 parameters or not.
 
 If the corresponding parameters are to be changed, the
-.BR gd_alter_lincom ()
+.FN gd_alter_lincom
 and
-.BR gd_alter_clincom ()
+.FN gd_alter_clincom
 functions take pointers to three arrays of length
-.I n_fields
+.ARG n_fields
 containing the input field names
 .RI ( in_fields ),
 the gain factors
@@ -151,151 +237,139 @@ the gain factors
 and the offset terms
 .RI ( b " or " cb ).
 Similarly,
-.BR gd_alter_polynom ()
+.FN gd_alter_polynom
 and
-.BR gd_alter_cpolynom ()
+.FN gd_alter_cpolynom
 take an array of length
-.I poly_ord
+.ARG poly_ord
 + 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.  These special values are:
-.TP
-.B NULL\fR:
+.DD NULL\fR:
 any of the string parameters, also 
 .IR m ", " b ", " a ", " cm ", " cb ", or " ca ;
-.TP
-.B 0\fR:
+.DD 0\fR:
 .IR spf ", " n_fields ", " numbits ", " cdividend ", " dividend ", or " array_len ;
-.TP
-.B -1\fR:
+.DD -1\fR:
 .IR bitnum " or " period ;
-.TP
-.B GD_NULL\fR:
+.DD GD_NULL\fR:
 .IR data_type " or " const_type ;
-.TP
-.B GD_WINDOP_UNK\fR:
-.IR windop .
+.DD GD_WINDOP_UNK\fR:
+.ARG 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
-.BR gd_alter_entry (3),
-.BR gd_alter_spec (3)
+.F3 gd_alter_entry ,
+.F3 gd_alter_spec
 or
-.BR gd_malter_spec (3),
+.F3 gd_malter_spec ,
 as appropriate.
 
 If
-.I rename_table
+.ARG rename_table
 is non-zero, the look-up table referenced by the
 .B LINTERP
 field will be renamed to the path given by
-.IR table .
+.ARG table .
 If
-.I recode
+.ARG recode
 is non-zero, the binary file associated with the
 .B RAW
 field will be re-encoded to reflect the new field parameters.  In this case,
 the field's I/O pointer will be reset to the beginning-of-frame.
 
 If
-.BR gd_alter_carray ()
+.FN gd_alter_carray
 is used to increase the length of a
 .B CARRAY
 field, the added elements will be uninitialised.  Use
-.BR gd_put_carray_slice (3)
-or equivalent to initialise them.
+.F3 gd_put_carray_slice
+or equivalent to initialise them.  Similarly, increasing the length of a
+.B SARRAY
+with
+.FN gd_alter_sarray
+will set the added elements to the empty string ("").  Use
+.F3 gd_put_sarray_slice
+or equivalent to modify them.
 
 See
 .B NOTES
 below for information on using
 .BR gd_alter_clincom "(), " gd_alter_crecip (),
 and 
-.BR gd_alter_cpolynom ()
+.FN gd_alter_cpolynom
 in the C89 GetData API.
 
 .SH RETURN VALUE
-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
+On success, these functions return zero.  On error, a negative-valued error
+code is returned.  Possible error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found, or a supplied field code did not contain the appropriate prefix
 or suffix.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_ENTRY
+.DD GD_E_BAD_ENTRY
 One or more of the field parameters specified was invalid.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 The field specified by
-.I field_code
+.ARG field_code
 was of the wrong type for the function called.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 The
-.IR data_type " or " const_type
+.ARG data_type
+.ARG const_type
 argument was invalid.
-.TP
-.B GD_E_IO
+.DD GD_E_IO
 An I/O error occurred while translating the binary file associated with a
 modified
 .B RAW
 field, or an I/O error occurred while attempting to rename a
 .B LINTERP
 table file.
-.TP
-.B GD_E_PROTECTED
+.DD GD_E_PROTECTED
 The metadata of the fragment was protected from change.  Or, a request to
 translate the binary file associated with a
 .B RAW
 field was attempted, but the data of the fragment was protected.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 The encoding scheme of the indicated format specification fragment is not known
 to the library.  As a result, the library was unable to translate the binary
 file be associated with a modified
 .B RAW
 field.
-.TP
-.B GD_E_UNSUPPORTED
+.DD GD_E_UNSUPPORTED
 The encoding scheme of the indicated format specification fragment does not
 support translating the binary file associated with a modified
 .B RAW
 field.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after these functions return by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
 
 .SH NOTES
 The C89 GetData API provides different prototypes for
 .BR gd_alter_clincom "(), " gd_alter_cpolynom (),
 and
-.BR gd_alter_crecip ():
+.FN gd_alter_crecip :
 .PP
-.nf
+.SC
 .B #define GD_C89_API
 .br
 .B #include <getdata.h>
-.fi
 .HP
-.nh
-.ad l
 .BI "int gd_alter_clincom(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "int " n_fields ", const char **" in_fields ", const double *" cm ,
 .BI "const double *" cb );
@@ -305,52 +379,109 @@ and
 .HP
 .BI "int gd_alter_crecip(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "const char *" in_field ", const double " cdividend\fR[2] );
-.hy
-.ad n
+.EC
 .PP
 In this case, the array pointers passed as
-.IR cm ", " cb
+.ARG cm ,
+.ARG cb
 or
-.IR ca
+.ARG ca
 should have twice as many (purely real) elements, consisting of alternating
 real and imaginary parts for the complex data.  That is, for example,
-.IR ca [0]
+.ARG ca [0]
 should be the real part of the first co-efficient,
-.IR ca [1]
+.ARG ca [1]
 the imaginary part of the first co-efficient,
-.IR ca [2]
+.ARG ca [2]
 the real part of the second co-efficient,
-.IR ca [3]
+.ARG ca [3]
 the imaginary part of the second co-efficient, and so on.  Similarly, the
-.I cdividend
+.ARG cdividend
 parameter becomes a double precision array of length two.
 .PP
 For
-.BR gd_alter_clincom ()
+.FN gd_alter_clincom
 and
-.BR gd_alter_cpolynom (),
+.FN gd_alter_cpolynom ,
 these are simply different (but equivalent) declarations of the C99 function
 entry point.  For
-.BR gd_alter_crecip (),
+.FN gd_alter_crecip ,
 however, a different entry point is needed (since the
-.I cdividend
+.ARG cdividend
 parameter is passed by reference instead of by value).  In the interests of
 portability, the C89 version of
-.BR gd_alter_crecip ()
+.FN gd_alter_crecip
 is always available, and may be accessed as
-.BR gd_alter_crecip89 (),
+.FN gd_alter_crecip89 ,
 with the C89 prototype, in both the C99 and C89 APIs.  Passing NULL as
-.I cdividend
+.ARG cdividend
 is equivalent to specifying a dividend of zero: it indicates no change to the
 dividend parameter.
 
+.SH HISTORY
+The functions
+.FN dirfile_alter_bit ,
+.FN dirfile_alter_const ,
+.FN dirfile_alter_lincom ,
+.FN dirfile_alter_linterp ,
+.FN dirfile_alter_multiply ,
+.FN dirfile_alter_phase ,
+and
+.FN dirfile_alter_raw
+appeared in GetData-0.5.0.
+
+The functions
+.FN dirfile_alter_clincom ,
+.FN dirfile_alter_cpolynom ,
+.FN dirfile_alter_polynom ,
+and
+.FN dirfile_alter_sbit
+appeared in GetData-0.6.0.
+
+In GetData-0.7.0, the functions were renamed to
+.FN gd_alter_bit ,
+.FN gd_alter_clincom ,
+.FN gd_alter_const ,
+.FN gd_alter_cpolynom ,
+.FN gd_alter_lincom ,
+.FN gd_alter_linterp ,
+.FN gd_alter_multiply ,
+.FN gd_alter_phase ,
+.FN gd_alter_polynom ,
+.FN gd_alter_raw ,
+and
+.FN gd_alter_sbit .
+The functions
+.FN gd_alter_carray ,
+.FN gd_alter_crecip ,
+.FN gd_alter_crecip89 ,
+.FN gd_alter_divide ,
+and
+.FN gd_alter_recip
+also appeared in this version.
+
+The functions
+.FN gd_alter_mplex
+and
+.FN gd_alter_window
+appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.  The functions
+.FN gd_alter_indir ,
+.FN gd_alter_sarray ,
+and
+.FN gd_alter_sindir
+also appeared in this version.
+
 .SH SEE ALSO
-.BR gd_alter_entry (3),
-.BR gd_alter_spec (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_malter_spec (3),
-.BR gd_metaflush (3),
-.BR gd_open (3),
-.BR gd_put_carray_slice (3),
-.BR dirfile-format (5)
+.F3 gd_alter_entry ,
+.F3 gd_alter_spec ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_malter_spec ,
+.F3 gd_metaflush ,
+.F3 gd_open ,
+.F3 gd_put_carray_slice ,
+.F3 gd_put_sarray_slice ,
+dirfile-format(5)
diff --git a/man/gd_alter_encoding.3.in b/man/gd_alter_encoding.3.in
deleted file mode 100644
index ca1ce57..0000000
--- a/man/gd_alter_encoding.3.in
+++ /dev/null
@@ -1,153 +0,0 @@
-.\" gd_alter_encoding.3.in.  The gd_alter_encoding man page.
-.\"
-.\" @configure_input@
-.\"
-.\" Copyright (C) 2008, 2009, 2010, 2014 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_encoding 3 "16 October 2014" "Version 0.9.0" "GETDATA"
-.SH NAME
-gd_alter_encoding \(em modify the binary encoding of data in a dirfile
-.SH SYNOPSIS
-.B #include <getdata.h>
-.HP
-.nh
-.ad l
-.BI "int gd_alter_encoding(DIRFILE *" dirfile ", unsigned int " encoding ,
-.BI "int " fragment_index ", int " recode );
-.hy
-.ad n
-.SH DESCRIPTION
-The
-.BR gd_alter_encoding ()
-function sets the binary encoding of the format specification fragment given by
-.I fragment_index
-to the encoding specified by
-.I encoding
-in the dirfile(5) database specified by
-.IR dirfile .
-The binary encoding of a fragment indicate the encoding of data stored in binary
-files associated with
-.B RAW
-fields defined in the specified fragment.  The binary encoding of a fragment containing
-no
-.B RAW
-fields is ignored.
-
-The
-.I encoding
-argument should be one of the following:
-.IP
-.nh
-.ad l
-.BR GD_UNENCODED ,\~ GD_BZIP2_ENCODED ,\~ GD_GZIP_ENCODED ,\~
-.BR GD_LZMA_ENCODED ,\~ GD_SLIM_ENCODED  ,\~ GD_SIE_ENCODED ,\~
-.BR GD_TEXT_ENCODED .
-.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.
-.PP
-In addition to being simply a valid fragment index,
-.I fragment_index
-may also be the special value
-.BR GD_ALL_FRAGMENTS ,
-which indicates that the encoding of all fragments in the database should
-be changed.
-
-If the
-.I recode
-argument is non-zero, this call will recode the binary data of affected
-.B RAW
-fields to account for the change in binary encoding.  If the encoding of the
-fragment is encoding insensitive, or if the data type is only one byte in
-size, no change is made.  The I/O pointer of all affected
-.B RAW
-fields is reset to the beginning-of-frame.
-
-If
-.I recode
-is zero, affected binary files are left untouched.
-
-.SH RETURN VALUE
-Upon successful completion,
-.BR gd_alter_encoding ()
-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_DIRFILE
-The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
-The supplied index was out of range.
-.TP
-.B GD_E_IO
-An I/O error occurred while attempting to recode a binary file.
-.TP
-.B GD_E_PROTECTED
-The metadata of the given format specification fragment was protected from
-change, or the binary data of the fragment was protected from change and binary
-file recoding was requested.
-.TP
-.B GD_E_UNCLEAN_DB
-An error occurred while moving the recoded file into place.  As a result, the
-database may be in an unclean state.  See the
-.B NOTES
-section below for recovery instructions.  In this case, the dirfile will be
-flagged as invalid, to prevent further database corruption.  It should be
-immediately closed.
-.TP
-.B GD_E_UNKNOWN_ENCODING
-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.
-.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 NOTES
-A binary file recoding occurs out-of-place.  As a result, sufficient space
-must be present on the filesystem for the binary files of all
-.B RAW
-fields in the fragment both before and after translation.  If all fragments
-are updated by specifying
-.BR GD_ALL_FRAGMENTS ,
-the recoding occurs one fragment at a time.
-
-An error code of
-.B GD_E_UNCLEAN_DB
-indicates a system error occurred while moving the re-encoded binary data into
-place or when deleting the old data.  If this happens, the database may be left
-in an unclean state.  The caller should check the filesystem directly to
-ascertain the state of the dirfile data before continuing.  For recovery
-instructions, see the file
- at absolute_docdir@/unclean_database_recovery.txt.
-.SH SEE ALSO
-.BR gd_cbopen (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_encoding (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
diff --git a/man/gd_alter_encoding.3in.in b/man/gd_alter_encoding.3in.in
new file mode 100644
index 0000000..09c8906
--- /dev/null
+++ b/man/gd_alter_encoding.3in.in
@@ -0,0 +1,162 @@
+.\" gd_alter_encoding.3.in.  The gd_alter_encoding man page.
+.\"
+.\" @configure_input@
+.\"
+.\" Copyright (C) 2008, 2009, 2010, 2014, 2016 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_encoding 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_alter_encoding \(em modify the binary encoding of data in a Dirfile
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "int gd_alter_encoding(DIRFILE *" dirfile ", unsigned int " encoding ,
+.BI "int " fragment_index ", int " recode );
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_alter_encoding
+function sets the binary encoding of the format specification fragment given by
+.ARG fragment_index
+to the encoding specified by
+.ARG encoding
+in the dirfile(5) database specified by
+.ARG dirfile .
+The binary encoding of a fragment indicate the encoding of data stored in binary
+files associated with
+.B RAW
+fields defined in the specified fragment.  The binary encoding of a fragment containing
+no
+.B RAW
+fields is ignored.
+
+The
+.ARG encoding
+argument should be one of the following symbols:
+.IP
+.SC
+.BR GD_UNENCODED ,
+.BR GD_BZIP2_ENCODED ,
+.BR GD_FLAC_ENCODED ,
+.BR GD_GZIP_ENCODED ,
+.BR GD_LZMA_ENCODED ,
+.BR GD_SLIM_ENCODED ,
+.BR GD_SIE_ENCODED ,
+.BR GD_TEXT_ENCODED .
+.EC
+.PP
+See
+.F3 gd_open
+and dirfile-encoding(5) for the meanings of these symbols and details on the
+supported encoding schemes.
+.PP
+In addition to being simply a valid fragment index,
+.ARG fragment_index
+may also be the special value
+.BR GD_ALL_FRAGMENTS ,
+which indicates that the encoding of all fragments in the database should
+be changed.
+
+If the
+.ARG recode
+argument is non-zero, this call will recode the binary data of affected
+.B RAW
+fields to account for the change in binary encoding.  If the encoding of the
+fragment is encoding insensitive, or if the data type is only one byte in
+size, no change is made.  The I/O pointer of all affected
+.B RAW
+fields is reset to the beginning-of-frame.
+
+If
+.ARG recode
+is zero, affected binary files are left untouched.
+
+.SH RETURN VALUE
+Upon successful completion,
+.FN gd_alter_encoding
+returns zero.  On error, it returns a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ACCMODE
+The specified dirfile was opened read-only.
+.DD GD_E_ALLOC
+The library was unable to allocate memory.
+.DD GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.DD GD_E_BAD_INDEX
+The supplied index was out of range.
+.DD GD_E_IO
+An I/O error occurred while attempting to recode a binary file.
+.DD GD_E_PROTECTED
+The metadata of the given format specification fragment was protected from
+change, or the binary data of the fragment was protected from change and binary
+file recoding was requested.
+.DD GD_E_UNCLEAN_DB
+An error occurred while moving the recoded file into place.  As a result, the
+database may be in an unclean state.  See the
+.B NOTES
+section below for recovery instructions.  In this case, the dirfile will be
+flagged as invalid, to prevent further database corruption.  It should be
+immediately closed.
+.DD GD_E_UNKNOWN_ENCODING
+The encoding scheme of the fragment is unknown.
+.DD GD_E_UNSUPPORTED
+The encoding scheme of the fragment does not support binary file recoding.
+.PP
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH NOTES
+A binary file recoding occurs out-of-place.  As a result, sufficient space
+must be present on the filesystem for the binary files of all
+.B RAW
+fields in the fragment both before and after translation.  If all fragments
+are updated by specifying
+.BR GD_ALL_FRAGMENTS ,
+the recoding occurs one fragment at a time.
+
+An error code of
+.B GD_E_UNCLEAN_DB
+indicates a system error occurred while moving the re-encoded binary data into
+place or when deleting the old data.  If this happens, the database may be left
+in an unclean state.  The caller should check the filesystem directly to
+ascertain the state of the dirfile data before continuing.  For recovery
+instructions, see the file
+ at absolute_docdir@/unclean_database_recovery.txt.
+
+.SH HISTORY
+The function
+.FN dirfile_alter_encoding
+appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_alter_encoding .
+
+in GetData-0.10.0, the error return from this function changed from -1 to
+a negative-valued error code.
+
+.SH SEE ALSO
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_encoding ,
+.F3 gd_open ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_alter_endianness.3.in b/man/gd_alter_endianness.3.in
deleted file mode 100644
index 004e425..0000000
--- a/man/gd_alter_endianness.3.in
+++ /dev/null
@@ -1,167 +0,0 @@
-.\" gd_alter_endianness.3.  The gd_alter_endianness man page.
-.\"
-.\" @configure_input@
-.\"
-.\" Copyright (C) 2008, 2010, 2012, 2014 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_endianness 3 "16 October 2014" "Version 0.9.0" "GETDATA"
-.SH NAME
-gd_alter_endianness \(em modify the byte sex of fields in a dirfile
-.SH SYNOPSIS
-.B #include <getdata.h>
-.HP
-.nh
-.ad l
-.BI "int gd_alter_endianness(DIRFILE *" dirfile ", unsigned long"
-.IB byte_sex ", int " fragment_index ", int " recode );
-.hy
-.ad n
-.SH DESCRIPTION
-The
-.BR gd_alter_endianness ()
-function sets the byte sex of the format specification fragment given by
-.I fragment_index
-to
-.I byte_sex
-in the dirfile(5) database specified by
-.IR dirfile .
-The byte sex of a fragment indicate the endianness of data stored in binary
-files associated with
-.B RAW
-fields defined in the specified fragment.  The byte sex of a fragment containing
-no
-.B RAW
-fields is ignored.
-
-The
-.I byte_sex
-argument should be one of the following:
-.TP
-.BR 0 " (zero)"
-Indicating that the byte sex should be the native endianness of the host,
-whichever that may be.
-.TP
-.B GD_BIG_ENDIAN
-Indicating that the byte sex should be big endian.
-.TP
-.B GD_LITTLE_ENDIAN
-Indicating that the byte sex should be little endian.
-.TP
-.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.
-.PP
-Furthermore, any of these may be bitwise or'd
-with
-.B GD_ARM_ENDIAN
-or
-.B GD_NOT_ARM_ENDIAN
-indicating that the floating point data are stored in the ARM middle-endian
-format.
-.PP
-In addition to being simply a valid fragment index,
-.I fragment_index
-may also be the special value
-.BR GD_ALL_FRAGMENTS ,
-which indicates that the byte sex of all fragments in the database should
-be changed.
-
-If the
-.I recode
-argument is non-zero, this call will byte swap the binary data of affected
-.B RAW
-fields to account for the change in byte sex.  If the encoding of the
-fragment is endianness insensitive, or if the data type is only one byte in
-size, no change is made.  The I/O pointer of all affected
-.B RAW
-fields is reset to the beginning-of-frame.
-
-If
-.I recode
-is zero, affected binary files are left untouched.
-
-.SH RETURN VALUE
-Upon successful completion,
-.BR gd_alter_endianness ()
-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_ARGUMENT
-The supplied
-.I byte_sex
-was invalid.
-.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_IO
-An I/O error occurred while attempting to byte swap a binary file.
-.TP
-.B GD_E_PROTECTED
-The metadata of the indicated format specification fragment was protected from
-change, or the binary data of the fragment was protected from change and binary
-file byte swapping was requested.
-.TP
-.B GD_E_UNCLEAN_DB
-An error occurred while moving the byte-swapped file into place.  As a result,
-the database may be in an unclean state.  See the
-.B NOTES
-section below for recovery instructions.  In this case, the dirfile will be
-flagged as invalid, to prevent further database corruption.  It should be
-immediately closed.
-.TP
-.B GD_E_UNKNOWN_ENCODING
-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.
-.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 NOTES
-A binary file byte swap occurs out-of-place.  As a result, sufficient space
-must be present on the filesystem for the binary files of all
-.B RAW
-fields in the fragment both before and after translation.  If all fragments
-are updated by specifying
-.BR GD_ALL_FRAGMENTS ,
-the byte swapping occurs one fragment at a time.
-
-An error code of
-.B GD_E_UNCLEAN_DB
-indicates a system error occurred while moving the byte-swapped binary data into
-place or when deleting the old data.  If this happens, the database may be left
-in an unclean state.  The caller should check the filesystem directly to
-ascertain the state of the dirfile data before continuing.  For recovery
-instructions, see the file
- at absolute_docdir@/unclean_database_recovery.txt.
-.SH SEE ALSO
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_endianness (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
diff --git a/man/gd_alter_endianness.3in.in b/man/gd_alter_endianness.3in.in
new file mode 100644
index 0000000..25e784c
--- /dev/null
+++ b/man/gd_alter_endianness.3in.in
@@ -0,0 +1,174 @@
+.\" gd_alter_endianness.3.  The gd_alter_endianness man page.
+.\"
+.\" @configure_input@
+.\"
+.\" Copyright (C) 2008, 2010, 2012, 2014, 2016 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_endianness 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_alter_endianness \(em modify the byte sex of fields in a Dirfile
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "int gd_alter_endianness(DIRFILE *" dirfile ", unsigned long"
+.IB byte_sex ", int " fragment_index ", int " recode );
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_alter_endianness
+function sets the byte sex of the format specification fragment given by
+.ARG fragment_index
+to
+.ARG byte_sex
+in the dirfile(5) database specified by
+.ARG dirfile .
+The byte sex of a fragment indicate the endianness of data stored in binary
+files associated with
+.B RAW
+fields defined in the specified fragment.  The byte sex of a fragment containing
+no
+.B RAW
+fields is ignored.
+
+The
+.ARG byte_sex
+argument should be one of the following:
+.DD "0\fR (zero)"
+Indicating that the byte sex should be the native endianness of the host,
+whichever that may be.
+.DD GD_BIG_ENDIAN
+Indicating that the byte sex should be big endian.
+.DD GD_LITTLE_ENDIAN
+Indicating that the byte sex should be little endian.
+.TP
+.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.
+.PP
+Furthermore, any of these may be bitwise or'd
+with
+.B GD_ARM_ENDIAN
+or
+.B GD_NOT_ARM_ENDIAN
+indicating that the floating point data are stored in the ARM middle-endian
+format.
+.PP
+In addition to being simply a valid fragment index,
+.ARG fragment_index
+may also be the special value
+.BR GD_ALL_FRAGMENTS ,
+which indicates that the byte sex of all fragments in the database should
+be changed.
+
+If the
+.ARG recode
+argument is non-zero, this call will byte swap the binary data of affected
+.B RAW
+fields to account for the change in byte sex.  If the encoding of the
+fragment is endianness insensitive, or if the data type is only one byte in
+size, no change is made.  The I/O pointer of all affected
+.B RAW
+fields is reset to the beginning-of-frame.
+
+If
+.ARG recode
+is zero, affected binary files are left untouched.
+
+.SH RETURN VALUE
+Upon successful completion,
+.FN gd_alter_endianness
+returns zero.  On error, it returns a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ACCMODE
+The specified dirfile was opened read-only.
+.DD GD_E_ALLOC
+The library was unable to allocate memory.
+.DD GD_E_ARGUMENT
+The supplied
+.ARG byte_sex
+was invalid.
+.DD GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.DD GD_E_BAD_INDEX
+The supplied index was out of range.
+.DD GD_E_IO
+An I/O error occurred while attempting to byte swap a binary file.
+.DD GD_E_PROTECTED
+The metadata of the indicated format specification fragment was protected from
+change, or the binary data of the fragment was protected from change and binary
+file byte swapping was requested.
+.DD GD_E_UNCLEAN_DB
+An error occurred while moving the byte-swapped file into place.  As a result,
+the database may be in an unclean state.  See the
+.B NOTES
+section below for recovery instructions.  In this case, the dirfile will be
+flagged as invalid, to prevent further database corruption.  It should be
+immediately closed.
+.DD GD_E_UNKNOWN_ENCODING
+The encoding scheme of the fragment is unknown.
+.DD GD_E_UNSUPPORTED
+The encoding scheme of the fragment does not support binary file byte swapping.
+.PP
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH NOTES
+A binary file byte swap occurs out-of-place.  As a result, sufficient space
+must be present on the filesystem for the binary files of all
+.B RAW
+fields in the fragment both before and after translation.  If all fragments
+are updated by specifying
+.BR GD_ALL_FRAGMENTS ,
+the byte swapping occurs one fragment at a time.
+
+An error code of
+.B GD_E_UNCLEAN_DB
+indicates a system error occurred while moving the byte-swapped binary data into
+place or when deleting the old data.  If this happens, the database may be left
+in an unclean state.  The caller should check the filesystem directly to
+ascertain the state of the dirfile data before continuing.  For recovery
+instructions, see the file
+ at absolute_docdir@/unclean_database_recovery.txt.
+
+.SH HISTORY
+The function
+.FN dirfile_alter_endianness
+appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_alter_endianness .
+The
+.B GD_E_ARM_ENDIAN
+and
+.B GD_NOT_ARM_ENDIAN
+flags also appeared in this version.
+
+in GetData-0.10.0, the error return from this function changed from -1 to
+a negative-valued error code.
+
+.SH SEE ALSO
+.F3 gd_open ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_endianness ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_alter_entry.3 b/man/gd_alter_entry.3
index dfc2df1..ba830fd 100644
--- a/man/gd_alter_entry.3
+++ b/man/gd_alter_entry.3
@@ -1,3 +1,78 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_alter_entry.3.  The gd_alter_entry man page.
 .\"
 .\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014, 2016 D. V. Wiebe
@@ -13,57 +88,58 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_alter_entry 3 "4 March 2016" "Version 0.9.2" "GETDATA"
+.TH gd_alter_entry 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_alter_entry \(em modify the metadata of a dirfile field
+gd_alter_entry \(em modify the metadata of a Dirfile field
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_alter_entry(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "const gd_entry_t *" entry ", int " recode );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_alter_entry ()
+.FN gd_alter_entry
 function modifies the field specified by 
-.I field_code
+.ARG field_code
 in the dirfile specified by
-.I dirfile
+.ARG dirfile
 to correspond to the new parameters specified by
-.IR entry .
+.ARG entry .
 In addition to specifying a regular field,
-.I field_code
+.ARG field_code
 may also refer to a metafield by specifying it using its full (slashed) field
 code.  However,
-.I field_code
+.ARG field_code
 should never contain a representation suffix.
 
 The form of
-.I entry
+.ARG entry
 is described in detail in the
-.BR get_entry (3)
+.F3 get_entry
 man page.  The
-.IR entry -> field
+.SPM entry field
 and
-.IR entry -> fragment_index
+.SPM entry fragment_index
 members are ignored by this function and need not be initialised.  All other
 members appropriate to the field type of 
-.I field_code
+.ARG field_code
 should be initialised, except as noted below.  To change the fragment index of a
 field, use
-.BR gd_move (3).
+.F3 gd_move .
 To change the name of a field, use
-.BR gd_rename (3).
+.F3 gd_rename .
 
 The only flags in the
-.IR entry -> flags
+.SPM entry flags
 member which are honoured are
 .BR GD_EN_HIDDEN ,
 which should be set or cleared to set the hiddenness of the entry (see
-.BR gd_hidden (3)),
+.F3 gd_hidden ),
 and
 .BR GD_EN_COMPSCAL ,
 which indicates whether scalar parameters are initialised from the complex
@@ -73,44 +149,44 @@ valued or purely real member, which both are present
 .BR RECIP ).
 
 If
-.I field_code
+.ARG field_code
 specifies a
 .B RAW
 field and the
-.I recode
+.ARG recode
 argument is non-zero, the binary file associated with the field will be
 converted for changes in data type and samples-per-frame.  In this case,
 the field's I/O pointer will be reset to the beginning-of-frame.  If
-.I recode
+.ARG recode
 is zero, no binary file conversion will take place.
 
 If
-.I field_code
+.ARG field_code
 specifies a
 .B LINTERP
 field and the
-.I recode
+.ARG recode
 argument is non-zero, the look-up table file will be moved if
-.IR entry -> table
+.SPM entry table
 specifies a different path.  If a file with the new pathname already exists, it
 will be overwritten.  If the field specified by
-.I field_code
+.ARG field_code
 is of type other than
 .B RAW
 or
 .BR LINTERP ,
 the
-.I recode
+.ARG recode
 argument is ignored.
 
 If
-.I field_code
+.ARG field_code
 specified a
 .B LINCOM
 or
 .B POLYNOM
 field, the value of
-.IR entry -> comp_scal
+.SPM entry comp_scal
 indicates whether the purely real scalar lists
 .RI ( entry -> a ", or " entry -> b " and " entry -> m )
 or the complex valued lists
@@ -118,35 +194,30 @@ or the complex valued lists
 will be used.  The unused counterparts need not be initialised.
 
 The
-.IR entry -> field_type
+.SPM entry field_type
 member must correspond to the field type of
-.IR field_code .
+.ARG field_code .
 This interface cannot be used to change the type of a given field.  To do so,
 delete the old field first with
-.BR gd_delete (3),
+.F3 gd_delete ,
 and then create a new field of the desired type with
-.BR gd_add (3).
+.F3 gd_add .
 
 Some entry members have special values which indicate no change should be
 made to the member.  These special values are:
-.TP
-.B NULL\fR:
+.DD NULL\fR:
 any of the string members;
-.TP
-.B 0\fR:
+.DD 0\fR:
 .IR spf ", " n_fields ", " numbits ", " cdividend ", " dividend ", or " array_len ;
-.TP
-.B -1\fR:
+.DD -1\fR:
 .IR bitnum " or " period ;
-.TP
-.B GD_NULL\fR:
+.DD GD_NULL\fR:
 .IR data_type " or " const_type ;
-.TP
-.B GD_WINDOP_UNK\fR:
+.DD GD_WINDOP_UNK\fR:
 .IR windop .
 .PP
 All
-.IR entry -> scalar
+.SPM entry scalar
 elements relevant for the given field type must be initialised to one of the
 following values:
 .IP \(bu 4
@@ -157,32 +228,32 @@ previously a field code, the new field code will replace the old one.  If the
 field code specifies a
 .B CARRAY
 field, the corresponding
-.IR entry -> scalar_ind
+.SPM entry scalar_ind
 element should also be set.
 .IP \(bu 4
 a pointer to the empty string ("").  In this case, no change is made to the
 field code for the corresponding field parameter: if one already existed, it is
 kept, otherwise the corresponding literal numerical parameter is used.  If the
 value of the corresponding numerical
-.I entry
+.ARG entry
 member is the special value listed above indicating no change, no change is
 made to the field parameter at all.
-.I NB:
+.B NB:
 In this case, GetData also ignores the corresponding
-.IR entry -> scalar_ind
+.SPM entry scalar_ind
 element, even if it differs from the current value.  To change a
-.I scalar_ind
+.ARG scalar_ind
 element without changing the corresponding
-.IR scalar ,
+.ARG scalar ,
 set that
-.I scalar
+.ARG scalar
 element to its current value (at which point GetData operates as per the
 previous bullet).
 .IP \(bu 4
 the NULL pointer.  If the corresponding field parameter was previously a field
 code, the field code will be deleted and a literal number used instead.  In the
 special case when a scalar element is NULL and the corresponding numerical
-.I entry
+.ARG entry
 member contains a special value indicating no change listed above, GetData will
 de-reference the previous field code value and convert it into a literal number
 before removing the field code from the entry.
@@ -190,41 +261,35 @@ before removing the field code from the entry.
 If this function is used to increase the length of a
 .B CARRAY
 field, the added elements will be uninitialised.  Use
-.BR gd_put_carray_slice (3)
+.F3 gd_put_carray_slice
 or equivalent to initialise them.
 
 .SH RETURN VALUE
 On success,
-.BR gd_alter_entry ()
-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
+.FN gd_alter_entry
+return zero.   On error, a negative-valued error code is returned.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 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
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_ENTRY
+.DD GD_E_BAD_ENTRY
 One or more of the parameters specified in
-.I entry
+.ARG entry
 was invalid.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 The
-.IR entry -> field_type
+.SPM entry field_type
 parameter did not correspond to the type of the field specified by
-.IR field_code ,
+.ARG field_code ,
 or an attempt was made to modify the immutable
 .I INDEX
 field.  This error may also result from attempting to dereference a scalar
@@ -233,73 +298,100 @@ field code which does not indicate a
 or
 .B CARRAY
 field.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 The
-.IR entry -> data_type
+.SPM entry data_type
 parameter provided with a
 .BR RAW
 entry, or the
-.IR entry -> const_type
+.SPM entry const_type
 parameter provided with a
 .BR CONST
 or
 .BR CARRAY
 entry, was invalid.
-.TP
-.B GD_E_IO
+.DD GD_E_IO
 An I/O error occurred while translating the binary file associated with a
 modified
 .B RAW
 field, or an I/O error occurred while attempting to rename a
 .B LINTERP
 table file.
-.TP
-.B GD_E_PROTECTED
+.DD GD_E_PROTECTED
 The metadata of the fragment was protected from change.  Or, a request to
 translate the binary file associated with a
 .B RAW
 field was attempted, but the data of the fragment was protected.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 The encoding scheme of the indicated format specification fragment is not known
 to the library.  As a result, the library was unable to translate the binary
 file be associated with a modified
 .B RAW
 field.
-.TP
-.B GD_E_UNSUPPORTED
+.DD GD_E_UNSUPPORTED
 The encoding scheme of the indicated format specification fragment does not
 support translating the binary file associated with a modified
 .B RAW
 field.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The function
+.FN dirfile_alter_entry
+appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_alter_entry .
+
+In GetData-0.8.0, the first version supporting fragment affixes, this function
+would apply the destination fragment's affixes to the supplied
+.SC
+.SPM entry field
+.EC
+name.  In GetData-0.8.1, this changed:
+.FN gd_alter_entry
+now assumes
+.SC
+.SPM entry field
+.EC
+contains the full field name, including any necessary affixes.
+
+In GetData-0.10.0, the error return changed from -1 to a negative-valued
+error code.
+
+See
+.F3 gd_entry
+for the history of the
+.B gd_entry_t
+structure.
+
 .SH SEE ALSO
-.BR gd_alter_bit (3),
-.BR gd_alter_carray (3),
-.BR gd_alter_const (3),
-.BR gd_alter_divide (3),
-.BR gd_alter_lincom (3),
-.BR gd_alter_linterp (3),
-.BR gd_alter_multiply (3),
-.BR gd_alter_phase (3),
-.BR gd_alter_polynom (3),
-.BR gd_alter_raw (3),
-.BR gd_alter_recip (3),
-.BR gd_alter_spec (3),
-.BR gd_delete (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_hidden (3),
-.BR gd_malter_spec (3),
-.BR gd_metaflush (3),
-.BR gd_move (3),
-.BR gd_open (3),
-.BR gd_put_carray_slice (3),
-.BR gd_rename (3),
-.BR dirfile-format (5)
+.F3 gd_alter_bit ,
+.F3 gd_alter_carray ,
+.F3 gd_alter_const ,
+.F3 gd_alter_divide ,
+.F3 gd_alter_lincom ,
+.F3 gd_alter_linterp ,
+.F3 gd_alter_multiply ,
+.F3 gd_alter_phase ,
+.F3 gd_alter_polynom ,
+.F3 gd_alter_raw ,
+.F3 gd_alter_recip ,
+.F3 gd_alter_spec ,
+.F3 gd_delete ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_hidden ,
+.F3 gd_malter_spec ,
+.F3 gd_metaflush ,
+.F3 gd_move ,
+.F3 gd_open ,
+.F3 gd_put_carray_slice ,
+.F3 gd_rename ,
+dirfile-format(5)
diff --git a/man/gd_alter_frameoffset.3.in b/man/gd_alter_frameoffset.3.in
deleted file mode 100644
index 21eb495..0000000
--- a/man/gd_alter_frameoffset.3.in
+++ /dev/null
@@ -1,146 +0,0 @@
-.\" gd_alter_frameoffset.3.  The gd_alter_frameoffset man page.
-.\"
-.\" @configure_input@
-.\"
-.\" Copyright (C) 2008, 2010, 2014 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_frameoffset 3 "16 October 2014" "Version 0.9.0" "GETDATA"
-.SH NAME
-gd_alter_frameoffset \(em modify the starting frame of fields in a dirfile
-.SH SYNOPSIS
-.B #include <getdata.h>
-.HP
-.nh
-.ad l
-.BI "int gd_alter_frameoffset(DIRFILE *" dirfile ", off_t " offset ,
-.BI "int " fragment_index ", int " recode );
-.hy
-.ad n
-.SH DESCRIPTION
-The
-.BR gd_alter_frameoffset ()
-function sets the frame offset of the format specification fragment given by
-.I fragment_index
-to
-.I offset
-in the dirfile(5) database specified by
-.IR dirfile .
-The frame offset of a fragment indicate the frame number of the first sample
-of data stored in binary files associated with
-.B RAW
-fields defined in the specified fragment.  The frame offset of a fragment
-containing no
-.B RAW
-fields is ignored.  The frame offset may not be negative.
-
-The
-.I dirfile
-argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
-
-In addition to being simply a valid fragment index,
-.I fragment_index
-may also be the special value
-.BR GD_ALL_FRAGMENTS ,
-which indicates that the frame offset of all fragments in the database should
-be changed.
-
-If the
-.I recode
-argument is non-zero, this call will shift the binary data of affected
-.B RAW
-fields to account for the change in frame offset.  If the new frame offset
-is larger than the old frame offset, this will result in permanent deletion of
-data from the database.  If the new frame offset is smaller than the old frame
-offset, the binary file will be padded at the front with zeroes.  The I/O
-pointer of all affected
-.B RAW
-fields is reset to the beginning-of-frame.
-
-If
-.I recode
-is zero, affected binary files are left untouched.
-
-.SH RETURN VALUE
-Upon successful completion,
-.BR gd_alter_frameoffset ()
-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_DIRFILE
-The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
-The supplied index was out of range.
-.TP
-.B GD_E_IO
-An I/O error occurred while attempting to shift a binary file.
-.TP
-.B GD_E_PROTECTED
-The metadata of the given format specification fragment was protected from
-change, or the binary data of the fragment was protected from change and binary
-file shifting was requested.
-.TP
-.B GD_E_RANGE
-The supplied offset was less than zero.
-.TP
-.B GD_E_UNCLEAN_DB
-An error occurred while moving the shifted file into place.  As a result, the
-database may be in an unclean state.  See the
-.B NOTES
-section below for recovery instructions.  In this case, the dirfile will be
-flagged as invalid, to prevent further database corruption.  It should be
-immediately closed.
-.TP
-.B GD_E_UNKNOWN_ENCODING
-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.
-.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 NOTES
-A binary file shift occurs out-of-place.  As a result, sufficient space
-must be present on the filesystem for the binary files of all
-.B RAW
-fields in the fragment both before and after translation.  If all fragments
-are updated by specifying
-.BR GD_ALL_FRAGMENTS ,
-the shifting occurs one fragment at a time.
-
-An error code of
-.B GD_E_UNCLEAN_DB
-indicates a system error occurred while moving the shifted binary data into
-place or when deleting the old data.  If this happens, the database may be left
-in an unclean state.  The caller should check the filesystem directly to
-ascertain the state of the dirfile data before continuing.  For recovery
-instructions, see the file
- at absolute_docdir@/unclean_database_recovery.txt.
-.SH SEE ALSO
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_frameoffset (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
diff --git a/man/gd_alter_frameoffset.3in.in b/man/gd_alter_frameoffset.3in.in
new file mode 100644
index 0000000..bd6e7dd
--- /dev/null
+++ b/man/gd_alter_frameoffset.3in.in
@@ -0,0 +1,151 @@
+.\" gd_alter_frameoffset.3.  The gd_alter_frameoffset man page.
+.\"
+.\" @configure_input@
+.\"
+.\" Copyright (C) 2008, 2010, 2014, 2016 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_frameoffset 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_alter_frameoffset \(em modify the starting frame of fields in a Dirfile
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "int gd_alter_frameoffset(DIRFILE *" dirfile ", off_t " offset ,
+.BI "int " fragment_index ", int " recode );
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_alter_frameoffset
+function sets the frame offset of the format specification fragment given by
+.ARG fragment_index
+to
+.ARG offset
+in the dirfile(5) database specified by
+.ARG dirfile .
+The frame offset of a fragment indicate the frame number of the first sample
+of data stored in binary files associated with
+.B RAW
+fields defined in the specified fragment.  The frame offset of a fragment
+containing no
+.B RAW
+fields is ignored.  The frame offset may not be negative.
+
+The
+.ARG dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.F3 gd_open .
+
+In addition to being simply a valid fragment index,
+.ARG fragment_index
+may also be the special value
+.BR GD_ALL_FRAGMENTS ,
+which indicates that the frame offset of all fragments in the database should
+be changed.
+
+If the
+.ARG recode
+argument is non-zero, this call will shift the binary data of affected
+.B RAW
+fields to account for the change in frame offset.  If the new frame offset
+is larger than the old frame offset, this will result in permanent deletion of
+data from the database.  If the new frame offset is smaller than the old frame
+offset, the binary file will be padded at the front with zeroes.  The I/O
+pointer of all affected
+.B RAW
+fields is reset to the beginning-of-frame.
+
+If
+.ARG recode
+is zero, affected binary files are left untouched.
+
+.SH RETURN VALUE
+Upon successful completion,
+.FN gd_alter_frameoffset
+returns zero.  On error, it returns a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ACCMODE
+The specified dirfile was opened read-only.
+.DD GD_E_ALLOC
+The library was unable to allocate memory.
+.DD GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.DD GD_E_BAD_INDEX
+The supplied index was out of range.
+.DD GD_E_IO
+An I/O error occurred while attempting to shift a binary file.
+.DD GD_E_PROTECTED
+The metadata of the given format specification fragment was protected from
+change, or the binary data of the fragment was protected from change and binary
+file shifting was requested.
+.DD GD_E_RANGE
+The supplied offset was less than zero.
+.DD GD_E_UNCLEAN_DB
+An error occurred while moving the shifted file into place.  As a result, the
+database may be in an unclean state.  See the
+.B NOTES
+section below for recovery instructions.  In this case, the dirfile will be
+flagged as invalid, to prevent further database corruption.  It should be
+immediately closed.
+.DD GD_E_UNKNOWN_ENCODING
+The encoding scheme of the fragment is unknown.
+.DD GD_E_UNSUPPORTED
+The encoding scheme of the fragment does not support binary file shifting.
+.PP
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH NOTES
+A binary file shift occurs out-of-place.  As a result, sufficient space
+must be present on the filesystem for the binary files of all
+.B RAW
+fields in the fragment both before and after translation.  If all fragments
+are updated by specifying
+.BR GD_ALL_FRAGMENTS ,
+the shifting occurs one fragment at a time.
+
+An error code of
+.B GD_E_UNCLEAN_DB
+indicates a system error occurred while moving the shifted binary data into
+place or when deleting the old data.  If this happens, the database may be left
+in an unclean state.  The caller should check the filesystem directly to
+ascertain the state of the dirfile data before continuing.  For recovery
+instructions, see the file
+ at absolute_docdir@/unclean_database_recovery.txt.
+
+.SH HISTORY
+The function
+.FN dirfile_alter_frameoffset
+appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_alter_frameoffset .
+
+in GetData-0.10.0, the error return from this function changed from -1 to
+a negative-valued error code.
+
+.SH SEE ALSO
+.F3 gd_open ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_frameoffset ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_alter_protection.3 b/man/gd_alter_protection.3
index 1025ece..4b95558 100644
--- a/man/gd_alter_protection.3
+++ b/man/gd_alter_protection.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_alter_protection.3.  The gd_alter_protection man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,43 +88,40 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_alter_protection 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.TH gd_alter_protection 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_alter_protection \(em modify the protection level of a dirfile fragment
+gd_alter_protection \(em modify the protection level of a Dirfile fragment
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_alter_protection(DIRFILE *" dirfile ", int"
 .IB protection_level ", int " fragment_index );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_alter_protection ()
+.FN gd_alter_protection
 function sets the advisory protection level of the format specification fragment
 given by
-.I fragment_index
+.ARG fragment_index
 to
-.I protection_level
+.ARG protection_level
 in the dirfile(5) database specified by
-.IR dirfile .
+.ARG dirfile .
 
 The
-.I protection_level
+.ARG protection_level
 argument should be one of the following:
-.TP
-.BR GD_PROTECT_NONE
+.DD GD_PROTECT_NONE
 Indicating that the fragment should not be protected at all.
-.TP
-.B GD_PROTECT_FORMAT
+.DD GD_PROTECT_FORMAT
 Indicating that the fragment's metadata should be protected.
-.TP
-.B GD_PROTECT_DATA
+.DD GD_PROTECT_DATA
 Indicating that the fragment's binary data should be protected.
-.TP
-.B GD_PROTECT_ALL
+.DD GD_PROTECT_ALL
 Indicating that both the fragment's metadata and its binary data should be
 protected.  This symbol is equivalent to the bitwise or of
 .B GD_PROTECT_FORMAT
@@ -57,7 +129,7 @@ and
 .BR GD_PROTECT_DATA .
 .PP
 In addition to being simply a valid fragment index,
-.I fragment_index
+.ARG fragment_index
 may also be the special value
 .BR GD_ALL_FRAGMENTS ,
 which indicates that the protection level of all fragments in the database
@@ -65,39 +137,47 @@ should be changed.
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_alter_protection ()
-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
+.FN gd_alter_protection
+returns zero.  On error, it returns a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ARGUMENT
+.DD GD_E_ARGUMENT
 The supplied
-.I protection_level
+.ARG protection_level
 was invalid.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD GD_E_BAD_INDEX
 The supplied index was out of range.
-.TP
-.B GD_E_BAD_PROTECTION
+.DD GD_E_BAD_PROTECTION
 The supplied protection level 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
 .SH NOTES
 This is the only GetData function which ignores the (existing) protection
 level of a format specification fragment.
+
+.SH HISTORY
+
+The function
+.FN dirfile_protect
+appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_alter_protection .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_protection (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_protection ,
+.F3 gd_open
diff --git a/man/gd_alter_spec.3 b/man/gd_alter_spec.3
index 1ea2a08..5ad8948 100644
--- a/man/gd_alter_spec.3
+++ b/man/gd_alter_spec.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_alter_spec.3.  The gd_alter_spec man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2011, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,39 +88,40 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_alter_spec 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_alter_spec 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_alter_spec, gd_malter_spec \(em modify a field in a dirfile
+gd_alter_spec, gd_malter_spec \(em modify a field in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_alter_spec(DIRFILE *" dirfile ", const char *" line ,
 .BI "int " recode );
 .HP
 .BI "int gd_malter_spec(DIRFILE *" dirfile ", const char *" line ,
 .BI "const char *" parent ", int " recode );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_alter_spec ()
+.FN gd_alter_spec
 function modifies the field described by the field specification line in
-.I line
+.ARG line
 to the dirfile specified by
-.IR dirfile .
+.ARG dirfile .
 The
-.BR gd_malter_spec ()
+.FN gd_malter_spec
 function behaves similarly, but modifies the metafield under the field
 indicated by the field code
-.IR parent .
+.ARG parent .
 Field specification lines are described in detail in
-.BR dirfile-format (5).
+dirfile-format(5).
 
 The name of the field to be modified, which must already exist, will be
 obtained from the field specification line.  When adding a metafield, 
-.I line
+.ARG line
 should only contain a field specification, and not a
 .B /META
 directive.
@@ -53,118 +129,118 @@ directive.
 If the modified field is of type
 .B RAW
 and the
-.I recode
+.ARG recode
 argument is non-zero, the binary file associated with the field will be
 converted for changes in data type and samples-per-frame.  In this case,
 the field's I/O pointer will be reset to the beginning-of-frame.  If
-.I recode
+.ARG recode
 is zero, no binary file conversion will take place.
 
 If the modified field is of type
 .B LINTERP
 and the
-.I recode
+.ARG recode
 argument is non-zero, the look-up table file will be moved if
-.I line
+.ARG line
 specifies a different path, overwriting an existing file with the new
 pathname, if present.  If the field specified by
-.I field_code
+.ARG field_code
 is of type other than
 .B RAW
 or
 .BR LINTERP ,
 the
-.I recode
+.ARG recode
 argument is ignored.
 
 Passing these functions a directive line instead of a field specification line
 will result in a syntax error.  These functions never call the registered
 parser callback function, even if
-.IR line 
+.ARG line 
 contains a syntax error.
 
 .SH RETURN VALUE
 On success,
-.BR gd_alter_spec ()
+.FN gd_alter_spec
 and
-.BR gd_malter_spec ()
-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
+.FN gd_malter_spec
+return zero.  On error, it returns a negative-valued error code.  Possible error
+codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified in
-.I line
+.ARG line
 was not found, or the
-.I parent
+.ARG parent
 field code was not found.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_FORMAT
+.DD GD_E_FORMAT
 A syntax error was encountered in
-.IR line .
-.TP
-.B GD_E_IO
+.ARG line .
+.DD GD_E_IO
 An I/O error occurred while translating the binary file associated with a
 modified
 .B RAW
 field, or an I/O error occurred while attempting to rename a
 .B LINTERP
 table file.
-.TP
-.B GD_E_LINE_TOO_LONG
+.DD GD_E_LINE_TOO_LONG
 The supplied
-.I line
-was longer than the parser was able to deal with.  Lines are limited by the
-storage size of
-.BR ssize_t .
-On 32-bit systems, this limits
-.I line
-to 2**31 bytes.  The limit is larger on 64-bit systems.
-.TP
-.B GD_E_PROTECTED
+.ARG line
+was longer than the parser was able to deal with.  Line lengths are limited by
+the storage size of
+.BR size_t .
+.DD GD_E_PROTECTED
 The metadata of the fragment was protected from change.  Or, a request to
 translate the binary file associated with a
 .B RAW
 field was attempted, but the data of the fragment was protected.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 The encoding scheme of the indicated format specification fragment is not known
 to the library.  As a result, the library was unable to translate the binary
 file be associated with a modified
 .B RAW
 field.
-.TP
-.B GD_E_UNSUPPORTED
+.DD GD_E_UNSUPPORTED
 The encoding scheme of the indicated format specification fragment does not
 support translating the empty binary file associated with a modified
 .B RAW
 field.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The functions
+.FN dirfile_alter_spec
+and
+.FN dirfile_malter_spec
+appeared in GetData-0.5.0.
+
+In GetData-0.7.0, these functions were renamed to
+.FN gd_alter_spec
+and
+.FN gd_malter_spec.
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_alter_bit (3),
-.BR gd_alter_const (3),
-.BR gd_alter_entry (3),
-.BR gd_alter_lincom (3),
-.BR gd_alter_linterp (3),
-.BR gd_alter_multiply (3),
-.BR gd_alter_phase (3),
-.BR gd_alter_raw (3),
-.BR gd_alter_spec (3),
-.BR gd_metaflush (3),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR dirfile-format (5)
+Any of the
+.BR gd_alter_ <entry-type>
+functions (e.g.,
+.F3 gd_alter_bit ),
+.F3 gd_alter_spec ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_metaflush ,
+.F3 gd_open ,
+dirfile-format(5)
diff --git a/man/gd_array_len.3 b/man/gd_array_len.3
index e5cc43f..d23071f 100644
--- a/man/gd_array_len.3
+++ b/man/gd_array_len.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_array_len.3.  The gd_array_len man page.
 .\"
-.\" Copyright (C) 2010, 2011, 2012, 2014 D. V. Wiebe
+.\" Copyright (C) 2010, 2011, 2012, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,74 +88,89 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_array_len 3 "27 May 2014" "Version 0.9.0" "GETDATA"
+.TH gd_array_len 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_array_len \(em returns the length of a CARRAY or SARRAY field in a dirfile
+gd_array_len \(em returns the length of a CARRAY or SARRAY field in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "size_t gd_array_len(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_array_len ()
+.FN gd_array_len
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns the number of length of the
+.ARG dirfile
+and calculates the length of the
 .BR CARRAY ", " CONST ", " STRING ,
 or
 .B SARRAY
 field called
-.IR field_code .
+.ARG field_code .
 If
-.I field_code
+.ARG field_code
 contains a valid representation suffix, it will be ignored.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_array_len ()
-returns the array length of the field specified.  (The length of a
+.FN gd_array_len
+returns a positive integer indicating the array length of the field specified.
+(The length of a
 .B CONST
 or a
 .B STRING
-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
+field is always 1.) On error, it returns a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 The field specified by
-.I field_code
+.ARG field_code
 was not of one of the field types 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 NOTES
-This function used to be called
-.BR gd_carray_len ().
-This name can still be used, but it has been marked deprecated.
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_carray_len
+function appeared in GetData-0.7.0.  It was restricted to
+.B CONST
+and
+.B CARRAY
+entries.
+
+In GetData-0.9.0, this function was renamed to
+.BR gd_array_len ,
+and
+.B STRING
+entries were now valid for this function.
+
+Before GetData-0.10.0, this function could also fail with the error code
+.BR GD_E_ALLOC .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3)
+dirfile(5),
+.F3 gd_open ,
+.F3 gd_error ,
+.F3 gd_error_string
diff --git a/man/gd_bof.3 b/man/gd_bof.3
index ebb0379..511158d 100644
--- a/man/gd_bof.3
+++ b/man/gd_bof.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_bof.3.  The gd_bof man page.
 .\"
-.\" Copyright (C) 2010, 2011 D. V. Wiebe
+.\" Copyright (C) 2010, 2011, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,25 +88,25 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_bof 3 "17 August 2011" "Version 0.8.0" "GETDATA"
+.TH gd_bof 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_bof \(em report the start of data in a field
+gd_bof \(em find the start of data in a Dirfile field
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "off_t gd_bof(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_bof ()
+.FN gd_bof
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns the sample number of the beginning-of-field marker for the vector
-field given by
-.IR field_code .
+.ARG dirfile
+and finds the beginning-of-field marker for the vector field given by
+.ARG field_code .
 
 The caller should not assume that the beginning-of-field marker falls on a
 frame boundary.  The beginning-of-field marker is never negative.
@@ -40,73 +115,83 @@ For a
 .B RAW
 field, the beginning-of-field corresponds to the frame offset of that field
 (see
-.BR gd_frameoffset (3)).
-The beginning-of-field for all other vector field type is the same as the
-beginning-of-field of whichever of its input fields that starts latest.  The
-beginning-of-field marker for the special field
+.F3 gd_frameoffset ).
+The beginning-of-field marker of the special field
 .I INDEX
-is always zero.
+is zero.
 
-The beginning-of-field marker for a field containing no data is in the same
-location as, or after, its end-of-field marker (see
-.BR gd_eof (3)).
-For a
+The beginning-of-field of a
+.B PHASE
+field is the beginning-of-field of its input adjusted by the
+.B PHASE
+field's shift (or zero, if the shift would make it negative).  The
+beginning-of-field for all other vector fields is the the latest
+beginning-of-field of any of its input fields.
+
+If the beginning-of-field marker of a field is greather than or equal to its
+end-of-field marker (see
+.F3 gd_eof ),
+then that field contains no data.  For a
 .B RAW
 field, the difference between the locations of the beginning- and end-of-field
 markers indicates the number of samples of data actually stored on disk.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_bof ()
-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
+.FN gd_bof
+returns a non-negative integer which is the sample number of the
+beginning-of-field marker for the specified field.  On error, it returns a
+negative-valued error code.  Possible error codes are:
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 or one of the fields it uses as input was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_DIMENSION
+.DD GD_E_DIMENSION
 A scalar field was found where a vector field was expected in the definition
 of
-.I field_code 
+.ARG field_code 
 or one of its inputs, or else
-.I field_code
+.ARG field_code
 itself specified a scalar field.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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
+.DD GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
+.ARG 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).
-A descriptive error string for the last error encountered can be obtained from
-a call to
-.BR gd_error_string (3).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_bof
+function appeared in GetData-0.7.0.
+
+Before GetData-0.10.0, this function could also fail with the error code
+.BR GD_E_ALLOC .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR dirfile-encoding (5),
-.BR gd_open (3),
-.BR gd_eof (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_nframes (3)
+.F3 gd_eof ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_frameoffset ,
+.F3 gd_open ,
+dirfile(5), dirfile-encoding(5)
diff --git a/man/gd_bof64.3 b/man/gd_bof64.3
index aa26d23..8723c92 100644
--- a/man/gd_bof64.3
+++ b/man/gd_bof64.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_bof64.3.  The gd_bof64 man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,42 +88,40 @@
 .\" 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"
+.TH gd_bof64 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_bof64 \(em retrieve data from a dirfile database, with largefile support
+gd_bof64 \(em find the start of data in a Dirfile field, with largefile support
+
 .SH SYNOPSIS
+.SC
 .B #define GD_64BIT_API
 .br
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "gd_off64_t gd_bof64(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 This version of
-.BR gd_bof (3)
+.F3 gd_bof
 uses a 64-bit offset type
 .RB ( gd_off64_t ),
-where one is available, regardless of the size of
+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.
+It is only guaranteed to be available when
+.B GD_64BIT_API
+is defined 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).
+.B off_t
+is a 64-bit type, this function will the same as
+.F3 gd_bof .
 Otherwise,
-.BR gd_bof (3)
+.F3 gd_bof
 will be a version of this function which uses a 32-bit
 .IR off_t .
+
 .SH SEE ALSO
-.BR gd_bof (3),
+.F3 gd_bof ,
 .BR feature_test_macros (7)
diff --git a/man/gd_carrays.3 b/man/gd_carrays.3
index f6bb364..da318ac 100644
--- a/man/gd_carrays.3
+++ b/man/gd_carrays.3
@@ -1,3 +1,78 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_carrays.3.  The gd_carrays man page.
 .\"
 .\" Copyright (C) 2010, 2011, 2016 D. V. Wiebe
@@ -13,137 +88,163 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_carrays 3 "19 April 2016" "Version 0.9.3" "GETDATA"
+.TH gd_carrays 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_carrays \(em retrieve a list of CARRAY values from a dirfile
+gd_carrays, gd_mcarrays \(em retrieve a list of CARRAY values from a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "const gd_carray_t *gd_carrays(DIRFILE *" dirfile ", gd_type_t
 .IB return_type );
-.hy
-.ad n
+.HP
+.BI "const gd_carray_t *gd_mcarrays(DIRFILE *" dirfile ", const char"
+.BI * parent ", gd_type_t " return_type );
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_carrays ()
+.FN gd_carrays
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns a read-only list of values of the all
+.ARG dirfile
+and generates a read-only list of values of the all top-level
 .B CARRAY
 fields defined in the database, after type conversion to the data type
 specified by
-.IR return_type .
-Notably, this list does not include /META subfields.  For a list of valid
-symbols to use for
-.IR return_type ,
+.ARG return_type .
+For a list of valid symbols to use for
+.ARG return_type ,
 see the
-.BR gd_get_carray (3)
-man page.
-
-The 
-.I dirfile
-argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_get_carray
+manual page.  
 
-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, except that it is guaranteed to be in the
-same order as the list of
+The
+.FN gd_mcarrays
+function behaves similarly, but creates a list of values of
 .B CARRAY
-fields returned by
-.BR gd_field_list_by_type (3).
-The number of values in the array can be obtained from a call to
-.BR gd_nfields_by_type (3).
+subfields under the parent field
+.ARG parent .
 
-The caller may not modify any values in the array, nor the array itself.  Doing
-so may cause database corruption.  The pointer returned is guaranteed to be
-valid only until
-.BR gd_carrays ()
-is called again with the same arguments, or until the dirfile's metadata is
-modified (by adding, modifying or deleting an entry), or until the array is
-de-allocated by a call to
-.BR gd_close (3).
+The 
+.ARG dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.F3 gd_open .
 
 A corresponding list of names for these fields may be obtained by calling
-.BR gd_field_list_by_type (3).
+.F3 gd_field_list_by_type
+or
+.F3 gd_mfield_list_by_type .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_carrays ()
-returns a pointer to an array of
+.FN gd_carrays
+and
+.F3 gd_mcarrays
+return a pointer to an array of
 .B gd_carray_t
 objects containing the values of all the CARRAYs defined in the dirfile
 database.  The
 .B gd_carray_t
-is defined as:
+structure is defined as:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   size_t       n;              /* array_len */
   void        *d;              /* CARRAY data */
 } gd_carray_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 where
-.I n
+.ARG n
 specifies the length of the
 .B CARRAY
 data, and
-.I d
+.ARG d
 is an array of the data values themselves. If
-.I return_type
+.ARG return_type
 was
 .BR GD_NULL ,
-.I d
+.ARG d
 will be NULL.  Otherwise, the caller should cast the
 .B void
 pointer to a type appropriate for the
-.I return_type
+.ARG return_type
 specified.  The list is terminated by an end-of-list marker consisting of a
 .B gd_carray_t
 item with
-.I n
+.ARG n
 set to zero.
 
 If no CARRAYs are defined in the database, a list containing only the
-end-of-list marker is returned.  On error,
-.BR gd_carrays ()
-returns NULL and sets the dirfile error to a non-zero error value.  Possible
-error values are:
-.TP 8
-.B GD_E_ALLOC
+end-of-list marker is returned.
+
+The array returned will be de-allocated by a call to
+.F3 gd_close
+and should not be de-allocated by the caller.  The list returned should not be
+assumed to be in any particular order, except that it is guaranteed to be in the
+same order as the list of
+.B CARRAY
+fields returned by
+.F3 gd_field_list_by_type
+or
+.F3 gd_mfield_list_by_type .
+The number of values in the array can be obtained from a call to
+.F3 gd_nfields_by_type
+or
+.F3 gd_nmfields_by_type .
+
+The caller may not modify any values in the array, nor the array itself.  Doing
+so may cause database corruption.  The pointer returned is guaranteed to be
+valid only until the function is called again, or until the dirfile's metadata
+is modified (by adding, modifying or deleting an entry), or until the array is
+de-allocated by a call to
+.F3 gd_close
+or
+.F3 gd_discard .
+
+On error,
+.FN gd_carrays
+returns NULL and stores a negative-valued error code in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 The
-.I return_type
+.ARG return_type
 specified was invalid.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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).
-A descriptive error string for the last error encountered can be obtained from
-a call to
-.BR gd_error_string (3).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_carrays
+and
+.FN gd_mcarrays
+functions appeared in GetData-0.7.0.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_field_list_by_type (3),
-.BR gd_get_carray (3),
-.BR gd_nfields_by_type (3)
+dirfile(5),
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_field_list_by_type ,
+.F3 gd_get_carray ,
+.F3 gd_mfield_list_by_type ,
+.F3 gd_nfields_by_type
+.F3 gd_nmfields_by_type
+.F3 gd_open
diff --git a/man/gd_cbopen.3 b/man/gd_cbopen.3
deleted file mode 100644
index 2031e39..0000000
--- a/man/gd_cbopen.3
+++ /dev/null
@@ -1,731 +0,0 @@
-.\" gd_cbopen.3.  The gd_cbopen man page.
-.\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014 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_cbopen 3 "16 October 2014" "Version 0.9.0" "GETDATA"
-.SH NAME
-gd_cbopen, gd_open \(em open or create a dirfile
-.SH SYNOPSIS
-.B #include <getdata.h>
-.HP
-.nh
-.ad l
-.BI "DIRFILE* gd_cbopen(const char *" dirfilename ", unsigned long"
-.IB flags ", gd_parser_callback_t " sehandler ", void *" extra );
-.HP
-.BI "DIRFILE* gd_open(const char *" dirfilename ", unsigned long " flags );
-.hy
-.ad n
-.SH DESCRIPTION
-The
-.BR gd_cbopen ()
-function opens or creates the dirfile specified by
-.IR dirfilename ,
-returning a DIRFILE object associated with it.  Opening a dirfile will cause the
-library to read and parse the dirfile's format specification (see
-.BR dirfile-format (5)).
-
-If not NULL,
-.I sehandler
-should be a pointer to a function which will be called whenever a syntax error
-is encountered during parsing the format specification.  Specify NULL for this
-parameter if no callback function is to be used.  The caller may use this
-function to correct the error or modify the error handling of the format
-specification parser.  See
-.B The Callback Function
-section below for details on this function.  The
-.I extra
-argument allows the caller to pass data to the callback function.  The pointer
-will be passed to the callback function verbatim.
-
-The
-.BR gd_open ()
-function is equivalent to
-.BR gd_cbopen (),
-with
-.I sehandler
-and
-.I extra
-set to NULL.
-
-The 
-.I flags
-argument should include one of the
-.IR "access modes" :
-.B GD_RDONLY
-(read-only) or 
-.BR GD_RDWR
-(read-write), and may also contain zero or more of the following flags,
-bitwise-or'd together:
-.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 dirfile will be created, if one does not already exist.  This will
-create both the dirfile directory and an empty format specification file called
-.IR format .
-If the call creates a dirfile, then the specified access mode is ignored: a
-newly-created DIRFILE is always opened with access mode
-.BR GD_RDWR ,
-even if
-.B GD_RDONLY
-had been specified.
-
-The directory will have have mode
-.BR S_IRWXU " | " S_IRWXG " | "  S_IRWXO 
-(0777), modified by the caller's umask value (see
-.BR umask (2)).
-The
-.I format
-file will have mode
-.BR S_IRUSR " | " S_IWUSR " | "  S_IRGRP " | "  S_IWGRP " | " S_IROTH " | " S_IWOTH
-(0666), also modified by the caller's umask.
-The owner of the dirfile directory and
-.I format
-file will be the effective user ID of the caller.  Group ownership follows the
-rules outlined in
-.BR mkdir (2).
-.TP
-.B GD_EXCL
-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.  If
-.B GD_CREAT
-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).
-.TP
-.B GD_FORCE_ENCODING
-Specifies that
-.B /ENCODING
-directives (see
-.BR dirfile-format (5))
-found in the dirfile format specification 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 dirfile format specification should be ignored.  All raw data will
-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.
-.TP
-.B GD_IGNORE_DUPS
-If the dirfile format metadata specifies more than one field with the same name,
-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.  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_PEDANTIC
-Reject dirfiles which don't conform to the Dirfile Standards.  See the
-.B Standards Compliance
-section below for full details.
-.TP
-.B GD_PERMISSIVE
-Allow non-compliant format specification syntax, even when given along with a
-conflicting
-.B /VERSION
-directive.  See the
-.B Standards Compliance
-section below for full details.
-.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 is opened read-only, this flag is
-ignored.
-.TP
-.B GD_TRUNC
-If
-.I dirfilename
-specifies an already existing dirfile, it will be truncated before opening.
-Since
-.BR gd_cbopen ()
-decides whether
-.I dirfilename
-specifies an existing dirfile before attempting to parse the dirfile,
-.I dirfilename
-is considered to specify an existing dirfile if it refers to a directory
-containing a regular file called
-.BR format ,
-regardless of the content or form of that file.
-
-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 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
-argument may also be bitwise or'd with one of the following symbols indicating
-the default encoding scheme of the dirfile.  Like the endianness flags, the
-choice of encoding here is ignored if the encoding is specified in the dirfile
-itself, unless
-.B GD_FORCE_ENCODED
-is also specified.  If none of these symbols is present,
-.B GD_AUTO_ENCODED
-is assumed, unless the
-.BR gd_cbopen ()
-call results in creation or truncation of the dirfile.  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 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_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 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
-is provided in the preprocessor macro
-.B GD_DIRFILE_STANDARDS_VERSION
-defined in getdata.h.  GetData is able to open and parse any dirfile which
-conforms to this Standards Version, or to any earlier Version.  The
-.BR dirfile-format (5)
-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 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 (),
-the parser will start parsing the format specification in
-.I pedantic
-mode, otherwise it will start in
-.I permissive
-mode.
-
-.I Permissive
-mode is provided primarily to allow GetData to be used on dirfiles which
-conform to no single Standard, but which were accepted by the GetData parser
-in previous versions.  It is notably lax regarding reserved field names, and
-field name characters, the mixing of old and new data type specifiers, and
-generally ignores the presence of
-.B /VERSION
-directives.
-In read-write mode,
-.I permissive
-mode should be used with caution, as it can cause unintentional corruption of
-dirfile metadata on write, if the heuristics in the parser incorrectly guessed
-the intention of non-compliant syntax.  In
-.I permissive
-mode, actual syntax errors are still reported as such.
-
-In
-.I pedantic
-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
-flag, the parser will start in
-.I pedantic
-mode with a target version equal to
-.BR GD_DIRFILE_STANDARDS_VERSION .
-Whenever a
-.B /VERSION
-directive is encountered in the format specification, the target version is
-changed to the Standards Version specified.  When encountering a
-.B /VERSION
-directive in
-.I permissive
-mode, the parser will switch to
-.I pedantic
-mode, unless the
-.B GD_PERMISSIVE
-flag was passed to
-.BR gd_cbopen (),
-in which case no mode switch will take place.
-
-Independent of the mode of the parser when parsing the format specification,
-GetData will calculate a list of Standards Versions to which the parsed
-metadata conform to.  The
-.BR gd_dirfile_standards (3)
-function can provide this information, and also specify the desired
-Standards Version for writing format metadata back to disk.
-
-.SS The Callback Function
-The caller-supplied
-.I sehandler
-function is called whenever the format specification parser encounters a syntax
-error
-.RI ( i.e.
-whenever it would return the
-.B GD_E_FORMAT
-error).  This callback may be used to correct the error, or to tell the parser
-how to recover from it.
-
-This function should take two pointers as arguments, and return an
-.BR int :
-.RS
-.HP
-.nh
-.ad l
-.BI "int " sehandler "(gd_parser_data_t *" pdata ", void *" extra );
-.hy
-.ad n
-.RE
-.PP
-The
-.I extra
-parameter is the pointer supplied to
-.BR gd_cbopen (),
-passed verbatim to this function.  It can be used to pass caller data to the
-callback.  GetData does not inspect this pointer, not even to check its
-validity.  If the caller needs to pass no data to the callback, it may be NULL.
-
-The
-.B gd_parser_data_t
-type is a structure with at least the following members:
-
-.in +4n
-.fam C
-.nf
-typedef struct {
-  const DIRFILE* dirfile;
-  int suberror;
-  int linenum;
-  const char* filename;
-  char* line;
-  size_t buflen;
-
-  ...
-} gd_parser_data_t;
-.fi
-.fam
-.in
-.PP
-The
-.IR pdata -> dirfile
-member will be a pointer to a DIRFILE object suitable only for passing to
-.BR gd_error_string ().
-Notably, the caller should not assume this pointer will be the same as the
-pointer eventually returned by
-.BR gd_cbopen (),
-nor that it will be valid after the callback function returns.
-
-The
-.IR pdata -> suberror
-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.
-.TP
-.B GD_E_FORMAT_BAD_NAME
-The specified field name was invalid.
-.TP
-.B GD_E_FORMAT_BAD_SPF
-The samples-per-frame of a RAW field was out-of-range.
-.TP
-.B GD_E_FORMAT_BAD_TYPE
-The data type of a RAW field was unrecognised.
-.TP
-.B GD_E_FORMAT_BITNUM
-The first bit of a BIT field was out-of-range.
-.TP
-.B GD_E_FORMAT_BITSIZE
-The last bit of a BIT field was out-of-range.
-.TP
-.B GD_E_FORMAT_CHARACTER
-An invalid character was found in the line, or a character escape sequence was
-malformed.
-.TP
-.B GD_E_FORMAT_DUPLICATE
-The specified field name already exists.
-.TP
-.B GD_E_FORMAT_ENDIAN
-The byte sex specified by an
-.B /ENDIAN
-directive was unrecognised.
-.TP
-.B GD_E_FORMAT_LITERAL
-An unexpected character was encountered in a complex literal. 
-.TP
-.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_FIELD
-The parent of a metafield was not found.
-.TP
-.B GD_E_FORMAT_NUMBITS
-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
-directive was unrecognised.
-.TP
-.B GD_E_FORMAT_RES_NAME
-A field was specified with the reserved name
-.IR INDEX
-(or with the reserved name
-.IR FILEFRAM
-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
-be freely modified by the callback function.  It will then be reparsed if the
-callback function returns the symbol
-.B GD_SYNTAX_RESCAN
-(see below).  The size of the memory buffer (which may be greater than the
-length of the actual string) is provided in
-.IR pdata -> buflen ,
-and space is available for at least GD_MAX_LINE_LENGTH bytes.  A larger buffer
-may be used if desired, by assigning a pointer to the new buffer of the desired
-length to
-.IR pdata -> line .
-The new buffer should be allocated with
-.BR malloc (3).
-It will be freed by the parser.  Do not call
-.BR free (3)
-or
-.BR realloc (3)
-on the original pointer passed to the callback as
-.IR pdata -> line :
-it, too, will be freed by the parser.
-
-The callback function should return one of the following symbols, which
-tells the parser how to subsequently handle the error:
-.TP
-.B GD_SYNTAX_ABORT
-The parser should immediately abort parsing the format specification and fail
-with the error
-.BR GD_E_FORMAT .
-This is the default behaviour, if no callback function is provided (or if
-the parser is invoked by calling
-.BR gd_open ()).
-.TP
-.B GD_SYNTAX_CONTINUE
-The parser should continue parsing the format specification.  However, once
-parsing has finished, the parser will fail with the error
-.BR GD_E_FORMAT ,
-even if no further syntax errors are encountered.  This behaviour may be used by
-the caller to identify all lines containing syntax errors in the format
-specification, instead of just the first one.
-.TP
-.B GD_SYNTAX_IGNORE
-The parser should ignore the line containing the syntax error completely, and
-carry on parsing the format specification.  If no further errors are
-encountered, the dirfile will be successfully opened.
-.TP
-.B GD_SYNTAX_RESCAN
-The parser should rescan the
-.I line
-argument, which replaces the line which originally contained the syntax error.
-The line is assumed to have been corrected by the callback function.  If the
-line still contains a syntax error, the callback function will be called again.
-
-Note: the line is not corrected on disk; however, the caller may subsequently
-correct the fragment on disk by calling
-.BR gd_rewrite_fragment (3).
-.PP
-The callback function handles only syntax errors.  The parser may still abort
-early, if a different kind of library error is encountered.  Furthermore,
-although a line may contain more than one syntax error, the parser will only
-ever report one syntax error per line, even if the callback function returns
-.BR GD_SYNTAX_CONTINUE .
-
-.SH RETURN VALUE
-A call to
-.BR gd_cbopen ()
-or
-.BR gd_open ()
-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 truncate a dirfile opened read-only (i.e.
-.B GD_TRUNC
-was specified in
-.I flags
-along with
-.BR GD_RDONLY ).
-.TP
-.B GD_E_ALLOC
-The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_REFERENCE
-The reference field specified by a
-.B /REFERENCE
-directive in the format specification (see
-.BR dirfile-format (5))
-was not found, or was not a
-.B RAW
-field.
-.TP
-.B GD_E_CALLBACK
-The registered callback function,
-.IR sehandler ,
-returned an unrecognised response.
-.TP
-.B GD_E_CREAT
-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
-.B GD_E_FORMAT
-A syntax error occurred in the format specification.  See also
-.B The Callback Function
-section above.
-.TP
-.B GD_E_IO
-The dirfile format file, or another file that it includes, could not be opened,
-or
-.I dirfilename
-does not specify a valid dirfile.
-.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 bytes.  The
-limit is larger on 64-bit systems.
-.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).
-When finished with it, a caller should de-allocate the DIRFILE object by calling
-.BR gd_close (3),
-or
-.BR gd_discard (3),
-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
-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 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
-dirfiles lacking
-.BR /ENDIAN .
-To read an old, little-ended dirfile on a big-ended platform, an
-.B /ENDIAN
-directive should be added to the format specification, or else
-.B GD_LITTLE_ENDIAN
-should be specified by the caller.
-
-GetData's parser assumes it is running on an ASCII-compatible platform.  Format
-specification parsing will fail gloriously on an EBCDIC platform.
-.SH SEE ALSO
-.BR dirfile (5),
-.BR dirfile-encoding (5),
-.BR dirfile-format (5),
-.BR gd_close (3),
-.BR gd_dirfile_standards (3),
-.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_verbose_prefix (3)
diff --git a/man/gd_close.3 b/man/gd_close.3
index 84f40b0..0da67fa 100644
--- a/man/gd_close.3
+++ b/man/gd_close.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_close.3.  The gd_close man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2014, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,105 +88,123 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_close 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_close 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_close, gd_discard \(em close a dirfile and free associated memory
+gd_close, gd_discard \(em close a Dirfile and free associated memory
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_close(DIRFILE *" dirfile );
 .HP
 .BI "int gd_discard(DIRFILE *" dirfile );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_close ()
-function first calls
-.BR gd_flush (3)
-(with
-.I field_code
-set to NULL) to flush all metadata changes to disk and to close all file handles
-associated with 
-.IR dirfile .
-It then frees memory associated with the DIRFILE object.  If
-.I dirfile
-is NULL, nothing happens, and the call succeeds.
+.FN gd_close
+and
+.FN gd_discard
+attempt to close the open Dirfile
+.ARG dirfile
+and free all memory associated with it.
 
 The
-.BR gd_discard ()
-function behaves similarly, except modified metadata is not written to disk,
-but simply discarded.  In order to ensure that modified data files associated
-with
+.FN gd_close
+function first flushes all pending metadata updates to disk.  This step is
+skipped by
+.FN gd_discard ,
+which simply discards metadata changes.  For dirfiles opened read-only,
+these two functions are equivalent.
+
+Next, all pending data is flushed to disk and all open data files closed.
+In order to ensure that modified data files associated with
 .B RAW
 fields are properly terminated, changes to
 .B RAW
-data files are still flushed to disk by this function.  If
-.I dirfile
-was opened in read-only mode,
-.BR gd_discard ()
-and
-.BR gd_close ()
-behave identically.
+data files are still flushed to disk by
+.FN gd_discard .
+
+Finally, if the above didn't encounter an error, these functions free memory
+associated with the DIRFILE object.
+
+If
+.ARG dirfile
+is NULL, nothing happens, and the call succeeds.
 
 One of these functions should be called on all pointers returned by
-.BR gd_cbopen (3),
-.BR gd_open (3),
+.F3 gd_cbopen ,
+.F3 gd_open ,
 and
-.BR gd_invalid_dirfile (3),
+.F3 gd_invalid_dirfile ,
 even if the call to those function failed.  After
-.BR gd_close ()
+.FN gd_close
 or
-.BR gd_discard ()
+.FN gd_discard
 returns successfully, the pointer
-.I dirfile
+.ARG dirfile
 should be considered invalid.
-.PP
+
 Metadata is written to disk using the current Standards Version as stored in the
-.I dirfile
+.ARG dirfile
 object.  See
-.BR gd_dirfile_standards (3)
+.F3 gd_dirfile_standards
 to change or report the current Standards Version.  If the dirfile metadata
 conforms to no known Standards Version, Standards non-compliant metadata will
 be written.
+
 .SH RETURN VALUE
-.BR gd_close ()
+.FN gd_close
 and
-.BR gd_discard ()
+.FN gd_discard
 return zero on success.  On error, they do not de-allocate
-.I dirfile
-and set the dirfile error to a non-zero error value.  Possible error values
-are:
-.TP 8
-.B GD_E_ALLOC
+.ARG dirfile
+and instead return a negative-valued error code.  Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_LINE_TOO_LONG
+.DD GD_E_LINE_TOO_LONG
 While attempting to flush modified metadata to disk, a field specification line
 exceeded the maximum allowed length.  On most platforms, the maximum length is
 at least 2**31 bytes, so this typically indicates something pathological
 happening.
-.TP
-.B GD_E_IO
+.DD GD_E_IO
 An I/O error occurred while trying to write modified data or metadata to disk.
 In this case, another call to
-.BR gd_close ()
+.FN gd_close
 or
-.BR gd_discard ()
+.FN gd_discard
 may be attempted.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The function
+.FN dirfile_close
+appeared in GetData-0.3.0.
+
+The function
+.FN dirfile_discard
+appeared in GetData-0.6.0.
+
+In GetData-0.7.0 these functions were renamed to
+.FN gd_close
+and
+.FN gd_discard .
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_cbopen (3),
-.BR gd_dirfile_standards (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_flush (3),
-.BR gd_invalid_dirfile (3),
-.BR gd_open (3)
+.F3 gd_dirfile_standards ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_flush ,
+.F3 gd_invalid_dirfile ,
+.F3 gd_open
diff --git a/man/gd_constants.3 b/man/gd_constants.3
index 13804be..1f24dc0 100644
--- a/man/gd_constants.3
+++ b/man/gd_constants.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_constants.3.  The gd_constants man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2011, 2015 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011, 2015, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,70 +88,82 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_constants 3 "4 December 2015" "Version 0.9.1" "GETDATA"
+.TH gd_constants 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_constants, gd_mconstants \(em retrieve a list of constant values from a dirfile
+gd_constants, gd_mconstants \(em retrieve a list of constant values from a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "const void *gd_constants(DIRFILE *" dirfile ", gd_type_t
 .IB return_type );
 .HP
 .BI "const void *gd_mconstants(DIRFILE *" dirfile ", const char"
 .BI * parent ", gd_type_t " return_type );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_constants ()
+.FN gd_constants
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns a read-only list of values of the all
+.ARG dirfile
+and compiles a list of values of the all
 .B CONST
 fields defined in the database, excluding meta subfields.  The values returned
 are converted to the data type specified by
-.IR return_type .
+.ARG return_type .
 The 
-.I return_type 
+.ARG return_type 
 should be one of the following symbols:
 .IP
-.nh
-.ad l
+.SC
 .BR GD_UINT8 ,\~ GD_INT8 ,\~ GD_UINT16 ,\~ GD_INT16 ,\~ GD_UINT32 ,\~ GD_INT32 ,
 .BR GD_UINT64, \~ GD_INT64 ,\~ GD_FLOAT32 ,\~ GD_FLOAT64 ,\~ GD_COMPLEX64 ,
 .BR GD_COMPLEX128 .
-.ad n
-.hy
+.EC
 .PP
 See
-.BR gd_get_constant (3)
+.F3 gd_get_constant
 for the meaning of these symbols.  The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
-
+.F3 gd_open .
 
 The
-.BR gd_mconstants ()
+.FN gd_mconstants
 function returns the same list for
 .B CONST
 meta subfields of the parent field specified by
-.IR parent .
+.ARG parent .
+
+A corresponding list of names for these fields may be obtained by calling
+.F3 gd_field_list_by_type
+or
+.F3 gd_mfield_list_by_type .
+
+.SH RETURN VALUE
+Upon successful completion,
+.FN gd_constants
+returns a pointer to an array containing the values of all the constants defined
+in the dirfile database.  Similarly,
+.FN gd_mconstants
+returns a pointer to an array containing the values of the all the meta subfield
+constants of the specified parent field.
 
 The list returned should not be assumed to be in any particular order, although
 it is guaranteed to be in the same order as the list of
 .B CONST
 fields returned by
-.BR gd_field_list_by_type (3)
+.F3 gd_field_list_by_type
 or
-.BR gd_mfield_list_by_type (3).
+.F3 gd_mfield_list_by_type .
 The array is unterminated.  The number of values in the array can be obtained
 from a call to
-.BR gd_nfields_by_type (3)
+.F3 gd_nfields_by_type
 or
-.BR gd_nmfields_by_type (3),
+.F3 gd_nmfields_by_type ,
 as appropriate.
 
 Memory for the returned array is managed by GetData and should not be
@@ -84,71 +171,68 @@ de-allocated by the caller.  The caller may not modify any values in the array.
 Doing so may cause database corruption.  The pointer returned is guaranteed to
 be valid only until the function is called again, with the exception that, since
 each top-level field maintains its own arrays, calling
-.BR gd_mconstants ()
+.FN gd_mconstants
 for a one parent field does not invalidate the pointer returned for a any other
 parent.
 
 Modifying the dirfile's metadata invalidates any pointer returned by these
 functions.  And no pointers remain valid after the dirfile is de-allocated by a
 call to
-.BR gd_close (3)
+.F3 gd_close
 or
-.BR gd_discard (3).
+.F3 gd_discard .
 Once a pointer is invalidated, the caller should not dereference it.
 
-A corresponding list of names for these fields may be obtained by calling
-.BR gd_field_list_by_type (3)
-or
-.BR gd_mfield_list_by_type (3).
-
-.SH RETURN VALUE
-Upon successful completion,
-.BR gd_constants ()
-returns a pointer to an array containing the values of all the constants defined
-in the dirfile database.  Similarly,
-.BR gd_mconstants ()
-returns a pointer to an array containing the values of the all the meta subfield
-constants of the specified parent field.
-
 If no constants of the appropriate class 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:
-.TP 8
-.B GD_E_ALLOC
+returned.  This is not considered an error.
+
+On error, these functions return NULL and store a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The specified
-.I parent
+.ARG parent
 field code was not found, or referred to a metafield
 .RB ( gd_mconstants ()
 only).
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 The
-.I return_type
+.ARG return_type
 specified was not one of the symbols listed above.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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).
-A descriptive error string for the last error encountered can be obtained from
-a call to
-.BR gd_error_string (3).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The functions
+.FN get_constants
+and
+.FN get_mconstants
+appeared in GetData-0.4.0.
+
+In GetData-0.7.0, these functions were renamed to
+.FN gd_constants
+and
+.FN gd_mconstants .
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_field_list_by_type (3),
-.BR gd_get_constant (3),
-.BR gd_mfield_list_by_type (3),
-.BR gd_nfields_by_type (3),
-.BR gd_nmfields_by_type (3)
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_field_list_by_type ,
+.F3 gd_get_constant ,
+.F3 gd_mfield_list_by_type ,
+.F3 gd_nfields_by_type ,
+.F3 gd_nmfields_by_type ,
+.F3 gd_open ,
+dirfile(5)
diff --git a/man/gd_delete.3 b/man/gd_delete.3
index cb738b1..bac9aa0 100644
--- a/man/gd_delete.3
+++ b/man/gd_delete.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_delete.3.  The gd_delete man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2012, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,112 +88,101 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_delete 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_delete 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_delete \(em remove an entry from a dirfile
+gd_delete \(em remove an entry from a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_delete(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "unsigned int " flags );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_delete ()
+.FN gd_delete
 function attempts to delete the field or alias specified by
-.I field_code
-in the dirfile specified by
-.IR dirfile .
+.ARG field_code
+from the dirfile specified by
+.ARG dirfile .
 The
-.I field_code
+.ARG field_code
 should not contain a representation suffix.
 
 The
-.I flags
+.ARG 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
 together:
-.TP 8
-.B GD_DEL_DATA
+.DD GD_DEL_DATA
 If the field to be deleted is a
 .B RAW
 field, also delete the binary data file associated with it.  If
-.I field_code
+.ARG field_code
 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.
-.TP
-.B GD_DEL_DEREF
+.DD GD_DEL_DEREF
 If the field to be deleted is a
 .B CONST
 or
 .B CARRAY
 field which is used as a parameter in the specification of other fields, resolve
-these other fields dependence on the deleted field by replacing instances of
-.I field_code
+these other fields' dependence on the deleted field by replacing instances of
+.ARG field_code
 in their field specifications with the value of the scalar field.
-.TP
-.B GD_DEL_FORCE
+.DD GD_DEL_FORCE
 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, or if it has aliases pointing to it.
-.TP
-.B GD_DEL_META
+.DD 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.
+
 .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:
-.TP 8
-.B GD_E_ACCMODE
+On successful deletion, zero is returned.  On error, a negative-valued error
+code is returned.  Possible error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_DELETE
-The attempt to delete the field failed.  Either the specified field is used in
-the specification of other fields and
+.DD GD_E_DELETE
+The attempt to delete the field failed.  Either it is used in the specification
+of other fields and
 .B GD_DEL_FORCE
 or
 .B GD_DEL_DEREF
 was not specified, or it has metafields and
 .B GD_DEL_META
 was not specified.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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_IO
+.DD GD_E_IO
 An error occurred while trying to close or delete the binary file associated
 with a
 .B RAW
 field.
-.TP
-.B GD_E_PROTECTED
+.DD GD_E_PROTECTED
 The metadata of the fragment containing the field was protected from change.
 Or, the deletion of the binary data file associated with a
 .B RAW
 field was attempted and the data of the fragment was protected.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 The
 .B GD_DEL_DATA
 flag was given but the encoding scheme of the indicated format specification
@@ -126,8 +190,7 @@ fragment is not known to the library.  As a result, the library was unable to
 delete the binary file associated with a
 .B RAW
 field.
-.TP
-.B GD_E_UNSUPPORTED
+.DD GD_E_UNSUPPORTED
 The
 .B GD_DEL_DATA
 flag was given but the encoding scheme of the indicated format specification
@@ -135,14 +198,37 @@ fragment does not support deleting the binary file associated with a
 .B RAW
 field.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+
+The function
+.FN dirfile_delete
+appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_delete .
+
+In all GetData-0.8.x releases, passing an alias name to this function would
+delete the target of the alias.  To delete an alias itself, a separate function,
+.FN gd_delete_alias
+was available.
+
+In GetData-0.9.0,
+.FN gd_delete_alias
+was removed.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_close (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_metaflush (3)
+.F3 gd_close ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_metaflush ,
+.F3 gd_open
diff --git a/man/gd_desync.3 b/man/gd_desync.3
index ad3ccd6..a605f92 100644
--- a/man/gd_desync.3
+++ b/man/gd_desync.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_desync.3.  The gd_desync man page.
 .\"
-.\" Copyright (C) 2012, 2014 D. V. Wiebe
+.\" Copyright (C) 2012, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,97 +88,95 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_desync 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_desync 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_desync \(em check for a change of metadata on disk
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_desync(DIRFILE *" dirfile ", unsigned int " flags );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_desync ()
-function reports whether the metadata of the loaded
-.I dirfile
+.FN gd_desync
+function determines whether the metadata of the loaded
+.ARG 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
+.ARG 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
+.ARG flags
+argument influences how the function works.  It should be zero or more of the
+following flags, bitwise or'd together:
+.DD GD_DESYNC_PATHCHECK
+Ignore GetData's internal directory cache, and use the format fragments' full
+path when checking for modifications.  This flag is of particular importance
+when the
+.ARG dirfilename
 passed to
-.BR gd_cbopen (3),
+.F3 gd_cbopen ,
 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
+.DD GD_DESYNC_REOPEN
 If this flag is specified, and
-.BR gd_desync ()
+.FN gd_desync
 detects desynchronisation, the Dirfile will be re-opened in place using the
 exiting
-.I dirfile
+.ARG 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
+.ARG dirfile
 has been successfully opened.
 
 Re-opening the dirfile is equivalent to calling
-.BR gd_discard (3),
+.F3 gd_discard ,
 and then
-.BR gd_cbopen (3)
+.F3 gd_cbopen
 with the same arguments used when originally creating
-.IR dirfile ,
+.ARG dirfile ,
 except that the
-.I dirfile
+.ARG dirfile
 pointer doesn't change its value.  As a result, this function may invoke the
 registered parser callback function (see
-.BR gd_cbopen (3)
+.F3 gd_cbopen
 and
-.BR gd_parser_callback (3)).
+.F3 gd_parser_callback ).
+
 .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
+When successful, this function returns zero if the loaded dirfile has not
+desynchronised, or one if it has.  On error, a negative-valued error code is
+returned, regardless of desynchronisation.  Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_IO
+.DD GD_E_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)
+.F3 gd_discard
 and
-.BR gd_cbopen (3)
+.F3 gd_cbopen
 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
 .SH LIMITATIONS
 The current implementation uses file modification times as reported by
 .BR stat (2)
@@ -112,18 +185,28 @@ 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).
+.F3 gd_fragmentname .
 .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 .
+.ARG flags .
+
+.SH HISTORY
+The function
+.FN gd_desync
+appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .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)
+.BR stat (2),
+.F3 gd_cbopen ,
+.F3 gd_discard ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_parser_callback
diff --git a/man/gd_dirfile_standards.3 b/man/gd_dirfile_standards.3
index d515bab..2baedff 100644
--- a/man/gd_dirfile_standards.3
+++ b/man/gd_dirfile_standards.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_dirfile_standards.3.  The gd_dirfile_standards man page.
 .\"
-.\" Copyright (C) 2010, 2012 D. V. Wiebe
+.\" Copyright (C) 2010, 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,66 +88,64 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_dirfile_standards 3 "29 June 2012" "Version 0.8.0" "GETDATA"
+.TH gd_dirfile_standards 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_dirfile_standards \(em change or report the current Dirfile Standards Version
 for a DirFile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_dirfile_standards(DIRFILE *" dirfile ", int " version );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_dirfile_standards ()
-function updates the current Standards Version for the open dirfile
-.I dirfile
+.FN gd_dirfile_standards
+function sets the current Standards Version for the open dirfile
+.ARG dirfile
 to the value specified by
-.IR version ,
-if possible, and then reports the current Standards Version.  Metadata written to
-disk for
-.I dirfile
-will conform to the current Standards Version.
+.ARG version ,
+determining the syntax used to write metadata to disk for
+.ARG dirfile .
 
 The Standards Version of the loaded dirfile also affects the operation of
 functions which add fields, such as
-.BR dirfile_add (3)
+.F3 dirfile_add
 or 
-.BR dirfile_add_spec (3);
+.F3 dirfile_add_spec ;
 and functions which modify field metadata, such as
-.BR dirfile_alter_entry (3)
+.F3 dirfile_alter_entry
 or 
-.BR dirfile_alter_spec (3).
+.F3 dirfile_alter_spec .
 For specific behaviour see the manual page of the appropriate function.
 
 The
-.I version
+.ARG version
 parameter should be between zero and the value of the symbol
 .BR GD_DIRFILE_STANDARDS_VERSION ,
-which is the newest Standards Version understood by GetData, inclusive or else
+which is the newest Standards Version understood by GetData, inclusive, or else
 one of the following special symbols:
-.TP
-.B GD_VERSION_EARLIEST
+.DD GD_VERSION_EARLIEST
 Specifies the current Standards Version should be set to the earliest version
-to which the loaded dirfile conforms.
-.TP
-.B GD_VERSION_CURRENT
+that supports all the features of the loaded
+.ARG dirfile ;
+.DD GD_VERSION_CURRENT
 Specifies that the current Standards Version should not be changed.  In this
-case, this function simply reports the current Standards Version.
-.TP
-.B GD_VERSION_LATEST
+case, this function simply reports the current Standards Version;
+.DD GD_VERSION_LATEST
 Specifies the current Standards Version should be set to the latest version
-to which the loaded dirfile conforms.
-.PP
+that supports all the features of the loaded
+.ARG dirfile ;
+
 If the loaded dirfile does not conform to the specified
-.IR version ,
+.ARG version ,
 this function fails, and the current Standards Version is unchanged.  If the
 loaded dirfile conforms to no known Standards Version, this function will fail
 regardless of the value of
-.I version
+.ARG version
 (even if
 .B GD_VERSION_CURRENT
 is used).
@@ -85,35 +158,43 @@ and
 
 .SH RETURN VALUE
 On success,
-.BR gd_dirfile_standards ()
+.FN gd_dirfile_standards
 returns the current Standards Version of the loaded dirfile, after possibly
-having been updated by the call.  This will be a number between zero and
+having been updated by the call.  This will be a non-negative integer between
+zero and
 .BR GD_DIRFILE_STANDARDS_VERSION
-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_ARGUMENT
+inclusive.  On error, a negative-valued error code is returned, and the current
+Standards Version is not changed.  Possible error codes are:
+.DD 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
+.DD 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
 
 .SH NOTES
 This function only changes the current Standards Version of the loaded dirfile.
 It does not update the any format specification fragments on disk to conform to
 the specified Standards Version.  To do that, use
-.BR gd_metaflush (3)
+.F3 gd_metaflush
 or 
-.BR gd_rewrite_fragment (3).
+.F3 gd_rewrite_fragment .
+
+.SH HISTORY
+The function
+.FN gd_dirfile_standards
+appeared in GetData-0.7.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_metaflush (3),
-.BR gd_rewrite_fragment (3)
+.F3 gd_open ,
+.F3 gd_metaflush ,
+.F3 gd_rewrite_fragment
diff --git a/man/gd_dirfilename.3 b/man/gd_dirfilename.3
index ff103ee..be4e9a0 100644
--- a/man/gd_dirfilename.3
+++ b/man/gd_dirfilename.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_dirfilename.3.  The dirfilename man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,47 +88,60 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_dirfilename 3 "1 August 2012" "Version 0.8.1" "GETDATA"
+.TH gd_dirfilename 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_dirfilename \(em retrieve the name of a dirfile
+gd_dirfilename \(em retrieve the name of a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "const char *gd_dirfilename(DIRFILE *" dirfile );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_dirfilename ()
+.FN gd_dirfilename
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and returns its name.  The name of a dirfile is an absolute pathname which
 refers to the dirfile base directory.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_dirfilename ()
+.FN gd_dirfilename
 returns a pointer to a constant string containing the pathname of the dirfile.
 On error, 
-.BR gd_dirfilename ()
-returns NULL and sets the dirfile error to a non-zero value.  Possible error
-values are:
-.TP 8
-.B GD_E_BAD_DIRFILE
+.FN gd_dirfilename
+returns NULL and stores a negative-valued error code in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD 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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+
+The function
+.FN dirfilename
+appeared in GetData-0.3.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_dirfilename .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_cbopen (3),
+.F3 gd_open ,
 .BR path_resolution (7)
diff --git a/man/gd_encoding.3 b/man/gd_encoding.3
index bec02b6..340d359 100644
--- a/man/gd_encoding.3
+++ b/man/gd_encoding.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_encoding.3.  The gd_encoding man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,26 +88,27 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_encoding 3 "21 April 2012" "Version 0.8.0" "GETDATA"
+.TH gd_encoding 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_encoding \(em report the binary encoding of data in a dirfile
+gd_encoding \(em report the binary encoding of data in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "unsigned long gd_encoding(DIRFILE *" dirfile ", int " fragment_index );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_encoding ()
+.FN gd_encoding
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns the binary encoding for the fragment indexed by
-.IR fragment_index .
-The binary encoding of a fragment indicate the encoding of data stored in binary
-files associated with
+.ARG dirfile
+and returns the data encoding for the fragment indexed by
+.ARG fragment_index .
+The data encoding of a fragment indicate the encoding of data files associated
+with
 .B RAW
 fields defined in the specified fragment.  The encoding of a fragment
 containing no
@@ -41,14 +117,14 @@ fields is ignored.
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_encoding ()
+.FN gd_encoding
 returns the binary encoding of the specified fragment, which will one of the
 following symbols:
 .IP
-.nh
-.ad l
+.SC
 .BR GD_UNENCODED ,
 .BR GD_BZIP2_ENCODED ,
+.BR GD_FLAC_ENCODED ,
 .BR GD_GZIP_ENCODED ,
 .BR GD_LZMA_ENCODED ,
 .BR GD_SIE_ENCODED ,
@@ -57,36 +133,42 @@ following symbols:
 .BR GD_ZZIP_ENCODED ,
 .BR GD_ZZSLIM_ENCODED ,
 .BR GD_ENC_UNSUPPORTED .
-.ad n
-.hy
+.EC
 .PP
 If the encoding scheme specified in the dirfile
 metadata is unknown to GetData,
 .B GD_ENC_UNSUPPORTED
 will be returned.  See
-.BR gd_cbopen (3)
+.F3 gd_open
 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:
-.TP 8
-.B GD_E_BAD_DIRFILE
+
+On error, this function returns zero and stores a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD 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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_encoding
+function appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_encoding .
+
 .SH SEE ALSO
-.BR gd_alter_encoding (3),
-.BR gd_cbopen (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_getdata (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
+.F3 gd_alter_encoding ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_getdata ,
+.F3 gd_open ,
+dirfile(5), dirfile-encoding(5)
diff --git a/man/gd_encoding_support.3 b/man/gd_encoding_support.3
index 72ceda9..8070f1b 100644
--- a/man/gd_encoding_support.3
+++ b/man/gd_encoding_support.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_encoding_support.3.  The gd_encoding_support man page.
 .\"
-.\" Copyright (C) 2014 D. V. Wiebe
+.\" Copyright (C) 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,50 +88,57 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_encoding_support 3 "5 May 2014" "Version 0.9.0" "GETDATA"
+.TH gd_encoding_support 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_encoding_support \(em determine GetData library support for data encodings
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_encoding_support(unsigned long " encoding );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_encoding_support ()
+.FN gd_encoding_support
 function reports whether the Dirfile encoding specified by
-.I encoding
+.ARG encoding
 is supported by the GetData library.  The
-.I encoding
+.ARG encoding
 argument should be one of the following symbols, indicating the encoding type:
 .IP
-.nh
-.ad l
-.BR GD_UNENCODED ", " GD_BZIP2_ENCODED ", " GD_GZIP_ENCODED ,
-.BR GD_LZMA_ENCODED ", " GD_SIE_ENCODED ", " GD_SLIM_ENCODED ,
-.BR GD_TEXT_ENCODED ", " GD_ZZIP_ENCODED ", " GD_ZZSLIM_ENCODED .
-.ad n
-.hy
+.SC
+.BR GD_UNENCODED ,
+.BR GD_BZIP2_ENCODED ,
+.BR GD_FLAC_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 .
+.EC
 .PP
 See
-.BR gd_cbopen (3)
+.F3 gd_open
 and dirfile-encoding(5) for the meanings of these symbols and details on the
 known encoding schemes.
 
 .SH RETURN VALUE
 The function
-.BR gd_encoding_support ()
+.FN gd_encoding_support
 returns
 .B GD_RDWR
 if the GetData library can read from and write to the specified encoding,
 .B GD_RDONLY
 if the GetData library can only read from the specified encoding, or -1 if
 neither reading nor writing is supported, or if
-.I encoding
+.ARG encoding
 was not one of the symbols listed above.
+
 .SH NOTES
 GetData's encoding support framework is more finely grained than the three-way
 system reported by this function.  It is possible for the library to have
@@ -75,7 +157,12 @@ will return
 when passed
 .BR GD_LZMA_ENCODED .
 
+.SH HISTORY
+The
+.FN gd_encoding_support
+function appeared in GetData-0.9.0.
+
 .SH SEE ALSO
-dirfile-encoding(5),
-.BR gd_cbopen (3),
-.BR gd_encoding (3)
+.F3 gd_encoding ,
+.F3 gd_open ,
+dirfile-encoding(5)
diff --git a/man/gd_endianness.3 b/man/gd_endianness.3
index 24d3b11..9358901 100644
--- a/man/gd_endianness.3
+++ b/man/gd_endianness.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_endianness.3.  The gd_endianness man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,26 +88,27 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_endianness 3 "17 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_endianness 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_endianness \(em report the byte sex of fields in a dirfile
+gd_endianness \(em report the byte sex of fields in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "unsigned long gd_endianness(DIRFILE *" dirfile ", int " fragment_index );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_endianness ()
+.FN gd_endianness
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns the byte sex for the fragment indexed by
-.IR fragment_index .
-The byte sex of a fragment indicate the endianness of data stored in binary
-files associated with
+.ARG dirfile
+and retrieves the byte sex of the fragment indexed by
+.ARG fragment_index .
+The byte sex of a fragment indicates the endianness of data files associated
+with
 .B RAW
 fields defined in the specified fragment.  The endianness of a fragment
 containing no
@@ -40,39 +116,58 @@ containing no
 fields is not meaningful.
 
 The
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_endianness ()
+.FN gd_endianness
 returns the byte sex of the specified fragment, which will be either
-.BR GD_BIG_ENDIAN " or " GD_LITTLE_ENDIAN ,
-bitwise-or'd with either
+.nh
+.B GD_BIG_ENDIAN
+or
+.BR GD_LITTLE_ENDIAN .
+.hy
+This will be bitwise-or'd with either
 .B GD_ARM_ENDIAN 
 or 
 .BR GD_NOT_ARM_ENDIAN ,
 indicating whether double-precision floating point data in this fragment are
-stored in the old ARM middle-endian format.  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_DIRFILE
+stored in the old ARM middle-endian format.
+
+On error, this function returns zero and stores a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD 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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_endianness
+function appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_endianness .
+This version also added the
+.B GD_ARM_ENDIAN 
+and 
+.BR GD_NOT_ARM_ENDIAN
+flags.
+
 .SH SEE ALSO
-.BR gd_alter_endianness (3),
-.BR gd_getdata (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_open (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
+.F3 gd_alter_endianness ,
+.F3 gd_getdata ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_open ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_entry.3 b/man/gd_entry.3
index accc7a7..777adc8 100644
--- a/man/gd_entry.3
+++ b/man/gd_entry.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_entry.3.  The gd_entry man page.
 .\"
-.\" Copyright (C) 2008-2013 D. V. Wiebe
+.\" Copyright (C) 2008-2013, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,52 +88,61 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_entry 3 "10 December 2013" "Version 0.9.0" "GETDATA"
+.TH gd_entry 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_entry \(em retrieve a dirfile field's metadata
+gd_entry \(em retrieve a Dirfile field's metadata
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_entry(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "gd_entry_t *" entry );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_entry ()
+.FN gd_entry
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns the metadata associated with the field specified by
-.IR field_code .
+.ARG dirfile
+and retrieves the metadata associated with the field specified by
+.ARG field_code .
 If
-.I field_code
+.ARG field_code
 contains a valid representation suffix, the suffix will be ignored.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 The entry will be stored in the gd_entry_t structure indicated by the
-.I entry
+.ARG entry
 argument, which must be allocated by the caller.  Members available in this
 structure depend on the field type of the field queried.  See below for a
 complete description of this data type.
 
 Strings members in 
-.I entry
-filled by this function (variously, depending on field type:
-.IR field ", the elements of the " in_fields "[] array, " table ;
-see below) will by dynamically allocated by
-.BR gd_entry ()
-and should not point to allocated memory locations before calling this function.
+.ARG entry
+filled by this function (including, depending on field type:
+.ARG field ,
+elements of the
+.ARG in_fields 
+and
+.ARG scalar
+arrays, the
+.B LINTERP
+.ARG table
+member) will by dynamically allocated by
+.FN gd_entry .
 Only strings provided by the gd_entry_t for the particular field type described
-will be allocated.  These strings should be de-allocated with
-.BR free (3)
-by the caller once they are no longer needed.  The
-.BR gd_free_entry_strings (3)
+will be allocated.  By default, these strings are allocated using
+.F3 strdup ,
+but this can be changed by specifying an alternate memory manager via
+.F3 gd_alloc_funcs .
+The caller is responsible for deallocating these strings.  The
+.F3 gd_free_entry_strings
 function is provided as a convenience to do this.
 
 If the entry's metadata contains scalar field codes which cannot be
@@ -70,42 +154,40 @@ flag in the returned entry object will
 be set.
 
 The returned
-.I entry
+.ARG entry
 structure, including strings and their pointers may be freely modified by the
 caller.
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_entry ()
-returns zero, and writes the field metadata in the supplied gd_entry_t buffer.
+.FN gd_entry
+returns zero and writes the field metadata in the supplied gd_entry_t buffer.
 On error, the supplied gd_entry_t buffer is not modified.  In this case,
-.BR gd_entry ()
-returns -1 and sets the dirfile error to a non-zero error value.  Possible
-error values are:
-.TP 8
-.B GD_E_ALLOC
+.FN gd_entry
+returns a negative-valued error code.  Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
 .SH THE ENTRY TYPE
 Members available in the gd_entry_t structure depend on the field type
 described.  All gd_entry_t objects are guaranteed to have at least:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
@@ -116,25 +198,24 @@ typedef struct {
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I field
+.ARG field
 member is the field code of the entry (i.e. its string name).  If the call to
-.BR gd_entry (3)
+.F3 gd_entry
 is successful, this will be the field name specified as part of the
-.I field_code
+.ARG field_code
 argument.
 .PP
 The
-.I field_type
+.ARG field_type
 member indicates the field type of the entry.  This is an integer type equal
 to one of the following symbols:
 .IP
-.nh
-.ad l
+.SC
 .BR GD_BIT_ENTRY ,
 .BR GD_CARRAY_ENTRY ,
 .BR GD_CONST_ENTRY ,
@@ -151,8 +232,7 @@ to one of the following symbols:
 .BR GD_SBIT_ENTRY ,
 .BR GD_STRING_ENTRY ,
 .BR GD_WINDOW_ENTRY .
-.ad n
-.hy
+.EC
 .PP
 .B GD_INDEX_ENTRY
 is a special field type used only for the implicit
@@ -160,33 +240,31 @@ is a special field type used only for the implicit
 field.  The other entry types are explained in detail in dirfile-format(5).
 .PP
 The 
-.I fragment_index
+.ARG fragment_index
 member indicates the format specification fragment in which this field is
 defined.  This is an integer index to the Dirfile's list of parsed format
 specification fragments.  The name of the file corresponding to
-.I fragment_index
+.ARG fragment_index
 may be obtained by calling
-.BR gd_fragmentname (3).
+.F3 gd_fragmentname .
 A value of zero for this field indicates that the field is defined in the
 primary fragment, the file called
 .B format
-in the root dirfile directory (see 
-.IR dirfile (5)).
+in the root dirfile directory (see dirfile(5)).
 .PP
 The
-.I flags
+.ARG flags
 member is a bitwise or'd collection of the following entry flags:
-.TP
-.B GD_EN_CALC
+.DD GD_EN_CALC
 This bit is set only when the non-literal scalar parameter field codes specified
 in the
-.I scalar
+.ARG scalar
 member have been resolved, and the corresponding numerical parameter have
 been initialised with these data.  When one or more field code does not exist,
 or is invalid (ie. when
-.BR gd_validate (3)
+.F3 gd_validate
 would fail on the specified
-.I field_code
+.ARG field_code
 with the error
 .BR GD_E_BAD_SCALAR ),
 then the unresolved numerical parameters are initialised to zero, and this flag
@@ -200,25 +278,23 @@ parameters
 .BR MULTIPLY ,
 .BR STRING ),
 the value of this bit is unspecified.
-.TP
-.B GD_EN_COMPSCAL
+.DD GD_EN_COMPSCAL
 For fields which permit complex valued parameters
 .RB ( LINCOM ,
 .BR POLYNOM ,
 .BR RECIP ),
 this bit is set only when at least one parameter is complex valued.  For
 other field types, the value of this bit is unspecified.
-.TP
-.B GD_EN_HIDDEN
+.DD GD_EN_HIDDEN
 This bit is set only when the field has been hidden by the
 .B /HIDDEN
 directive (see
-.BR gd_hidden (3)).
+.F3 gd_hidden ).
 .PP
 Remaining fields in the gd_entry_t structure depend on the value of
-.IR field_type .
+.ARG field_type .
 Callers are advised to check
-.I field_type
+.ARG field_type
 before attempting to access the remaining members.  Members for different
 field types may be stored in the same physical location in core.  Accordingly,
 attempting to access a member not declared for the appropriate field type will
@@ -231,20 +307,21 @@ parameters
 .BR SBIT ", or " WINDOW )
 will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
-  const char *scalar[GD_MAX_POLY_ORD + 1];     /* param. fields */
-  int         scalar_ind[GD_MAX_POLY_ORD + 1]; /* CARRAY indices */
+  const char *scalar[GD_MAX_POLY_ORD + 1];   /* param. fields */
+  int         scalar_ind[GD_MAX_POLY_ORD + 1];
+                                            /* CARRAY indices */
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 Only certain elements of these arrays will be initialised:
 .IP \(bu
@@ -253,9 +330,9 @@ For
 and
 .B SBIT
 fields, the first element corresponds to
-.I bitnum
+.ARG bitnum
 and the second to
-.IR numbits .
+.ARG numbits .
 The remainder are uninitialised.
 .IP \(bu
 For
@@ -269,53 +346,53 @@ and the next
 elements correspond to the offsets
 .RI ( cb ).
 Only the first
-.I n_fields
+.ARG n_fields
 elements of these two sets are initialised.  Notably, this means for
-.I n_fields
+.ARG n_fields
 < GD_MAX_LINCOM, there will be uninitialised elements in the middle of these
 arrays between the element corresponding to
 .IR cm [ n_fields
 - 1] and the element corresponding to
-.IR cb [0].
+.ARG cb [0].
 .IP \(bu
 For
 .B MPLEX
 fields, the first element corresponds to
-.I count_val
+.ARG count_val
 and the second to
-.IR period .
+.ARG period .
 The remainder are uninitialised.
 .IP \(bu
 For
 .B PHASE
 fields, the first element corresponds to
-.IR shift .
+.ARG shift .
 The remainder are uninitialised.
 .IP \(bu
 For
 .B POLYNOM
 fields, these arrays correspond with the co-efficients
-.IR ca .
+.ARG ca .
 Only the first
-.I poly_ord
+.ARG poly_ord
 + 1 elements are initialised.
 .IP \(bu
 For
 .B RAW
 fields, the first element corresponds to
-.IR spf .
+.ARG spf .
 The remainder are uninitialised.
 .IP \(bu
 For
 .B RECIP
 fields, the first element corresponds to
-.IR cdividend .
+.ARG cdividend .
 The remainder are uninitialised.
 .IP \(bu
 For
 .B WINDOW
 fields, the first element corresponds to
-.IR threshold .
+.ARG threshold .
 The remainder are uninitialised.
 .PP
 The
@@ -324,17 +401,17 @@ parameters are NULL if a literal parameter was used, or else a field code
 specifying the scalar parameters. 
 .PP
 If an element of
-.I scalar
+.ARG scalar
 specifies a
 .B CARRAY
 field, the corresponding
-.I scalar_ind
+.ARG scalar_ind
 will indicate the element of the
 .B CARRAY
 used.  For
 .B CONST
 fields,
-.I scalar_ind
+.ARG scalar_ind
 will be -1.
 
 .SS BIT and SBIT Members
@@ -344,9 +421,9 @@ or
 .B SBIT
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
@@ -356,32 +433,32 @@ typedef struct {
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I in_fields
+.ARG in_fields
 member is an array of length one containing the input field code.
 .PP
 The
-.I bitnum
+.ARG bitnum
 member indicates the number of the first bit (counted from zero) extracted from
 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]
+.ARG scalar [0]
 will contain the field code itself, otherwise
-.IR scalar [0]
+.ARG scalar [0]
 will be NULL.
 .PP
 The
-.I numbits
+.ARG numbits
 member indicates the number of bits which are extracted from the input.
 If this value was specified as a scalar field code, this will be the numerical
 value of that field, and
-.IR scalar [1]
+.ARG scalar [1]
 will contain the field code itself, otherwise
-.IR scalar [1]
+.ARG scalar [1]
 will be NULL.
 
 .SS CARRAY Members
@@ -389,32 +466,32 @@ A gd_entry_t describing a
 .B CARRAY
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
-  gd_type_t   const_type;     /* data type in format specification */
-  size_t      array_len;      /* length of array data */
+  gd_type_t  const_type; /* data type in format specification */
+  size_t     array_len;  /* length of array data */
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I const_type
+.ARG const_type
 member indicates the data type of the constant value stored in the format
 file metadata.  See
-.BR gd_getdata (3)
+.F3 gd_getdata
 for a list of valid values that a variable of type
 .B gd_type_t
 may take.
 .PP
 The
-.I array_len
+.ARG array_len
 member gives the number of elements in the array.
 
 .SS CONST Members
@@ -422,29 +499,56 @@ A gd_entry_t describing a
 .B CONST
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
-  gd_type_t   const_type;     /* data type in format specification */
+  gd_type_t  const_type; /* data type in format specification */
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I const_type
+.ARG const_type
 member indicates the data type of the constant value stored in the format
 file metadata.  See
-.BR gd_getdata (3)
+.F3 gd_getdata
 for a list of valid values that a variable of type
 .B gd_type_t
 may take.
 
+.SS DIVIDE, INDIR, MULTIPLY, and SINDIR Members
+A gd_entry_t describing a
+.BR DIVIDE ,
+.BR INDIR ,
+.BR MULTIPLY ,
+or
+.B SINDIR
+entry, will also provide:
+.PP
+.RS
+.SC
+.nf
+typedef struct {
+  ...
+
+  const char *in_fields[2];     /* input field codes */
+
+  ...
+} gd_entry_t;
+.fi
+.EC
+.RE
+.PP
+The
+.ARG in_fields
+member is an array of length two containing the input field codes.
+
 .SS INDEX Members
 A gd_entry_t describing an
 .B INDEX
@@ -457,27 +561,27 @@ A gd_entry_t describing a
 .B LINCOM
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
-  int            n_fields;                  /* # of input fields */
-  const char    *in_fields[GD_MAX_LINCOM];  /* input field code(s) */
-  double complex cm[GD_MAX_LINCOM];         /* scale factor(s) */
-  double         m[GD_MAX_LINCOM];          /* scale factor(s) */
-  double complex cb[GD_MAX_LINCOM];         /* offset terms(s) */
-  double         b[GD_MAX_LINCOM];          /* offset terms(s) */
+  int            n_fields;                 /* # of inputs */
+  const char    *in_fields[GD_MAX_LINCOM]; /* input fields(s) */
+  double complex cm[GD_MAX_LINCOM];        /* scale factor(s) */
+  double         m[GD_MAX_LINCOM];         /* scale factor(s) */
+  double complex cb[GD_MAX_LINCOM];        /* offset terms(s) */
+  double         b[GD_MAX_LINCOM];         /* offset terms(s) */
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I n_fields
+.ARG n_fields
 member indicates the number of input fields.  It will be between one and
 .B GD_MAX_LINCOM
 inclusive.
@@ -486,22 +590,22 @@ is defined in getdata.h as the maximum number of input fields permitted by a
 .BR LINCOM .
 .PP
 The
-.I in_fields
+.ARG in_fields
 member is an array of length
 .B GD_MAX_LINCOM
 containing the input field code(s).  Only the first
-.I n_fields
+.ARG n_fields
 elements of this array are initialised.  The remaining elements contain
 uninitialised data.
 .PP
 The
-.I cm
+.ARG cm
 and
-.I cb
+.ARG cb
 members are arrays of the scale factor(s) and offset term(s) for the
 .BR LINCOM .
 Only the first
-.I n_fields
+.ARG n_fields
 elements of these array contain meaningful data.
 If any of these values were specified as a scalar field code, this will be the
 numerical value of that field.  The field code corresponding to
@@ -515,33 +619,33 @@ will be stored in
 +
 .BR GD_MAX_LINCOM ].
 Otherwise the corresponding
-.I scalar
+.ARG scalar
 member will be NULL.
 See
 .B NOTES
 below on changes to the declaration of
-.I cm
+.ARG cm
 and
-.I cb
+.ARG cb
 when using the C89 GetData API.
 .PP
 The elements of
-.I m
+.ARG m
 and
-.I b
+.ARG b
 are the real parts of the corresponding elements of
-.I cm
+.ARG cm
 and
-.IR cb .
+.ARG cb .
 
 .SS LINTERP Members
 A gd_entry_t describing a
 .B LINTERP
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
@@ -550,19 +654,19 @@ typedef struct {
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I table
+.ARG table
 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).
+.F3 gd_linterp_tablename .
 .PP
 The
-.I in_fields
+.ARG in_fields
 member is an array of length one containing the input field code.
 
 .SS MPLEX Members
@@ -570,100 +674,76 @@ A gd_entry_t describing a
 .B MPLEX
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .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 */
+  const char *in_fields[2];   /* input field codes */
+  int         count_val;      /* value of the multiplex index */
+  int         period;         /* samples between successive
+                                                      indices */
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I in_fields
+.ARG 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
+.ARG 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
+.ARG period
 member is the number of samples between successive occurrances of
-.I count_val
+.ARG 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
-or
-.B DIVIDE
-entry, will also provide:
-.PP
-.in +4n
-.nf
-.fam C
-typedef struct {
-  ...
-
-  const char *in_fields[2];     /* input field codes */
-
-  ...
-} gd_entry_t;
-.fam
-.fi
-.in
-.PP
-The
-.I in_fields
-member is an array of length two containing the input field codes.
+.F3 gd_mplex_lookback .
 
 .SS PHASE Members
 A gd_entry_t describing a
 .B PHASE
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
   const char *in_fields[1];     /* input field code */
-  gd_shift_t  shift;            /* phase shift */
+  gd_int64_t  shift;            /* phase shift */
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I in_fields
+.ARG in_fields
 member is an array of length one containing the input field code.
 .PP
 The
-.I shift
+.ARG shift
 member indicates the shift in samples.  The
-.I gd_shift_t
+.B gd_int64_t
 type is a 64-bit signed integer type.  A positive value indicates a shift
 forward in time (towards larger frame numbers).  If this value was specified as
 a scalar field code, this will be the numerical value of that field, and
-.IR scalar [0]
+.ARG scalar [0]
 will contain the field code itself, otherwise
-.IR scalar [0]
+.ARG scalar [0]
 will be NULL.
 
 .SS POLYNOM Members
@@ -671,25 +751,25 @@ A gd_entry_t describing a
 .B POLYNOM
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
-  int            poly_ord;                  /* polynomial order */
-  const char    *in_fields[1];              /* input field code(s) */
-  double complex ca[GD_MAX_POLY_ORD + 1];   /* co-efficients(s) */
-  double         a[GD_MAX_POLY_ORD + 1];    /* co-efficients(s) */
+  int            poly_ord;                /* polynomial order */
+  const char    *in_fields[1];            /* input field(s) */
+  double complex ca[GD_MAX_POLY_ORD + 1]; /* co-efficients(s) */
+  double         a[GD_MAX_POLY_ORD + 1];  /* co-efficients(s) */
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I poly_ord
+.ARG poly_ord
 member indicates the order of the polynomial.  It will be between one and
 .B GD_MAX_POLY_ORD
 inclusive.
@@ -698,15 +778,15 @@ is defined in getdata.h as the maximum order of polynomial permitted by a
 .BR POLYNOM .
 .PP
 The
-.I in_fields
+.ARG in_fields
 member is an array of length one containing the input field code.
 .PP
 The
-.I ca
+.ARG ca
 members are arrays of the co-efficient(s) for the
 .BR POLYNOM .
 Only the first
-.I poly_ord
+.ARG poly_ord
 + 1 elements of this array contains meaningful data.  If any of these values
 were specified as a scalar field code, this will be the numerical value of that
 field.  The field code corresponding to
@@ -714,26 +794,26 @@ field.  The field code corresponding to
 will be stored in
 .IR scalar [ i ].
 Otherwise the corresponding
-.I scalar
+.ARG scalar
 member will be NULL.  See
 .B NOTES
 below on changes to the declaration of
-.I ca
+.ARG ca
 when using the C89 GetData API.
 .PP
 The elements of
-.I a
+.ARG a
 are the real parts of the corresponding elements of
-.IR ca .
+.ARG ca .
 
 .SS RAW Members
 A gd_entry_t describing a
 .B RAW
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
@@ -742,24 +822,24 @@ typedef struct {
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I spf
+.ARG 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]
+.ARG scalar [0]
 will contain the field code itself, otherwise
-.IR scalar [0]
+.ARG scalar [0]
 will be NULL.
 .PP
 The
-.I data_type
+.ARG data_type
 member indicates the data type of the binary data on disk.  See
-.BR gd_getdata (3)
+.F3 gd_getdata
 for a list of valid values that a variable of type
 .B gd_type_t
 may take.
@@ -769,9 +849,9 @@ A gd_entry_t describing a
 .B RECIP
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
@@ -781,26 +861,26 @@ typedef struct {
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I in_fields
+.ARG in_fields
 member is an array of length one containing the input field code.
 .PP
 The
-.I cdividend
+.ARG cdividend
 member provides the constant dividend of the computed division.  If this value
 was specified as a scalar field code, this will be the numerical value of that
 field, and
-.IR scalar [0]
+.ARG scalar [0]
 will contain the field code itself, otherwise
-.IR scalar [0]
+.ARG scalar [0]
 will be NULL.  The
-.I dividend
+.ARG dividend
 member contains the real part of
-.IR cdividend .
+.ARG cdividend .
 
 .SS STRING Members
 A gd_entry_t describing a
@@ -812,9 +892,9 @@ A gd_entry_t describing a
 .B WINDOW
 entry, will also provide:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef struct {
   ...
 
@@ -824,81 +904,73 @@ typedef struct {
 
   ...
 } gd_entry_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The
-.I in_fields
+.ARG in_fields
 member contains the field codes of the input field (element 0) and the check
 field (element 1).
 .PP
 The
-.I windop
+.ARG windop
 member equals one of the following symbols, indicating the particular comparison
 performed on the check field:
-.TP
-.B GD_WINDOP_EQ
+.DD GD_WINDOP_EQ
 data are extracted when the check field equals
-.IR threshold ;
-.TP
-.B GD_WINDOP_GE
+.ARG threshold ;
+.DD GD_WINDOP_GE
 data are extracted when the check field is greater than or equal to
-.IR threshold ;
-.TP
-.B GD_WINDOP_GT
+.ARG threshold ;
+.DD GD_WINDOP_GT
 data are extracted when the check field is strictly greater than
-.IR threshold ;
-.TP
-.B GD_WINDOP_LE
+.ARG threshold ;
+.DD GD_WINDOP_LE
 data are extracted when the check field is less than or equal to
-.IR threshold ;
-.TP
-.B GD_WINDOP_LT
+.ARG threshold ;
+.DD GD_WINDOP_LT
 data are extracted when the check field is strictly less than
-.IR threshold ;
-.TP
-.B GD_WINDOP_NE
+.ARG threshold ;
+.DD GD_WINDOP_NE
 data are extracted when the check field is not equal to
-.IR threshold ;
-.TP
-.B GD_WINDOP_SET
+.ARG threshold ;
+.DD GD_WINDOP_SET
 data are extracted when at least one bit in
-.I threshold 
+.ARG threshold 
 is also set in the check field;
-.TP
-.B GD_WINDOP_CLR
+.DD GD_WINDOP_CLR
 data are extracted when at least one bit in
-.I threshold 
+.ARG threshold 
 is not set in the check field.
 .PP
 The
-.I threshold
-is the value against the check field is compared.  The
+.ARG threshold
+is the value against which the check field is compared.  The
 .B gd_triplet_t
 type is defined as:
 .PP
-.in +4n
+.RS
+.SC
 .nf
-.fam C
 typedef union {
   gd_int64_t i;
   gd_uint64_t u;
   double r;
 } gd_triplet_t;
-.fam
 .fi
-.in
+.EC
+.RE
 .PP
 The particular element of the union to use depends on the value of
-.I windop:
+.ARG windop:
 .IP \(bu
 For
 .B GD_WINDOP_EQ
 and
 .BR GD_WINDOP_NE ,
 the signed integer element,
-.IB threshold . i
+.IB threshold . i\fR,
 is set;
 .IP \(bu
 For
@@ -906,13 +978,13 @@ For
 and
 .BR GD_WINDOP_CLR ,
 the unsigned integer element,
-.IB threshold . u
+.IB threshold . u\fR,
 is set;
 .IP \(bu
 For all other values of
 .IR windop ,
 the floating point element,
-.IB threshold . r
+.IB threshold . r\fR,
 is set.
 
 .SH NOTES
@@ -930,17 +1002,17 @@ C99 API|C89 API
 int|bitnum|int|u.bit.bitnum
 int|numbits|int|u.bit.numbits
 int|n_fields|int|u.lincom.n_fields
-double complex|cm[3]|double|u.lincom.cm[3][2]
-double|m[3]|double|u.lincom.m[3]
-double complex|cb[3]|double|u.lincom.cb[3][2]
-double|b[3]|double|u.lincom.b[3]
+double complex|cm[]|double|u.lincom.cm[][2]
+double|m[]|double|u.lincom.m[]
+double complex|cb[]|double|u.lincom.cb[][2]
+double|b[]|double|u.lincom.b[]
 const char*|table|const char*|u.linterp.table
 int|count_val|int|u.mplex.count_val
 int|period|int|u.mplex.period
-gd_shift_t|shift|gd_shift_t|u.phase.shift
+gd_int64_t|shift|gd_int64_t|u.phase.shift
 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]
+double complex|ca[]|double|u.polynom.ca[][2]
+double|a[]|double|u.polynom.a[]
 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]
@@ -955,15 +1027,108 @@ 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 HISTORY
+The
+.FN get_entry
+function appeared in GetData-0.3.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_entry .
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.
+
+.SS Changes to the gd_entry_t structure
+Field-type specific members have been added to the structure as support for
+those field types have been introduced to the library:
+.IP \(bu
+.BR BIT ,
+.BR LINCOM ,
+.BR LINTERP ,
+.BR MULTIPLY ,
+.BR PHASE ,
+and
+.BR RAW
+were supported in GetData-0.3.0 (Dirfile Standards Version 5).
+.IP \(bu
+.B CONST
+and
+.B STRING
+entries were introduced in GetData-0.4.0 (Dirfile Standards Version 6); this
+is also the first version that treats
+.I INDEX
+as a normal field.  In earlier versions, trying to retrieve the metadata for
+the
+.I INDEX
+field would fail.
+.IP \(bu
+.B POLYNOM
+and
+.B SBIT
+entries were introduced in GetData-0.6.0 (Dirfile Standards Version 7).
+.IP \(bu
+.BR CARRAY ,
+.BR DIVIDE ,
+and
+.B RECIP
+entries were introduced in GetData-0.7.0 (Dirfile Standards Version 8).
+.IP \(bu
+.B MPLEX
+and
+.B WINDOW
+entries were introduced in GetData-0.8.0 (Dirfile Standards Version 9).
+.IP \(bu
+.BR INDIR ,
+.BR SARRAY ,
+and
+.B SINDIR
+entries were introduced in GetData-0.10.0 (Dirfile Standards Version 10).
+.PP
+The
+.ARG scalar
+member appeared in GetData-0.6.0.  This release also introduced the
+complex-valued scalar members
+.RI ( cm ,
+.ARG cb ,
+&c.)
+
+The
+.ARG scalar_ind
+member appeared in GetData-0.7.0.  This was also the first release with
+a working ANSI C (C89) conforming alternate definition.
+.PP
+Before Getdata-0.8.4, the
+.ARG period
+member for
+.B MPLEX
+data was named
+.ARG count_max .
+
+Before GetData-0.9.0, the
+.ARG flags
+member is missing.  In it's place was:
+.PP
+.RS
+.SC
+int comp_scal;     /* Scalar parameters are complex-valued */
+.EC
+.RE
+.PP
+which was non-zero to indicate complex-valued parameters, which is now indicated
+by the
+.B GD_EN_COMPSCAL
+flag.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_free_entry_strings (3),
-.BR gd_cbopen (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_field_list (3),
-.BR gd_fragmentname (3),
-.BR gd_linterp_tablename (3)
-.BR gd_mplex_lookback (3),
-.BR gd_raw_filename (3),
-.BR gd_validate (3)
+dirfile(5),
+.F3 gd_alloc_funcs ,
+.F3 gd_cbopen ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_field_list ,
+.F3 gd_fragmentname ,
+.F3 gd_free_entry_strings ,
+.F3 gd_linterp_tablename
+.F3 gd_mplex_lookback ,
+.F3 gd_raw_filename ,
+.F3 gd_validate
diff --git a/man/gd_entry_list.3 b/man/gd_entry_list.3
index e95c63f..7ef212e 100644
--- a/man/gd_entry_list.3
+++ b/man/gd_entry_list.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_entry_list.3.  The gd_entry_list man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,17 +88,18 @@
 .\" 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"
+.TH gd_entry_list 3 "25 December 2016" "Version 0.10.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
+gd_mvector_list, gd_vector_list \(em list field entries in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .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 );
+.BI "const char **gd_entry_list(DIRFILE *" dirfile ,
+.BI "const char *" parent ", int " type ", unsigned int " flags );
 .HP
 .BI "const char **gd_field_list(DIRFILE *" dirfile );
 .HP
@@ -37,87 +113,85 @@ gd_mvector_list, gd_vector_list \(em list field entries in a dirfile
 .BI "const char **gd_mvector_list(DIRFILE *" dirfile ", const char *" parent );
 .HP
 .BI "const char **gd_vector_list(DIRFILE *" dirfile );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_entry_list ()
+.FN 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
+.ARG dirfile
+and finds all the fields satisfying the provided criteria.  If
+.ARG parent
 is non-NULL, metafields under the field specified by
-.I parent
+.ARG parent
 are considered; otherwise, top-level fields are considered, and metafields
 ignored.
 
 The
-.I type
+.ARG type
 argument should be one of the following symbols indicating an explicit entry
 type to list:
 .IP
-.nh
-.ad l
+.SC
 .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
+.BR GD_INDEX_ENTRY ", " GD_INDIR_ENTRY ", " GD_LINCOM_ENTRY ,
+.BR GD_LINTERP_ENTRY ", " GD_MPLEX_ENTRY ", " GD_MULTIPLY_ENTRY ,
+.BR GD_PHASE_ENTRY ", " GD_POLYNOM_ENTRY ", " GD_RAW_ENTRY ", " GD_RECIP_ENTRY ,
+.BR GD_SARRAY_ENTRY ", " GD_SBIT_ENTRY ", " GD_SINDIR_ENTRY ,
+.BR GD_STRING_ENTRY ", " GD_WINDOW_ENTRY .
+.EC
 .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)
+.DD GD_ALL_ENTRIES \fR(=\fB0\fR)
 List entries of all types.
-.TP
-.B GD_ALIAS_ENTRIES
+.DD 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
+.DD 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).
+.RB ( CONST ", " CARRAY ", " SARRAY ", " STRING ).
+.DD GD_VECTOR_ENTRIES
+List only numeric-valued vector field types (all field types except
+.B SINDIR
+and the scalar field types listed above).
 .PP
 The
-.I flags
+.ARG flags
 argument should be zero or more of the following flags, bitwise or'd together:
-.TP
-.B GD_ENTRIES_HIDDEN
+.DD GD_ENTRIES_HIDDEN
 Include hidden entries (see
-.BR gd_hidden (3))
+.F3 gd_hidden )
 in the list: normally hidden entries are skipped;
-.TP
-.B GD_ENTRIES_NOALIAS
+.DD 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)
+.F3 gd_close
 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).
+.F3 gd_nentries .
 
 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 ()
+.FN 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).
+.F3 gd_close .
 (Although the data may have become obsolete, if metadata have been modified in
 the interrim.)
+
+This function has a subset of the functionality of the
+.F3 gd_match_entries
+function (q.v.).
+
 .SS Special Cases
 The call
 .RS
@@ -182,29 +256,56 @@ is equivalent to
 .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
+supplied criteria.  On error, they return zero and store a negative-valued
+error code in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_BAD_CODE
 The supplied parent field code was not found, or referred to a metafield itself.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_ENTRY
+.DD GD_E_BAD_ENTRY
 The
-.I type
+.ARG 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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_field_list
+function appeared in GetData-0.3.0.
+
+The
+.FN get_field_list_by_type ,
+.FN get_mfield_list ,
+.FN get_mfield_list_by_type ,
+.FN get_mvector_list ,
+and
+.FN get_vector_list
+functions appeared in GetData-0.4.0.
+
+In GetData-0.7.0, these functions were renamed to
+.FN gd_field_list ,
+.FN gd_field_list_by_type ,
+.FN gd_mfield_list ,
+.FN gd_mfield_list_by_type ,
+.FN gd_mvector_list ,
+and
+.FN gd_vector_list .
+
+The
+.FN gd_entry_list
+function appeared in GetData-0.8.0.
+
 .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)
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_hidden ,
+.F3 gd_match_entries ,
+.F3 gd_nentries ,
+.F3 gd_open ,
+dirfile(5)
diff --git a/man/gd_entry_type.3 b/man/gd_entry_type.3
index 2bfa1e8..6efab63 100644
--- a/man/gd_entry_type.3
+++ b/man/gd_entry_type.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_entry_type.3.  The gd_entry_type man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,40 +88,41 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_entry_type 3 "21 August 2012" "Version 0.8.0" "GETDATA"
+.TH gd_entry_type 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_entry_type \(em retrieve the type of a dirfile field
+gd_entry_type \(em retrieve the type of a Dirfile field
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "gd_entype_t gd_entry_type(const DIRFILE *" dirfile ", const char"
 .BI * field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_entry_type ()
+.FN gd_entry_type
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and returns the field type of the field specified by
-.IR field_code .
+.ARG field_code .
 If
-.I field_code
+.ARG field_code
 contains a valid representation suffix, it will be ignored.
 
 The
 .B gd_entype_t
 type is an enumerated type which may take any of the following values:
 .IP
-.nh
-.ad l
+.SC
 .BR GD_BIT_ENTRY ,
 .BR GD_CARRAY_ENTRY ,
 .BR GD_CONST_ENTRY ,
 .BR GD_DIVIDE_ENTRY ,
 .BR GD_INDEX_ENTRY ,
+.BR GD_INDIR_ENTRY ,
 .BR GD_LINCOM_ENTRY ,
 .BR GD_LINTERP_ENTRY ,
 .BR GD_MPLEX_ENTRY ,
@@ -55,43 +131,48 @@ type is an enumerated type which may take any of the following values:
 .BR GD_POLYNOM_ENTRY ,
 .BR GD_RAW_ENTRY ,
 .BR GD_RECIP_ENTRY ,
+.BR GD_SARRAY_ENTRY ,
 .BR GD_SBIT_ENTRY ,
+.BR GD_SINDIR_ENTRY ,
 .BR GD_STRING_ENTRY ,
 .BR GD_WINDOW_ENTRY .
-.ad n
-.hy
+.EC
+
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_entry_type ()
+.FN gd_entry_type
 returns the field type of the specified field.  On error,
-.BR gd_entry_type ()
+.FN gd_entry_type
 returns
 .B GD_NO_ENTRY
-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
+and stores a negative-valued error code in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
 .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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_entry_type
+function appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_entry_type .
 
 .SH SEE ALSO
-.BR gd_cbopen (3),
-.BR gd_entry (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_fragmentname (3),
-.BR gd_parent_fragment (3),
-.BR dirfile (5)
+.F3 gd_entry ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_fragmentname ,
+.F3 gd_open ,
+.F3 gd_parent_fragment ,
+dirfile(5)
diff --git a/man/gd_eof.3 b/man/gd_eof.3
index 0f8d16e..8de0965 100644
--- a/man/gd_eof.3
+++ b/man/gd_eof.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_eof.3.  The gd_eof man page.
 .\"
-.\" Copyright (C) 2010, 2011, 2014 D. V. Wiebe
+.\" Copyright (C) 2010, 2011, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,126 +88,130 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_eof 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_eof 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_eof \(em report the number of samples in a dirfile field
+gd_eof \(em find the end of a Dirfile field
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "off_t gd_eof(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_eof ()
+.FN gd_eof
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns the sample number of the end-of-field marker for the vector field
+.ARG dirfile
+and determines the sample number of the end-of-field marker for the vector field
 given by
-.IR field_code .
+.ARG field_code .
 This is effectively the total number of samples available for the field,
 including any frame offset.
 
 The caller should not assume that this is equivalent (when accounting for the samples-per-frame of the indicated field) to the number of frames in the database
 returned by
-.BR gd_nframes (3),
+.F3 gd_nframes ,
 nor even that the end-of-field marker falls on a frame boundary.
 
 For a
 .B RAW
 field, the end-of-field marker occurs immediately after the last datum in the
-data file associated with the field.  For other field types, the end-of-field
-marker is equivalent to the end-of-field marker closest to the start of the
-dirfile of any of the field inputs.  The special field
+data file associated with the field.  The special field
 .I INDEX
 has no end-of-field marker.
 
-The end-of-field marker for a field containing no data is in the same location
-as, or before, its beginning-of-field marker (see
-.BR gd_bof (3)).
-For a
+The end-of-field of a
+.B PHASE
+field is the end-of-field of its input adjusted by the
+.B PHASE
+field's shift.  For other vector field types, the end-of-field marker is the
+smallest end-of-field marker of any of its inputs.
+
+If the end-of-field marker for a field is less than or equal to its
+beginning-of-field marker (see
+.F3 gd_bof ),
+then that field has no data.  For a
 .B RAW
-field, the difference between the locations of the beginning- and end-of-field
-markers indicates the number of samples of data actually stored on disk.
+field, the difference between the beginning- and end-of-field markers indicates
+the number of samples of data actually stored on disk.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_eof ()
-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
+.FN gd_eof
+returns the sample number of the end-of-field marker for the indicated field,
+which is never negative.  On error, it returns a negative-valued error code.
+Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 or one of the fields it uses as input was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 The location of the non-existent end-of-field marker for the special field
 .I INDEX
 was requested, possibly as a result of the field specified by
-.I field_code
+.ARG field_code
 using
 .I INDEX
 as one of its inputs.
-.TP
-.B GD_E_DIMENSION
+.DD GD_E_DIMENSION
 A scalar field was found where a vector field was expected in the definition
 of
-.I field_code 
+.ARG field_code 
 or one of its inputs, or else
-.I field_code
+.ARG field_code
 itself specified a scalar field.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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_IO
-An attempt to
-.BR stat (2)
-the file associated with the field, or one of its input fields, failed.
-.TP
-.B GD_E_RECURSE_LEVEL
+.DD GD_E_IO
+An I/O error occurred while deterimining the size of the raw data file
+associated with the field, or one of its input fields.
+.DD GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
+.ARG field_code .
 This usually indicates a circular dependency in field specification in the
 dirfile.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 The size of the decoded data file associated with the specified field or one of
 its inputs could not be determined, because its encoding scheme was not
 understood.
-.TP
-.B GD_E_UNSUPPORTED
+.DD GD_E_UNSUPPORTED
 The size of the decoded data file associated with the specified field or one of
 its inputs could not be determined, because its encoding scheme was not
 supported.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_eof
+function appeared in GetData-0.7.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR dirfile-encoding (5),
-.BR gd_open (3),
-.BR gd_bof (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_nframes (3)
+.F3 gd_bof ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_nframes ,
+.F3 gd_open ,
+dirfile(5), dirfile-encoding(5)
diff --git a/man/gd_eof64.3 b/man/gd_eof64.3
index 7705003..e990874 100644
--- a/man/gd_eof64.3
+++ b/man/gd_eof64.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_eof64.3.  The gd_eof64 man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,42 +88,40 @@
 .\" 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"
+.TH gd_eof64 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_eof64 \(em retrieve data from a dirfile database, with largefile support
+gd_eof64 \(em find the end of a Dirfile field, with largefile support
+
 .SH SYNOPSIS
+.SC
 .B #define GD_64BIT_API
 .br
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "gd_off64_t gd_eof64(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 This version of
-.BR gd_eof (3)
+.F3 gd_eof
 uses a 64-bit offset type
 .RB ( gd_off64_t ),
-where one is available, regardless of the size of
+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.
+It is only guaranteed to be available when
+.B GD_64BIT_API
+is defined 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).
+.B off_t
+is a 64-bit type, this function will the same as
+.F3 gd_eof .
 Otherwise,
-.BR gd_eof (3)
+.F3 gd_eof
 will be a version of this function which uses a 32-bit
-.IR off_t .
+.BR off_t .
+
 .SH SEE ALSO
-.BR gd_eof (3),
+.F3 gd_eof ,
 .BR feature_test_macros (7)
diff --git a/man/gd_error.3 b/man/gd_error.3
index 9ddd489..57f9a7d 100644
--- a/man/gd_error.3
+++ b/man/gd_error.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_error.3.  The gd_error man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2011 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,32 +88,116 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_error 3 "20 April 2011" "Version 0.8.0" "GETDATA"
+.TH gd_error 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_error \(em report a GetData library error
+gd_error, gd_error_string \(em report a GetData library error
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_error(const DIRFILE *" dirfile );
-.hy
-.ad n
+.HP
+.BI "char *gd_error_string(const DIRFILE *" dirfile ", char *" buffer ", size_t
+.IB buflen );
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_error ()
-function returns the numeric dirfile error associated with the dirfile
-.I dirfile
-which is set by many GetData library functions.
+.FN gd_error
+function determines the success or failure of the most recent GetData library
+function call that operated on
+.ARG dirfile .
+If the last call succeeded,
+.FN gd_error
+will return
+.B GD_E_OK
+(which equals zero).  If the last call failed,
+.FN gd_error
+returns a negative-valued error code indicating the cause of the failure.
+Possible codes vary from function to function.  See corresponding manual page of
+the function that failed for a list of possible codes.
+
+The
+.FN gd_error_string
+function behaves similarly, but composes a string describing the error.  If 
+.ARG buffer
+is not NULL, the string is written to this memory location.  At most
+.ARG buflen
+characters will be written including the terminating NUL byte.  If
+.ARG buffer
+is not large enough to hold the entire string, the string will be truncated, but
+the truncated string will still be NUL-terminated.
 
-A textual description of the error may be obtained by calling
-.BR gd_error_string (3).
+If
+.ARG buffer
+is NULL,
+.FN gd_error_string
+will allocate a string of sufficient length on the heap.  In this case,
+.ARG buflen
+is ignored.  By default,
+.F3 malloc
+is used to allocate this buffer, but an alternate memory manager may be
+specified by calling
+.F3 gd_alloc_funcs
+before calling this function.  The caller is responsible for deallocating this
+string when it is no longer needed.
+
+The functions
+.F3 gd_alloc_funcs ,
+.F3 gd_error_count ,
+.F3 gd_flags ,
+.F3 gd_free_entry_strings ,
+.F3 gd_mplex_lookback ,
+and
+.F3 gd_parser_callback
+are ignored by these functions, since they always succeed.  Previous
+.BR gd_error()
+and
+.BR gd_error_string()
+calls are also ignored.
 
 .SH RETURN VALUE
 The
-.BR gd_error ()
-function always returns the dirfile error corresponding to the error state of
-the last library call on the supplied DIRFILE object.
+.FN gd_error
+function always returns the integer error code of the last library call on the
+supplied DIRFILE object.
+
+If
+.ARG buffer
+is non-NULL,
+.FN gd_error_string
+returns 
+.ARG buffer ,
+unless
+.ARG buflen
+is less than one, in which case it returns NULL.  If
+.ARG buffer
+is NULL, this function returns a newly allocated string of sufficient length
+which should be deallocated by the caller, or NULL, if memory allocation failed.
+
+.SH HISTORY
+The
+.FN get_error_string
+function appeared in GetData-0.3.0.
+
+The
+.FN get_error
+function appeared in GetData-0.4.0.  Before this, the error code was directly
+accessible via the
+.SPM dirfile error
+member in the
+.B DIRFILE
+structure.
+
+In GetData-0.7.0, these functions were renamed to
+.FN gd_error
+and
+.FN gd_error_string .
+This is also the first release in which
+.FN gd_error_string
+would allocate a buffer for the error string if passed NULL.
+
 .SH SEE ALSO
-.BR gd_error_count (3),
-.BR gd_error_string (3)
+.F3 gd_error_count
diff --git a/man/gd_error_count.3 b/man/gd_error_count.3
index e595447..cde4ded 100644
--- a/man/gd_error_count.3
+++ b/man/gd_error_count.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_error_count.3.  The gd_error_count man page.
 .\"
-.\" Copyright (C) 2011, 2013 D. V. Wiebe
+.\" Copyright (C) 2011, 2013, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,47 +88,54 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_error_count 3 "17 December 2013" "Version 0.9.0" "GETDATA"
+.TH gd_error_count 3 "25 December 2016" "Version 0.10.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
+.SC
 .BI "int gd_error_count(DIRFILE *" dirfile );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The first time
-.BR gd_error_count ()
+.FN gd_error_count
 is called with the DIRFILE object
-.IR dirfile ,
+.ARG dirfile ,
 it returns the number of errors encountered by the GetData library while
 operating on
-.I dirfile
+.ARG dirfile
 since its creation.  Calling this function resets the internal count, so
 that subsequent calls to
-.BR gd_error_count ()
+.FN 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
+.ARG dirfile
 (which might be
 .BR GD_E_OK ,
 indicating no error) can be obtained by calling
-.BR gd_error (3).
+.F3 gd_error .
 
 .SH RETURN VALUE
 The
-.BR gd_error_count ()
+.FN 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 HISTORY
+The
+.FN gd_error_count
+function appeared in GetData-0.8.0.
+
 .SH SEE ALSO
-.BR gd_error (3),
-.BR gd_error_string (3)
+.F3 gd_error ,
+.F3 gd_error_string
diff --git a/man/gd_error_string.3 b/man/gd_error_string.3
deleted file mode 100644
index cf74070..0000000
--- a/man/gd_error_string.3
+++ /dev/null
@@ -1,73 +0,0 @@
-.\" gd_error_string.3.  The gd_error_string man page.
-.\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2014 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_string 3 "16 October 2014" "Version 0.9.0" "GETDATA"
-.SH NAME
-gd_error_string \(em report a GetData library error
-.SH SYNOPSIS
-.B #include <getdata.h>
-.HP
-.nh
-.ad l
-.BI "char *gd_error_string(const DIRFILE *" dirfile ", char *" buffer ", size_t
-.IB buflen );
-.hy
-.ad n
-.SH DESCRIPTION
-The
-.BR gd_error_string ()
-function returns a string describing the last dirfile error encountered while
-operating on 
-.IR dirfile .
-
-If 
-.I buffer
-is not NULL, the string is written to this memory location.  At most
-.I buflen
-characters will be written. This always includes a terminating null byte, even
-if the error string was truncated.
-The numeric dirfile error itself may be obtained by calling
-.BR gd_error (3).
-
-If
-.I buffer
-is NULL,
-.BR gd_error_string ()
-will allocate a string of sufficient length using
-.BR malloc (3),
-and
-.I buflen
-is ignored.  In this case, the caller should deallocate the returned string
-using
-.BR free (3)
-when it is no longer needed.
-
-.SH RETURN VALUE
-If
-.I buffer
-is non-NULL, the
-.BR gd_error_string ()
-function returns 
-.IR buffer ,
-or NULL if buflen is less than one.  If
-.I buffer
-is NULL, this function returns a newly malloc'd
-string of sufficient length which should be deallocated by the caller, or
-NULL, if memory allocation failed.  In all cases, the error state of
-.I dirfile
-is unchanged.
-.SH SEE ALSO
-.BR gd_error (3),
-.BR gd_error_count (3)
diff --git a/man/gd_flags.3 b/man/gd_flags.3
index 4794806..0b20dfa 100644
--- a/man/gd_flags.3
+++ b/man/gd_flags.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_flags.3.  The gd_flags man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,81 +88,85 @@
 .\" 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"
+.TH gd_flags 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_flags \(em alter GetData operational flags
+
 .SH SYNOPSIS
+.SC
 .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
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_flags ()
+.FN gd_flags
 function modifies the operational flags of the dirfile(5) database specified by
-.IR dirfile ,
+.ARG 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)).
+.F3 gd_cbopen ).
 These are:
-.TP
-.B GD_PRETTY_PRINT
+.DD 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)
+.F3 gd_flush
 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
+.DD 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),
+.F3 gd_error_string ,
 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).
+.F3 gd_verbose_prefix .
 Without this flag, GetData writes nothing to standard error.  (GetData never
 writes to standard output.)
 .PP
 Flags which appear only in
-.I set
+.ARG set
 will be turned on (enabled); flags which appear only in
-.I reset
+.ARG reset
 will be turned off (disabled); flags which appear in both
-.I set
+.ARG set
 and
-.I reset
+.ARG reset
 will be toggled.  Flags which appear in neither of these are left unchanged.
 Accordingly, to simply query the current flags, both
-.I set
+.ARG set
 and
-.I reset
+.ARG 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 ,
+.ARG set ,
 and it's bitwise complement in
-.IR reset .
+.ARG reset .
 
 .SH RETURN VALUE
 The
-.BR gd_flags ()
+.FN 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 HISTORY
+The
+.FN gd_flags
+function appeared in GetData-0.8.0.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_cbopen (3),
-.BR gd_verbose_prefix (3),
-.BR stderr (3).
+.F3 gd_open ,
+.F3 gd_verbose_prefix ,
+dirfile(5)
diff --git a/man/gd_flush.3 b/man/gd_flush.3
index 2f7e552..6e40070 100644
--- a/man/gd_flush.3
+++ b/man/gd_flush.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_flush.3.  The gd_flush man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,102 +88,120 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_flush 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_flush 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_flush gd_raw_close gd_sync \(em write all pending dirfile changes to disk or
+gd_flush gd_raw_close gd_sync \(em write all pending Dirfile changes to disk or
 close open raw fields
+
 .SH SYNOPSIS
+.SC
 .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
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_sync ()
+.FN gd_sync
 function flushes all pending writes to disk of raw data files associated with
-.IR field_code ,
+.ARG field_code ,
 or its input(s), in the dirfile specified by
-.IR dirfile .
+.ARG dirfile .
 If the
-.I field_code
-contains a valid representation suffix, it will be ignored.  As a special case,
-if
-.I field_code
-is NULL, all fields in
-.I dirfile
+.ARG field_code
+contains a valid representation suffix, it will be ignored.
+
+As a special case, if NULL is passed to
+.FN gd_sync
+as
+.ARG field_code ,
+all fields in
+.ARG dirfile
 will be flushed.  In this special case, modified metadata will also be flushed
 to disk as if
-.BR gd_metaflush (3)
+.F3 gd_metaflush
 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
 The
-.BR gd_raw_close ()
+.FN gd_raw_close
 function closes any raw data files which GetData has opened associated with
-.IR field_code ,
+.ARG field_code ,
 or its input(s).  Again, if
-.I field_code
+.ARG field_code
 is NULL, all open data files are closed.  The I/O pointer of any
 .B RAW
 field which is closed is reset to the beginning-of-field.
 .PP
 Calling
-.BR gd_flush ()
+.FN gd_flush
 is essentially equivalent to calling first
-.BR gd_sync ()
+.FN gd_sync
 and then
-.BR gd_raw_close ()
+.FN gd_raw_close
 (ie. it does both tasks), although, if
-.I field_code
+.ARG field_code
 is NULL, the order of operations if may be different than making the two explicit
 calls.
+
 .SH RETURN VALUE
-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
+On success, these functions return zero.   On error, a negative-valued error
+code is returned.  Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_IO
+.DD GD_E_IO
 An I/O error occurred while trying to write modified data or metadata to disk.
-.TP
-.B GD_E_LINE_TOO_LONG
+.DD GD_E_LINE_TOO_LONG
 While attempting to flush modified metadata to disk, a field specification line
 exceeded the maximum allowed length.  On most platforms, the maximum length is
 at least 2**31 bytes, so this typically indicates something pathological
 happening.
-.TP
-.B GD_E_RECURSE_LEVEL
+.DD GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
+.ARG 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).
-A descriptive error string for the last error encountered can be obtained from
-a call to
-.BR gd_error_string (3).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN dirfile_flush
+function appeared in GetData-0.3.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_flush .
+
+The
+.FN gd_raw_close
+and
+.FN gd_sync
+functions appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_close (3),
-.BR gd_dirfile_standards (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_metaflush (3)
+.F3 gd_close ,
+.F3 gd_dirfile_standards ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_metaflush ,
+.F3 gd_open
diff --git a/man/gd_fragment_affixes.3 b/man/gd_fragment_affixes.3
index 2b99c7e..54ab166 100644
--- a/man/gd_fragment_affixes.3
+++ b/man/gd_fragment_affixes.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_fragment_affixes.3.  The gd_fragment_affixes man page.
 .\"
-.\" Copyright (C) 2012, 2015 D. V. Wiebe
+.\" Copyright (C) 2012, 2015, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,76 +88,94 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_fragment_affixes 3 "4 November 2015" "Version 0.9.1" "GETDATA"
+.TH gd_fragment_affixes 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_fragment_affixes \(em report the field affixes of a fragment of a dirfile database
+gd_fragment_affixes \(em report the field affixes of a fragment of a Dirfile database
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_fragment_affixes(DIRFILE *" dirfile ", int " fragment_index ,
 .BI "char **" prefix ", char **" suffix );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_fragment_affixes ()
+.FN gd_fragment_affixes
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and returns the field affixes for the fragment indexed by
-.IR fragment_index .
+.ARG fragment_index .
 The field prefix and suffix are appended to all field codes found in the
 specified fragment.
 
 The
-.I prefix
+.ARG prefix
 and
-.I suffix
+.ARG suffix
 parameters point to memory locations in which store the addresses of the
-returned strings.
+returned strings.  The returned
+.ARG prefix
+does NOT contain the root namespace of the fragment.  To retreive that, use
+.F3 gd_fragment_namespace .
 
 The
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_fragment_affixes ()
+.FN gd_fragment_affixes
 returns zero.  If non-empty, the prefix and suffix are reported in
-.BR malloc (3)'d
-buffers whose addresses are returned in
+heap-allocated 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.
+By default
+.F3 malloc
+is used to allocate these buffers, but a different allocator may be specified
+by calling
+.F3 gd_alloc_funcs
+before calling this function.  The caller is responsible for deallocating the
+buffers.  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
+On error, a negative-valued error code is returned.  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
+returned error codes are:
+.DD GD_E_ALLOC
+A memory allocation error occurred.
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_fragment_affixes
+function appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_alter_frameoffset (3),
-.BR gd_include_affixes (3),
-.BR gd_open (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
+.F3 gd_alloc_funcs ,
+.F3 gd_alter_affixes ,
+.F3 gd_fragment_namespace ,
+.F3 gd_include_affixes ,
+.F3 gd_open ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_fragment_index.3 b/man/gd_fragment_index.3
index ee33739..bb09977 100644
--- a/man/gd_fragment_index.3
+++ b/man/gd_fragment_index.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_fragment_index.3.  The gd_fragment_index man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,63 +88,70 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_fragment_index 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.TH gd_fragment_index 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_fragment_index \(em retrieve the fragment containing a dirfile field
+gd_fragment_index \(em retrieve the fragment containing a Dirfile field
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_fragment_index(const DIRFILE *" dirfile ", const char"
 .BI * entry_name );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_fragment_index ()
+.FN gd_fragment_index
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 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.
+named
+.ARG entry_name .
 
 This is one of the few GetData functions which does not resolve aliases:
 supplying the name of an alias as
-.I entry_name
+.ARG 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 ()
-returns the requested fragment index.  On error,
-.BR gd_fragment_index ()
-returns -1 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_CODE
+.FN gd_fragment_index
+returns the requested fragment index, which is never negative.  On error,
+.FN gd_fragment_index
+returns a negative-valued error code.  Possible error codes are:
+.DD GD_E_BAD_CODE
 The entry specified by
-.I entry_name
+.ARG entry_name
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_fragment_index
+function appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_fragment_index .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
 
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_entry (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_fragmentname (3),
-.BR gd_parent_fragment (3),
-.BR dirfile (5)
+.F3 gd_open ,
+.F3 gd_entry ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_fragmentname ,
+.F3 gd_parent_fragment ,
+dirfile(5)
diff --git a/man/gd_fragment_namespace.3 b/man/gd_fragment_namespace.3
new file mode 100644
index 0000000..e5e9428
--- /dev/null
+++ b/man/gd_fragment_namespace.3
@@ -0,0 +1,187 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
+.\" gd_fragment_namespace.3.  The gd_fragment_namespace man page.
+.\"
+.\" Copyright (C) 2016 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_namespace 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_fragment_namespace \(em report or change the root namespace of a fragment of
+a dirfile database
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "const char *gd_fragment_namespace(DIRFILE *" dirfile ", int
+.IB fragment_index ", char *" new_namespace );
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_fragment_namespace
+function can be used to update and/or query the root namespace of a fragment
+in the dirfile(5) database specified by
+.ARG dirfile .
+
+If
+.ARG new_namespace
+is NULL, then the current root namespace of the fragment indexed by
+.ARG fragment_index
+is returned.  If
+.ARG new_namespace
+is non-NULL, then the root namespace is first changed to the string provided
+before being reported.  The new namespace may optionally contain a single,
+trailing dot
+.RB ( . ).
+To remove an existing root namespace, pass a pointer to the empty string
+.RB ( """""" )
+as
+.ARG new_namespace .
+
+The root namespace of the root format file (the one indexed by
+.ARG fragment_index =0)
+may not be changed.  It is always the empty string.
+
+The
+.ARG dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.F3 gd_open .
+
+.SH RETURN VALUE
+Upon successful completion,
+.FN gd_fragment_namespace
+returns a non-NULL pointer to a read-only string containing the current root
+namespace of the fragment specified.  This will be a copy of the string
+.ARG new_namespace ,
+if that parameter was non-NULL.  If the fragment's root namespace is empty,
+a pointer to the empty string
+.RB ( """""" )
+will be returned.
+
+On error, this function returns NULL and sets the dirfile error to a non-zero
+error value.  Possible
+dirfile error values are:
+.DD GD_E_ACCMODE
+The dirfile was opened read-only.
+.DD GD_E_ALLOC
+A memory allocation error occurred.
+.DD GD_E_BAD_CODE
+The supplied
+.ARG new_fragment
+was not a valid namespace.
+.DD GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.DD GD_E_BAD_INDEX
+The supplied index was out of range.  This error will also be returned if an
+attempt is made to change the root namespace of the root format file
+.RI ( fragment_index
+zero).
+.DD GD_E_DUPLICATE
+Attempting to change the root namespace resulted in a duplicated field
+definition.
+.DD GD_E_PROTECTED
+The protection level of the specified fragment prohibits metadata changes.
+.PP
+The dirfile error may be retrieved by calling
+.F3 gd_error .
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_fragment_namespace
+function appeared in GetData-0.10.0.
+
+.SH SEE ALSO
+.F3 gd_alter_affixes ,
+.F3 gd_include_ns ,
+.F3 gd_open ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_fragmentname.3 b/man/gd_fragmentname.3
index d2f6ee0..e21905d 100644
--- a/man/gd_fragmentname.3
+++ b/man/gd_fragmentname.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_fragmentname.3.  The gd_fragmentname man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,66 +88,75 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_fragmentname 3 "21 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_fragmentname 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_fragmentname \(em retrieve a dirfile format specification fragment name
+gd_fragmentname \(em retrieve a Dirfile format specification fragment name
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "const char* gd_fragmentname(const DIRFILE *" dirfile ", int " index );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_fragmentname ()
+.FN gd_fragmentname
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and returns the filename of the format specification fragment indexed by the
 non-negative
-.IR index .
+.ARG index .
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 The fragment with
-.I index
+.ARG index
 equal to zero is always the primary fragment for the database (the file called 
 .B format
 in the root dirfile directory).  The largest valid value of
-.I index
+.ARG index
 is one less than the total number of fragments, which may be obtained from a
 call to
-.BR gd_nfragments (3).
+.F3 gd_nfragments .
+
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_fragmentname ()
+.FN gd_fragmentname
 returns a pointer to a read-only character string containing the file name of
-the specified fragment.  On error,
-.BR gd_fragmentname ()
-returns NULL and sets the dirfile error a non-zero error value.  Possible error
-values are:
-.TP 8
-.B GD_E_BAD_DIRFILE
+the specified fragment.
+
+On error, this function returns NULL and stores a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD 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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_fragmentname
+function appeared in GetData-0.4.0.
+
+In GetData-0.7.0 this function was renamed to
+.FN gd_fragmentname .
 
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_include (3),
-.BR gd_nfragments (3),
-.BR gd_open (3),
-.BR gd_parent_fragment (3)
+dirfile(5),
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_include ,
+.F3 gd_nfragments ,
+.F3 gd_open ,
+.F3 gd_parent_fragment
diff --git a/man/gd_framenum_subset.3 b/man/gd_framenum_subset.3
index a5d2c41..1ff47f8 100644
--- a/man/gd_framenum_subset.3
+++ b/man/gd_framenum_subset.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_framenum_subset.3.  The gd_framenum man page.
 .\"
-.\" Copyright (C) 2009, 2010, 2011, 2014 D. V. Wiebe
+.\" Copyright (C) 2009, 2010, 2011, 2014, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,55 +88,56 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_framenum_subset 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_framenum_subset 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_framenum_subset, gd_framenum \(em perform a reverse look-up on a
 monotonic dirfile field
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "double gd_framenum_subset(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "double " value ", off_t " field_start ", off_t " field_end );
 .HP
 .BI "double gd_framenum(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "double " value );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_framenum_subset ()
+.FN gd_framenum_subset
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and returns the fractional frame number at which the field specified by
-.IR field_code ,
+.ARG field_code ,
 which may contain a representation suffix, equals
-.IR value ,
+.ARG value ,
 by considering the field between the frame limits
-.I field_start
+.ARG field_start
 and
-.IR field_end .
+.ARG field_end .
 
 If
-.I field_start
+.ARG field_start
 is zero, the frame offset of the field is used as the lower limit instead (which
 may, in fact, be zero; see
-.BR gd_frameoffset (3)).
+.F3 gd_frameoffset ).
 If
-.I field_end
+.ARG field_end
 is zero, the number of frames in the dirfile, as reported by
-.BR gd_nframes (3),
+.F3 gd_nframes ,
 is used instead as the upper limit.
 
 The
-.BR gd_framenum ()
+.FN gd_framenum
 function is equivalent to calling
-.BR gd_framenum_subset ()
+.FN gd_framenum_subset
 with
-.I field_start
+.ARG field_start
 and
-.I field_end
+.ARG field_end
 equal to zero.
 
 The field must be monotonic (either increasing or decreasing) between the
@@ -97,73 +173,74 @@ outside of the supplied limits, up to and including positive or negative
 infinity.
 
 On error, these functions return an IEEE-754 conforming not-a-number (NaN), and
-set the dirfile error to a non-zero error value.  Possible error values are:
-.TP 8
-.B GD_E_ALLOC
+store a negative-valued error code in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_SCALAR
+.DD GD_E_BAD_SCALAR
 A scalar field used in the definition of the field was not found, or was not of
 scalar type.
-.TP
-.B GD_E_DIMENSION
+.DD GD_E_DIMENSION
 The field specified by
-.I field_code
+.ARG 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
+.DD GD_E_DOMAIN
 The specified field was complex valued, or the supplied frame range was too
 small.  This error may also arise if data is deleted from the field as the
 function is executing.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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_IO
+.DD GD_E_IO
 An error occurred while trying to open or read from a file on disk containing
 a raw field or LINTERP table.
-.TP
-.B GD_E_LUT
+.DD GD_E_LUT
 A LINTERP table was malformed.
-.TP
-.B GD_E_RANGE
+.DD GD_E_RANGE
 The specified field is constant between the supplied limits.
-.TP
-.B GD_E_RECURSE_LEVEL
+.DD GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
+.ARG field_code .
 This usually indicates a circular dependency in field specification in the
 dirfile.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD 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
+.DD 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)
+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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_framenum
+and
+.FN get_framenum_subset
+functions appeared in GetData-0.6.0.
+
+In GetData-0.7.0, these functions were renamed to
+.FN gd_framenum
+and
+.FN gd_framenum_subset .
+
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_frameoffset (3),
-.BR gd_nframes (3)
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_frameoffset ,
+.F3 gd_nframes ,
+.F3 gd_open
diff --git a/man/gd_framenum_subset64.3 b/man/gd_framenum_subset64.3
index 2173029..592a191 100644
--- a/man/gd_framenum_subset64.3
+++ b/man/gd_framenum_subset64.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_framenum_subset64.3.  The gd_framenum_subset64 man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,45 +88,43 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_framenum_subset64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
+.TH gd_framenum_subset64 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_framenum_subset64 \(em perform a reverse look-up on a monotonic dirfile
+gd_framenum_subset64 \(em perform a reverse look-up on a monotonic Dirfile
 field, with largefile support.
+
 .SH SYNOPSIS
+.SC
 .B #define GD_64BIT_API
 .br
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "double gd_framenum_subset64(DIRFILE *" dirfile ,
 .BI "const char *" field_code ", double " value ", gd_off64_t " field_start ,
 .BI "gd_off64_t " field_end );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 This version of
-.BR gd_framenum_subset (3)
+.F3 gd_framenum_subset
 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.
+It is only guaranteed to be available if
+.BR GD_64BIT_API
+is defined 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_framenum_subset (3).
+.B off_t
+is a 64-bit type, this function will the same as
+.F3 gd_framenum_subset .
 Otherwise,
-.BR gd_framenum_subset (3)
+.F3 gd_framenum_subset
 will be a version of this function which uses a 32-bit
-.IR off_t .
+.BR off_t .
+
 .SH SEE ALSO
-.BR gd_framenum_subset (3),
+.F3 gd_framenum_subset ,
 .BR feature_test_macros (7)
diff --git a/man/gd_frameoffset.3 b/man/gd_frameoffset.3
index 95fe69e..9865121 100644
--- a/man/gd_frameoffset.3
+++ b/man/gd_frameoffset.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_frameoffset.3.  The gd_frameoffset man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,24 +88,25 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_frameoffset 3 "15 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_frameoffset 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_frameoffset \(em report the starting frame of fields in a dirfile
+gd_frameoffset \(em report the starting frame of fields in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "off_t gd_frameoffset(DIRFILE *" dirfile ", int " fragment_index );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_frameoffset ()
+.FN gd_frameoffset
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and returns the frame offset (see dirfile-format(5)) for the fragment indexed by
-.IR fragment_index .
+.ARG fragment_index .
 The frame offset of a fragment indicate the frame number of the first sample
 of data stored in binary files associated with
 .B RAW
@@ -40,32 +116,42 @@ containing no
 fields is ignored.
 
 The
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_frameoffset ()
-returns the frame offset of the specified fragment.  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_BAD_DIRFILE
+.FN gd_frameoffset
+returns a non-negative integer containing the frame offset of the specified
+fragment.  On error, it returns a negative-valued error code.  Possible error
+codes are:
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_frameoffset
+function appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_frameoffset .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_alter_frameoffset (3),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
+.F3 gd_alter_frameoffset ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_open ,
+dirfile(5), dirfile-format(5)
diff --git a/man/gd_frameoffset64.3 b/man/gd_frameoffset64.3
index 44266ad..47ed33b 100644
--- a/man/gd_frameoffset64.3
+++ b/man/gd_frameoffset64.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_frameoffset64.3.  The gd_frameoffset64 man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,53 +88,51 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_frameoffset64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
+.TH gd_frameoffset64 3 "25 December 2016" "Version 0.10.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
+.SC
 .B #define GD_64BIT_API
 .br
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "gd_off64_t gd_frameoffset(DIRFILE *" dirfile ", int " fragment_index );
 .HP
 .BI "int gd_alter_frameoffset64(DIRFILE *" dirfile ", gd_off64_t " offset ,
 .BI "int " fragment_index ", int " move );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 These versions of
-.BR gd_frameoffset (3)
+.F3 gd_frameoffset
 and
-.BR gd_alter_frameoffset (3)
+.F3 gd_alter_frameoffset
 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.
+They are only available if
+.BR GD_64BIT_API
+has been defined before including getdata.h.
 
 If
-.I off_t
-is a 64-bit type (possibly because
-.I _FILE_OFFSET_BITS
-has been defined to 64), these functions will the same as
-.BR gd_framenum_subset (3)
+.B off_t
+is a 64-bit type, these functions will the same as
+.F3 gd_framenum_subset
 and
-.BR gd_alter_frameoffset (3).
+.F3 gd_alter_frameoffset .
 Otherwise,
-.BR gd_framenum_subset (3)
+.F3 gd_framenum_subset
 and
-.BR gd_alter_frameoffset (3)
+.F3 gd_alter_frameoffset
 will be versions of these function which use a 32-bit
-.IR off_t .
+.BR off_t .
+
 .SH SEE ALSO
-.BR gd_alter_frameoffset (3),
-.BR gd_frameoffset (3),
+.F3 gd_alter_frameoffset ,
+.F3 gd_frameoffset ,
 .BR feature_test_macros (7)
diff --git a/man/gd_free_entry_strings.3 b/man/gd_free_entry_strings.3
index 4ff2552..939ca14 100644
--- a/man/gd_free_entry_strings.3
+++ b/man/gd_free_entry_strings.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_free_entry_strings.3.  The gd_free_entry_strings man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2013 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2013, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,58 +88,67 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_free_entry_strings 3 "7 December 2013" "Version 0.9.0" "GETDATA"
+.TH gd_free_entry_strings 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_free_entry_strings \(em free strings in a GetData gd_entry_t object
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "gd_entry_t *gd_free_entry_strings(gd_entry_t *" entry );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_free_entry_strings ()
+.FN gd_free_entry_strings
 function frees the character strings found in the gd_entry_t object
-.I entry
+.ARG entry
 which were previously allocated by a call to
-.BR gd_entry (3).
+.F3 gd_entry .
 After freeing a string, the associated pointer is set to NULL.  If
-.I entry
+.ARG entry
 is NULL, this function does nothing.
 
 If non-NULL,
-.I entry
+.ARG entry
 must point to a valid and properly initialised gd_entry_t object, such as that
 returned by
-.BR gd_entry (3).
-As well, the caller may construct a properly initialised gd_entry_t object by
-first setting all bits to zero, then setting the field_type parameter to the
-desired gd_entype_t symbol, and finally initialising only the members defined
-for that type.  The results of calling this function are undefined if the
-character strings pointed to by the string members of
-.I entry
-have not been allocated with
-.BR malloc (3),
-unless these pointer members are equal to NULL.
+.F3 gd_entry .
+By default, strings are deallocated by calling
+.F3 free
+on each, but a different memory manager may be specified by calling
+.F3 gd_alloc_funcs
+before calling this function.
 
 See 
-.BR gd_entry (3)
+.F3 gd_entry
 for a description of the gd_entry_t data type.
+
 .SH RETURN VALUE
 The function
-.BR gd_free_entry_strings ()
+.FN gd_free_entry_strings
 always returns its input,
-.IR entry .
+.ARG entry .
+
 .SH NOTES
-This function is provided as a convenience only.  Callers may free strings
-allocated by
-.BR gd_entry (3)
-themselves by simply calling
-.BR free (3)
-on the appropriate members for the given entry type, if they prefer to do so.
+This function is provided as a convenience only.  The caller may deallocate the
+strings in the
+.B gd_entry_t
+object provided by
+.F3 gd_entry
+itself simply by calling the deallocator on the each initialised string member,
+if they prefer to do so.
+
+.SH HISTORY
+The
+.FN dirfile_free_entry_strings
+function appeared in GetData-0.3.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_free_entry_strings .
+
 .SH SEE ALSO
-.BR gd_entry (3),
-.BR free (3)
+.F3 gd_alloc_funcs ,
+.F3 gd_entry
diff --git a/man/gd_get_carray_slice.3 b/man/gd_get_carray_slice.3
index 6b3bccb..03a6740 100644
--- a/man/gd_get_carray_slice.3
+++ b/man/gd_get_carray_slice.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_get_carray_slice.3.  The gd_get_carray_slice man page.
 .\"
-.\" Copyright (C) 2010-2013 D. V. Wiebe
+.\" Copyright (C) 2010-2013, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,14 +88,15 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_get_carray_slice 3 "1 October 2013" "Version 0.9.0" "GETDATA"
+.TH gd_get_carray_slice 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_get_carray, gd_get_carray_slice, gd_get_constant \(em retrieve CONST or 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
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_get_carray_slice(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "unsigned int " start ", size_t " len ", gd_type_t " return_type ,
 .BI "void *" data_out );
@@ -30,183 +106,176 @@ gd_get_carray, gd_get_carray_slice, gd_get_constant \(em retrieve CONST or CARRA
 .HP
 .BI "int gd_get_constant(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "gd_type_t " return_type ", void *" data_out );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_get_carray_slice ()
+.FN gd_get_carray_slice
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 for the
 .B CONST
 or
 .B CARRAY
-scalar array
-.IR field_code ,
+scalar
+.ARG field_code ,
 which may contain a representation suffix.
 The data in the field is converted to the data type specified by
-.IR return_type ,
+.ARG return_type ,
 and stored in the user-supplied buffer
-.IR data_out .
+.ARG data_out .
 The first element of the field stored is given by
-.IR start ,
+.ARG start ,
 and the number of elements stored is given by
-.IR len .
+.ARG len .
 
 The
-.BR gd_get_carray ()
+.FN gd_get_carray
 function behaves similarly, except it returns the entire field, as if
-.BR gd_get_carray_slice ()
+.FN gd_get_carray_slice
 were called with
-.I start
+.ARG start
 equal to zero and
-.I len
+.ARG len
 equal to the value returned by
-.BR gd_carray_len (3).
+.F3 gd_array_len .
 The
-.BR gd_get_constant ()
+.FN gd_get_constant
 function is equivalent to calling
-.BR gd_get_carray_slice ()
+.FN gd_get_carray_slice
 with
-.I start
+.ARG start
 equal to zero and
-.I len
+.ARG len
 equal to one.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 The argument
-.I data_out
+.ARG data_out
 must point to a valid memory location of sufficient size to hold all the
 requested data of the return type specified.  The number of elements returned
 by
-.BR gd_get_carray ()
+.FN gd_get_carray
 may be obtained by calling
-.BR gd_carray_len (3).
+.F3 gd_array_len .
 Unlike
-.BR gd_getdata (3),
+.F3 gd_getdata ,
 calling
-.BR gd_get_carray_slice ()
+.FN gd_get_carray_slice
 never results in a short read; attempting to read past the end of the
 field will result in an error, and no data will be returned.
 
 The 
-.I return_type
+.ARG return_type
 argument should be one of the following symbols, which indicates the desired
 return type of the data:
 .RS
-.TP 11
-.B GD_UINT8
+.DD GD_UINT8
 unsigned 8-bit integer
-.TP
-.B GD_INT8
+.DD GD_INT8
 signed (two's complement) 8-bit integer
-.TP
-.B GD_UINT16
+.DD GD_UINT16
 unsigned 16-bit integer
-.TP
-.B GD_INT16
+.DD GD_INT16
 signed (two's complement) 16-bit integer
-.TP
-.B GD_UINT32
+.DD GD_UINT32
 unsigned 32-bit integer
-.TP
-.B GD_INT32
+.DD GD_INT32
 signed (two's complement) 32-bit integer
-.TP
-.B GD_UINT64
+.DD GD_UINT64
 unsigned 64-bit integer
-.TP
-.B GD_INT64
+.DD GD_INT64
 signed (two's complement) 64-bit integer
-.TP
-.B GD_FLOAT32
+.DD GD_FLOAT32
 IEEE-754 standard 32-bit single precision floating point number
-.TP
-.B GD_FLOAT64
+.DD GD_FLOAT64
 IEEE-754 standard 64-bit double precision floating point number
-.TP
-.B GD_COMPLEX64
+.DD GD_COMPLEX64
 C99-conformant 64-bit single precision complex number
-.TP
-.B GD_COMPLEX128
+.DD GD_COMPLEX128
 C99-conformant 128-bit double precision complex number
-.TP
-.B GD_NULL
+.DD GD_NULL
 the null type: the database is queried as usual, but no data is returned.
 In this case,
-.I data_out
+.ARG data_out
 is ignored and may be NULL.
 .RE
 
 The return type of the field need not be the same as the type of the data stored
 in the database.  Type conversion will be performed as necessary to return the
 requested type.  If the
-.I field_code
+.ARG field_code
 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.
+
 .SH RETURN VALUE
 On success,
-.BR gd_get_carray (),
-.BR gd_get_carray_slice (),
+.FN gd_get_carray ,
+.FN gd_get_carray_slice ,
 and
-.BR gd_get_constant ()
-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
+.FN gd_get_constant
+return zero.  On error, they return a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 An invalid
-.I dirfile
+.ARG dirfile
 was supplied.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 The supplied
-.I field_code
+.ARG field_code
 was not a
 .BR CONST
 nor
 .BR CARRAY .
-The caller should use
-.BR gd_getdata (3)
-or
-.BR gd_get_string (3)
-instead.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 An invalid
-.I return_type
+.ARG return_type
 was specified.
-.TP
-.B GD_E_BOUNDS
+.DD GD_E_BOUNDS
 A request for data beyond the end of the field was made.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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).
-A descriptive error string for the last error encountered may be obtained from
-a call to
-.BR gd_error_string (3).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_constant
+function appeared in GetData-0.4.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_get_constant .
+In this release, the
+.FN gd_get_carray
+and
+.FN gd_get_carray_slice
+functions also appeared.
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_carray_len (3),
-.BR gd_carrays (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_get_constant (3),
-.BR gd_open (3),
-.BR gd_put_carray_slice (3)
+.F3 gd_array_len ,
+.F3 gd_carrays ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_open ,
+.F3 gd_put_carray_slice ,
+dirfile(5)
diff --git a/man/gd_get_sarray_slice.3 b/man/gd_get_sarray_slice.3
new file mode 100644
index 0000000..e562419
--- /dev/null
+++ b/man/gd_get_sarray_slice.3
@@ -0,0 +1,222 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
+.\" gd_get_sarray_slice.3.  The gd_get_sarray_slice man page.
+.\"
+.\" Copyright (C) 2010-2013, 2016 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_get_sarray_slice 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_get_sarray, gd_get_sarray_slice \(em retrieve STRING or SARRAY data from a
+dirfile database
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "int gd_get_sarray_slice(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "unsigned int " start ", size_t " len ", const char **" data_out );
+.HP
+.BI "int gd_get_sarray(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "const char **" data_out );
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_get_sarray_slice
+function queries a dirfile(5) database specified by
+.ARG dirfile
+for the
+.B STRING
+or
+.B SARRAY
+scalar
+.ARG field_code .
+Pointers to read-only string elements of the specified field are stored in the
+user-supplied 
+.ARG data_out
+buffer, which must be large enough to hold
+.ARG len
+pointers.  The first element of the field stored is given by
+.ARG start ,
+and the number of elements stored is given by
+.ARG len .
+
+The
+.FN gd_get_sarray
+function behaves similarly, except it returns the entire field, as if
+.FN gd_get_sarray_slice
+were called with
+.ARG start
+equal to zero and
+.ARG len
+equal to the value returned by
+.F3 gd_array_len .
+
+The 
+.ARG dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.F3 gd_open .
+The number of elements returned by
+.FN gd_get_sarray
+may be obtained by calling
+.F3 gd_array_len .
+Unlike
+.F3 gd_getdata ,
+calling
+.FN gd_get_sarray_slice
+never results in a short read; attempting to read past the end of the
+field will result in an error, and no data will be returned.
+
+If
+.ARG field_code
+refers to a
+.B STRING
+field, it is treated as if it were a
+.B SARRAY
+field with only one element.  See the
+.F3 gd_get_string
+manual page for an example of how to replace
+.F3 gd_get_string
+calls with
+.FN gd_get_sarray .
+
+.SH RETURN VALUE
+On success,
+.FN gd_get_sarray
+and
+.FN gd_get_sarray_slice ,
+return zero.  Storage for the strings returned by this function are managed
+by GetData and should not be deallocated by the caller.  On error, these
+functions return a negative-valued error code.  Possible error codes are:
+.DD GD_E_ALLOC
+The library was unable to allocate memory.
+.DD GD_E_BAD_CODE
+The field specified by
+.ARG field_code
+was not found in the database.
+.DD GD_E_BAD_DIRFILE
+An invalid
+.ARG dirfile
+was supplied.
+.DD GD_E_BAD_FIELD_TYPE
+The supplied
+.ARG field_code
+was not a
+.BR STRING
+nor
+.BR SARRAY .
+.DD GD_E_BOUNDS
+A request for data beyond the end of the field was made.
+.DD 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 error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_get_sarray
+and
+.FN gd_get_sarray_slice
+functions appeared in GetData-0.10.0.
+
+.SH SEE ALSO
+.F3 gd_array_len ,
+.F3 gd_get_string ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_open ,
+.F3 gd_put_sarray_slice ,
+.F3 gd_sarrays ,
+dirfile(5)
diff --git a/man/gd_get_string.3 b/man/gd_get_string.3
index 042bd98..4837b5b 100644
--- a/man/gd_get_string.3
+++ b/man/gd_get_string.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_get_string.3.  The gd_get_string man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,100 +88,136 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_get_string 3 "25 May 2010" "Version 0.7.0" "GETDATA"
+.TH gd_get_string 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_get_string \(em retrieve a string from a dirfile database
+gd_get_string \(em retrieve STRING or SARRAY data from a Dirfile database
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "size_t gd_get_string(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "size_t " len ", char *" data_out );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_get_string ()
+.FN gd_get_string
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 for the string scalar
-.IR field_code ,
+.ARG field_code ,
 which should not contain a representation suffix.  The first
-.I len
+.ARG len
 characters of the string scalar are stored in the user-supplied buffer
-.IR data_out .
+.ARG data_out .
+If
+.ARG field_code
+refers to a
+.B SARRAY
+field, the first element is returned.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 If
-.I len
+.ARG len
 equals zero, or if
-.I data_out
+.ARG data_out
 equals NULL, no data will be copied to
-.IR data_out ,
+.ARG data_out ,
 but the length of the string scalar will still be returned by
-.BR gd_get_string ().
+.FN gd_get_string .
 Otherwise, the argument
-.I data_out
+.ARG data_out
 must point to a valid memory location of sufficient size to hold at least
-.I len
+.ARG len
 characters.  If the length of the string scalar is greater than
-.IR len ", " data_out
-will not be NULL-terminated.
+.ARG len ,
+.ARG data_out
+will not be NUL-terminated.
+
+The
+.F3 gd_get_sarray
+function provides another way of retrieving
+.B STRING
+data, but without having to know the length of the returned string in advance.
+The code:
+
+.RS
+.SC
+.BI "size_t " len " = gd_get_string(" dirfile ", " field_code ", 0, NULL);"
+.br
+.BI "char *" string " = malloc(" len );
+.br
+.BI gd_get_string( dirfile ", " field_code ", " len ", " string );
+.EC
+.RE
+
+which ensures the whole string, including the terminating NUL, is returned, can
+be replaced with, simply:
+
+.RS
+.SC
+.BI "const char *" string;
+.br
+.BI gd_get_sarray( dirfile ", " field_code ", &" string );
+.EC
+.RE
+
+with the added benefit of not having manage the memory for the string.
+
 .SH RETURN VALUE
 On success,
-.BR gd_get_string ()
-returns the actual length of the specified string scalar, including the trailing
-NULL character.  A return value greater than
-.I len
-indicates that the output string is not null terminated.
-
-On error, it returns 0 and sets the dirfile error to a non-zero
-value.  Possible error values are:
-.TP 8
-.B GD_E_BAD_CODE
+.FN gd_get_string
+returns the actual length of the specified string scalar, including space for
+the trailing NUL-character.  A return value greater than
+.ARG len
+indicates that the output string is not NUL-terminated.
+
+On error, this function returns 0 and stores a negative-valued error code in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 An invalid
-.I dirfile
+.ARG dirfile
 was supplied.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 The supplied
-.I field_code
+.ARG field_code
 referred to a field of type other than
-.BR STRING .
-The caller should use
-.BR gd_getdata (3),
+.B STRING
 or
-.BR gd_get_constant (3)
-instead.
-.TP
-.B GD_E_BAD_TYPE
-An invalid
-.I return_type
-was specified.
-.TP
-.B GD_E_INTERNAL_ERROR
+.BR SARRAY .
+.DD 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).
-A descriptive error string for the last error encountered may be obtained from
-a call to
-.BR gd_error_string (3).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_string
+function appeared in GetData-0.4.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_get_string .
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_put_string (3)
+.F3 gd_get_sarray ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_open ,
+.F3 gd_put_string ,
+dirfile(5)
diff --git a/man/gd_getdata.3 b/man/gd_getdata.3
index d127f59..b721d3f 100644
--- a/man/gd_getdata.3
+++ b/man/gd_getdata.3
@@ -1,3 +1,78 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_getdata.3.  The gd_getdata man page.
 .\"
 .\" Copyright (C) 2008-2016 D. V. Wiebe
@@ -13,52 +88,53 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_getdata 3 "24 February 2016" "Version 0.9.2" "GETDATA"
+.TH gd_getdata 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_getdata \(em retrieve data from a dirfile database
+gd_getdata \(em retrieve data from a Dirfile database
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "size_t gd_getdata(DIRFILE *" dirfile ", const char *" field_code ", off_t"
 .IB first_frame ", off_t " first_sample ", size_t " num_frames ", size_t"
 .IB num_samples ", gd_type_t " return_type ", void *" data_out );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_getdata ()
+.FN gd_getdata
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 for the field
-.IR field_code .
+.ARG field_code .
 It fetches
-.I num_frames
+.ARG num_frames
 frames plus
-.I num_samples
+.ARG num_samples
 samples from this field, starting 
-.I first_sample
+.ARG first_sample
 samples past frame
-.IR first_frame . 
+.ARG first_frame . 
 The data is converted to the data type specified by
-.IR return_type ,
+.ARG return_type ,
 and stored in the user-supplied buffer
-.IR data_out .
+.ARG data_out .
 
 The 
-.I field_code
+.ARG field_code
 may contain one of the representation suffixes listed in dirfile-format(5).
 If it does,
-.BR gd_getdata ()
+.FN gd_getdata
 will compute the appropriate complex norm before returning the data.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 The argument
-.I data_out
+.ARG data_out
 must point to a valid memory location of sufficient size to hold all data
 requested.
 
@@ -69,87 +145,84 @@ Unless using
 .IR first_frame " * " samples_per_frame " + " first_sample
 .PP
 as measured from the start of the dirfile, where
-.I samples_per_frame
+.ARG samples_per_frame
 is the number of samples per frame as returned by
-.BR gd_spf (3).
+.F3 gd_spf .
 The number of samples fetched is, similarly,
 .IP
 .IR num_frames " * " samples_per_frame " + " num_samples .
 .PP
 Although calling
-.BR gd_getdata ()
+.FN gd_getdata
 using both samples and frames is possible, the function is typically called
 with either
-.IR num_samples " and " first_sample ,
+.ARG num_samples
+and
+.ARG first_sample ,
 or
-.IR num_frames " and " first_frames ,
+.ARG num_frames
+and
+.ARG 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 .
+.ARG first_frame .
 This will result in the read occurring at the current position of the I/O
 pointer for the field (see
 .B GetData I/O Pointers
 below for a discussion of field I/O pointers).  In this case, the value of
-.I first_sample
+.ARG first_sample
 is ignored.
 
-The 
-.I return_type
+When reading a
+.B SINDIR
+field,
+.ARG return_type
+must be
+.BR GD_STRING .
+For all other field types, the
+.ARG return_type
 argument should be one of the following symbols, which indicates the desired
 return type of the data:
 .RS
-.TP 11
-.B GD_UINT8
+.DD GD_UINT8
 unsigned 8-bit integer
-.TP
-.B GD_INT8
+.DD GD_INT8
 signed (two's complement) 8-bit integer
-.TP
-.B GD_UINT16
+.DD GD_UINT16
 unsigned 16-bit integer
-.TP
-.B GD_INT16
+.DD GD_INT16
 signed (two's complement) 16-bit integer
-.TP
-.B GD_UINT32
+.DD GD_UINT32
 unsigned 32-bit integer
-.TP
-.B GD_INT32
+.DD GD_INT32
 signed (two's complement) 32-bit integer
-.TP
-.B GD_UINT64
+.DD GD_UINT64
 unsigned 64-bit integer
-.TP
-.B GD_INT64
+.DD GD_INT64
 signed (two's complement) 64-bit integer
-.TP
-.B GD_FLOAT32
+.DD GD_FLOAT32
 IEEE-754 standard 32-bit single precision floating point number
-.TP
-.B GD_FLOAT64
+.DD GD_FLOAT64
 IEEE-754 standard 64-bit double precision floating point number
-.TP
-.B GD_COMPLEX64
+.DD GD_COMPLEX64
 C99-conformant 64-bit single precision complex number
-.TP
-.B GD_COMPLEX128
+.DD GD_COMPLEX128
 C99-conformant 128-bit double precision complex number
-.TP
-.B GD_NULL
+.DD GD_NULL
 the null type: the database is queried as usual, but no data is returned.
 In this case,
-.I data_out
+.ARG data_out
 is ignored and may be NULL.
 .RE
 
 The return type of the data need not be the same as the type of the data stored
 in the database.  Type conversion will be performed as necessary to return the
 requested type.  If the
-.I field_code
+.ARG field_code
 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.
@@ -161,6 +234,59 @@ 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 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
+.F3 gd_mplex_lookback .
+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 SINDIR :
+The only allowed
+.ARG return_type
+when reading
+.B SINDIR
+data is
+.BR GD_STRING .
+The
+.ARG data
+argument should be of type
+.BR "const char **" ,
+and be large enough to hold one pointer for each sample requested.  It will be
+filled with pointers to read-only string data.  The caller should not free the
+returned string pointers.  For convenience when allocating buffers, the
+.B GD_STRING
+constant has the property:
+.nh
+.BI "GD_SIZE(GD_STRING) == sizeof(" "const char *" )\fR.
+.hy
+On samples where the index vector is out of range of the
+.BR SARRAY ,
+and also on samples before the index vector's frame offset, the value stored in
+.ARG data
+will be the NULL pointer.
+
+.TP
 .BR PHASE :
 A forward-shifted
 .B PHASE
@@ -168,16 +294,16 @@ 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 ()
+.FN gd_getdata
 and using
-.BR gd_nframes (3)
+.F3 gd_nframes
 to gauge field lengths (that is: a
 forward-shifted
 .B PHASE
 field always has less data in it than
-.BR gd_nframes (3)
+.F3 gd_nframes
 implies that it does).  As with any other field,
-.BR gd_getdata ()
+.FN gd_getdata
 will return a short count whenever a read from a
 .B PHASE
 field encounters the end-of-field marker.
@@ -185,7 +311,7 @@ field encounters the end-of-field marker.
 Backward-shifted
 .B PHASE
 fields do not suffer from this problem, since
-.BR gd_getdata ()
+.FN 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
@@ -200,40 +326,13 @@ 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)
+.F3 gd_nframes
 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
@@ -243,119 +342,109 @@ point return types.
 
 .SH RETURN VALUE
 In all cases,
-.BR gd_getdata ()
+.FN gd_getdata
 returns the number of samples (not bytes) successfully read from the database.
 If the end-of-field is encountered before the requested number of samples have
-been read, a short count will result.  The library does not consider this an
-error.  Requests for data before the beginning-of-field marker, which may have
-been shifted from frame zero by the presence of a
-.B FRAMEOFFSET
-directive, will result in the the data being padded at the front by NaN or zero
+been read, a short count will result.  this is not an error.
+
+Requests for data before the beginning-of-field marker, which may have
+been shifted from frame zero by a
+.B PHASE
+field or
+.B /FRAMEOFFSET
+directive, will result in the the data being padded at the front by NaN or zero,
 depending on whether the return type is of floating point or integral type.
 
-If an error has occurred, zero is returned and the dirfile error
-will be set to a non-zero value.  Possible error values are:
-.TP 8
-.B GD_E_ALLOC
+On error, this function returns zero and stores a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.IR field_code ,
+.ARG field_code ,
 or one of the fields it uses for input, was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 An invalid
-.I dirfile
+.ARG dirfile
 was supplied.
-.TP
-.B GD_E_BAD_SCALAR
+.DD GD_E_BAD_SCALAR
 A scalar field used in the definition of the field was not found, or was not of
 scalar type.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 An invalid
-.I return_type
+.ARG return_type
 was specified.
-.TP
-.B GD_E_DIMENSION
+.DD GD_E_DIMENSION
 The supplied
-.I field_code
+.ARG 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) ,
+.F3 gd_get_constant ,\~ gd_get_carray (3) ,
 or
-.BR gd_get_string (3)
+.F3 gd_get_string
 instead.  Or, a scalar field was found where a vector field was expected in
 the definition of
-.I field_code
+.ARG field_code
 or one of its inputs.
-.TP
-.B GD_E_DOMAIN
+.DD 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
+.DD 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_IO
+.DD GD_E_IO
 An error occurred while trying to open or read from a file on disk containing
 a raw field or LINTERP table.
-.TP
-.B GD_E_LUT
+.DD GD_E_LUT
 A LINTERP table was malformed.
-.TP
-.B GD_E_RANGE
+.DD GD_E_RANGE
 An attempt was made to read data outside the addressable Dirfile range (more
 than 2**63 samples past the start of the dirfile).
-.TP
-.B GD_E_RECURSE_LEVEL
+.DD GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
+.ARG field_code .
 This usually indicates a circular dependency in field specification in the
 dirfile.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD 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
+.DD 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)
+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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
 
 .SH NOTES
 To save memory,
-.BR gd_getdata ()
+.FN gd_getdata
 uses the memory pointed to by
-.I data_out
+.ARG 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 ()
+.FN gd_getdata
 will report zero samples returned on error.
 
 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 ()
+.FN gd_getdata
 calls for efficiency's sake.  Memory used by this internal slimlib buffer can be
 reclaimed by calling
-.BR gd_raw_close (3)
+.F3 gd_raw_close
 on fields when finished reading them.
 
 When operating on a platform whose
@@ -363,13 +452,13 @@ When operating on a platform whose
 is
 .IR N -bytes
 wide, a single call of
-.BR gd_getdata ()
+.FN gd_getdata
 will never return more than (2**(\fIN\fR-1) - 1) samples.  The request will
 be truncated at (2**(\fIN\fR-\fIM\fR) - 1) samples, where \fIM\fR is the size,
 in bytes, of the largest data type used to calculate the returned field.  If a
 larger request is specified, less data than requested will be returned, without
 raising an error.  This limit is imposed even when 
-.I return_type
+.ARG return_type
 is
 .B GD_NULL
 or when reading from the
@@ -380,7 +469,7 @@ actual amount of data is returned.
 .SH GETDATA I/O POINTERS
 This is a general discussion of field I/O pointers in the GetData library, and
 contains information not directly applicable to
-.BR gd_getdata ().
+.FN gd_getdata .
 
 Every
 .B RAW
@@ -392,7 +481,7 @@ Dirfile fields (see
 .B GD_HERE
 in the description above).  The value of the I/O pointer of a field is reported
 by
-.BR gd_tell (3).
+.F3 gd_tell .
 
 Derived fields have virtual I/O pointers arising from the I/O pointers of their
 input fields.  These virtual I/O pointers may be valid (when all input fields
@@ -457,7 +546,7 @@ When a Dirfile is first opened, the I/O pointer of every
 .B RAW
 field is set to the beginning-of-frame
 (the value returned by
-.BR gd_bof (3)),
+.F3 gd_bof ),
 as is the I/O pointer of any newly-created
 .B RAW
 field.
@@ -480,7 +569,7 @@ above), the position of that
 field's I/O pointer is unspecified (that is: it is not specified which input
 field is read first).
 .TP
-.BR gd_seek (3)
+.F3 gd_seek
 This function is used to manipulate I/O pointers directly.
 .TP
 .BR gd_flush "(3) and " gd_raw_close (3)
@@ -490,12 +579,16 @@ field which is closed back to the beginning-of-field.
 .TP
 .I calls which result in modifications to raw data files:
 this may happen when calling any of:
-.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_malter_spec (3),
-.BR gd_move (3),
+.F3 gd_alter_encoding ,
+.F3 gd_alter_endianness ,
+.F3 gd_alter_frameoffset ,
+.F3 gd_alter_entry ,
+.F3 gd_alter_raw ,
+.F3 gd_alter_spec ,
+.F3 gd_malter_spec ,
+.F3 gd_move ,
 or
-.BR gd_rename (3);
+.F3 gd_rename ;
 these functions close affected
 .B RAW
 fields before making changes to the raw data files, and so reset the
@@ -505,21 +598,42 @@ corresponding I/O pointers to the beginning-of-field.
 In general, when these calls fail, the I/O pointers of affected fields may be
 anything, even out-of-bounds or invalid.  After an error, the caller should
 issue an explicit
-.BR gd_seek (3)
+.F3 gd_seek
 to repoisition I/O pointers before attempting further sequential operations.
 
+.SH HISTORY
+The function
+.FN getdata
+appeared in GetData-0.3.0.
+
+The
+.B GD_COMPLEX64
+and
+.B GD_COMPLEX128
+data types appeared in GetData-0.6.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_getdata .
+
+The
+.B GD_HERE
+symbol used for sequential reads appeared in GetData-0.8.0.
+
+The
+.B GD_STRING
+data type appeared in GetData-0.10.0.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR dirfile-encoding (5),
-.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_putdata (3),
-.BR GD_SIZE (3)
+.F3 GD_SIZE ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_get_constant ,
+.F3 gd_get_string ,
+.F3 gd_mplex_lookback ,
+.F3 gd_nframes ,
+.F3 gd_open ,
+.F3 gd_raw_close ,
+.F3 gd_seek ,
+.F3 gd_spf ,
+.F3 gd_putdata ,
+dirfile(5), dirfile-encoding(5)
diff --git a/man/gd_getdata64.3 b/man/gd_getdata64.3
index a076312..9f37d6c 100644
--- a/man/gd_getdata64.3
+++ b/man/gd_getdata64.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_getdata64.3.  The gd_getdata64 man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,45 +88,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 2012" "Version 0.8.0" "GETDATA"
+.TH gd_getdata64 3 "25 December 2016" "Version 0.10.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
+.SC
 .B #define GD_64BIT_API
 .br
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .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
+.EC
+
 .SH DESCRIPTION
 This version of
-.BR gd_getdata (3)
+.F3 gd_getdata
 uses a 64-bit offset type
 .RB ( gd_off64_t ),
-where one is available, regardless of the size of
+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.
+This function is only guaranteed to be available if
+.BR GD_64BIT_API
+is defined 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_getdata (3).
+.B off_t
+is a 64-bit type, this function will the same as
+.F3 gd_getdata .
 Otherwise,
-.BR gd_getdata (3)
+.F3 gd_getdata
 will be a version of this function which uses a 32-bit
-.IR off_t .
+.BR off_t .
+
 .SH SEE ALSO
-.BR gd_getdata (3),
+.F3 gd_getdata ,
 .BR feature_test_macros (7)
diff --git a/man/gd_hidden.3 b/man/gd_hidden.3
index 7cbd045..a1dbc8e 100644
--- a/man/gd_hidden.3
+++ b/man/gd_hidden.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_hidden.3.  The gd_hidden man page.
 .\"
-.\" Copyright (C) 2012, 2013, 2015 D. V. Wiebe
+.\" Copyright (C) 2012, 2013, 2015, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,67 +88,83 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_hidden 3 "5 November 2015" "Version 0.9.1" "GETDATA"
+.TH gd_hidden 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_hidden \(em check whether a dirfile entry is hidden or not
+gd_hidden \(em check whether a Dirfile entry is hidden or not
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_hidden(const DIRFILE *" dirfile ", const char"
 .BI * entry_name );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_hidden ()
+.FN gd_hidden
 function queries a dirfile(5) database specified by
-.I dirfile
-and indicates whether the field or alias called
-.IR entry_name
+.ARG dirfile
+to determine whether the field or alias called
+.ARG entry_name
 is hidden or not.  This information is also available in the entry object
 proved by
-.BR gd_entry (3).
-
-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).
+.F3 gd_entry .
+
+By default, a hidden entry does not appear in the lists returned by the
+functions
+.F3 gd_match_entries ,
+.F3 gd_entry_list
+.F3 gd_constants ,
+or
+.F3 gd_strings ,
+including the special-case versions of
+.F3 gd_entry_list
+such as
+.F3 gd_field_list .
 These omissions are also reflected in the counts returned by the corresponding
-field counting functions
+field counting function
+.F3 gd_nentries
+and it's special-case versions
 .RB ( gd_nfields (3),
 &c.).
+
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_hidden ()
+.FN 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
+
+On error, it returns a negative-valued error code.  (As a result, the caller
+checking simply whether the return value of this function is non-zero is usually
+an error.)  Possible error codes are:
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_hidden
+function appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
 
 .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)
+.F3 gd_entry ,
+.F3 gd_field_list ,
+.F3 gd_hide ,
+.F3 gd_nfields ,
+.F3 gd_open ,
+.F3 gd_unhide ,
+dirfile(5)
diff --git a/man/gd_hide.3 b/man/gd_hide.3
index e63e1b0..19a4012 100644
--- a/man/gd_hide.3
+++ b/man/gd_hide.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_hide.3.  The gd_hidden man page.
 .\"
-.\" Copyright (C) 2012, 2013 D. V. Wiebe
+.\" Copyright (C) 2012, 2013, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,79 +88,94 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_hide 3 "10 December 2013" "Version 0.9.0" "GETDATA"
+.TH gd_hide 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_hide, gd_unhide \(em hide or unhide a dirfile database entry
+gd_hide, gd_unhide \(em hide or unhide a Dirfile database entry
+
 .SH SYNOPSIS
+.SC
 .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
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_hide ()
+.FN gd_hide
 function hides the field or alias called
-.IR entry_name
+.ARG entry_name
 in the dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and indicates whether the field or alias called is hidden or not.  Similarly,
 the
-.BR gd_unhide ()
+.FN gd_unhide
 function unhides the specified entry.  An entry can also be hidden or unhidden
 using
-.BR gd_alter_entry (3).
+.F3 gd_alter_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).
+By default, a hidden entry does not appear in the lists returned by the
+functions
+.F3 gd_match_entries ,
+.F3 gd_entry_list
+.F3 gd_constants ,
+or
+.F3 gd_strings ,
+including the special-case versions of
+.F3 gd_entry_list
+such as
+.F3 gd_field_list .
 These omissions are also reflected in the counts returned by the corresponding
-field counting functions
+field counting function
+.F3 gd_nentries
+and it's special-case versions
 .RB ( gd_nfields (3),
-&c.).  A hidden field is otherwise no different than an unhidden field.
+&c.).
+
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_hide ()
+.FN 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
+.FN gd_unhide
+return zero.  On error, they return a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_PROTECTED
+.DD 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_hide
+and
+.FN gd_unhide
+functions appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.
 
 .SH SEE ALSO
-.BR gd_alter_entry (3),
-.BR gd_field_list (3),
-.BR gd_hidden (3),
-.BR gd_nfields (3),
-.BR gd_open (3),
-.BR dirfile (5)
+.F3 gd_alter_entry ,
+.F3 gd_field_list ,
+.F3 gd_hidden ,
+.F3 gd_nfields ,
+.F3 gd_open ,
+dirfile(5)
diff --git a/man/gd_include.3 b/man/gd_include.3
new file mode 100644
index 0000000..803f533
--- /dev/null
+++ b/man/gd_include.3
@@ -0,0 +1,424 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
+.\" gd_include.3.  The gd_include man page.
+.\"
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014, 2016 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 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_include, gd_include_affix, gd_include_ns \(em add a format specification
+fragment to a Dirfile
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "int gd_include(DIRFILE *" dirfile ", const char *" include_file ,
+.BI "int " parent_fragment ", unsigned long " flags );
+.HP
+.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_ns(DIRFILE *" dirfile ", const char *" include_file ,
+.BI "int " parent_fragment ", const char *" namespace , 
+.BI "unsigned long " flags );
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_include_affix
+function adds the format specification fragment given by the path
+.ARG include_file
+to the specified dirfile, possibly creating the fragment, using the affixes
+specified.  This occurs as if, in the existing fragment indexed
+by
+.ARG parent_fragment ,
+the following directive were present:
+.IP
+.B /INCLUDE
+.I <include_file> <prefix> <suffix>
+.PP
+(see
+dirfile-format(5)).
+The
+.ARG prefix
+may include a namespace, separated from the rest of the prefix, which may be
+the empty string, by a dot
+.RI ( . ).
+If a parser callback function had been specified when the dirfile was opened
+using
+.F3 gd_cbopen ,
+or added later with
+.F3 gd_parser_callback ,
+this callback function will be called if a syntax error is encountered while
+parsing the included fragment.
+
+Passing NULL as
+.ARG prefix
+or
+.ARG suffix
+is the same as using the empty string (ie. the corresponding affix is empty).
+
+The function
+.FN gd_include
+is equivalent to calling
+.FN gd_include_affix
+with both
+.ARG prefix
+and
+.ARG suffix
+equal to NULL.
+
+The function
+.FN gd_include_ns
+is equivalent to calling
+.FN gd_include_affix
+with
+.ARG suffix
+equal to NULL and
+.ARG prefix
+equal to
+.ARG namespace
+concatenated with a trailing dot.
+
+The 
+.ARG flags
+argument should be a bitwise-or'd collection of zero or more of the following
+flags:
+.PP
+.DD GD_ARM_ENDIAN 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.
+.DD GD_BIG_ENDIAN 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.
+.DD 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)).
+.DD 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
+.ARG 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).
+.DD GD_FORCE_ENCODING
+Specifies that
+.B /ENCODING
+directives (see
+dirfile-format(5))
+found in the fragment should be ignored.  The encoding scheme
+specified in
+.ARG flags
+will be used instead (see below).
+.DD GD_FORCE_ENDIAN
+Specifies that
+.B /ENDIAN
+directives (see
+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.
+.DD 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.
+.DD 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.
+.DD 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
+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.
+.DD GD_TRUNC
+If
+.ARG include_file
+already exists, it will be truncated before opening.  If the file does not
+exist, this flag is ignored.
+
+.PP
+The
+.ARG 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
+dirfile-encoding(5)
+for details on dirfile encoding schemes.
+.DD 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
+.F3 gd_putdata
+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.
+.DD 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.
+.DD GD_FLAC_ENCODED
+Specifies that raw data files are compressed using the Free Lossless Audio
+Coded (FLAC).
+.DD GD_GZIP_ENCODED
+Specifies that raw data files are compressed using Lempel-Ziv coding (LZ77)
+as implemented in the gzip format.
+.DD 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.
+.DD GD_SIE_ENCODED
+Specified that raw data files are sample-index encoded, similar to run-length
+encoding, suitable for data that change rarely.
+.DD GD_SLIM_ENCODED
+Specifies that raw data files are compressed using the slimlib library.
+.DD GD_TEXT_ENCODED
+Specifies that raw data files are encoded as text files containing one data
+sample per line.  
+.DD GD_UNENCODED
+Specifies that raw data files are not encoded, but written verbatim to disk.
+.DD 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.
+.DD 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, they return a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ACCMODE
+The supplied dirfile was opened in read-only mode.
+.DD GD_E_ALLOC
+The library was unable to allocate memory.
+.DD GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.DD GD_E_BAD_INDEX
+The supplied parent fragment index was out of range.
+.DD GD_E_BAD_REFERENCE
+The reference field specified by a
+.B /REFERENCE
+directive in the fragment (see
+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.
+.DD GD_E_CALLBACK
+The registered callback function returned an unrecognised response.
+.DD GD_E_FORMAT
+A syntax error occurred in the fragment.
+.DD 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.
+.DD GD_E_IO
+An I/O error occured while trying to read or create the fragment.
+.DD GD_E_PROTECTED
+The metadata of the parent fragment was protected from change.
+.PP
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN dirfile_include
+function appeared in GetData-0.4.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_include .
+
+The
+.FN gd_include_affix
+function appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.  The
+.FN gd_include_ns
+function also appeared in this release.
+
+See
+.F3 gd_open
+for history of the flags.
+
+.SH SEE ALSO
+.F3 gd_alter_affixes ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_fragmentname ,
+.F3 gd_nfragments ,
+.F3 gd_open ,
+.F3 gd_parser_callback ,
+.F3 gd_reference ,
+.F3 gd_uninclude ,
+dirfile(5), dirfile-encoding(5), dirfile-format(5)
diff --git a/man/gd_include_affix.3 b/man/gd_include_affix.3
deleted file mode 100644
index bdea7b2..0000000
--- a/man/gd_include_affix.3
+++ /dev/null
@@ -1,354 +0,0 @@
-.\" gd_include_affix.3.  The gd_include_affix man page.
-.\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014 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 "16 October 2014" "Version 0.9.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_IO
-An I/O error occured while trying to read or create the fragment.
-.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 34814d1..f5f09fb 100644
--- a/man/gd_invalid_dirfile.3
+++ b/man/gd_invalid_dirfile.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_invalid_dirfile.3.  The gd_invalid_dirfile man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,26 +88,27 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_invalid_dirfile 3 "17 August 2011" "Version 0.8.0" "GETDATA"
+.TH gd_invalid_dirfile 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_invalid_dirfile \(em obtain an pointer to an invalid DIRFILE object
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "DIRFILE* gd_invalid_dirfile(void);
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_invalid_dirfile ()
+.FN gd_invalid_dirfile
 returns a pointer to a newly allocated, invalid DIRFILE object.  Like any
 other DIRFILE object, the invalid DIRFILE object should be de-allocated by
 calling
-.BR gd_close (3)
+.F3 gd_close
 or
-.BR gd_discard (3)
+.F3 gd_discard
 when it is no longer needed.
 
 The DIRFILE object returned may be passed to any other GetData function which
@@ -42,23 +118,19 @@ with the
 error.
 
 A similar effect can be achieved by making an invalid
-.BR gd_open (3)
+.F3 gd_open
 call, such as:
-.HP
-.in +2n
-.nf
-.fam C
+.SC
+.IP
 .BR gd_open( """""" ,\~ 0 );
-.fam
-.fi
-.in
+.EC
 .PP
 which also returns a pointer to an invalid DIRFILE object.  The difference
-is that an invalid DIRFILE created in this way has a non-zero dirfile
-error (obtainable with
-.BR gd_error (3)),
+is that an invalid DIRFILE created in this way has a non-zero error code
+(obtainable with
+.F3 gd_error ),
 while the dirfile error of the invalid DIRFILE returned by
-.BR gd_invalid_dirfile (3)
+.F3 gd_invalid_dirfile
 is zero (indicating success).
 
 .SH RETURN VALUE
@@ -66,8 +138,13 @@ This function always returns a pointer to a newly allocated, invalid DIRFILE
 object, except when it is unable to allocate memory for the DIRFILE, in which
 case it returns NULL.
 
+.SH HISTORY
+The
+.FN gd_invalid_dirfile
+function appeared in GetData-0.7.0.
+
 .SH SEE ALSO
-.BR gd_close (3),
-.BR gd_discard (3),
-.BR gd_error (3),
-.BR gd_open (3)
+.F3 gd_close ,
+.F3 gd_discard ,
+.F3 gd_error ,
+.F3 gd_open
diff --git a/man/gd_linterp_tablename.3 b/man/gd_linterp_tablename.3
index be14add..dfd7bbf 100644
--- a/man/gd_linterp_tablename.3
+++ b/man/gd_linterp_tablename.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_linterp_tablename.3.  The gd_linterp_tablename man page.
 .\"
-.\" Copyright (C) 2012, 2013 D. V. Wiebe
+.\" Copyright (C) 2012, 2013, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,80 +88,86 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_linterp_tablename 3 "10 December 2013" "Version 0.9.0" "GETDATA"
+.TH gd_linterp_tablename 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_linterp_tablename \(em retrieve the pathname of a look-up table in a dirfile
+gd_linterp_tablename \(em retrieve the pathname of a look-up table in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "char *gd_linterp_tablename(DIRFILE *" dirfile ", const char"
 .BI * field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_linterp_tablename ()
+.FN gd_linterp_tablename
 function retrieves the pathname of the look-up table (LUT) used by the
 .B LINTERP
 field specified by
-.I field_code
+.ARG field_code
 in the dirfile specified by
-.IR dirfile .
+.ARG dirfile .
 If
-.I field_code
+.ARG 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
+.ARG table
 member in a
 .B gd_entry_t
 object (see
-.BR gd_entry (3))
+.F3 gd_entry )
 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 ()
+.FN gd_linterp_tablename
 returns the full pathname of the LUT associated with the specified field in a
-buffer allocated by
-.BR malloc (3).  
-Once no longer needed, the returned pointer should be passed to
-.BR free (3)
-to deallocate the associated memory.  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
+newly-allocated buffer.  By default, this buffer is allocated with
+.F3 malloc ,
+but a different memory manager may be specified by calling
+.F3 gd_alloc_funcs
+before calling this function.  The caller is responsible for deallocating the
+returned buffer.
+
+On error, this function returns NULL and stores a negative-valued error code
+in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 The field specified by
-.I field_code
+.ARG field_code
 was not a
 .B LINTERP
 field.
 .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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_linterp_tablename
+function appeared in GetData-0.8.1.
+
 .SH SEE ALSO
-.BR gd_entry (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR dirfile (5),
-.BR dirfile-format (5),
-.BR free (3),
-.BR malloc (3)
+.F3 gd_alloc_funcs ,
+.F3 gd_entry ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_madd_bit.3 b/man/gd_madd_bit.3
index afaa731..2af26a5 100644
--- a/man/gd_madd_bit.3
+++ b/man/gd_madd_bit.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_madd_bit.3.  The gd_madd_bit man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2012, 2013 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,18 +88,19 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_madd_bit 3 "30 September 2013" "Version 0.9.0" "GETDATA"
+.TH gd_madd_bit 3 "25 December 2016" "Version 0.10.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,
-gd_madd_multiply, gd_madd_phase, gd_madd_polynom, gd_madd_recip, gd_madd_sbit,
-gd_madd_string
-\(em add a field to a dirfile
+gd_madd_crecip, gd_madd_divide, gd_madd_indir, gd_madd_lincom, gd_madd_linterp,
+gd_madd_multiply, gd_madd_phase, gd_madd_polynom, gd_madd_recip,
+gd_madd_sarray, gd_madd_sbit, gd_madd_sindir, gd_madd_string
+\(em add a field to a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_madd_bit(DIRFILE *" dirfile ,
 .BI "const char *" parent ", const char *" field_name ,
 .BI "const char *" in_field ", int " bitnum ", int " numbits );
@@ -54,6 +130,10 @@ gd_madd_string
 .BI "const char *" parent ", const char *" field_name ,
 .BI " const char *" in_field1 ", const char *" in_field2 );
 .HP
+.BI "int gd_madd_indir(DIRFILE *" dirfile ,
+.BI "const char *" parent ", const char *" field_name ,
+.BI " const char *" index_field ", const char *" carray_field );
+.HP
 .BI "int gd_madd_lincom(DIRFILE *" dirfile ", const char *" parent ,
 .BI "const char *" field_name ", int " n_fields ", const char **" in_fields ,
 .BI "const double *" m ", const double *" b );
@@ -77,16 +157,24 @@ gd_madd_string
 .HP
 .BI "int gd_madd_phase(DIRFILE *" dirfile ,
 .BI "const char *" parent ", const char *" field_name ,
-.BI "const char *" in_field ", gd_shift_t " shift );
+.BI "const char *" in_field ", gd_int64_t " shift );
 .HP
 .BI "int gd_madd_recip(DIRFILE *" dirfile ", const char *" parent ,
 .BI "const char *" field_name ", const char *" in_field ,
 .BI "double " dividend ", int " fragment_index );
 .HP
+.BI "int gd_madd_sarray(DIRFILE *" dirfile ,
+.BI "const char *" parent ", const char *" field_name ,
+.BI size_t " array_len ", const char **" value );
+.HP
 .BI "int gd_madd_sbit(DIRFILE *" dirfile ,
 .BI "const char *" parent ", const char *" field_name ,
 .BI "const char *" in_field ", int " bitnum ", int " numbits );
 .HP
+.BI "int gd_madd_sindir(DIRFILE *" dirfile ,
+.BI "const char *" parent ", const char *" field_name ,
+.BI " const char *" index_field ", const char *" sarray_field );
+.HP
 .BI "int gd_madd_string(DIRFILE *" dirfile ", const char *" parent ,
 .BI "const char *" field_name ", const char *" value );
 .HP
@@ -94,42 +182,42 @@ gd_madd_string
 .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
+.EC
+
 .SH DESCRIPTION
 These functions add a new metafield of the indicated type under the parent field
 given by
-.I parent
-in the dirfile specified by
-.IR dirfile .
+.ARG parent
+to the dirfile specified by
+.ARG dirfile .
 .PP
 In all of these calls,
-.I field_name
+.ARG field_name
 indicates the name of the field to be added.  It should not be the full
 .IB <parent-field> / <meta-field>
 field code.  The meaning and valid types of other arguments may be obtained from
 the
-.BR gd_entry (3)
+.F3 gd_entry
 and
-.BR dirfile-format (5)
+dirfile-format(5)
 manual pages.
 
 The
-.BR gd_madd_clincom ()
+.FN gd_madd_clincom
 and
-.BR gd_madd_cpolynom ()
+.FN gd_madd_cpolynom
 functions are identical to
-.BR gd_madd_lincom ()
+.FN gd_madd_lincom
 and
-.BR gd_madd_polynom (),
+.FN gd_madd_polynom ,
 except they take complex scalar parameters, instead of purely real values.
 
 The
-.BR gd_madd_lincom ()
+.FN gd_madd_lincom
 and
-.BR gd_madd_clincom ()
+.FN gd_madd_clincom
 functions take pointers to three arrays of length
-.I n_fields
+.ARG n_fields
 containing the input field names
 .RI ( in_fields ),
 the gain factors
@@ -137,34 +225,42 @@ the gain factors
 and the offset terms
 .RI ( b " or " cb ).
 Similarly,
-.BR gd_madd_polynom ()
+.FN gd_madd_polynom
 and
-.BR gd_madd_cpolynom ()
+.FN gd_madd_cpolynom
 take an array of length
-.I poly_ord
+.ARG poly_ord
 + 1
 containing the polynomial co-efficients
 .RI ( a " or " ca ).
 
 The
-.BR gd_madd_string (),\~ gd_madd_carray ,
+.FN gd_madd_carray ,
+.FN gd_madd_const ,
+.FN gd_madd_sarray ,
 and
-.BR gd_madd_const ()
+.FN gd_madd_string ,
 functions both add the field and set the value of the field to
-.IR value .
+.ARG value .
 For
-.BR gd_madd_const ()
+.FN gd_madd_const
 and
-.BR gd_madd_carray (),
+.FN gd_madd_carray ,
 the
-.I const_type
+.ARG const_type
 argument specifies the storage type for the const, while
-.I data_type
+.ARG data_type
 specifies the data type of the value pointed to by
-.IR value .
+.ARG value .
+For
+.FN gd_madd_sarray ,
+.ARG value
+should contain
+.ARG array_len
+string pointers.
 
 The
-.B gd_shift_t
+.B gd_int64_t
 type is a signed 64-bit integer type.  The
 .B gd_triplet_t
 type is defined as:
@@ -186,17 +282,17 @@ Which element of this
 union to set depends on the operator selected for the
 .B WINDOW
 field.  See
-.BR gd_entry (3)
+.F3 gd_entry
 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)
+.F3 gd_madd
 or
-.BR gd_madd_spec (3).
+.F3 gd_madd_spec .
 See
-.BR gd_add_bit (3),
+.F3 gd_add_bit ,
 &c. for an alternate way of adding metafields with explicit parameters.
 
 See
@@ -204,67 +300,60 @@ See
 below for information on using
 .BR gd_madd_clincom "(), " gd_madd_cpolynom (),
 and 
-.BR gd_madd_crecip ()
+.FN gd_madd_crecip
 in the C89 GetData API.
 
 .SH RETURN VALUE
-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
+On success, any of these functions returns zero.  On error, a negative-valued
+error code is returned.  Possible error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The
-.IR field_name
+.ARG field_name
 argument contained invalid characters. Alternately, the
-.I parent
+.ARG parent
 field code was not found, or was already a metafield.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_ENTRY
+.DD GD_E_BAD_ENTRY
 One or more of the field parameters specified was invalid.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 The
-.IR data_type " or " const_type
+.ARG data_type
+or
+.ARG const_type
 argument provided to
-.BR gd_madd_const ()
+.FN gd_madd_const
 or
-.BR gd_madd_carray ()
+.FN gd_madd_carray
 was invalid.
-.TP
-.B GD_E_DUPLICATE
+.DD GD_E_DUPLICATE
 The
-.IR field_name
+.ARG field_name
 provided duplicated that of an already existing field.
-.TP
-.B GD_E_PROTECTED
+.DD GD_E_PROTECTED
 The metadata of the fragment was protected from change.
 .PP
-The dirfile error may be retrieved by calling
-.BR gd_error (3).
+The dirfile error may also be retrieved by calling
+.F3 gd_error .
 A descriptive error string for the last error encountered can be obtained from
 a call to
-.BR gd_error_string (3).
+.F3 gd_error_string .
 
 .SH NOTES
 The C89 GetData API provides different prototypes for
-.BR gd_madd_clincom (),\~ gd_madd_cpolynom (),
+.FN gd_madd_clincom ,\~ gd_madd_cpolynom (),
 and
-.BR gd_madd_crecip ():
+.FN gd_madd_crecip :
 .PP
+.SC
 .B #define GD_C89_API
 .br
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_madd_clincom(DIRFILE *" dirfile ", const char *" parent ,
 .BI "const char *" field_name ", int " n_fields ", const char **" in_fields ,
 .BI "const double *" cm ", const double *" cb );
@@ -276,60 +365,108 @@ and
 .BI "int gd_madd_crecip(DIRFILE *" dirfile ", const char *" parent ,
 .BI "const char *" field_name ", const char *" in_field ,
 .BI "double " cdividend\fR[2] ", int " fragment_index );
-.hy
-.ad n
+.EC
 .PP
 In this case, the array pointers passed as
-.IR cm ", " cb
+.ARG cm ,
+.ARG cb
 or
-.IR ca
+.ARG ca
 should have twice as many (purely real) elements, consisting of alternating
 real and imaginary parts for the complex data.  That is, for example,
-.IR ca [0]
+.ARG ca [0]
 should be the real part of the first co-efficient,
-.IR ca [1]
+.ARG ca [1]
 the imaginary part of the first co-efficient,
-.IR ca [2]
+.ARG ca [2]
 the real part of the second co-efficient,
-.IR ca [3]
+.ARG ca [3]
 the imaginary part of the second co-efficient, and so on.  Similarly, the
-.I cdividend
+.ARG cdividend
 parameter becomes a double precision array of length two.
 .PP
 For
-.BR gd_madd_clincom ()
+.FN gd_madd_clincom
 and
-.BR gd_madd_cpolynom (),
+.FN gd_madd_cpolynom ,
 these are simply different (but equivalent) declarations of the C99 function
 entry point.  For
-.BR gd_madd_crecip (),
+.FN gd_madd_crecip ,
 however, a different entry point is needed (since the
-.I cdividend
+.ARG cdividend
 parameter is passed by reference instead of by value).  In the interests of
 portability, the C89 version of
-.BR gd_madd_crecip ()
+.FN gd_madd_crecip
 is always available, and may be accessed as
-.BR gd_madd_crecip89 (),
+.FN gd_madd_crecip89 ,
 with the C89 prototype, in both the C99 and C89 APIs.
 
+.SH HISTORY
+The functions
+.FN dirfile_madd_bit ,
+.FN dirfile_madd_const ,
+.FN dirfile_madd_lincom ,
+.FN dirfile_madd_linterp ,
+.FN dirfile_madd_multiply ,
+.FN dirfile_madd_phase ,
+and
+.FN dirfile_madd_string
+appeared in GetData-0.4.0.
+
+The functions
+.FN dirfile_madd_clincom ,
+.FN dirfile_madd_cpolynom ,
+.FN dirfile_madd_polynom ,
+and
+.FN dirfile_madd_sbit
+appeared in GetData-0.6.0.
+
+In GetData-0.7.0, the functions were renamed to
+.FN gd_madd_bit ,
+.FN gd_madd_clincom ,
+.FN gd_madd_const ,
+.FN gd_madd_cpolynom ,
+.FN gd_madd_lincom ,
+.FN gd_madd_linterp ,
+.FN gd_madd_multiply ,
+.FN gd_madd_phase ,
+.FN gd_madd_polynom ,
+.FN gd_madd_sbit ,
+and
+.FN gd_madd_string .
+The functions
+.FN gd_madd_carray ,
+.FN gd_madd_crecip ,
+.FN gd_madd_divide ,
+and
+.FN gd_madd_recip
+also appeared in this version.
+
+In GetData-0.8.0, these functions first allowed adding metafields by providing
+the full (slashed) field name.  The functions
+.FN gd_madd_mplex
+and
+.FN gd_madd_window
+also appeared in this version.
+
+In GetData-0.10.0, the error return from these functions changed from -1 to a
+negative-valued error code.  The functions
+.FN gd_madd_indir ,
+.FN gd_madd_sarray ,
+and
+.FN gd_madd_sindir
+also appeared in this version.
+
 .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 dirfile-format (5)
+the corresponding
+.BR gd_add_ <entry-type>
+functions (e.g.
+.F3 gd_add_bit ),
+.F3 gd_entry ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_madd ,
+.F3 gd_madd_spec ,
+.F3 gd_metaflush ,
+.F3 gd_open ,
+dirfile-format(5)
diff --git a/man/gd_match_entries.3 b/man/gd_match_entries.3
new file mode 100644
index 0000000..0cf84bf
--- /dev/null
+++ b/man/gd_match_entries.3
@@ -0,0 +1,361 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
+.\" gd_match_entries.3in.  The gd_match_entries man page.
+.\"
+.\" Copyright (C) 2016 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_match_entries 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_match_entries \(em search the entry list of a Dirfile
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "unsigned int gd_match_entries(DIRFILE *" dirfile ,
+.BI "const char *" regex ", int " fragment ", int " type ,
+.BI "unsigned int " flags ", const char ***" entries );
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_match_entries
+function queries a dirfile(5) database specified by
+.I dirfile
+and all the fields satisfying the provided criteria. If
+.I entries
+is not NULL, a list of matched entries will be returned in
+.BI * entries\fR.
+
+The match criteria are:
+
+.IP \(bu
+If
+.I regex
+is non-NULL, it is a regular expression to match against the entry names.
+Various regular expression grammars (or none) may be supported by the library.
+See the
+.B REGULAR EXPRESSIONS
+section below for details.
+.IP \(bu
+If the
+.I fragment
+argument is
+.BR GD_ALL_FRAGMENTS ,
+entries defined in all fragments are matched. Otherwise only entries specified
+in the fragment indexed by
+.I fragment
+are matched.
+.IP \(bu
+The
+.I type
+argument should be one of the following symbols indicating an explicit entry
+type to match:
+.RS
+.IP
+.SC
+.BR GD_BIT_ENTRY ", " GD_CARRAY_ENTRY ", " GD_CONST_ENTRY ", " GD_DIVIDE_ENTRY ,
+.BR GD_INDEX_ENTRY ", " GD_INDIR_ENTRY ", " GD_LINCOM_ENTRY ,
+.BR GD_LINTERP_ENTRY ", " GD_MPLEX_ENTRY ", " GD_MULTIPLY_ENTRY ,
+.BR GD_PHASE_ENTRY ", " GD_POLYNOM_ENTRY ", " GD_RAW_ENTRY ", " GD_RECIP_ENTRY ,
+.BR GD_SARRAY_ENTRY ", " GD_SBIT_ENTRY ", " GD_SINDIR_ENTRY ,
+.BR GD_STRING_ENTRY ", " GD_WINDOW_ENTRY .
+.EC
+.PP
+.RB ( GD_INDEX_ENTRY
+is a special field type for the implicit
+.I INDEX
+field) or else one of the following special symbols:
+.DD "GD_ALL_ENTRIES \fR(=\fB0\fR)"
+Match entries of all types.
+.DD GD_ALIAS_ENTRIES
+Match only aliases.  This is the only way to match aliases which do not point
+to valid field codes.
+.DD GD_SCALAR_ENTRIES
+Match only scalar field types
+.RB ( CONST ", " CARRAY ", " SARRAY ", " STRING ).
+.DD GD_VECTOR_ENTRIES
+Match only numeric-valued vector field types (all field types except
+.B SINDIR
+and the scalar field types listed above).
+.RE
+.IP \(bu
+The
+.I flags
+argument should be zero or more of the following flags, bitwise or'd together:
+.RS
+.DD GD_ENTRIES_HIDDEN
+Match hidden entries (see
+.F3 gd_hidden ):
+normally hidden entries are ignored;
+.DD GD_ENTRIES_NOALIAS
+Don't match aliases: normally aliases are matched as ifathey have the entry type
+of their target.
+.PP
+If
+.I regex
+is non-NULL, these flags may further be bitwise-or'd with the following flags
+which affect the interpretation of the supplied regular expression:
+.IP
+.SC
+.BR GD_REGEX_PCRE ", " GD_REGEX_EXTENDED ", " GD_REGEX_ICASE ,
+.BR GD_REGEX_CASELESS ", " GD_REGEX_JAVASCRIPT ", " GD_REGEX_UNICODE
+.EC
+.PP
+See the
+.B REGULAR EXPRESSIONS
+section below for details. If
+.I regex
+is NULL, these additional regular-expression-specific flags are ignored.
+.RE
+
+.SH RETURN VALUE
+Upon successful completion,
+.FN gd_match_entries
+returns the number of entries successfully matched. In this case, if
+.I entries
+is non-NULL, this function sets
+.BI * entries
+to a pointer to a list of the matching entry names. This list is terminated by a
+NULL pointer. Memory for the list, and for the strings it contains, is managed
+by GetData. None of the returned pointers should be free'd by the caller. The
+pointers returned are only valid until this function is called again, and the
+associated memory will be deallocated when
+.I dirfile
+is closed (see
+.F3 gd_close ).
+
+If no entries match, but no error occurs, zero is returned. In this case, if
+.I entries
+is non-NULL,
+.BI * entries
+is still set to a non-NULL pointer, which points to a list containing only the
+terminating NULL.
+
+On error, this function also returns zero.  If
+.I entries
+is non-NULL,
+.BI * entries
+is set to NULL in this case (which can be used to distinguish this case from the
+zero-match case). This function furthermore stores a negative-valued error code
+in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ARGUMENT
+There was an error in the supplied regular expression. See the
+.B REGULAR EXPRESSION
+section below for details.
+.DD GD_E_BAD_CODE
+The supplied parent field code was not found, or referred to a metafield itself.
+.DD GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.DD GD_E_BAD_ENTRY
+The
+.I type
+parameter supplied was not one of the symbols listed above.
+.DD GD_E_UNSUPPORTED
+The
+.I regex
+parameter was non-NULL, but the library lacked support for the specified regular
+expression grammar. See the
+.B REGULAR EXPRESSION
+section below for details.
+.PP
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH REGULAR EXPRESSIONS
+Regular expression support in GetData is provided by external libraries and is
+optional. Whether a particular regular expression library is supported by
+GetData is determined when the library is built. Preprocessor symbols are
+present in getdata.h to provide compile-time support to programs building
+against GetData indicating what support the GetData library was built with.
+
+GetData supports the following regular expression libraries:
+.IP \(bu
+The POSIX.2 regular expression library, which provides support for both basic
+and extended POSIX regular expressions. See regex(7) for details. The POSIX
+regular expression library is derived from Henry Spencer's original regex
+package found in BSD. If GetData lacks support for POSIX regular expressions,
+the symbol
+.B GD_NO_REGEX
+will be defined in getdata.h.
+.IP \(bu
+Perl-compatible Regular Expressions (PCRE), which provides a modern,
+full-featured regular expression grammar. See pcre(3) for details. If GetData
+lacks support for PCREs, the symbol
+.B GD_NO_PCRE
+will be defined in getdata.h.
+.PP
+Support for one, both, or neither library may be enabled in the GetData
+library when it is built.
+
+When calling
+.FN gd_match_entries ,
+the choice of regular expression grammar to use is controlled by bitwise-or'ing
+.I flags
+with zero or more of the following symbols:
+.DD GD_REGEX_PCRE
+Use the Perl-compatible Regular Expression (PCRE) library for regular expression
+matching. Without this flag, the POSIX regex library is used.
+.DD GD_REGEX_CASELESS GD_REGEX_ICASE
+Perform case-insensitive matching. These two symbols are synonyms. This is
+equivalent to the
+.B REG_ICASE
+flag in
+.F3 regex
+and the
+.B PCRE_CASELESS
+flag in
+.F3 pcreapi .
+.PP
+The following flags are only supported when using the PCRE library (i.e., when
+.B GD_REGEX_PCRE
+is also specified):
+.DD GD_REGEX_JAVASCRIPT
+Enable Javascript compatibility mode in the PCRE library. This results in a
+regular expression grammar that mimics more closely Javascript's regular
+expressions than Perl's. See the
+.B PCRE_JAVASCRIPT_COMPAT
+flag in
+.F3 pcreapi
+for details.
+.DD GD_REGEX_UNICODE
+Interpret the supplied regex, as well as the Dirfile's entry names, as UTF-8
+sequences. Without this flag, they are all assumed to be ASCII sequences. When
+this flag is specified, the flags
+.BR PCRE_UTF8
+and
+.B BPCRE_BSR_UNICODE
+are passed to the PCRE library. Without it, the flags
+.B PCRE_BSR_ANYCRLF
+is used instead. See
+.F3 pcreapi
+for details.
+.PP
+In addition to the above, the flags
+.B PCRE_DOLLAR_ENDONLY
+and
+.B PCRE_DOTALL
+are always passed to the PCRE library. Note, however, that the PCRE grammar also
+permits overriding most of these flags by specifying different options in the
+regex pattern itself.
+
+GetData does not return captured substrings to the caller, nor does it support
+PCRE callouts.
+
+If the caller attempts to use a regular expression library for which support has
+not been built into GetData,
+.B GD_E_UNSUPPORTED
+will be returned. It is always possible for the caller avoid this error at
+runtime by checking for
+.B GD_NO_REGEX
+or
+.B GD_NO_PCRE
+at compile time.
+
+Errors returned by the regular expression compiler itself will be reported to
+the caller with
+.BR GD_E_BAD_ARGUMENT .
+
+.SH HISTORY
+The
+.FN gd_match_entries
+function appeared in GetData-0.10.0.
+
+.SH SEE ALSO
+.F3 gd_entry_list ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_hidden ,
+.F3 gd_match_entries ,
+.F3 gd_nentries ,
+.F3 gd_open ,
+dirfile(5)
diff --git a/man/gd_mcarrays.3 b/man/gd_mcarrays.3
deleted file mode 100644
index edced73..0000000
--- a/man/gd_mcarrays.3
+++ /dev/null
@@ -1,147 +0,0 @@
-.\" gd_constants.3.  The gd_constants man page.
-.\"
-.\" Copyright (C) 2010, 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_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
-.B #include <getdata.h>
-.HP
-.nh
-.ad l
-.BI "const gd_carray_t *gd_mcarrays(DIRFILE *" dirfile ", const char"
-.BI * parent ", gd_type_t " return_type );
-.hy
-.ad n
-.SH DESCRIPTION
-The
-.BR gd_mcarrays ()
-function queries a dirfile(5) database specified by
-.I dirfile
-and returns a read-only list of values of the all
-.B CARRAY
-metafields for the supplied
-.I parent
-field, after type conversion to the data type specified by
-.IR return_type .
-For a list of valid symbols to use for
-.IR return_type ,
-see the
-.BR gd_get_carray (3)
-man page.
-
-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, except that it is guaranteed to be in the
-same order as the list of
-.B CARRAY
-fields returned by
-.BR gd_mfield_list_by_type (3).
-The number of values in the array can be obtained from a call to
-.BR gd_nmfields_by_type (3).
-
-The caller may not modify any values in the array, nor the array itself.  Doing
-so may cause database corruption.  The pointer returned is guaranteed to be
-valid only until
-.BR gd_mcarrays ()
-is called again, or until the dirfile's metadata is modified (by adding,
-modifying or deleting an entry), or until the array is de-allocated by a call to
-.BR gd_close (3).
-
-A corresponding list of names for these fields may be obtained by calling
-.BR gd_field_list_by_type (3).
-
-.SH RETURN VALUE
-Upon successful completion,
-.BR gd_mcarrays ()
-returns a pointer to an array of
-.B gd_carray_t
-objects containing the values of all the CARRAYs defined in the dirfile
-database.  The
-.B gd_carray_t
-is defined as:
-.PP
-.in +4n
-.nf
-.fam C
-typedef struct {
-  size_t       n;              /* array_len */
-  void        *d;              /* CARRAY data */
-} gd_carray_t;
-.fam
-.fi
-.in
-.PP
-where
-.I n
-specifies the length of the
-.B CARRAY
-data, and
-.I d
-is an array of the data values themselves.  The caller should cast the
-.B void
-pointer to a type appropriate for the
-.I return_type
-specified.  The list is terminated by an end-of-list marker consisting of a
-.B gd_carray_t
-item with
-.I n
-set to zero.
-
-If no CARRAYs are defined in the database, a list containing only the
-end-of-list marker is returned.  On error,
-.BR gd_mcarrays ()
-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 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_TYPE
-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).
-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_carrays (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_get_carray (3),
-.BR gd_mfield_list_by_type (3),
-.BR gd_nmfields_by_type (3),
-.BR gd_open (3)
diff --git a/man/gd_metaflush.3 b/man/gd_metaflush.3
index 1d863fb..9ced982 100644
--- a/man/gd_metaflush.3
+++ b/man/gd_metaflush.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_metaflush.3.  The gd_metaflush man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2011, 2012, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011, 2012, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,74 +88,85 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_metaflush 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_metaflush 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_metaflush \(em write modified dirfile metadata to disk
+gd_metaflush \(em write modified Dirfile metadata to disk
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_metaflush(DIRFILE *" dirfile );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_metaflush ()
+.FN gd_metaflush
 function flushes all pending metadata changes in the dirfile specified by
-.I dirfile 
+.ARG dirfile 
 to disk.  This is accomplished by re-writing the format specification fragments
 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
-.I dirfile
+.ARG dirfile
 object.  See
-.BR gd_dirfile_standards (3)
+.F3 gd_dirfile_standards
 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.
 .PP
 This function flushes only metadata.  To flush the field data as well, call
-.BR gd_sync (3)
+.F3 gd_sync
 instead.
+
 .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:
-.TP 8
-.B GD_E_ACCMODE
+On success, zero is returned.  On error, a negative-valued error code is
+returned.  Possible error codes are:
+.DD GD_E_ACCMODE
 The supplied dirfile was opened in read-only mode.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_IO
+.DD GD_E_IO
 An I/O error occurred while trying to write modified metadata to disk.
-.TP
-.B GD_E_LINE_TOO_LONG
+.DD GD_E_LINE_TOO_LONG
 While attempting to flush modified metadata to disk, a field specification line
 exceeded the maximum allowed length.  On most platforms, the maximum length is
 at least 2**31 bytes, so this typically indicates something pathological
 happening.
 .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
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH NOTES
 When writing metadata using Standards Version 4 or earlier, the reference field
 may change, owing to the lack of a
 .B /REFERENCE
 directive.  A work-around is to upgrade to Standards Version 5 or later.
+
+.SH HISTORY
+The
+.FN dirfile_metaflush
+function appeared in GetData-0.4.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_metaflush .
+
+in GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_close (3),
-.BR gd_dirfile_standards (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_rewrite_fragment (3),
-.BR gd_sync (3)
+.F3 gd_close ,
+.F3 gd_dirfile_standards ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_open ,
+.F3 gd_rewrite_fragment ,
+.F3 gd_sync
diff --git a/man/gd_move.3 b/man/gd_move.3
index 663aead..097664a 100644
--- a/man/gd_move.3
+++ b/man/gd_move.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_move.3.  The gd_move man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,21 +88,22 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_move 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_move 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_move \(em move a dirfile entry between format specification fragments
+gd_move \(em move a Dirfile entry between format specification fragments
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_move(DIRFILE *" dirfile ", const char"
 .BI * field_code ", int " new_fragment ", unsigned int " flags );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_move ()
+.FN gd_move
 function transfers the field or alias specified by
 .IR field_code ,
 which should not have a representation suffix, defined in the dirfile
@@ -41,23 +117,21 @@ this function does nothing and returns no error.
 
 If the new fragment has different affixes, the field will be renamed as part of
 the move.  See
-.BR gd_rename (3)
+.F3 gd_rename
 for details on field renaming.  The field is closed before moving, resulting
 in it's I/O pointer being reset to the beginning-of-field.
 
 The
 .I flags
 parameter should be zero or more of the following flags, bitwise or'd together:
-.TP
-.B GD_REN_DANGLE
+.DD GD_REN_DANGLE
 By default, if the move results in a change of name for the field due to
 differing fragment affixes,
 .B ALIAS
 entries pointing to this field will be updated with the field's new name.
 Specifying this flag prohibits this behaviour, turning these aliases into
 dangling aliases.  If moving the field doesn't rename it, this flag is ignored.
-.TP
-.B GD_REN_DATA
+.DD GD_REN_DATA
 If
 .I field_code
 specifies a
@@ -78,79 +152,103 @@ fragment is larger than that of the source fragment, this will result in
 permanent deletion of data from the database.  If the new frame offset is
 smaller than the old frame offset, the binary file will be padded at the front
 with zeroes.
-.TP
-.B GD_REN_FORCE
+.DD GD_REN_FORCE
 Skip updating entries which would be invalid (see
-.BR gd_rename (3)
+.F3 gd_rename
 for details).  By default, an invalid field causes the move to fail.  If moving
 the field doesn't rename it, this flag is ignored.
-.TP
-.B GD_REN_UPDB
+.DD GD_REN_UPDB
 If moving the field renames it, update entries which use this field as an input
 to account for the new name (see
-.BR gd_rename (3)).
+.F3 gd_rename ).
 If moving the field doesn't rename it, this flag is ignored.
 
 .SH RETURN VALUE
 On success,
-.BR gd_move ()
-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
+.FN gd_move
+returns zero.   On error, a negative-valued error code is returned.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
 .I field_code
 was not found, or else the move resulted in the field being renamed and
 the resultant metadata update tried to change a field code into something
 prohibited by a fragment's affixes.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 An attempt was made to move the immutable
 .I INDEX
 field.
-.TP
-.B GD_E_BAD_INDEX
+.DD GD_E_BAD_INDEX
 The
 .I new_fragment
 argument did not index a valid format specification fragment.
-.TP
-.B GD_E_IO
+.DD GD_E_IO
 An I/O error occurred while attempting to translate a binary file.
-.TP
-.B GD_E_PROTECTED
+.DD GD_E_PROTECTED
 The metadata of the source or destination format specification fragments was
 protected from change, or the binary data of the source or destination fragments
 was protected from change and binary file translation was requested.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 The encoding scheme of the source or destination fragment is unknown.
-.TP
-.B GD_E_UNSUPPORTED
+.DD GD_E_UNSUPPORTED
 The encoding scheme of the source or destination fragment does not support
 binary file translation.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
 .SH NOTES
 A binary file translation occurs out-of-place.  As a result, sufficient space
 must be present on the filesystem for both the binary file before translation
 and the binary file after translation.
+
+.SH HISTORY
+The
+.FN dirfile_move
+function appeared in GetData-0.5.0.  It had no
+.ARG flags
+parameter.  In place of
+.ARG flags
+was
+.B int
+.IR move_data .
+Passing a non-zero value for this parameter had the same effect as the
+.B GD_REN_DATA
+flag does now.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_move .
+
+In all GetData-0.8.x releases, passing an alias name to this function would
+move the target of the alias.  To move an alias itself, a separate function,
+.FN gd_move_alias
+was available.
+
+In GetData-0.9.0,
+.FN gd_move_alias
+was removed.  Also in this release, the
+.ARG move_data
+parameter was repaced with the
+.ARG flags
+parameter.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_metaflush (3),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
+.F3 gd_metaflush ,
+.F3 gd_open ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_mplex_lookback.3 b/man/gd_mplex_lookback.3
index bc1be23..d958e9c 100644
--- a/man/gd_mplex_lookback.3
+++ b/man/gd_mplex_lookback.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_mplex_lookback.3.  The gd_mplex_lookback man page.
 .\"
-.\" Copyright (C) 2012, 2013 D. V. Wiebe
+.\" Copyright (C) 2012, 2013, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,20 +88,21 @@
 .\" 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"
+.TH gd_mplex_lookback 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_mplex_lookback \(em set the GetData lookback length for MPLEX fields.
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "void gd_mplex_lookback(DIRFILE *" dirfile ", int " lookback );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_mplex_lookback ()
+.FN gd_mplex_lookback
 function controls how far GetData searches backwards for the initial value of
 a field when reading a
 .B MPLEX
@@ -39,7 +115,7 @@ 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)
+.F3 gd_getdata
 for further discussion on the data returned for a
 .B MPLEX
 field).
@@ -58,9 +134,9 @@ is the special symbol
 GetData will exhaustively search all available data before the returned portion
 for an initial value.
 
-Otherwise,
+If not one of the special values,
 .I lookback
-should be a positive number specifying the number of
+should be a positive integer specifying the number of
 .B MPLEX
 periods to search.  Each
 .B MPLEX
@@ -74,7 +150,7 @@ field in question specifies an optional
 positive parameter (see the
 .B MPLEX
 definition in
-.BR dirfile-format (5)),
+dirfile-format(5)),
 its period is that many samples;
 .IP \(bu
 otherwise, if the
@@ -118,7 +194,13 @@ 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 HISTORY
+The
+.FN gd_mplex_lookback
+function appeared in GetData-0.8.0.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR dirfile-format (5),
-.BR gd_getdata (3).
+.F3 gd_getdata ,
+.F3 gd_open ,
+dirfile(5), dirfile-format(5)
diff --git a/man/gd_mstrings.3 b/man/gd_mstrings.3
deleted file mode 100644
index db862c8..0000000
--- a/man/gd_mstrings.3
+++ /dev/null
@@ -1,98 +0,0 @@
-.\" gd_mstrings.3.  The gd_mstrings man page.
-.\"
-.\" Copyright (C) 2008, 2010, 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_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
-.B #include <getdata.h>
-.HP
-.nh
-.ad l
-.BI "const char **gd_mstrings(DIRFILE *" dirfile ", const char *" parent );
-.hy
-.ad n
-.SH DESCRIPTION
-The
-.BR gd_mstrings ()
-function queries a dirfile(5) database specified by
-.I dirfile
-and returns a read-only list of values of the all
-.B STRING
-type metafields for the supplied
-.I parent
-field.
-
-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, although it is guaranteed to be in the
-same order as the list of
-.B STRING
-fields returned by
-.BR gd_mfield_list_by_type (3).
-The array is terminated by a NULL pointer.  The number of strings in the array
-can be obtained from a call to
-.BR gd_nmfields_by_type (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_mstrings ()
-is called again with the same arguments, or until the array is de-allocated by
-a call to
-.BR gd_close (3).
-
-A corresponding list of names for these fields may be obtained by calling
-.BR gd_mfield_list_by_type (3).
-
-.SH RETURN VALUE
-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.  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.
-.TP
-.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.
-.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_mfield_list_by_type (3),
-.BR gd_nmfields_by_type (3),
-.BR gd_strings (3)
diff --git a/man/gd_naliases.3 b/man/gd_naliases.3
index 6f3f662..447a28c 100644
--- a/man/gd_naliases.3
+++ b/man/gd_naliases.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_naliases.3.  The gd_naliases man page.
 .\"
-.\" Copyright (C) 2012, 2013 D. V. Wiebe
+.\" Copyright (C) 2012, 2013, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,50 +88,59 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_naliases 3 "1 October 2013" "Version 0.9.0" "GETDATA"
+.TH gd_naliases 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_naliases \(em report the number of aliases of a field in a dirfile
+gd_naliases \(em report the number of aliases of a field in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "unsigned int gd_naliases(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_naliases ()
+.FN gd_naliases
 function queries a dirfile(5) database specified by
 .I dirfile
-and returns the number of aliases of the field specified by
+and counts the number of aliases of the entry (including the entry's name)
+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).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_naliases ()
-returns the number of aliases of the specified field code 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
+.FN gd_naliases
+returns an unsigned integer indicating the number of aliases of the specified
+field code in the dirfile.  If successful, this count will be at least one.
+
+On error, this function returns zero and stores a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_BAD_CODE
 The supplied field code was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD 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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_naliases
+function appeared in GetData-0.8.0.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_open (3),
-.BR gd_aliases (3),
-.BR gd_alias_target (3)
+.F3 gd_aliases ,
+.F3 gd_alias_target ,
+.F3 gd_open ,
+dirfile(5)
diff --git a/man/gd_native_type.3 b/man/gd_native_type.3
index 34ee7be..d5f02a7 100644
--- a/man/gd_native_type.3
+++ b/man/gd_native_type.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_native_type.3.  The gd_native_type man page.
 .\"
-.\" Copyright (C) 2009, 2010, 2011, 2012, 2014 D. V. Wiebe
+.\" Copyright (C) 2009, 2010, 2011, 2012, 2014, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,141 +88,143 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_native_type 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_native_type 3 "25 January 2017" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_native_type \(em returns the native data type of a field in a dirfile
+gd_native_type \(em returns the native data type of a field in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "gd_type_t gd_native_type(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_native_type ()
+.FN gd_native_type
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns the native data type of the field
-.IR field_code ,
+.ARG dirfile
+and determines the native type of data specified by
+.ARG field_code ,
 which may contain a representation suffix.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 The native data type of a field of a given entry type is calculated as:
-.TP
-.BR BIT " or " INDEX " Entry:"
+.DD BIT INDEX
 .BR GD_UINT64 ;
-.TP
-.BR CONST " or " CARRAY " Entry:"
+.DD CONST CARRAY
 the data type of the field;
-.TP
-.BR LINCOM " or " POLYNOM " Entry:"
+.DD DIVIDE MULTIPLY
+if either input field is complex valued:
+.BR GD_COMPLEX128 ,
+otherwise:
+.BR GD_FLOAT64 ;
+.DD INDIR
+the data type of the input
+.BR CARRAY ;
+.DD LINCOM POLYNOM
 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:"
+.DD LINTERP
 if the look-up table is complex valued:
 .BR GD_COMPLEX128 ,
 otherwise:
 .BR GD_FLOAT64 ;
-.TP
-.BR MPLEX " or " WINDOW " Entry:"
+.DD MPLEX WINDOW
 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:"
+.DD PHASE
 the native data type of the input field;
-.TP
-.BR RAW " Entry:"
+.DD RAW
 the data type of the raw data on disk;
-.TP
-.BR RECIP " Entry:"
+.DD RECIP
 if the dividend or the native data type of the input field is complex valued:
 .BR GD_COMPLEX128 ,
 otherwise:
 .BR GD_FLOAT64 ;
-.TP
-.BR SARRAY " or " STRING " Entry:"
+.DD SARRAY SINDIR STRING
 .BR GD_STRING ;
-.TP
-.BR SBIT " Entry:"
+.DD SBIT
 .BR GD_INT64 .
 .PP
 Furthermore, if the supplied
-.I field_code
+.ARG field_code
 contains a representation suffix, and the native data type of the field is
 complex valued, the native type returned will be the corresponding real valued
 type.
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_native_type ()
-returns the native data type of the field code specified.  This will be one of
-the symbols:
+.FN gd_native_type
+returns the native data type of the field code specified.  This will equal one
+of the symbols:
 .IP
-.nh
-.ad l
+.SC
 .BR GD_UINT8 ", " GD_INT8 ", " GD_UINT16 ", " GD_INT16 ", " GD_UINT32 ,
 .BR GD_INT32 ", " GD_FLOAT32 ", " GD_FLOAT64 ", " GD_COMPLEX64 ,
 .BR GD_COMPLEX128 ", " GD_STRING .
-.ad n
-.hy
+.EC
 .PP
 The meanings of these symbols are explained in the
-.BR gd_getdata (3)
-manual page.  On error, it returns
+.F3 gd_getdata
+manual page.
+
+On error, this function returns
 .B GD_UNKNOWN
-and sets the dirfile error to a non-zero error value.  Possible error values
-are:
-.TP 8
-.B GD_E_ALLOC
+and stores a negative-valued error code in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 or one of the fields it uses as input was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_DIMENSION
+.DD GD_E_DIMENSION
 A scalar field was found where a vector field was expected.
-.TP
-.B GD_E_IO
+.DD GD_E_IO
 An error occurred while trying to read a LINTERP table from disk.
-.TP
-.B GD_E_LUT
+.DD GD_E_LUT
 A LINTERP table was malformed.
-.TP
-.B GD_E_RECURSE_LEVEL
+.DD GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
+.ARG 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).
-A descriptive error string for the last error encountered can be obtained from
-a call to
-.BR gd_error_string (3).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_native_type
+function appeared in GetData-0.6.0.  The return type for
+.B STRING
+fields was
+.BR GD_NULL .
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_native_type .
+
+Before GetData-0.10.0, the return type for
+.B STRING
+fields was
+.BR GD_NULL .
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_open (3),
-.BR gd_getdata (3),
-.BR gd_error (3),
-.BR gd_error_string (3)
+.F3 gd_error ,
+.F3 gd_error_string
+.F3 gd_getdata ,
+.F3 gd_open ,
+dirfile(5)
diff --git a/man/gd_nentries.3 b/man/gd_nentries.3
index 5dd3b71..1c13ad5 100644
--- a/man/gd_nentries.3
+++ b/man/gd_nentries.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_nentries.3.  The gd_nentries man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,17 +88,18 @@
 .\" 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"
+.TH gd_nentries 3 "25 December 2016" "Version 0.10.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
+gd_nmvectors, gd_nvectors \(em count field entries in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .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 );
+.BI "unsigned int gd_nentries(DIRFILE *" dirfile ,
+.BI "const char *" parent ", unsigned int " type ", unsigned int " flags );
 .HP
 .BI "unsigned int gd_nfields(DIRFILE *" dirfile );
 .HP
@@ -37,72 +113,71 @@ gd_nmvectors, gd_nvectors \(em count field entries in a dirfile
 .BI "unsigned int gd_nmvectors(DIRFILE *" dirfile ", const char *" parent );
 .HP
 .BI "unsigned int gd_nvectors(DIRFILE *" dirfile );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_nentries ()
+.FN 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
+.ARG dirfile
+and counts the number of metadata entries satisfying the provided criteria.  If
+.ARG parent
 is non-NULL, metafields under the field specified by
-.I parent
+.ARG parent
 are considered; otherwise, top-level fields are considered, and metafields
 ignored.
 
 The
-.I type
+.ARG type
 argument should be one of the following symbols indicating an explicit entry
 type to count:
 .IP
-.nh
-.ad l
+.SC
 .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
+.BR GD_INDEX_ENTRY ", " GD_INDIR_ENTRY ", " GD_LINCOM_ENTRY ,
+.BR GD_LINTERP_ENTRY ", " GD_MPLEX_ENTRY ", " GD_MULTIPLY_ENTRY ,
+.BR GD_PHASE_ENTRY ", " GD_POLYNOM_ENTRY ", " GD_RAW_ENTRY ", " GD_RECIP_ENTRY ,
+.BR GD_SARRAY_ENTRY ", " GD_SBIT_ENTRY ", " GD_SINDIR_ENTRY ,
+.BR GD_STRING_ENTRY ", " GD_WINDOW_ENTRY .
+.EC
 .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)
+.DD "GD_ALL_ENTRIES \fR(=0)"
 Count entries of all types.
-.TP
-.B GD_ALIAS_ENTRIES
+.DD 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
+.DD 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).
+.RB ( CONST ", " CARRAY ", " SARRAY ", " STRING ).
+.DD GD_VECTOR_ENTRIES
+Count only numeric-valued vector field types (all field types except
+.B SINDIR
+and the scalar field types listed above).
 .PP
 The
-.I flags
+.ARG flags
 argument should be zero or more of the following flags, bitwise or'd together:
-.TP
-.B GD_ENTRIES_HIDDEN
+.DD GD_ENTRIES_HIDDEN
 Include hidden entries (see
-.BR gd_hidden (3))
+.F3 gd_hidden )
 in the count: normally hidden entries are skipped;
-.TP
-.B GD_ENTRIES_NOALIAS
+.DD 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).
+
+.PP
+This function has a subset of the functionality of the
+.F3 gd_match_entries
+function (q.v.).
+
 .SS Special Cases
 The call
 .RS
@@ -165,30 +240,59 @@ is equivalent to
 .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
+Upon successful completion, these functions return an unsigned in indicating
+the number of entries in the database satisfying the supplied criteria.
+
+On error, these functions return zero and store a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_BAD_CODE
 The supplied parent field code was not found, or referred to a metafield itself.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_ENTRY
+.DD GD_E_BAD_ENTRY
 The
-.I type
+.ARG 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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_nfields
+function appeared in GetData-0.3.0.
+
+The
+.FN get_nfields_by_type ,
+.FN get_nmfields ,
+.FN get_nmfields_by_type ,
+.FN get_nmvectors ,
+and
+.FN get_nvectors
+functions appeared in GetData-0.4.0.
+
+In GetData-0.7.0, these functions were renamed to
+.FN gd_nfields ,
+.FN gd_nfields_by_type ,
+.FN gd_nmfields ,
+.FN gd_nmfields_by_type ,
+.FN gd_nmvectors ,
+and
+.FN gd_nvectors .
+
+The
+.FN gd_nentries
+function appeared in GetData-0.8.0.
+
 .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)
+dirfile(5),
+.F3 gd_open ,
+.F3 gd_entry_list ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_hidden ,
+.F3 gd_match_entries
diff --git a/man/gd_nfragments.3 b/man/gd_nfragments.3
index 5712dd1..f6d35b1 100644
--- a/man/gd_nfragments.3
+++ b/man/gd_nfragments.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_nfragments.3.  The gd_nfragments man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,51 +88,61 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_nfragments 3 "21 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_nfragments 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_nfragments \(em retrieve the number of format specification fragments in a
 dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_nfragments(const DIRFILE *" dirfile );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_nfragments ()
+.FN gd_nfragments
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and returns the total number of parsed format specification fragments in the
 database.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_nfragments ()
+.FN gd_nfragments
 returns the total number of format specification fragments which are present in
-the dirfile.  On error, 
-.BR gd_nfragments ()
-returns zero and sets the dirfile error to a non-zero value.  Possible error
-values are:
-.TP 8
-.B GD_E_BAD_DIRFILE
+the dirfile.
+
+On error, this function return zero and store a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD 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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_nfragments
+function appeared in GetData-0.4.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_nfragments .
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_fragmentname (3),
-.BR gd_include (3),
-.BR gd_open (3),
-.BR gd_parent_fragment (3)
+dirfile(5),
+.F3 gd_fragmentname ,
+.F3 gd_include ,
+.F3 gd_open ,
+.F3 gd_parent_fragment
diff --git a/man/gd_nframes.3 b/man/gd_nframes.3
index b47eddf..273499e 100644
--- a/man/gd_nframes.3
+++ b/man/gd_nframes.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_nframes.3.  The gd_nframes man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2011, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,76 +88,83 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_nframes 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_nframes 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_nframes \(em report the size of a dirfile
+gd_nframes \(em report the size of a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "off_t gd_nframes(DIRFILE *" dirfile );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_nframes ()
+.FN gd_nframes
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and returns the number of frames in the database.  Since different fields may
 have differing number of frames, the Dirfile Standards (see
-.BR dirfile (5))
+dirfile(5))
 dictate that the number of frames in the database is defined to be equal to the
 number of frames in the reference field defined by the
 .B /REFERENCE
 directive (see
-.BR dirfile-format (5))
+dirfile-format(5))
 or, if no such reference field is defined, by the first raw field specified in
 the format specification.
 
 If no vector fields are defined in the database,
-.BR gd_nframes ()
+.FN gd_nframes
 returns zero and succeeds.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_nframes ()
-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
+.FN gd_nframes
+returns the number of frames in the dirfile, which is never negative.  On error,
+it returns a negative-valued error code.  Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_IO
-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
-be not be determined because its encoding was not understood.
-.TP
-.B GD_E_UNSUPPORTED
-The size of the decoded data file associated with the reference field could not
-be not be determined because its encoding was not supported.
+.DD GD_E_IO
+An I/O error occurred while determining the number of samples in the data file
+associated with the reference field.
+.DD GD_E_UNKNOWN_ENCODING
+The number of samples available for the reference field could not be determined
+because the encoding used to store the reference field's data file was not
+understood.
+.DD GD_E_UNSUPPORTED
+GetData does not support determining the number of samples for the encoding of
+of the data file associated with the reference field.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_nframes
+function appeared in GetData-0.3.0.
+
+In GeData-0.7.0, this function was renamed to
+.FN gd_nframes .
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR dirfile-encoding (5),
-.BR gd_open (3),
-.BR gd_bof (3),
-.BR gd_eof (3),
-.BR gd_error (3),
-.BR gd_error_string (3)
+dirfile(5),
+dirfile-encoding(5),
+.F3 gd_open ,
+.F3 gd_bof ,
+.F3 gd_eof ,
+.F3 gd_error ,
+.F3 gd_error_string
diff --git a/man/gd_nframes64.3 b/man/gd_nframes64.3
index 100d80d..7b4f25b 100644
--- a/man/gd_nframes64.3
+++ b/man/gd_nframes64.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_nframes64.3.  The gd_nframes64 man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,42 +88,40 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_nframes64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
+.TH gd_nframes64 3 "25 December 2016" "Version 0.10.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 GD_64BIT_API
 .br
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "gd_off64_t gd_nframes64(DIRFILE *" dirfile );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 This version of
-.BR gd_nframes (3)
+.F3 gd_nframes
 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.
+It is only guaranteed to be available if
+.BR GD_64BIT_API
+is defined 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_nframes (3).
+.B off_t
+is a 64-bit type, this function will the same as
+.F3 gd_nframes .
 Otherwise,
-.BR gd_nframes (3)
+.F3 gd_nframes
 will be a version of this function which uses a 32-bit
-.IR off_t .
+.BR off_t .
+
 .SH SEE ALSO
-.BR gd_nframes (3),
+.F3 gd_nframes ,
 .BR feature_test_macros (7)
diff --git a/man/gd_open.3 b/man/gd_open.3
new file mode 100644
index 0000000..128097b
--- /dev/null
+++ b/man/gd_open.3
@@ -0,0 +1,817 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
+.\" gd_open.3.  The gd_open man page.
+.\"
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016 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_open 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_open, gd_cbopen \(em open or create a Dirfile
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "DIRFILE* gd_open(const char *" dirfilename ", unsigned long " flags );
+.HP
+.BI "DIRFILE* gd_cbopen(const char *" dirfilename ", unsigned long"
+.IB flags ", gd_parser_callback_t " sehandler ", void *" extra );
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_cbopen
+function opens or creates the dirfile specified by
+.ARG dirfilename ,
+returning a DIRFILE object associated with it.  Opening a dirfile will cause the
+library to read and parse the dirfile's format specification (see
+dirfile-format(5)).
+
+If not NULL,
+.ARG sehandler
+should be a pointer to a function which will be called whenever a syntax error
+is encountered during parsing the format specification.  Specify NULL for this
+parameter if no callback function is to be used.  The caller may use this
+function to correct the error or modify the error handling of the format
+specification parser.  See
+.B The Callback Function
+section below for details on this function.  The
+.ARG extra
+argument allows the caller to pass data to the callback function.  The pointer
+will be passed to the callback function verbatim.
+
+The
+.FN gd_open
+function is equivalent to
+.FN gd_cbopen ,
+with
+.ARG sehandler
+and
+.ARG extra
+set to NULL.
+
+The 
+.ARG flags
+argument should include one of the
+.IR "access modes" :
+.B GD_RDONLY
+(read-only) or 
+.BR GD_RDWR
+(read-write), and may also contain zero or more of the following flags,
+bitwise-or'd together:
+.PP
+.DD GD_ARM_ENDIAN 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.
+.DD GD_BIG_ENDIAN 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.
+.DD GD_CREAT
+An empty dirfile will be created, if one does not already exist.  This will
+create both the dirfile directory and an empty format specification file called
+.ARG format .
+If the call creates a dirfile, then the specified access mode is ignored: a
+newly-created DIRFILE is always opened with access mode
+.BR GD_RDWR ,
+even if
+.B GD_RDONLY
+had been specified.
+
+The directory will have have mode
+.BR S_IRWXU " | " S_IRWXG " | "  S_IRWXO 
+(0777), modified by the caller's umask value (see
+.BR umask (2)).
+The
+.ARG format
+file will have mode
+.BR S_IRUSR " | " S_IWUSR " | "  S_IRGRP " | "  S_IWGRP " | " S_IROTH " | " S_IWOTH
+(0666), also modified by the caller's umask.
+The owner of the dirfile directory and
+.ARG format
+file will be the effective user ID of the caller.  Group ownership follows the
+rules outlined in
+.BR mkdir (2).
+.DD GD_EXCL
+Ensure that this call creates a dirfile: when specified along with
+.BR GD_CREAT ,
+the call will fail if the dirfile specified by
+.ARG dirfilename
+already exists.  If
+.B GD_CREAT
+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).
+.DD GD_FORCE_ENCODING
+Specifies that
+.B /ENCODING
+directives (see
+dirfile-format(5))
+found in the dirfile format specification should be ignored.  The encoding
+scheme specified in
+.ARG flags
+will be used instead (see below).
+.DD GD_FORCE_ENDIAN
+Specifies that
+.B /ENDIAN
+directives (see
+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 absence of the
+.BR GD_ARM_ENDIAN ", " GD_BIG_ENDIAN ", " GD_LITTLE_ENDIAN ,
+and
+.B GD_NOT_ARM_ENDIAN
+flags.
+.DD GD_IGNORE_DUPS
+If the dirfile format metadata specifies more than one field with the same name,
+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.  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.
+.DD GD_PEDANTIC
+Reject dirfiles which don't conform to the Dirfile Standards.  See the
+.B Standards Compliance
+section below for full details.
+.DD GD_PERMISSIVE
+Allow non-compliant format specification syntax, even when given along with a
+conflicting
+.B /VERSION
+directive.  See the
+.B Standards Compliance
+section below for full details.
+.DD GD_PRETTY_PRINT
+When dirfile metadata are flushed to disk (either explicitly via
+.BR gd_metaflush "(3), " gd_rewrite_fragment (3),
+or 
+.F3 gd_flush
+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 is opened read-only, this flag is
+ignored.
+.DD GD_TRUNC
+If
+.ARG dirfilename
+specifies an already existing dirfile, it will be truncated before opening.
+Since
+.FN gd_cbopen
+decides whether
+.ARG dirfilename
+specifies an existing dirfile before attempting to parse the dirfile,
+.ARG dirfilename
+is considered to specify an existing dirfile if it refers to a directory
+containing a regular file called
+.BR format ,
+regardless of the content or form of that file.
+
+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.
+.DD 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.
+.DD 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 
+.F3 gd_error_string ,
+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
+.F3 gd_verbose_prefix .
+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
+.F3 gd_flags
+function.
+.PP
+The
+.ARG flags
+argument may also be bitwise or'd with one of the following symbols indicating
+the default encoding scheme of the dirfile.  Like the endianness flags, the
+choice of encoding here is ignored if the encoding is specified in the dirfile
+itself, unless
+.B GD_FORCE_ENCODED
+is also specified.  If none of these symbols is present,
+.B GD_AUTO_ENCODED
+is assumed, unless the
+.FN gd_cbopen
+call results in creation or truncation of the dirfile.  In that case,
+.B GD_UNENCODED
+is assumed.  See
+dirfile-encoding(5)
+for details on dirfile encoding schemes.
+.DD 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
+.F3 putdata
+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.
+.DD 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.
+.DD GD_FLAC_ENCODED
+Specifies that raw data files are compressed using the Free Lossless Audio
+Coded (FLAC).
+.DD GD_GZIP_ENCODED
+Specifies that raw data files are compressed using Lempel-Ziv coding (LZ77)
+as implemented in the gzip format.
+.DD 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.
+.DD GD_SLIM_ENCODED
+Specifies that raw data files are compressed using the slimlib library.
+.DD GD_SIE_ENCODED
+Specified that raw data files are sample-index encoded, similar to run-length
+encoding, suitable for data that change rarely.
+.DD GD_TEXT_ENCODED
+Specifies that raw data files are encoded as text files containing one data
+sample per line.  
+.DD GD_UNENCODED
+Specifies that raw data files are not encoded, but written as simply binary data
+to disk.
+.DD 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.
+.DD 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
+is provided in the preprocessor macro
+.B GD_DIRFILE_STANDARDS_VERSION
+defined in getdata.h.  GetData is able to open and parse any dirfile which
+conforms to this Standards Version, or to any earlier Version.  The
+dirfile-format(5)
+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 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
+.FN gd_cbopen ,
+the parser will start parsing the format specification in
+.I pedantic
+mode, otherwise it will start in
+.I permissive
+mode.
+
+.I Permissive
+mode is provided primarily to allow GetData to be used on dirfiles which
+conform to no single Standard, but which were accepted by the GetData parser
+in previous versions.  It is notably lax regarding reserved field names, and
+field name characters, the mixing of old and new data type specifiers, and
+generally ignores the presence of
+.B /VERSION
+directives.
+In read-write mode,
+.I permissive
+mode should be used with caution, as it can cause unintentional corruption of
+dirfile metadata on write, if the heuristics in the parser incorrectly guessed
+the intention of non-compliant syntax.  In
+.I permissive
+mode, actual syntax errors are still reported as such.
+
+In
+.I pedantic
+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
+flag, the parser will start in
+.I pedantic
+mode with a target version equal to
+.BR GD_DIRFILE_STANDARDS_VERSION .
+Whenever a
+.B /VERSION
+directive is encountered in the format specification, the target version is
+changed to the Standards Version specified.  When encountering a
+.B /VERSION
+directive in
+.I permissive
+mode, the parser will switch to
+.I pedantic
+mode, unless the
+.B GD_PERMISSIVE
+flag was passed to
+.FN gd_cbopen ,
+in which case no mode switch will take place.
+
+Independent of the mode of the parser when parsing the format specification,
+GetData will calculate a list of Standards Versions to which the parsed
+metadata conform to.  The
+.F3 gd_dirfile_standards
+function can provide this information, and also specify the desired
+Standards Version for writing format metadata back to disk.
+
+.SS The Callback Function
+The caller-supplied
+.ARG sehandler
+function is called whenever the format specification parser encounters a syntax
+error
+.RI ( i.e.
+whenever it would return the
+.B GD_E_FORMAT
+error).  This callback may be used to correct the error, or to tell the parser
+how to recover from it.
+
+This function should take two pointers as arguments, and return an
+.BR int :
+.RS
+.HP
+.SC
+.BI "int " sehandler "(gd_parser_data_t *" pdata ", void *" extra );
+.EC
+.RE
+.PP
+The
+.ARG extra
+parameter is the pointer supplied to
+.FN gd_cbopen ,
+passed verbatim to this function.  It can be used to pass caller data to the
+callback.  GetData does not inspect this pointer, not even to check its
+validity.  If the caller needs to pass no data to the callback, it may be NULL.
+
+The
+.B gd_parser_data_t
+type is a structure with at least the following members:
+
+.in +4n
+.fam C
+.nf
+typedef struct {
+  const DIRFILE* dirfile;
+  int suberror;
+  int linenum;
+  const char* filename;
+  char* line;
+  size_t buflen;
+
+  ...
+} gd_parser_data_t;
+.fi
+.fam
+.in
+.PP
+The
+.SPM pdata dirfile
+member will be a pointer to a DIRFILE object suitable only for passing to
+.FN gd_error_string .
+Notably, the caller should not assume this pointer will be the same as the
+pointer eventually returned by
+.FN gd_cbopen ,
+nor that it will be valid after the callback function returns.
+
+The
+.SPM pdata suberror
+parameter will be one of the following symbols indicating the type of syntax
+error encountered:
+.DD GD_E_FORMAT_ALIAS
+The parent specified for a meta field was an alias.
+.DD GD_E_FORMAT_BAD_LINE
+The line was indecipherable.  Typically this means that the line contained
+neither a reserved word, nor a field type.
+.DD GD_E_FORMAT_BAD_NAME
+The specified field name was invalid.
+.DD GD_E_FORMAT_BAD_SPF
+The samples-per-frame of a RAW field was out-of-range.
+.DD GD_E_FORMAT_BAD_TYPE
+The data type of a RAW field was unrecognised.
+.DD GD_E_FORMAT_BITNUM
+The first bit of a BIT field was out-of-range.
+.DD GD_E_FORMAT_BITSIZE
+The last bit of a BIT field was out-of-range.
+.DD GD_E_FORMAT_CHARACTER
+An invalid character was found in the line, or a character escape sequence was
+malformed.
+.DD GD_E_FORMAT_DUPLICATE
+The specified field name already exists.
+.DD GD_E_FORMAT_ENDIAN
+The byte sex specified by an
+.B /ENDIAN
+directive was unrecognised.
+.DD GD_E_FORMAT_LITERAL
+An unexpected character was encountered in a complex literal. 
+.DD GD_E_FORMAT_LOCATION
+The parent of a metafield was defined in another fragment.
+.DD GD_E_FORMAT_META_META
+An attempt was made to use a metafield as the parent to a new metafield.
+.DD GD_E_FORMAT_METARAW
+An attempt was made to add a RAW metafield.
+.DD GD_E_FORMAT_MPLEXVAL
+A MPLEX specification has a negative period.
+.DD GD_E_FORMAT_N_FIELDS
+The number of fields of a LINCOM field was out-of-range.
+.DD GD_E_FORMAT_N_TOK
+An insufficient number of tokens was found on the line.
+.DD GD_E_FORMAT_NO_FIELD
+The parent of a metafield was not found.
+.DD GD_E_FORMAT_NUMBITS
+The number of bits of a BIT field was out-of-range.
+.DD GD_E_FORMAT_PROTECT
+The protection level specified by a
+.B /PROTECT
+directive was unrecognised.
+.DD GD_E_FORMAT_RES_NAME
+A field was specified with the reserved name
+.IR INDEX
+(or with the reserved name
+.IR FILEFRAM
+in a dirfile conforming to Standards Version 5 or earlier).
+.DD GD_E_FORMAT_UNTERM
+The last token of the line was unterminated.
+.DD GD_E_FORMAT_WINDOP
+The operation in a WINDOW field was not recognised.
+.PP
+.SPM pdata filename
+and
+.SPM 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
+.SPM pdata line
+member contains a copy of the line containing the syntax error.  This line may
+be freely modified by the callback function.  It will then be reparsed if the
+callback function returns the symbol
+.B GD_SYNTAX_RESCAN
+(see below).  The size of the memory buffer, which may be greater than the
+length of the actual string, is provided in
+.SPM pdata buflen\fR ,
+and space is available for at least
+.B GD_MAX_LINE_LENGTH
+bytes.
+
+If the callback function returns
+.BR GD_SYNTAX_RESCAN ,
+then a different buffer, which may be larger, may be used to hold the new
+string, by assigning a pointer to the new buffer to
+.SPM pdata line\fR .
+This buffer will be deallocated by the library using the
+.ARG free
+function specified through
+.F3 gd_alloc_funcs ,
+or else
+.F3 free
+by default.  Do not deallocate the original buffer passed to the callback
+through
+.SPM pdata line\fR :
+it, too, will be deallocated by the library.
+
+The callback function should return one of the following symbols, which
+tells the parser how to subsequently handle the error:
+.DD GD_SYNTAX_ABORT
+The parser should immediately abort parsing the format specification and fail
+with the error
+.BR GD_E_FORMAT .
+This is the default behaviour, if no callback function is provided (or if
+the parser is invoked by calling
+.FN gd_open ).
+.DD GD_SYNTAX_CONTINUE
+The parser should continue parsing the format specification.  However, once
+parsing has finished, the parser will fail with the error
+.BR GD_E_FORMAT ,
+even if no further syntax errors are encountered.  This behaviour may be used by
+the caller to identify all lines containing syntax errors in the format
+specification, instead of just the first one.
+.DD GD_SYNTAX_IGNORE
+The parser should ignore the line containing the syntax error completely, and
+carry on parsing the format specification.  If no further errors are
+encountered, the dirfile will be successfully opened.
+.DD GD_SYNTAX_RESCAN
+The parser should rescan the
+.I line
+argument, which replaces the line which originally contained the syntax error.
+The line is assumed to have been corrected by the callback function.  If the
+line still contains a syntax error, the callback function will be called again.
+
+Note: the line is not corrected on disk; however, the caller may subsequently
+correct the fragment on disk by calling
+.F3 gd_rewrite_fragment .
+.PP
+The callback function handles only syntax errors.  The parser may still abort
+early, if a different kind of library error is encountered.  Furthermore,
+although a line may contain more than one syntax error, the parser will only
+ever report one syntax error per line, even if the callback function returns
+.BR GD_SYNTAX_CONTINUE .
+
+.SH RETURN VALUE
+A call to
+.FN gd_cbopen
+or
+.FN gd_open
+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, these functions will store a negative-valued error
+code in the returned DIRFILE, which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ACCMODE
+The library was asked to truncate a dirfile opened read-only (i.e.
+.B GD_TRUNC
+was specified in
+.ARG flags
+along with
+.BR GD_RDONLY ).
+.DD GD_E_ALLOC
+The library was unable to allocate memory.
+.DD GD_E_BAD_REFERENCE
+The reference field specified by a
+.B /REFERENCE
+directive in the format specification (see
+dirfile-format(5))
+was not found, or was not a
+.B RAW
+field.
+.DD GD_E_CALLBACK
+The registered callback function,
+.ARG sehandler ,
+returned an unrecognised response.
+.DD GD_E_CREAT
+The library was unable to create the dirfile.
+.DD GD_E_EXISTS
+The dirfile already exists and both
+.BR GD_CREAT " and " GD_EXCL
+were specified.
+.DD GD_E_FORMAT
+A syntax error occurred in the format specification.  See also
+.B The Callback Function
+section above.
+.DD GD_E_IO
+The dirfile format file, or another file that it includes, could not be read,
+or
+.ARG dirfilename
+does not specify a valid dirfile.
+.DD 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 bytes.  The
+limit is larger on 64-bit systems.
+.PP
+A DIRFILE which is returned from a failed open is flagged as invalid, meaning
+most functions it is passed to will faill with the error
+.BR GD_E_BAD_DIRFILE .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+When no longer needed, the caller should de-allocate any returned DIRFILE object
+by calling
+.F3 gd_close ,
+or
+.F3 gd_discard ,
+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
+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 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
+dirfiles lacking
+.BR /ENDIAN .
+To read an old, little-ended dirfile on a big-ended platform, an
+.B /ENDIAN
+directive should be added to the format specification, or else
+.B GD_LITTLE_ENDIAN
+should be specified by the caller.
+
+GetData's parser assumes it is running on an ASCII-compatible platform.  Format
+specification parsing will fail gloriously on an EBCDIC platform.
+
+.SH HISTORY
+The
+.FN dirfile_open
+function appeared in GetData-0.3.0.  The only supported flags were
+.BR GD_BIG_ENDIAN ,
+.BR GD_CREAT ,
+.BR GD_EXCL ,
+.BR GD_FORCE_ENDIAN ,
+.BR GD_LITTLE_ENDIAN ,
+.BR GD_PEDANTIC ,
+.BR GD_RDONLY ,
+.BR GD_RDWR ,
+and
+.BR GD_TRUNC .
+
+The
+.BR GD_AUTO_ENCODED ,
+.BR GD_FORCE_ENCODING ,
+.BR GD_SLIM_ENCODED ,
+.BR GD_TEXT_ENCODED ,
+.BR GD_UNECODED ,
+and
+.B GD_VERBOSE
+flags appeared in GetData-0.4.0.
+
+The
+.FN dirfile_cbopen
+function and the
+.BR GD_BZIP2_ENCODED ,
+.BR GD_GZIP_ENCODED ,
+and
+.BR GD_IGNORE_DUPS
+flags appeared in GetData-0.5.0.
+
+The
+.B GD_PRETTY_PRINT
+and
+.B GD_LZMA_ENCODED
+flags appeared in GetData-0.6.0.
+
+In GetData-0.7.0 these functions were renamed to
+.FN gd_open
+and
+.FN gd_cbopen .
+The
+.BR GD_ARM_ENDIAN ,
+.BR GD_NOT_ARM_ENDIAN ,
+and
+.B GD_PERMISSIVE
+flags also appeared in this release.
+
+The
+.BR GD_SIE_ENCODED ,
+.BR GD_TRUNCSUB ,
+.BR GD_ZZIP_ENCODED ,
+and
+.B GD_ZZSLIM_ENCODED
+flags appeared in GetData-0.8.0.
+
+The
+.B GD_FLAC_ENCODED
+flag appeared in GetData-0.9.0.
+
+.SH SEE ALSO
+.F3 gd_alloc_funcs ,
+.F3 gd_close ,
+.F3 gd_dirfile_standards ,
+.F3 gd_discard ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_flags ,
+.F3 gd_getdata ,
+.F3 gd_include ,
+.F3 gd_parser_callback ,
+.F3 gd_verbose_prefix ,
+dirfile(5), dirfile-encoding(5), dirfile-format(5)
diff --git a/man/gd_parent_fragment.3 b/man/gd_parent_fragment.3
index 53addf0..d5eeb47 100644
--- a/man/gd_parent_fragment.3
+++ b/man/gd_parent_fragment.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_parent_fragment.3.  The gd_parent_fragment man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,54 +88,65 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_parent_fragment 3 "21 April 2012" "Version 0.8.0" "GETDATA"
+.TH gd_parent_fragment 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_parent_fragment \(em retrieve the parent fragment of a fragment in a dirfile
+gd_parent_fragment \(em retrieve the parent fragment of a fragment in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_parent_fragment(DIRFILE *" dirfile ", int " fragment_index );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_parent_fragment ()
+.FN gd_parent_fragment
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and returns the index of the fragment which contains the
 .B INCLUDE
 directive for the fragment indexed by
-.IR fragment_index .
+.ARG fragment_index .
 
 Since the primary format specification fragment is not included in any other
 fragment, passing zero for
-.I fragment_index
+.ARG fragment_index
 will result in an error.
 
 .SH RETURN VALUE
 On success,
-.BR gd_parent_fragment ()
+.FN gd_parent_fragment
 returns the index of the specified fragment's parent.  On error,
-.BR gd_parent_fragment ()
-returns -1 and sets the dirfile error to a non-zero value.  Possible error
-values are:
-.TP 8
-.B GD_E_BAD_DIRFILE
+.FN gd_parent_fragment
+returns a negative-valued error code.  Possible error codes are:
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD GD_E_BAD_INDEX
 The supplied index was out of range, or was equal to zero.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_parent_fragment
+function appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_parent_fragment .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_include (3),
-.BR gd_open (3),
-.BR gd_fragmentname (3),
-.BR gd_nfragments (3)
+dirfile(5),
+.F3 gd_include ,
+.F3 gd_open ,
+.F3 gd_fragmentname ,
+.F3 gd_nfragments
diff --git a/man/gd_parser_callback.3 b/man/gd_parser_callback.3
index a64c02c..e74c44d 100644
--- a/man/gd_parser_callback.3
+++ b/man/gd_parser_callback.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_parser_callback.3.  The gd_parser_callback man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,45 +88,55 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_parser_callback 3 "17 September 2010" "Version 0.7.0" "GETDATA"
+.TH gd_parser_callback 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_parser_callback \(em set the syntax error callback handler for a dirfile
+gd_parser_callback \(em set the syntax error callback handler for a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "void gd_parser_callback(DIRFILE *" dirfile ", gd_parser_callback_t"
 .IB sehandler ", void *" extra );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_parser_callback ()
+.FN gd_parser_callback
 function updates the syntax error callback function of the DIRFILE object
-.I dirfile
+.ARG dirfile
 to be
-.IR sehandler ,
+.ARG sehandler ,
 and the caller supplied extra pointer passed to the handler to be
-.IR extra ,
+.ARG extra ,
 discarding any syntax error handler and extra pointer which were previously
 registered for this DIRFILE.  If
-.I sehandler
+.ARG sehandler
 is NULL, the existing handler will be removed and the default behaviour (abort
 on error) restored.  See
-.BR gd_cbopen (3)
+.F3 gd_cbopen
 for a discussion on the requirements for the syntax handler.
 
 Since parsing of an existing format specification occurs when the DIRFILE object
 is created, before this function can be called, this function is only useful to
 set or modify a callback function or its caller data before calling
-.BR gd_include (3),
+.F3 gd_include ,
 which will invoke the callback function if syntax errors are found in the
 included fragment.
 
 This function always succeeds, and has no return value.
 
+.SH HISTORY
+
+The
+.FN dirfile_parser_callback
+function appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_parser_callback .
+
 .SH SEE ALSO
-.BR gd_cbopen (3),
-.BR gd_include (3),
-.BR dirfile (5)
+.F3 gd_cbopen ,
+.F3 gd_include ,
+dirfile(5)
diff --git a/man/gd_protection.3 b/man/gd_protection.3
index c2a61c2..cda3c12 100644
--- a/man/gd_protection.3
+++ b/man/gd_protection.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_protection.3.  The gd_protection man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,58 +88,69 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_protection 3 "16 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_protection 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_protection \(em report the protection level of a dirfile fragment
+gd_protection \(em report the protection level of a Dirfile fragment
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_protection(DIRFILE *" dirfile ", int " fragment_index );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_protection ()
+.FN gd_protection
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns the advisory protection level for the fragment indexed by
-.IR fragment_index .
+.ARG dirfile
+and determines the advisory protection level for the fragment indexed by
+.ARG fragment_index .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_protection ()
-returns the advisory protection level of the specified fragment, which will be
-one of the following symbols.
+.FN gd_protection
+returns a non-negative integer indicating the the advisory protection level of
+the specified fragment.  This integer will equal
+one of the following symbols:
 .IP
-.nh
-.ad l
+.SC
 .BR GD_PROTECT_NONE ,\~ GD_PROTECT_FORMAT ,\~ GD_PROTECT_DATA ,\~
 .BR GD_PROTECT_ALL .
-.ad n
-.hy
+.EC
 .PP
 The meaning of these symbols are explained in the
-.BR gd_alter_protection (3)
-man page.  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_BAD_DIRFILE
+.F3 gd_alter_protection
+man page.  On error, it returns a negative-valued error code.  Possible error
+codes are:
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD 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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_protection
+function appeared in GetData-0.5.0.
+
+In GetData-0.7.0 this function was renamed to
+.FN gd_protection .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_alter_protection (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
+.F3 gd_open ,
+.F3 gd_alter_protection ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_put_carray_slice.3 b/man/gd_put_carray_slice.3
index 3804f39..db5633b 100644
--- a/man/gd_put_carray_slice.3
+++ b/man/gd_put_carray_slice.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_put_carray_slice.3.  The gd_put_carray_slice man page.
 .\"
-.\" Copyright (C) 2010, 2011, 2012 D. V. Wiebe
+.\" Copyright (C) 2010, 2011, 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,15 +88,16 @@
 .\" 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 July 2012" "Version 0.8.0" "GETDATA"
+.TH gd_put_carray_slice 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_put_carray, gd_put_carray_slice, gd_put_constant \(em write CONST or CARRAY
 data to a dirfile database
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_put_carray_slice(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "unsigned int " start ", size_t " len ", gd_type_t " data_type ,
 .BI "const void *" data_in );
@@ -31,180 +107,173 @@ data to a dirfile database
 .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
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_put_carray_slice ()
+.FN gd_put_carray_slice
 function writes data to a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 into the
 .B CARRAY
 scalar array
-.IR field_code .
+.ARG field_code .
 The data in the field is converted from the data type specified by
-.IR data_type ,
+.ARG data_type ,
 and read from in the user-supplied buffer
-.IR data_in .
+.ARG data_in .
 The location of the first element of the field into which data is stored is
 given by
-.IR start ,
+.ARG start ,
 and the number of elements stored is given by
-.IR len .
+.ARG len .
 
 The
-.BR gd_put_carray ()
+.FN gd_put_carray
 function behaves similarly, except the whole scalar array is written, as if
-.BR gd_put_carray_slice ()
+.FN gd_put_carray_slice
 were called with
-.I start
+.ARG start
 equal zero and
-.I len
+.ARG len
 equal to the value returned by
-.BR gd_carray_len (3).
+.F3 gd_array_len .
 The
-.BR gd_put_constant ()
+.FN gd_put_constant
 function is equivalent to calling
-.BR gd_put_carray_slice ()
+.FN gd_put_carray_slice
 with
-.I start
+.ARG start
 equal to zero and
-.I len
+.ARG len
 equal to one.  None of these interfaces can write to field representations.
 
 The argument
-.I data_in
+.ARG data_in
 must point to a valid memory location containing all the data to be written.
 The number of elements which will be stored by
-.BR gd_put_carray ()
+.FN gd_put_carray
 may be obtained by calling
-.BR gd_carray_len (3).
+.F3 gd_array_len .
 Unlike
-.BR gd_putdata (3),
+.F3 gd_putdata ,
 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),
+.F3 gd_alter_carray ,
 or another equivalent function.
 
 The 
-.I data_type
+.ARG data_type
 argument should be one of the following symbols, which indicates the type
 of the data pointed to by
-.IR data_in :
+.ARG data_in :
 .RS
 .TP 11
 .B GD_UINT8
 unsigned 8-bit integer
-.TP
-.B GD_INT8
+.DD GD_INT8
 signed (two's complement) 8-bit integer
-.TP
-.B GD_UINT16
+.DD GD_UINT16
 unsigned 16-bit integer
-.TP
-.B GD_INT16
+.DD GD_INT16
 signed (two's complement) 16-bit integer
-.TP
-.B GD_UINT32
+.DD GD_UINT32
 unsigned 32-bit integer
-.TP
-.B GD_INT32
+.DD GD_INT32
 signed (two's complement) 32-bit integer
-.TP
-.B GD_UINT64
+.DD GD_UINT64
 unsigned 64-bit integer
-.TP
-.B GD_INT64
+.DD GD_INT64
 signed (two's complement) 64-bit integer
-.TP
-.B GD_FLOAT32
+.DD GD_FLOAT32
 IEEE-754 standard 32-bit single precision floating point number
-.TP
-.B GD_FLOAT64
+.DD GD_FLOAT64
 IEEE-754 standard 64-bit double precision floating point number
-.TP
-.B GD_COMPLEX64
+.DD GD_COMPLEX64
 C99-conformant 64-bit single precision complex number
-.TP
-.B GD_COMPLEX128
+.DD GD_COMPLEX128
 C99-conformant 128-bit double precision complex number
 .RE
 
 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
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
+
 .SH RETURN VALUE
 On success,
-.BR gd_put_carray (),
-.BR gd_put_carray_slice ()
+.FN gd_put_carray ,
+.FN gd_put_carray_slice
 and
-.BR gd_put_constant ()
-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_ACCMODE
+.FN gd_put_constant
+return zero.  On error, they return a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The specified
-.I dirfile
+.ARG dirfile
 was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
-An invalid
-.I dirfile
-was supplied.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_DIRFILE
+The supplied
+.ARG dirfile
+was invalid.
+.DD GD_E_BAD_FIELD_TYPE
 The supplied
-.I field_code
+.ARG field_code
 was not a
 .B CONST
 nor a
 .BR CARRAY .
-The caller should use
-.BR gd_putdata (3),
-.BR gd_put_constant (3),
-or
-.BR gd_put_string (3)
-instead.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 An invalid
-.I data_type
+.ARG data_type
 was specified.
-.TP
-.B GD_E_BOUNDS
+.DD GD_E_BOUNDS
 A request for data beyond the end of the field was made.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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
+.DD 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).
-A descriptive error string for the last error encountered may be obtained from
-a call to
-.BR gd_error_string (3).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN put_constant
+function appeared in GetData-0.4.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_put_constant .
+The functions
+.FN gd_put_carray
+and
+.FN gd_put_carray_slice
+functions also appeared in this release.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_carray_len (3),
-.BR gd_carrays (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_get_carray_slice (3),
-.BR gd_open (3),
-.BR gd_put_constant (3)
+dirfile(5),
+.F3 gd_array_len ,
+.F3 gd_carrays ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_get_carray_slice ,
+.F3 gd_open ,
+.F3 gd_put_constant
diff --git a/man/gd_put_sarray_slice.3 b/man/gd_put_sarray_slice.3
new file mode 100644
index 0000000..1a23f72
--- /dev/null
+++ b/man/gd_put_sarray_slice.3
@@ -0,0 +1,223 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
+.\" gd_put_sarray_slice.3.  The gd_put_sarray_slice man page.
+.\"
+.\" Copyright (C) 2010, 2011, 2012, 2016 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_put_sarray_slice 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_put_sarray, gd_put_sarray_slice \(em write STRING or SARRAY data to a Dirfile database
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "int gd_put_sarray_slice(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "unsigned int " start ", size_t " len ", const char **" data_in );
+.HP
+.BI "int gd_put_sarray(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "const char **" data_in );
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_put_sarray_slice
+function writes string data to a dirfile(5) database specified by
+.ARG dirfile
+into the
+.B STRING
+or
+.B SARRAY
+scalar array
+.ARG field_code .
+The location of the first element of the field into which data is stored is
+given by
+.ARG start ,
+and the number of elements stored is given by
+.ARG len .
+
+If
+.ARG field_code
+specifies a
+.B STRING
+field, it is treated as if it were a
+.B SARRAY
+field of length one.
+
+The
+.FN gd_put_sarray
+function behaves similarly, except the whole scalar array is written, as if
+.FN gd_put_sarray_slice
+were called with
+.ARG start
+equal zero and
+.ARG len
+equal to the value returned by
+.F3 gd_array_len .
+
+The argument
+.ARG data_in
+must point to an array of pointers to character strings, which are the
+values to store.  The number of elements which will be stored by
+.FN gd_put_sarray
+may be obtained by calling
+.F3 gd_array_len .
+Unlike
+.F3 gd_putdata ,
+writing data past the end of the field is not permitted.  To add data to a
+.BR SARRAY ,
+first increase its length by calling
+.F3 gd_alter_sarray ,
+or another equivalent function.
+
+The
+.F3 gd_put_string
+function provides another way of writing data to a
+.B STRING
+field.
+
+.SH RETURN VALUE
+On success,
+.FN gd_put_sarray
+and
+.FN gd_put_sarray_slice
+return zero.  On error, they return a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ACCMODE
+The specified
+.ARG dirfile
+was opened read-only.
+.DD GD_E_ALLOC
+The library was unable to allocate memory.
+.DD GD_E_BAD_CODE
+The field specified by
+.ARG field_code
+was not found in the database.
+.DD GD_E_BAD_DIRFILE
+An invalid
+.ARG dirfile
+was supplied.
+.DD GD_E_BAD_FIELD_TYPE
+The supplied
+.ARG field_code
+was not a
+.B STRING
+nor a
+.BR SARRAY .
+.DD GD_E_BOUNDS
+A request for data beyond the end of the field was made.
+.DD 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.
+.DD GD_E_PROTECTED
+The fragment containing the constant was protected from change.
+.PP
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The 
+.FN gd_put_sarray
+and
+.FN gd_put_sarray_slice
+functions appeared in GetData-0.10.0.
+
+.SH SEE ALSO
+dirfile(5),
+.F3 gd_array_len ,
+.F3 gd_sarrays ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_get_sarray_slice ,
+.F3 gd_open ,
+.F3 gd_put_string
diff --git a/man/gd_put_string.3 b/man/gd_put_string.3
index c2a425f..6314b65 100644
--- a/man/gd_put_string.3
+++ b/man/gd_put_string.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_put_string.3.  The gd_put_string man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2011 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,96 +88,115 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_put_string 3 "19 August 2011" "Version 0.8.0" "GETDATA"
+.TH gd_put_string 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_put_string \(em retrieve a string from a dirfile database
+gd_put_string \(em write a STRING or SARRAY element to a Dirfile database
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_put_string(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "const char *" data_in );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_put_string ()
+.FN gd_put_string
 function queries a dirfile(5) database specified by
-.I dirfile
-and sets the
+.ARG dirfile
+and stores the character string
+.ARG data_in
+in the
 .B STRING
-.I field_code ,
-which should not contain a representation suffix, to the value specified in
-.IR data_in .
+or
+.B SARRAY
+scalar field, specified by
+.ARG field_code .
+If
+.ARG field_code
+specifies a
+.B SARRAY
+field, the supplied string is stored as the first element.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 Because string values are stored in the dirfile metadata, the new value of
-.I field_code
+.ARG field_code
 won't be written to disk until the dirfile metadata is flushed with
-.BR gd_metaflush (3),
-or until the dirfile is closed.
+.F3 gd_metaflush ,
+or until the dirfile is closed with
+.F3 gd_close .
+
+The
+.F3 gd_put_sarray
+function provides another way of storing
+.B STRING
+and
+.B SARRAY
+data to a Dirfile.
+
 .SH RETURN VALUE
 On success,
-.BR gd_put_string ()
-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
+.FN gd_put_string
+returns zero.  On error, this a negative-valued error code.  Possible error
+codes are:
+.DD GD_E_ACCMODE
 The specified
-.I dirfile
+.ARG dirfile
 was opened read-only.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 An invalid
-.I dirfile
+.ARG dirfile
 was supplied.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 The supplied
-.I field_code
+.ARG field_code
 referred to a field of type other than
-.BR STRING .
-The caller should use
-.BR gd_putdata (3),
-.BR gd_put_carray (3),
+.BR SARRAY
 or
-.BR gd_put_constant (3)
-instead.
-.TP
-.B GD_E_BAD_TYPE
-An invalid
-.I data_type
-was specified.
-.TP
-.B GD_E_INTERNAL_ERROR
+.BR STRING .
+.DD 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
+.DD GD_E_PROTECTED
 The fragment containing the string 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 may be obtained from
-a call to
-.BR gd_error_string (3).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN put_string
+function apepared in GetData-0.4.0.  It returned a
+.B size_t
+cotnaining length of the string written, or zero on error.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_put_strint .
+
+In GetData-0.10.0, this function's return value changed to zero on success, or
+or else a negative-valued error code.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_metaflush (3),
-.BR gd_open (3),
-.BR gd_get_string (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_putdata (3)
+dirfile(5),
+.F3 gd_close ,
+.F3 gd_get_string ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_metaflush ,
+.F3 gd_open ,
+.F3 gd_put_sarray .
diff --git a/man/gd_putdata.3 b/man/gd_putdata.3
index 3c548f5..9e36e22 100644
--- a/man/gd_putdata.3
+++ b/man/gd_putdata.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_putdata.3.  The gd_putdata man page.
 .\"
-.\" Copyright (C) 2008-2016 D. V. Wiebe
+.\" Copyright (C) 2008-2017 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,44 +88,45 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_putdata 3 "24 February 2016" "Version 0.9.2" "GETDATA"
+.TH gd_putdata 3 "25 January 2017" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_putdata \(em write data to a dirfile database
+gd_putdata \(em write data to a Dirfile database
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "size_t gd_putdata(DIRFILE *" dirfile ", const char *" field_code ", off_t"
 .IB first_frame ", off_t " first_sample ", size_t " num_frames ", size_t"
 .IB num_samples ", gd_type_t " data_type ", const void *" data_in );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_putdata ()
+.FN gd_putdata
 function writes data to a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 for the field
-.IR field_code ,
+.ARG field_code ,
 which may not contain a representation suffix.  It writes
-.I num_frames
+.ARG num_frames
 frames plus
-.I num_samples
+.ARG num_samples
 samples to this field, starting 
-.I first_sample
+.ARG first_sample
 samples past frame
-.IR first_frame . 
+.ARG first_frame . 
 The data is read from the user-supplied buffer
-.IR data_in,
+.ARG data_in,
 which is has a data type specified by
-.IR data_type .
+.ARG data_type .
 This interface cannot write to field representations.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 Unless using
 .B GD_HERE 
@@ -61,81 +137,74 @@ Unless using
 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).
+.F3 gd_spf .
 The number of samples which
-.BR gd_putdata ()
+.FN gd_putdata
 attempts to write is, similarly,
 .RS
 .IR num_frames " * " samples_per_frame " + " num_samples .
 .RE
 Although calling
-.BR gd_putdata ()
+.FN gd_putdata
 using both samples and frames is possible, the function is typically called
 with either
-.IR num_samples " and " first_sample ,
+.ARG num_samples
+and
+.ARG first_sample ,
 or
-.IR num_frames " and " first_frames ,
+.ARG num_frames
+and
+.ARG 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 .
+.ARG first_frame .
 This will result in the write occurring at the current position of the I/O
 pointer for the field (see
-.BR gd_getdata (3)
+.F3 gd_getdata
 for a discussion of I/O pointers).  In this case, the value of
-.I first_sample
+.ARG first_sample
 is ignored.
 
 The 
-.I data_type
+.ARG data_type
 argument should be one of the following symbols, which indicates the type of
 the input data:
 .RS
 .TP 11
 .B GD_UINT8
 unsigned 8-bit integer
-.TP
-.B GD_INT8
+.DD GD_INT8
 signed (two's complement) 8-bit integer
-.TP
-.B GD_UINT16
+.DD GD_UINT16
 unsigned 16-bit integer
-.TP
-.B GD_INT16
+.DD GD_INT16
 signed (two's complement) 16-bit integer
-.TP
-.B GD_UINT32
+.DD GD_UINT32
 unsigned 32-bit integer
-.TP
-.B GD_INT32
+.DD GD_INT32
 signed (two's complement) 32-bit integer
-.TP
-.B GD_UINT64
+.DD GD_UINT64
 unsigned 64-bit integer
-.TP
-.B GD_INT64
+.DD GD_INT64
 signed (two's complement) 64-bit integer
-.TP
-.B GD_FLOAT32
+.DD GD_FLOAT32
 IEEE-754 standard 32-bit single precision floating point number
-.TP
-.B GD_FLOAT64
+.DD GD_FLOAT64
 IEEE-754 standard 64-bit double precision floating point number
-.TP
-.B GD_COMPLEX64
+.DD GD_COMPLEX64
 C99-conformant 64-bit single precision complex number
-.TP
-.B GD_COMPLEX128
+.DD 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
 in the database.  Type conversion will be performed as necessary to write the
 appropriate type.  The argument
-.I data_in
+.ARG 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
@@ -144,113 +213,103 @@ position of the I/O pointer is not specified.
 
 .SH RETURN VALUE
 In all cases,
-.BR gd_putdata ()
+.FN gd_putdata
 returns the number of samples (not bytes) successfully written to the database,
 which may be zero if an error has occurred.
 
-If an error has occurred, the dirfile error
-will be set to a non-zero value.  Possible error values are:
-.TP 8
-.B GD_E_ACCMODE
+On error, this function returns zero and stores a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ACCMODE
 The specified
-.I dirfile
+.ARG dirfile
 was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.IR field_code ,
+.ARG field_code ,
 or one of the fields it uses for input, was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 An invalid
-.I dirfile
+.ARG dirfile
 was supplied.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 Either the field specified by
-.IR field_code ,
+.ARG field_code ,
 or one of the fields it uses for input, was of
-.B MULTIPLY
+.BR MULTIPLY ,
+.BR DIVIDE ,
+.BR WINDOW ,
+.BR INDIR ,
 or
-.B DIVIDE
-type, or
+.B SINDIR
+type, or a
 .B LINCOM
-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
+with more than one input field, or a
+.B POLYNOM
+with quadratic or higer terms.  Alternately, the caller may have attempted to
 write to the implicit INDEX field, which is not possible.
-.TP
-.B GD_E_BAD_TYPE
+.DD GD_E_BAD_TYPE
 An invalid
-.I data_type
+.ARG data_type
 was specified.
-.TP
-.B GD_E_DIMENSION
+.DD GD_E_DIMENSION
 The field specified by
-.I field_code
+.ARG field_code
 was not a vector field.  The caller should use
-.BR gd_put_carray (3),
-.BR gd_put_constant (3),
+.F3 gd_put_carray ,
+.F3 gd_put_constant ,
 or
-.BR gd_put_string (3)
+.F3 gd_put_string
 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
+.ARG field_code .
+.DD 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
+.DD 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_IO
+.DD GD_E_IO
 An error occurred while trying to open, read from, or write to a file on disk
-containing a raw field or
+containing a raw field or a
 .B LINTERP
 table.
-.TP
-.B GD_E_LUT
+.DD GD_E_LUT
 A
 .B LINTERP
 table was malformed.
-.TP
-.B GD_E_PROTECTED
+.DD GD_E_PROTECTED
 The data of the
 .B RAW
 field backing
-.I field_code
+.ARG field_code
 was protected from change by a /PROTECT directive.
-.TP
-.B GD_E_RANGE
+.DD GD_E_RANGE
 An attempt was made to write data either before the beginning-of-frame marker
 for
-.IR field_code ,
+.ARG field_code ,
 or the raw field it depends on, or else outside the addressable Dirfile range
 (more than 2**63 samples beyond the start of the Dirfile).
-.TP
-.B GD_E_RECURSE_LEVEL
+.DD GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
+.ARG field_code .
 This usually indicates a circular dependency in field specification in the
 dirfile.
-.TP
-.B GD_E_UNSUPPORTED
+.DD 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)
+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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
 
 .SH NOTES
 When operating on a platform whose
@@ -258,27 +317,39 @@ When operating on a platform whose
 is
 .IR N -bytes
 wide, a single call of
-.BR gd_putdata ()
-will never write more than (2**(\fIN\fR-1) - 1) samples.  The request will
-be truncated at (2**(\fIN\fR-\fIM\fR) - 1) samples, where \fIM\fR is the size,
-in bytes, of the largest data type used to calculate the stored field.  If a
-larger request is specified, less data than requested will be written, without
-raising an error.  This limit is imposed even when 
-.I data_type
+.FN gd_putdata
+will never write more than (2**(\fIN\fR-\fIM\fR) - 1) samples, where \fIM\fR is
+the size, in bytes, of the largest data type used to calculate the stored field.
+If a larger request is specified, less data than requested will be written,
+without raising an error.  This limit is imposed even when 
+.ARG data_type
 is
 .B GD_NULL
 (i.e., even when no actual I/O or calculation occurs).  In all cases, the actual
 amount of data is returned.
 
+.SH HISTORY
+The
+.FN putdata
+function appeared in GetData-0.3.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_getdata .
+
+The
+.B GD_HERE
+symbol used for sequential writes appeared in GetData-0.8.0.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR dirfile-encoding (5),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_getdata (3),
-.BR gd_put_carray (3),
-.BR gd_put_constant (3),
-.BR gd_seek (3),
-.BR gd_spf (3),
-.BR GD_SIZE (3)
+.F3 GD_SIZE ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_getdata ,
+.F3 gd_open ,
+.F3 gd_put_carray ,
+.F3 gd_put_constant ,
+.F3 gd_put_sarray ,
+.F3 gd_put_string ,
+.F3 gd_seek ,
+.F3 gd_spf ,
+dirfile(5), dirfile-encoding(5)
diff --git a/man/gd_putdata64.3 b/man/gd_putdata64.3
index bdd1fdd..a14d3a9 100644
--- a/man/gd_putdata64.3
+++ b/man/gd_putdata64.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_putdata64.3.  The gd_putdata64 man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,45 +88,42 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_putdata64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
+.TH gd_putdata64 3 "25 December 2016" "Version 0.10.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 GD_64BIT_API
 .br
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .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
+.EC
+
 .SH DESCRIPTION
 This version of
-.BR gd_putdata (3)
-uses a 64-bit offset type
+.F3 gd_putdata
+uses an explicitly 64-bit offset type
 .RB ( gd_off64_t ),
-where one is available, regardless of the size of
+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.
+It is only guaranteed to be available if
+.BR GD_64BIT_API
+is defined 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_putdata (3).
+.B off_t
+is a 64-bit type, this function will the same as
+.F3 gd_putdata .
 Otherwise,
-.BR gd_putdata (3)
+.F3 gd_putdata
 will be a version of this function which uses a 32-bit
-.IR off_t .
+.BR off_t .
+
 .SH SEE ALSO
-.BR gd_putdata (3),
-.BR feature_test_macros (7)
+.F3 gd_putdata
diff --git a/man/gd_raw_filename.3 b/man/gd_raw_filename.3
index 7590672..a219490 100644
--- a/man/gd_raw_filename.3
+++ b/man/gd_raw_filename.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_raw_filename.3.  The gd_raw_filename man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2013 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2013, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,75 +88,86 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_raw_filename 3 "10 December 2013" "Version 0.9.0" "GETDATA"
+.TH gd_raw_filename 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_raw_filename \(em retrieve the pathname of a binary file in a dirfile
+gd_raw_filename \(em retrieve the pathname of a binary file in a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "char *gd_raw_filename(DIRFILE *" dirfile ", const char"
 .BI * field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_raw_filename ()
+.FN gd_raw_filename
 function reports the pathname of the file backing the
 .B RAW
 field specified by
-.I field_code
+.ARG field_code
 in the dirfile specified by
-.IR dirfile .
+.ARG dirfile .
 If
-.I field_code
+.ARG field_code
 contains a valid representation suffix, it will be ignored.
 
 .SH RETURN VALUE
 On success,
-.BR gd_raw_filename ()
+.FN gd_raw_filename
 returns the full pathname of the binary file associated with the specified
-field in buffer allocated by
-.BR malloc (3).
-The returned pointer should be passed to
-.BR free (3)
-once the caller no longer needs it.  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
+field in a newly-allocated buffer.  By default, this buffer is allocated with
+.F3 malloc ,
+but a different memory manager may be specified by calling
+.F3 gd_alloc_funcs
+before calling this function.  The caller is responsible for deallocating the
+returned buffer.
+
+On error, this function returns NULL and stores a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 The field specified by
-.I field_code
+.ARG field_code
 was not a
 .B RAW
 field.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 The encoding scheme of the specified field could not be determined or was not
 understood by GetData.
 .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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_raw_filename
+function appeared in GetData-0.4.2.  Memory for the string it returned was
+managed by GetData.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_raw_filename .
+
+In GetData-0.8.0, the returned string changed to a malloc'd buffer, and the
+responsibility for freeing the buffer passed to the caller.
+
 .SH SEE ALSO
-.BR gd_entry (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR dirfile (5),
-.BR dirfile-encoding (5),
-.BR dirfile-format (5),
-.BR free (3),
-.BR malloc (3)
+.F3 free ,
+.F3 gd_entry ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 malloc ,
+dirfile(5), dirfile-encoding(5), dirfile-format(5)
diff --git a/man/gd_reference.3 b/man/gd_reference.3
index 0227d17..a4a1683 100644
--- a/man/gd_reference.3
+++ b/man/gd_reference.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_reference.3.  The gd_reference man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,23 +88,24 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_reference 3 "20 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_reference 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_reference \(em retrieve or set the reference field for a dirfile
+gd_reference \(em retrieve or set the reference field for a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "const char *gd_reference(DIRFILE *" dirfile ", const char"
 .BI * field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_reference ()
+.FN gd_reference
 function sets or retrieves the reference field (see 
-.BR dirfile (5))
+dirfile(5))
 associated with the dirfile specified by
 .IR dirfile .
 If the
@@ -42,7 +118,7 @@ a RAW field, and may not contain a representation suffix.
 
 .SH RETURN VALUE
 On success,
-.BR gd_reference ()
+.FN gd_reference
 returns the field code of the dirfile's reference field, which will be
 .IR field_code ,
 if
@@ -52,42 +128,56 @@ is non-NULL.   If no
 fields are defined in the dirfile, this function will return NULL, without
 raising an error.  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_ACCMODE
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
 .I field_code
 was not found.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 The field specified by
 .I field_code
 was not a
 .B RAW
 field.
-.TP
-.B GD_E_PROTECTED
+.DD GD_E_PROTECTED
 The metadata of the primary format specification fragment (the file named
 .I format
 in the root dirfile directory) was protected from change.
 .PP
 The dirfile error may be retrieved by calling
-.BR gd_error (3).
+.F3 gd_error .
 A descriptive error string for the last error encountered can be obtained from
 a call to
-.BR gd_error_string (3).
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_reference
+function appeared in GetData-0.4.2.  It took only one parameter (the
+.BR DIRFILE ),
+and returned the current reference field.
+
+The
+.FN dirfile_reference
+function appeared in GetData-0.5.0.
+
+In GetData-0.7.0, the
+.FN dirfile_reference
+function was renamed to
+.FN gd_reference
+and the
+.FN get_reference
+function was removed.
+
 .SH SEE ALSO
-.BR gd_metaflush (3),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_metaflush ,
+.F3 gd_open ,
+dirfile(5),
+dirfile-format(5)
diff --git a/man/gd_rename.3 b/man/gd_rename.3
index ba212f9..2301cbc 100644
--- a/man/gd_rename.3
+++ b/man/gd_rename.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_rename.3.  The gd_rename man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,21 +88,22 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_rename 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_rename 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_rename \(em change the name of a dirfile field or alias
+gd_rename \(em change the name of a Dirfile field or alias
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_rename(DIRFILE *" dirfile ", const char"
 .BI * old_code ", const char *" new_name ", unsigned int " flags );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_rename ()
+.FN gd_rename
 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
@@ -61,13 +137,11 @@ modified.
 The
 .I flags
 parameter should be zero or more of the following flags, bitwise or'd together:
-.TP
-.B GD_REN_DANGLE
+.DD GD_REN_DANGLE
 Don't update
 .B ALIAS
 entries, instead turning them into dangling aliases.
-.TP
-.B GD_REN_DATA
+.DD GD_REN_DATA
 if
 .I old_code
 specifies a
@@ -79,8 +153,7 @@ field's I/O pointer will be reset to the beginning-of-frame.  If
 specifies a field of type other than
 .BR RAW ,
 this flag is ignored.
-.TP
-.B GD_REN_FORCE
+.DD GD_REN_FORCE
 When updating field metadata (either the target of an alias, or else when
 specified along with
 .BR GD_REN_UPDB ), 
@@ -89,8 +162,7 @@ skip updating field codes which would be invalid (due to
 affixes).  Without this flag, such invalid field codes causes this function to
 fail with the error
 .BR GD_E_BAD_CODE .
-.TP
-.B GD_REN_UPDB
+.DD 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
@@ -98,58 +170,82 @@ this field are left unmodified.
 
 .SH RETURN VALUE
 On success,
-.BR gd_rename ()
-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
+.FN gd_rename
+returns zero.   On error, a negative-valued error code is returned.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The specified dirfile was opened read-only.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
 .I old_code
 was not found.  Or else the resultant metadata update tried to change a
 field code into something prohibited by a fragment's affixes.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD GD_E_BAD_FIELD_TYPE
 An attempt was made to rename the immutable
 .I INDEX
 field.
-.TP
-.B GD_E_DUPLICATE
+.DD GD_E_DUPLICATE
 The new name specified is already in use by another entry.
-.TP
-.B GD_E_IO
+.DD GD_E_IO
 An I/O error occurred while attempting to rename the binary file.
-.TP
-.B GD_E_PROTECTED
+.DD GD_E_PROTECTED
 The metadata of the format specification fragment containing the renamed entry,
 or another entry affected by this change, was protected from change, or the
 binary data of the fragment was protected from change and a binary file move
 was requested.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD GD_E_UNKNOWN_ENCODING
 The encoding scheme of the specified field could not be determined or was not
 understood by GetData.
-.TP
-.B GD_E_UNSUPPORTED
+.DD GD_E_UNSUPPORTED
 The encoding scheme of the field does not support binary file renaming.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN dirfile_rename
+function appeared in GetData-0.5.0.  It had no
+.ARG flags
+argument.  In its place was
+.B int
+.ARG move_data .
+Passing a non-zero value for this parameter has the same effect as the
+.B GD_REN_DATA
+flag does now.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_rename .
+
+In GetData-0.8.0, the
+.ARG move_data
+parameter was replaced with the
+.ARG flags
+parameter.  The only flags available were
+.B GD_REN_DATA
+and
+.BR GD_REN_UBDB .
+
+The flags
+.B GD_REN_DANGLE
+and
+.B GD_REN_FORCE
+flags appeared in GetData-0.9.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_metaflush (3),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR dirfile (5),
-.BR dirfile-format (5)
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_metaflush ,
+.F3 gd_open ,
+dirfile(5), dirfile-format(5)
diff --git a/man/gd_rewrite_fragment.3 b/man/gd_rewrite_fragment.3
index 7ef711d..bcf28ed 100644
--- a/man/gd_rewrite_fragment.3
+++ b/man/gd_rewrite_fragment.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_rewrite_fragment.3.  The gd_rewrite_fragment man page.
 .\"
-.\" Copyright (C) 2010, 2011, 2014 D. V. Wiebe
+.\" Copyright (C) 2010, 2011, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,20 +88,21 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_rewrite_fragment 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_rewrite_fragment 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_rewrite_fragment \(em re-write a dirfile format specification fragment
+gd_rewrite_fragment \(em re-write a Dirfile format specification fragment
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_rewrite_fragment(DIRFILE *" dirfile ", int " fragment );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_rewrite_fragment ()
+.FN gd_rewrite_fragment
 writes the format specification fragment specified by
 .I fragment
 to disk, regardless of whether it has changed or not, overwriting the existing
@@ -41,51 +117,56 @@ which indicates that all fragments should be rewritten.
 Metadata is written to disk using the current Standards Version as stored in the
 .I dirfile
 object.  See
-.BR gd_dirfile_standards (3)
+.F3 gd_dirfile_standards
 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.
+
 .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:
-.TP 8
-.B GD_E_ACCMODE
+On success, zero is returned.  On error, a negative-valued error code is
+returned.  Possible error codes are:
+.DD GD_E_ACCMODE
 The supplied dirfile was opened in read-only mode.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD GD_E_BAD_INDEX
 The supplied fragment index was out of range.
-.TP
-.B GD_E_IO
+.DD GD_E_IO
 An I/O error occurred while trying to write modified metadata to disk.
-.TP
-.B GD_E_LINE_TOO_LONG
+.DD GD_E_LINE_TOO_LONG
 While attempting to flush modified metadata to disk, a field specification line
 exceeded the maximum allowed length.  On most platforms, the maximum length is
 at least 2**31 bytes, so this typically indicates something pathological
 happening.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
 .SH BUGS
 When writing metadata using Standards Version 4 or earlier, the reference field
 may change, owing to the lack of a
 .B /REFERENCE
 directive.  A work-around is to upgrade to Standards Version 5 or later.
-.SH SEE ALSO
-.BR gd_open (3),
-.BR gd_close (3),
-.BR gd_dirfile_standards (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_flush (3),
-.BR gd_metaflush (3)
 
+.SH HISTORY
+The
+.FN gd_rewrite_fragment
+function appeared in GetData-0.7.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
+.SH SEE ALSO
+.F3 gd_close ,
+.F3 gd_dirfile_standards ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_flush ,
+.F3 gd_metaflush ,
+.F3 gd_open
diff --git a/man/gd_sarrays.3 b/man/gd_sarrays.3
new file mode 100644
index 0000000..ebef9c0
--- /dev/null
+++ b/man/gd_sarrays.3
@@ -0,0 +1,205 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
+.\" gd_sarrays.3.  The gd_sarrays man page.
+.\"
+.\" Copyright (C) 2010, 2011, 2016 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_sarrays 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
+.SH NAME
+gd_sarrays, gd_msarrays \(em retrieve a list of SARRAY values from a Dirfile
+
+.SH SYNOPSIS
+.SC
+.B #include <getdata.h>
+.HP
+.BI "const char ***gd_sarrays(DIRFILE *" dirfile );
+.HP
+.BI "const char ***gd_msarrays(DIRFILE *" dirfile ", const char"
+.BI * parent );
+.EC
+
+.SH DESCRIPTION
+The
+.FN gd_sarrays
+function queries a dirfile(5) database specified by
+.ARG dirfile
+and generates a read-only list of values of the all top-level
+.B SARRAY
+fields defined in the database, after type conversion to the data type
+specified by
+.ARG return_type .
+For a list of valid symbols to use for
+.ARG return_type ,
+see the
+.F3 gd_get_sarray
+manual page.  
+
+The
+.FN gd_msarrays
+function behaves similarly, but creates a list of values of
+.B SARRAY
+subfields under the parent field
+.ARG parent .
+
+The 
+.ARG dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.F3 gd_open .
+
+The array returned will be de-allocated by a call to
+.F3 gd_close
+and should not be de-allocated by the caller.  The list returned should not be
+assumed to be in any particular order, except that it is guaranteed to be in the
+same order as the list of
+.B SARRAY
+fields returned by
+.F3 gd_field_list_by_type
+or
+.F3 gd_mfield_list_by_type .
+The number of values in the array can be obtained from a call to
+.F3 gd_nfields_by_type
+or
+.F3 gd_nmfields_by_type .
+
+The caller may not modify any values in the array, nor the array itself.  Doing
+so may cause database corruption.  The pointer returned is guaranteed to be
+valid only until the function is called again with the same arguments, or until
+the dirfile's metadata is modified (by adding, modifying or deleting an entry),
+or until the array is de-allocated by a call to
+.F3 gd_close
+or
+.F3 gd_discard .
+
+A corresponding list of names for these fields may be obtained by calling
+.F3 gd_field_list_by_type
+or
+.F3 gd_mfield_list_by_type .
+
+.SH RETURN VALUE
+Upon successful completion,
+.FN gd_sarrays
+and
+.F3 gd_msarrays
+return a pointer to an array of arrays of strings.  For convenience, both
+levels of the array are terminated by NULL pointers.
+
+If no SARRAYs are defined in the database, a pointer to a single-element array
+containing only the terminating NULL is returned.
+
+On error,
+.FN gd_sarrays
+returns NULL and stores a negative-valued error code in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ALLOC
+The library was unable to allocate memory.
+.DD GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.DD 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
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_sarrays
+function appeared in GetData-0.10.0.
+
+.SH SEE ALSO
+.F3 gd_entry_list ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_get_sarray ,
+.F3 gd_nentries ,
+.F3 gd_open ,
+dirfile(5)
diff --git a/man/gd_seek.3 b/man/gd_seek.3
index ebb6414..b632f7c 100644
--- a/man/gd_seek.3
+++ b/man/gd_seek.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_getdata.3.  The gd_getdata man page.
 .\"
-.\" Copyright (C) 2011, 2012, 2013, 2014, 2015 D. V. Wiebe
+.\" Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,43 +88,44 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_seek 3 "25 September 2015" "Version 0.9.0" "GETDATA"
+.TH gd_seek 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_seek \(em reposition a dirfile field pointer
+gd_seek \(em reposition a Dirfile field pointer
+
 .SH SYNOPSIS
+.SC
 .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
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_seek ()
+.FN gd_seek
 function changes the position of the I/O pointer associated with the field
-.I field_code
+.ARG field_code
 in the dirfile(5) database specified by
-.IR dirfile .
+.ARG dirfile .
 In normal operation,
-.BR gd_seek ()
+.FN gd_seek
 advances the field I/O pointer
-.I frame_num
+.ARG frame_num
 frames plus
-.I sample_num
+.ARG sample_num
 samples from the origin point specified in
-.IR flags ,
+.ARG 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)).
+.F3 gd_eof ).
 
 In addition to one of the symbols above, the
-.I flags
+.ARG 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
@@ -60,7 +136,7 @@ The effect of attempting to seek past the end-of-field is encoding specific.
 Some encodings don't actually add the padding requested by
 .B GD_SEEK_WRITE
 unless a subsequent
-.BR gd_putdata (3)
+.F3 gd_putdata
 call is used to add more data to the field at the new end-of-field.  Other
 encodings add the padding, advancing the end-of-field, regardless of subsequent
 writes.  Similarly, attempting to seek past the end-of-field marker in read mode
@@ -73,140 +149,133 @@ end of field.  Check the return value to determine the result.
 In general,
 .B GD_SEEK_WRITE
 should be used on
-.BR gd_seek ()
+.FN gd_seek
 calls before a write via
-.BR gd_putdata (3),
+.F3 gd_putdata ,
 while calls before a read via
-.BR gd_getdata (3)
+.F3 gd_getdata
 should omit the
 .B GD_SEEK_WRITE
 flag.  So the following:
 .IP
-.nh
-.ad l
+.SC
 .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 ,
+.BI "gd_putdata(" dirfile ", " field_code ", GD_HERE, 0, " c ", " d ", " type ,
 .IB data );
-.ad n
-.hy
+.EC
 .P
 is equivalent to:
 .IP
-.nh
-.ad l
-.BI "gd_putdata(" dirfile ", "field_code ", " a ", " b ", " c ", " d ", " type ,
-.IB data );
+.SC
+.BI "gd_putdata(" dirfile ", " field_code ", " a ", " b ", " c ", " d ,
+.IB type ", " data );
+.EC
 .P
 and, similarly,
 .IP
-.nh
-.ad l
+.SC
 .BI "gd_seek(" dirfile ", " field_code ", " a ", " b ", GD_SEEK_SET);"
 .br
-.BI "gd_getdata(" dirfile ", "field_code ", GD_HERE, 0, " c ", " d ", " type ,
+.BI "gd_getdata(" dirfile ", " field_code ", GD_HERE, 0, " c ", " d ", " type ,
 .IB data );
-.ad n
-.hy
+.EC
 .P
 is equivalent to:
 .IP
-.nh
-.ad l
-.BI "gd_getdata(" dirfile ", "field_code ", " a ", " b ", " c ", " d ", " type ,
-.IB data );
+.SC
+.BI "gd_getdata(" dirfile ", " field_code ", " a ", " b ", " c ", " d ,
+.IB type ", " data );
+.EC
 .P
 Only
 .B RAW
 fields (and the implicit
 .I INDEX
 field) have field I/O pointers associated with them.  Calling
-.BR gd_seek ()
+.FN 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 ()
+.FN 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
+.FN gd_seek
+returns a non-negative integer indicating the I/O position, in samples, of the
+specified field after performing the seek.  On error, it returns a
+negative-valued error code.  Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_ARGUMENT
+.DD GD_E_ARGUMENT
 The
-.I flags
+.ARG 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
+.DD GD_E_BAD_CODE
 The field specified by
-.IR field_code ,
+.ARG field_code ,
 or one of the fields it uses for input, was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_FIELD_TYPE
+.DD 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_DIMENSION
+.DD GD_E_DIMENSION
 The specified field or one of its inputs wasn't of vector type.
-.TP
-.B GD_E_DOMAIN
+.DD GD_E_DOMAIN
 The field position couldn't be set due to a derived field reading simultaneously
 from more than one place in a
 .B RAW
 field.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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_IO
+.DD GD_E_IO
 An error occurred while trying to open or read from a file on disk containing
 a raw field.
-.TP
-.B GD_E_RANGE
+.DD 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
+.DD GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
+.ARG field_code .
 This usually indicates a circular dependency in field specification in the
 dirfile.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD 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
+.DD 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)
+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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_seek
+function appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_getdata (3),
-.BR gd_putdata (3),
-.BR gd_tell (3).
+.F3 gd_getdata ,
+.F3 gd_open ,
+.F3 gd_putdata ,
+.F3 gd_tell
diff --git a/man/gd_seek64.3 b/man/gd_seek64.3
index 52044cb..3236560 100644
--- a/man/gd_seek64.3
+++ b/man/gd_seek64.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_seek64.3.  The gd_seek64 man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,43 +88,40 @@
 .\" 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"
+.TH gd_seek64 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_seek64 \(em retrieve data from a dirfile database, with largefile support
+gd_seek64 \(em retrieve data from a Dirfile database, with largefile support
+
 .SH SYNOPSIS
 .B #define GD_64BIT_API
 .br
+.SC
 .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
+.EC
+
 .SH DESCRIPTION
 This version of
-.BR gd_seek (3)
-uses a 64-bit offset type
+.F3 gd_seek
+uses an explicitly 64-bit offset type
 .RB ( gd_off64_t ),
-where one is available, regardless of the size of
+regardless of the size of
 .BR off_t .
-It is only available if one defines
-.IR GD_64BIT_API
-or
-.IR _LARGEFILE64_SOURCE
+It is only guaranteed to be available if one defines
+.BR GD_64BIT_API
 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).
+.B off_t
+is a 64-bit type, this function will the same as
+.F3 gd_seek .
 Otherwise,
-.BR gd_seek (3)
+.F3 gd_seek
 will be a version of this function which uses a 32-bit
-.IR off_t .
+.BR off_t .
+
 .SH SEE ALSO
-.BR gd_seek (3),
-.BR feature_test_macros (7)
+.F3 gd_seek
diff --git a/man/gd_spf.3 b/man/gd_spf.3
index 5cad8ad..d6a69f9 100644
--- a/man/gd_spf.3
+++ b/man/gd_spf.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_spf.3.  The gd_spf man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,73 +88,79 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_spf 3 "1 April 2012" "Version 0.8.0" "GETDATA"
+.TH gd_spf 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_spf \(em returns the samples per frame for a field in a
 dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "unsigned int gd_spf(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_spf ()
+.FN gd_spf
 function queries a dirfile(5) database specified by
-.I dirfile
-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.
+.ARG dirfile
+and determines the number of samples per frame for the field
+.ARG field_code .
+This information is also available from
+.F3 gd_entry .
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_spf ()
-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
+.FN gd_spf
+returns a positive integer indicating the number of samples per frame for the
+field specified.  On error, it returns zero and stores a negative-valued error
+code in the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_DIMENSION
+.DD GD_E_DIMENSION
 A scalar field was found where a vector field was expected.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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_RECURSE_LEVEL
+.DD GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
+.ARG 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).
-A descriptive error string for the last error encountered can be obtained from
-a call to
-.BR gd_error_string (3).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_spf
+function appeared in GetData-0.3.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_spf .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3)
+.F3 gd_entry ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_open ,
+dirfile(5)
diff --git a/man/gd_strings.3 b/man/gd_strings.3
index d680b2d..0ba5dce 100644
--- a/man/gd_strings.3
+++ b/man/gd_strings.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_strings.3.  The gd_strings man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2011 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,83 +88,121 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_strings 3 "19 October 2011" "Version 0.8.0" "GETDATA"
+.TH gd_strings 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_strings \(em retrieve a list of string values from a dirfile
+gd_strings \(em retrieve a list of string values from a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "const char **gd_strings(DIRFILE *" dirfile );
-.hy
-.ad n
+.HP
+.BI "const char **gd_mstrings(DIRFILE *" dirfile ", const char *" parent );
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_strings ()
+.FN gd_strings
 function queries a dirfile(5) database specified by
-.I dirfile
-and returns a read-only list of values of the all
+.ARG dirfile
+and compiles a read-only list of values of the all
+.B STRING
+type fields defined in the database, excluding /META subfields.
+
+The
+.FN gd_mstrings
+function produces the same list, but for
 .B STRING
-type fields defined in the database.  Notably, this list does not include
-/META subfields.
+meta subfields of the indicated
+.ARG parent
+field.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
+
+.SH RETURN VALUE
+Upon successful completion,
+.FN gd_strings
+returns a pointer to an array of strings containing the values of all the
+.B STRING
+fields defined in the dirfile database.  Similarly,
+.FN gd_mstrings
+returns a pointer to an array of strings containing the values of all the
+.B STRING
+metafields under
+.ARG parent .
+
+The returned array is terminated by a NULL pointer.  A valid pointer is always
+returned if this function does not encounter an error.  If there are no string
+values to return, a pointer to an array consisting of only the NULL pointer is
+returned.
 
 The array returned will be de-allocated by a call to
-.BR gd_close (3)
+.F3 gd_close
 and should not be de-allocated by the caller.  The list returned should not be
 assumed to be in any particular order, although it is guaranteed to be in the
 same order as the list of
 .B STRING
 fields returned by
-.BR gd_field_list_by_type (3).
+.F3 gd_field_list_by_type .
 The array is terminated by a NULL pointer.  The number of strings in the array
 can be obtained from a call to
-.BR gd_nfields_by_type (3).
+.F3 gd_nfields_by_type .
 
 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_strings ()
+.FN gd_strings
+or
+.FN gd_mstrings
 is called again with the same arguments, or until the array is de-allocated by
 a call to
-.BR gd_close (3).
+.F3 gd_close
+or
+.F3 gd_discard .
 
-A corresponding list of names for these fields may be obtained by
-calling
-.BR gd_field_list_by_type (3).
-
-.SH RETURN VALUE
-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.  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
+On error, these functions return NULL and store a negative-valued error code in
+the
+.B DIRFILE
+object which may be retrieved by a subsequent call to
+.F3 gd_error .
+Possible error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_CODE
+.RB ( gd_mstrings ()
+only) The supplied parent field code was not found, or referred to a metafield
+itself.
+.DD 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).
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN get_strings
+function appeared in GetData-0.3.0.
+
+The
+.FN get_mstrings
+function appeared in GetData-0.4.0.
+
+In GetData-0.7.0, these functions were renamed to
+.FN gd_strings
+and
+.FN gd_mstrings .
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_field_list_by_type (3),
-.BR gd_mstrings (3),
-.BR gd_nfields_by_type (3),
-.BR gd_string (3)
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_field_list_by_type ,
+.F3 gd_mstrings ,
+.F3 gd_nfields_by_type ,
+.F3 gd_open ,
+.F3 gd_string ,
+dirfile(5)
diff --git a/man/gd_strtok.3 b/man/gd_strtok.3
index 9ead5d8..e0ad1be 100644
--- a/man/gd_strtok.3
+++ b/man/gd_strtok.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_strtok.3.  The gd_strtok man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,85 +88,94 @@
 .\" 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"
+.TH gd_strtok 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_strtok \(em tokenise a string using the GetData parser
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "char *gd_strtok(DIRFILE *" dirfile ", const char *" string );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_strtok ()
+.FN 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 ()
+.FN gd_strtok
 is called, the string to be parsed should be passed in
-.IR string .
+.ARG string .
 The first token will be returned.  In subsequent calls to parse the same string,
-.I string
+.ARG string
 should be NULL (as with
-.BR strtok (3)).
+.F3 strtok ).
 Each time 
-.BR gd_strtok ()
+.FN 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 .
+.ARG dirfile .
 Use
-.BR gd_dirfile_standards (3)
+.F3 gd_dirfile_standards
 to retrieve or change this value.  Changing the Standards Version of
-.I dirfile
+.ARG 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
+.ARG dirfile
 object.  Calling
-.BR gd_strtok ()
+.FN gd_strtok
 with different
-.IR dirfile s
+.ARG 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).
+.FN gd_strtok
+returns a copy of the first token, if
+.ARG string
+is non-NULL, or else a subsequent token from the previously specified string,
+if
+.ARG string
+is NULL.  Every non-NULL pointer returned by
+.FN gd_strtok
+points to a new buffer allocated on the heap.  By default,
+.F3 strdup
+is used the allocate the buffers, but an alternate memory manager may be
+used by calling
+.F3 gd_alloc_funcs
+before calling this function.  The caller is responsible for deallocating all
+these buffers.
 .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
+.DD GD_E_ALLOC
 A memory allocation error occurred.
-.TP
-.B GD_E_ARGUMENT
+.DD GD_E_ARGUMENT
 There was no string to parse (i.e.
-.I string
+.ARG string
 was NULL, but no previous call specified a string to parse).
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_FORMAT
+.DD GD_E_FORMAT
 A syntax error was found in the string.
 .PP
 The dirfile error may be retrieved by calling
-.BR gd_error (3).
+.F3 gd_error .
 A descriptive error string for the last error encountered can be obtained from
 a call to
-.BR gd_error_string (3).
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_strtok
+function appeared in GetData-0.8.0.
 
 .SH SEE ALSO
-.BR gd_dirfile_standards (3),
-.BR gd_open (3),
-.BR dirfile-format (5)
+.F3 gd_dirfile_standards ,
+.F3 gd_open ,
+dirfile-format(5)
diff --git a/man/gd_tell.3 b/man/gd_tell.3
index fe09d3d..5eaf4d5 100644
--- a/man/gd_tell.3
+++ b/man/gd_tell.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_getdata.3.  The gd_getdata man page.
 .\"
-.\" Copyright (C) 2011, 2014, 2015 D. V. Wiebe
+.\" Copyright (C) 2011, 2014, 2015, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,94 +88,95 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_tell 3 "5 November 2015" "Version 0.9.1" "GETDATA"
+.TH gd_tell 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_tell \(em report the position of a dirfile field I/O pointer
+gd_tell \(em report the position of a Dirfile field I/O pointer
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "off_t gd_tell(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_tell ()
+.FN gd_tell
 function reports the current position of the I/O pointer of the field
-.I field_code
+.ARG field_code
 in the dirfile(5) database specified by
-.IR dirfile .
+.ARG dirfile .
 .P
 Only
 .B RAW
 fields (and the implicit
 .I INDEX
 field) have field pointers associated with them.  Calling
-.BR gd_tell ()
+.FN 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
+.FN gd_tell
+returns a non-negative integer indicating the I/O position of the specified
+field in samples.  On error, it returns a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_CODE
+.DD GD_E_BAD_CODE
 The field specified by
-.IR field_code ,
+.ARG field_code ,
 or one of the fields it uses for input, was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_DIMENSION
+.DD GD_E_DIMENSION
 The specified field or one of its inputs wasn't of vector type.
-.TP
-.B GD_E_DOMAIN
+.DD GD_E_DOMAIN
 The I/O position of a derived field wasn't well defined because its input fields
 simultaneously read from different places in the same
 .B RAW
 field.
-.TP
-.B GD_E_INTERNAL_ERROR
+.DD 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_IO
+.DD GD_E_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
+.DD GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
+.ARG field_code .
 This usually indicates a circular dependency in field specification in the
 dirfile.
-.TP
-.B GD_E_UNKNOWN_ENCODING
+.DD 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
+.DD 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)
+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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_tell
+function appeared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_getdata (3),
-.BR gd_putdata (3),
-.BR gd_seek (3).
+.F3 gd_getdata ,
+.F3 gd_open ,
+.F3 gd_putdata ,
+.F3 gd_seek .
diff --git a/man/gd_tell64.3 b/man/gd_tell64.3
index 10507b4..5ee7fc6 100644
--- a/man/gd_tell64.3
+++ b/man/gd_tell64.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_tell64.3.  The gd_tell64 man page.
 .\"
-.\" Copyright (C) 2012 D. V. Wiebe
+.\" Copyright (C) 2012, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,42 +88,39 @@
 .\" 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"
+.TH gd_tell64 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_tell64 \(em retrieve data from a dirfile database, with largefile support
+gd_tell64 \(em retrieve data from a Dirfile database, with largefile support
+
 .SH SYNOPSIS
 .B #define GD_64BIT_API
 .br
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "gd_off64_t gd_tell64(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 This version of
-.BR gd_tell (3)
-uses a 64-bit offset type
+.F3 gd_tell
+uses an exmplicitly 64-bit offset type
 .RB ( gd_off64_t ),
-where one is available, regardless of the size of
+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.
+It is only guaranteed to be available if
+.B GD_64BIT_API
+is defined 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).
+.B off_t
+is a 64-bit type, this function will the same as
+.F3 gd_tell .
 Otherwise,
-.BR gd_tell (3)
+.F3 gd_tell
 will be a version of this function which uses a 32-bit
-.IR off_t .
+.BR off_t .
+
 .SH SEE ALSO
-.BR gd_tell (3),
-.BR feature_test_macros (7)
+.F3 gd_tell
diff --git a/man/gd_uninclude.3 b/man/gd_uninclude.3
index fb54b1b..80fdd10 100644
--- a/man/gd_uninclude.3
+++ b/man/gd_uninclude.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_uninclude.3.  The gd_uninclude man page.
 .\"
-.\" Copyright (C) 2008, 2010, 2014 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2014, 2016 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,23 +88,24 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_uninclude 3 "16 October 2014" "Version 0.9.0" "GETDATA"
+.TH gd_uninclude 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_uninclude \(em remove a format specification fragment from a dirfile
+gd_uninclude \(em remove a format specification fragment from a Dirfile
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_uninclude(DIRFILE *" dirfile ", int " fragment_index ,
 .BI "int " del );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_uninclude ()
+.FN gd_uninclude
 removes the format specification fragment indexed by
-.I fragment_index
+.ARG fragment_index
 from the specified dirfile, as well as any fragments the indicated fragment
 INCLUDEs.  Fields defined in the removed fragments will be removed from the
 dirfile.
@@ -37,82 +113,73 @@ dirfile.
 Before removing the specified fragment, all pending writes are flushed to
 .B RAW
 fields defined the the removed fragments.  If
-.I del
+.ARG del
 is zero, metadata changes will also be written to the removed fragments.  If
-.I del
+.ARG del
 is non-zero, the format specification fragments will be deleted from disk, if
 possible.  Regardless of the value of
-.IR del ,
+.ARG del ,
 binary data files associated with
 .B RAW
 fields defined in the removed fragments will not be deleted.  To delete these
 binary files, use
-.BR gd_delete (3)
+.F3 gd_delete
 before calling this function.
 
 The primary format specification (the fragment indexed by zero) cannot be
 removed from the dirfile.
+
 .SH RETURN VALUE
 On success,
-.BR gd_uninclude ()
-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
+.FN gd_uninclude
+returns zero.  On error, a negative-valued error code is returned.  Possible
+error codes are:
+.DD GD_E_ACCMODE
 The supplied dirfile was opened in read-only mode.
-.TP
-.B GD_E_ALLOC
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_INDEX
+.DD GD_E_BAD_INDEX
 The supplied fragment index was out of range, or an attempt was made to remove
 the primary format specification.
-.TP
-.B GD_E_IO
+.DD GD_E_IO
 An I/O error occurred while trying to write modified data or metadata to disk.
-.TP
-.B GD_E_PROTECTED
+.DD GD_E_PROTECTED
 The metadata of the fragment which included the removed 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).
-When finished with it, the DIRFILE object may be de-allocated with a call to
-.BR gd_close (3),
-even if the open failed.
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
 .SH NOTES
 This function re-arranges the remaining format specification fragments in some
 unspecified way, except for the primary fragment, which is guaranteed to remain
 at index zero.  Callers which cache format specification fragment indices must
 re-initialise their cache after calling this function.
 
-Unlike
-.BR gd_delete (3),
-fields which depend on fields removed by this function are not automatically
-updated, nor is any check made to ensure that this function does not leave
-fields with missing input fields.  Because of this, a fragment inclusion may be
-easily moved from one fragment to another with a combination of
-.BR gd_uninclude ()
-and
-.BR gd_include (3).
-However, if such checks are required, use
-.BR gd_delete (3)
-to delete the fields defined in the removed fragments first.
+.SH HISTORY
+The
+.FN dirfile_uninclude
+function appeared in GetData-0.5.0.
+
+In GetData-0.7.0, this function was renamed to
+.FN gd_uninclude .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR gd_delete (3),
-.BR gd_include (3),
-.BR gd_open (3),
-.BR gd_reference (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_fragmentname (3),
-.BR gd_nfragments (3),
-.BR dirfile (5),
-.BR dirfile-encoding (5),
-.BR dirfile-format (5)
+.F3 gd_delete ,
+.F3 gd_include ,
+.F3 gd_open ,
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_fragmentname ,
+.F3 gd_nfragments ,
+.F3 gd_reference ,
+dirfile(5), dirfile-encoding(5), dirfile-format(5)
diff --git a/man/gd_validate.3 b/man/gd_validate.3
index 4501a6a..c1e55ee 100644
--- a/man/gd_validate.3
+++ b/man/gd_validate.3
@@ -1,6 +1,81 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_validate.3.  The gd_validate man page.
 .\"
-.\" Copyright (C) 2009, 2010, 2011 D. V. Wiebe
+.\" Copyright (C) 2009, 2010, 2011, 2016 D.V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,72 +88,82 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_validate 3 "19 August 2011" "Version 0.8.0" "GETDATA"
+.TH gd_validate 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
-gd_validate \(em check a dirfile field code for validity
+gd_validate \(em check a Dirfile field code for validity
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_validate(DIRFILE *" dirfile ", const char *" field_code );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_validate ()
+.FN gd_validate
 function queries a dirfile(5) database specified by
-.I dirfile
+.ARG dirfile
 and checks whether
-.IR field_code ,
+.ARG field_code ,
 which may contain a representation suffix, specifies a valid field.
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 This function checks whether the field and its input fields (if any) are found,
-whether the representation suffix (if any) is valid, and also that all
-non-literal parameters specify valid scalar fields.
+and also that all non-literal parameters specify valid scalar fields.
 
 .SH RETURN VALUE
 If all checks pass,
-.BR gd_validate ()
-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_BAD_CODE
+.FN gd_validate
+returns zero.  On error, it returns a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_BAD_CODE
 The field specified by
-.I field_code
+.ARG field_code
 or one of the fields it uses as input was not found in the database.
-.TP
-.B GD_E_BAD_DIRFILE
+.DD GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_SCALAR
+.DD 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
+.DD GD_E_DIMENSION
 A scalar field was found where a vector field was expected.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
 .SH NOTES
 It is not necessary to call this function before passing a field code to another
 GetData function: all functions which accept field codes perform these checks
 themselves.
+
+.SH HISTORY
+The
+.F3 dirfile_validate
+function appared in GetData-0.6.0.
+
+In GetData-0.7.0, this function was renamed to
+.F3 gd_validate .
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .SH SEE ALSO
-.BR dirfile (5),
-.BR gd_getdata (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
-.BR gd_open (3)
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_getdata ,
+.F3 gd_open ,
+dirfile(5)
diff --git a/man/gd_verbose_prefix.3 b/man/gd_verbose_prefix.3
index 00d3c36..4de93fd 100644
--- a/man/gd_verbose_prefix.3
+++ b/man/gd_verbose_prefix.3
@@ -1,3 +1,78 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
 .\" gd_verbose_prefix.3.  The gd_verbose_prefix man page.
 .\"
 .\" Copyright (C) 2012, 2016 D. V. Wiebe
@@ -13,31 +88,32 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_verbose_prefix 3 "12 May 2016" "Version 0.9.3" "GETDATA"
+.TH gd_verbose_prefix 3 "25 December 2016" "Version 0.10.0" "GETDATA"
+
 .SH NAME
 gd_verbose_prefix \(em set the prefix on error messages printed by GetData
+
 .SH SYNOPSIS
+.SC
 .B #include <getdata.h>
 .HP
-.nh
-.ad l
 .BI "int gd_verbose_prefix(DIRFILE *" dirfile ", const char *" prefix );
-.hy
-.ad n
+.EC
+
 .SH DESCRIPTION
 The
-.BR gd_verbose_prefix ()
+.FN gd_verbose_prefix
 sets the prefix printed before error messages output by the GetData library
 for the dirfile(5) database specified by
-.IR dirfile .
+.ARG dirfile .
 If
-.I prefix
+.ARG 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).
+.F3 gd_flags .
 If this flag is not set, this function still updates the prefix, but GetData
 does not use it.
 .PP
@@ -46,33 +122,42 @@ If
 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)),
+.F3 gd_error_string ),
 followed by a newline.  All output goes to the caller's standard error
 .RB ( stderr (3)).
 
 The 
-.I dirfile
+.ARG dirfile
 argument must point to a valid DIRFILE object previously created by a call to
-.BR gd_open (3).
+.F3 gd_open .
 
 .SH RETURN VALUE
 Upon successful completion,
-.BR gd_verbose_prefix ()
-returns 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
+.FN gd_verbose_prefix
+returns zero.  On error, it returns a negative-valued error code.  Possible
+error codes are:
+.DD GD_E_ALLOC
 The library was unable to allocate memory.
 .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).
+The error code is also stored in the
+.B DIRFILE
+object and may be retrieved after this function returns by calling
+.F3 gd_error .
+A descriptive error string for the error may be obtained by calling
+.F3 gd_error_string .
+
+.SH HISTORY
+The
+.FN gd_verbose_prefix
+function appared in GetData-0.8.0.
+
+In GetData-0.10.0, the error return from this function changed from -1 to a
+negative-valued error code.
+
 .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).
+.F3 gd_error ,
+.F3 gd_error_string ,
+.F3 gd_flags ,
+.F3 gd_open ,
+.F3 stderr ,
+dirfile(5)
diff --git a/man/header.tmac b/man/header.tmac
new file mode 100644
index 0000000..b02aa02
--- /dev/null
+++ b/man/header.tmac
@@ -0,0 +1,75 @@
+.\" header.tmac.  GetData manual macros.
+.\"
+.\" Copyright (C) 2016 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.
+
+.\" Format a function name with optional trailer: func_name()trailer
+.de FN \" func_name [trailer]
+.nh
+.BR \\$1 ()\\$2
+.hy
+..
+
+.\" Format a reference to section 3 of the manual: name(3)trailer
+.de F3 \" func_name [trailer]
+.nh
+.BR \\$1 (3)\\$2
+.hy
+..
+
+.\" Format the header of a list of definitons
+.de DD \" name alt...
+.ie "\\$2"" \{ \
+.TP 8
+.PD
+.B \\$1 \}
+.el \{ \
+.PP
+.B \\$1
+.PD 0
+.DD \\$2 \\$3 \}
+..
+
+.\" Start a code block: Note: groff defines an undocumented .SC for
+.\" Bell Labs man legacy reasons.
+.de SC
+.fam C
+.na
+.nh
+..
+
+.\" End a code block
+.de EC
+.hy
+.ad
+.fam
+..
+
+.\" Format a structure pointer member: struct->member\fRtrailer
+.de SPM \" struct member trailer
+.nh
+.ie "\\$3"" .IB \\$1 ->\: \\$2
+.el .IB \\$1 ->\: \\$2\fR\\$3
+.hy
+..
+
+.\" Format a function argument
+.de ARG \" name trailer
+.nh
+.ie "\\$2"" .I \\$1
+.el .IR \\$1 \\$2
+.hy
+..
+
+.\" Hyphenation exceptions
+.hw sarray carray lincom linterp
diff --git a/src/Makefile.am b/src/Makefile.am
index 43b96ca..257b08c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -139,11 +139,13 @@ libgetdata_la_LDFLAGS = $(EXPORT_DYNAMIC) -export-symbols-regex '^[^_]' \
 												-version-info \
 												${GETDATA_IFACE_VERSION}:${GETDATA_IMPL_REVISION}:${GETDATA_IFACE_AGE} \
 												$(EXTERNAL_LDFLAGS) $(EXTERNAL_LIBS)
-libgetdata_la_LIBADD = $(LIBLTDL) $(DLOPEN_LIBGETDATASLIM_LA) \
-											 $(DLOPEN_LIBGETDATAGZIP_LA) 
-											 $(DLOPEN_LIBGETDATABZIP2_LA) \
-											 $(DLOPEN_LIBGETDATALZMA_LA) $(DLOPEN_LIBGETDATAZZIP_LA) \
-											 $(DLOPEN_LIBGETDATAZZSLIM_LA) $(DLOPEN_LIBGETDATAFLAC_LA)
+libgetdata_la_LIBADD = $(LIBLTDL) $(DLOPEN_LIBGETDATABZIP2_LA) \
+											 $(DLOPEN_LIBGETDATAFLAC_LA) \
+											 $(DLOPEN_LIBGETDATAGZIP_LA) \
+											 $(DLOPEN_LIBGETDATALZMA_LA) \
+											 $(DLOPEN_LIBGETDATASLIM_LA) \
+											 $(DLOPEN_LIBGETDATAZZIP_LA) \
+											 $(DLOPEN_LIBGETDATAZZSLIM_LA)
 
 libgetdataslim_la_SOURCES = slim.c
 libgetdataslim_la_LDFLAGS = $(SLIM_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
diff --git a/src/Makefile.in b/src/Makefile.in
index 337022f..5775b1d 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -141,12 +141,25 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(moduledir)" \
 	"$(DESTDIR)$(includedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES) $(module_LTLIBRARIES)
 am__DEPENDENCIES_1 =
- at USE_MODULES_TRUE@@USE_SLIM_TRUE at am__DEPENDENCIES_2 =  \
- at USE_MODULES_TRUE@@USE_SLIM_TRUE@	libgetdataslim.la
- at USE_GZIP_TRUE@@USE_MODULES_TRUE at am__DEPENDENCIES_3 =  \
+ at USE_BZIP2_TRUE@@USE_MODULES_TRUE at am__DEPENDENCIES_2 =  \
+ at USE_BZIP2_TRUE@@USE_MODULES_TRUE@	libgetdatabzip2.la
+ at USE_FLAC_TRUE@@USE_MODULES_TRUE at am__DEPENDENCIES_3 =  \
+ at USE_FLAC_TRUE@@USE_MODULES_TRUE@	libgetdataflac.la
+ at USE_GZIP_TRUE@@USE_MODULES_TRUE at am__DEPENDENCIES_4 =  \
 @USE_GZIP_TRUE@@USE_MODULES_TRUE@	libgetdatagzip.la
+ at USE_LZMA_TRUE@@USE_MODULES_TRUE at am__DEPENDENCIES_5 =  \
+ at USE_LZMA_TRUE@@USE_MODULES_TRUE@	libgetdatalzma.la
+ at USE_MODULES_TRUE@@USE_SLIM_TRUE at am__DEPENDENCIES_6 =  \
+ at USE_MODULES_TRUE@@USE_SLIM_TRUE@	libgetdataslim.la
+ at USE_MODULES_TRUE@@USE_ZZIP_TRUE at am__DEPENDENCIES_7 =  \
+ at USE_MODULES_TRUE@@USE_ZZIP_TRUE@	libgetdatazzip.la
+ at USE_MODULES_TRUE@@USE_ZZSLIM_TRUE at am__DEPENDENCIES_8 =  \
+ at USE_MODULES_TRUE@@USE_ZZSLIM_TRUE@	libgetdatazzslim.la
 libgetdata_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3)
+	$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \
+	$(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \
+	$(am__DEPENDENCIES_6) $(am__DEPENDENCIES_7) \
+	$(am__DEPENDENCIES_8)
 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 flac.c flimits.c flush.c fragment.c \
@@ -350,6 +363,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
@@ -632,8 +647,13 @@ libgetdata_la_LDFLAGS = $(EXPORT_DYNAMIC) -export-symbols-regex '^[^_]' \
 												${GETDATA_IFACE_VERSION}:${GETDATA_IMPL_REVISION}:${GETDATA_IFACE_AGE} \
 												$(EXTERNAL_LDFLAGS) $(EXTERNAL_LIBS)
 
-libgetdata_la_LIBADD = $(LIBLTDL) $(DLOPEN_LIBGETDATASLIM_LA) \
-											 $(DLOPEN_LIBGETDATAGZIP_LA) 
+libgetdata_la_LIBADD = $(LIBLTDL) $(DLOPEN_LIBGETDATABZIP2_LA) \
+											 $(DLOPEN_LIBGETDATAFLAC_LA) \
+											 $(DLOPEN_LIBGETDATAGZIP_LA) \
+											 $(DLOPEN_LIBGETDATALZMA_LA) \
+											 $(DLOPEN_LIBGETDATASLIM_LA) \
+											 $(DLOPEN_LIBGETDATAZZIP_LA) \
+											 $(DLOPEN_LIBGETDATAZZSLIM_LA)
 
 libgetdataslim_la_SOURCES = slim.c
 libgetdataslim_la_LDFLAGS = $(SLIM_LDFLAGS) -release $(GETDATA_LIB_VERSION) \
@@ -1257,9 +1277,6 @@ 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) $(DLOPEN_LIBGETDATAFLAC_LA)
 
 clean-local:
 	rm -rf *~ getdata.pc *.gcno
diff --git a/src/add.c b/src/add.c
index 66476ed..d298fdc 100644
--- a/src/add.c
+++ b/src/add.c
@@ -23,11 +23,10 @@
 int _GD_InvalidEntype(gd_entype_t t) {
   dtrace("0x%X", t);
 
-  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)
+  if (((t & GD_SCALAR_ENTRY_BIT) == 0 &&
+        (t < GD_RAW_ENTRY || t > GD_SINDIR_ENTRY))
+      || ((t & GD_SCALAR_ENTRY_BIT) &&
+        (t < GD_CONST_ENTRY || t > GD_SARRAY_ENTRY)))
   {
     dreturn("%i", -1);
     return -1;
@@ -37,58 +36,82 @@ int _GD_InvalidEntype(gd_entype_t t) {
   return 0;
 }
 
+int _GD_BadType(int standards, gd_type_t type)
+{
+  int bad = 1;
+  const int size = GD_SIZE(type);
+  const int bits = type - size;
+
+  dtrace("%i, 0x%X", standards, type);
+
+  if (bits == 0 && (size == 1 || size == 2 || size == 4 ||
+        (standards >= 5 && size == 8)))
+  {
+    bad = 0;
+  } else if (bits == GD_SIGNED && (size == 2 || size == 4 ||
+        (standards >= 5 && (size == 1 || size == 8))))
+  {
+    bad = 0;
+  } else if (bits == GD_IEEE754 && (size == 4 || size == 8))
+    bad = 0;
+  else if (standards >= 8 && bits == GD_COMPLEX && (size == 8 || size == 16))
+    bad = 0;
+
+  dreturn("%i", bad);
+  return bad;
+}
+
 static gd_entry_t *_GD_FixName(DIRFILE *restrict D, char **restrict buffer,
-    const char *name, int frag, int *restrict offset)
+    size_t *restrict len, const char *name, int frag, size_t *restrict offset)
 {
   gd_entry_t *P;
   char *ptr;
   struct parser_state p;
+  const unsigned flags =
+    GD_CO_NAME | GD_CO_ERROR | ((D->standards <= 5) ? GD_CO_EARLY : 0);
 
-  dtrace("%p, %p, \"%s\", %i, %p", D, buffer, name, frag, offset);
+  dtrace("%p, %p, %p, \"%s\", %i, %p", D, buffer, len, name, frag, offset);
 
   /* Check prefix and suffix */
-  if (_GD_CheckCodeAffixes(D, name, frag, 1)) {
+  if (_GD_CheckCodeAffixes(D, name, frag, flags)) {
     dreturn("%p", NULL);
     return NULL;
   }
     
-  *buffer = ptr = _GD_Strdup(D, name);
+  *buffer = ptr = _GD_Malloc(D, *len + 1);
 
   if (ptr == NULL) {
-    free(ptr);
     dreturn("%p", NULL);
     return NULL;
   }
 
+  memcpy(ptr, name, *len + 1);
   _GD_SimpleParserInit(D, NULL, &p);
-  P = _GD_CheckParent(D, &p, &ptr, -1);
-
-  if (D->error) {
-    free(*buffer);
-    dreturn("%p", NULL);
-    return NULL;
-  }
+  P = _GD_CheckParent(D, &p, &ptr, len, -1);
 
   if (P) {
-    char *temp2;
+    char *name_out;
+
     /* 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) {
+    *offset = P->e->len + 1;
+    name_out = _GD_Malloc(D, *offset + *len + 1);
+    if (name_out == NULL) {
       free(*buffer);
       dreturn("%p", NULL);
       return NULL;
     }
 
-    sprintf(temp2, "%s/%s", P->field, ptr);
+    memcpy(name_out, P->field, *offset - 1);
+    name_out[*offset - 1] = '/';
+    memcpy(name_out + *offset, ptr, *len + 1); /* including trailing NUL */
+    *len += P->e->len + 1;
     free(*buffer);
-    *buffer = temp2;
+    *buffer = name_out;
   } else
     *offset = 0;
 
-  dreturn("%p (\"%s\", %i)", P, *buffer, *offset);
+  dreturn("%p (\"%s\", %" PRIuSIZE ")", P, *buffer, *offset);
   return P;
 }
 
@@ -98,6 +121,7 @@ static unsigned _GD_CopyScalars(DIRFILE *restrict D,
     gd_entry_t *restrict E, const gd_entry_t *restrict entry, unsigned mask)
 {
   unsigned mask_out = 0;
+  const unsigned flags = GD_CO_ERROR | ((D->standards <= 5) ? GD_CO_EARLY : 0);
   int i;
 
   dtrace("%p, %p, %p, 0x%X", D, E, entry, mask);
@@ -110,8 +134,11 @@ static unsigned _GD_CopyScalars(DIRFILE *restrict D,
       E->scalar[i] = NULL;
     } else {
       /* check for correct affixes */
-      if (_GD_CheckCodeAffixes(D, entry->scalar[i], entry->fragment_index, 1))
+      if (_GD_CheckCodeAffixes(D, entry->scalar[i], entry->fragment_index,
+            flags))
+      {
         break;
+      }
 
       /* when using early Standards, reject ambiguous field codes */
       if (entry->scalar_ind[i] == -1 && !(D->flags & GD_NOSTANDARD) &&
@@ -136,22 +163,28 @@ static unsigned _GD_CopyScalars(DIRFILE *restrict D,
   return mask_out;
 }
 
-/* add an entry - returns the added entry on success. */
+/* add an entry - returns the added entry on success.  If the new entry
+ * is scalar and init_scalar is non-zero then the scalar is intialised
+ * with the default value (0 or ""). */
 static gd_entry_t *_GD_Add(DIRFILE *restrict D,
-    const gd_entry_t *restrict entry, const char *restrict parent)
+    const gd_entry_t *restrict entry, const char *restrict parent,
+    int init_scalar)
 {
-  char *temp_buffer;
-  int i, is_dot, offset;
+  char *name;
+  int i;
   void *new_list;
   void *new_ref = NULL;
+  size_t z, subfield_offs, len =  strlen(entry->field);
   unsigned int u;
   unsigned mask;
   gd_entry_t *E;
   gd_entry_t *P = NULL;
 
-  dtrace("%p, %p, \"%s\"", D, entry, parent);
+  /* Flags used by both StripCode and CheckCodeAffixes */
+  const unsigned flags = GD_CO_NSALL | GD_CO_ASSERT | GD_CO_ERROR |
+    ((D->standards <= 5) ? GD_CO_EARLY : 0);
 
-  _GD_ClearError(D);
+  dtrace("%p, %p, \"%s\", %i", D, entry, parent, init_scalar);
 
   /* check access mode */
   if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
@@ -169,39 +202,49 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
     return NULL;
   }
 
+  /* check for bad field type */
+  if (_GD_InvalidEntype(entry->field_type)) {
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_TYPE, NULL, entry->field_type,
+        NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
   /* check parent */
   if (parent != NULL) {
-    P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+    P = _GD_FindField(D, parent, strlen(parent), D->entry, D->n_entries, 0,
+        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 (P->e->n_meta == -1) {
+    /* make sure it's not a meta field already or an alias */
+    if (P->e->n_meta == -1 || P->field_type == GD_ALIAS_ENTRY) {
       _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
       dreturn("%p", NULL);
       return NULL;
     }
 
     /* make name */
-    offset = strlen(parent) + 1;
-    temp_buffer = (char *)_GD_Malloc(D, offset + strlen(entry->field) + 1);
+    subfield_offs = P->e->len + 1;
+    name = _GD_Malloc(D, subfield_offs + len + 1);
 
-    if (temp_buffer == NULL) {
+    if (name == NULL) {
       dreturn("%p", NULL);
       return NULL;
     }
 
-    strcpy(temp_buffer, parent);
-    temp_buffer[offset - 1] = '/';
-    strcpy(temp_buffer + offset, entry->field);
+    memcpy(name, parent, P->e->len);
+    name[subfield_offs - 1] = '/';
+    memcpy(name + subfield_offs, entry->field, len + 1);
+    len += subfield_offs;
   } 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);
+    P = _GD_FixName(D, &name, &len, entry->field, entry->fragment_index,
+        &subfield_offs);
 
     if (D->error) {
       dreturn("%p", NULL);
@@ -210,26 +253,17 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
   }
 
   /* check for duplicate field */
-  if (_GD_FindField(D, temp_buffer, D->entry, D->n_entries, 0, &u)) {
-    _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, temp_buffer);
-    free(temp_buffer);
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  /* check for bad field type */
-  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);
+  if (_GD_FindField(D, name, len, D->entry, D->n_entries, 0, &u)) {
+    _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, name);
+    free(name);
     dreturn("%p", NULL);
     return NULL;
   }
 
   /* New entry */
-  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
+  E = _GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    free(temp_buffer);
+    free(name);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -244,29 +278,43 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
     _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
         D->fragment[E->fragment_index].cname);
     free(E);
-    free(temp_buffer);
+    free(name);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
-      sizeof(struct gd_private_entry_));
+  E->e = _GD_Malloc(D, sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
     free(E);
-    free(temp_buffer);
+    free(name);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = entry->field_type;
-  E->field = temp_buffer;
-  E->flags = entry->flags & GD_EN_HIDDEN; /* it's possible to hide a newly
-                                             added field this way */
+  E->field = name;
+  E->e->len = len;
+
+  /* GD_EN_HIDDEN is the only flag we honour in the input entry */
+  E->flags = entry->flags & GD_EN_HIDDEN;
+
+  /* Figure out the length of the attached namespace in the supplied field
+   * name.  If P is non-NULL, then there can't be a namespace because
+   * we're only checking the subfield name */
+  if (D->standards >= 10 && P == NULL) {
+    const char *dot, *slash;
+    _GD_SlashDot(E->field, strlen(E->field), GD_CO_NAME, &dot, &slash);
+    if (dot)
+      z = dot - E->field + 1;
+    else
+      z = 0;
+  } else
+    z = 0;
 
   /* Check */
-  if (_GD_ValidateField(E->field + offset, D->standards, 1, GD_VF_CODE,
-        &is_dot))
+  if (_GD_ValidateField(E->field + subfield_offs, z, D->standards, 1,
+        GD_VF_NAME))
   {
     _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, entry->field);
     _GD_FreeE(D, E, 1);
@@ -274,13 +322,15 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
     return NULL;
   }
 
+  if (D->standards <= 5)
+    E->flags |= GD_EN_EARLY;
+
   /* Set meta indices */
   if (P != NULL)
     E->e->n_meta = -1;
 
   /* Validate entry and add auxiliary data */
-  switch(entry->field_type)
-  {
+  switch(entry->field_type) {
     case GD_RAW_ENTRY:
       /* no METARAW fields allowed */
       if (P != NULL) {
@@ -300,19 +350,14 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
       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, 0,
-          D->fragment[entry->fragment_index].prefix,
-          D->fragment[entry->fragment_index].suffix, NULL, NULL, E->field,
-          NULL, NULL, GD_MC_RQ_PARTS);
-      if (D->error)
-        break;
+      E->e->u.raw.filebase = _GD_StripCode(D, entry->fragment_index, E->field,
+          flags);
 
       mask = _GD_CopyScalars(D, E, entry, 0x1);
 
       if (!(mask & 1) && (E->EN(raw,spf) = entry->EN(raw,spf)) == 0)
         _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_SPF, NULL, 0, NULL);
-      else if (E->EN(raw,data_type) & 0x40 || (E->e->u.raw.size =
-            GD_SIZE(E->EN(raw,data_type))) == 0)
+      else if (_GD_BadType(D->standards, E->EN(raw,data_type)))
         _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, entry->EN(raw,data_type),
             NULL);
       else if (_GD_InitRawIO(D, E, NULL, -1, NULL, 0,
@@ -332,7 +377,8 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
             E->EN(lincom,n_fields), NULL);
       
       for (i = 0; i < E->EN(lincom,n_fields); ++i)
-        _GD_CheckCodeAffixes(D, entry->in_fields[i], entry->fragment_index, 1);
+        _GD_CheckCodeAffixes(D, entry->in_fields[i], entry->fragment_index,
+            flags);
 
       if (D->error)
         break;
@@ -370,7 +416,7 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
       E->e->u.linterp.table_len = -1;
 
       if (_GD_CheckCodeAffixes(D, entry->in_fields[0], entry->fragment_index,
-            1))
+            flags))
       {
         break;
       }
@@ -380,19 +426,19 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
-      if (_GD_CheckCodeAffixes(D, entry->in_fields[0], entry->fragment_index,
-            1) || _GD_CheckCodeAffixes(D, entry->in_fields[1],
-              entry->fragment_index, 1))
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
+      if (!_GD_CheckCodeAffixes(D, entry->in_fields[0], entry->fragment_index,
+            flags) && !_GD_CheckCodeAffixes(D, entry->in_fields[1],
+              entry->fragment_index, flags))
       {
-        break;
+        E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+        E->in_fields[1] = _GD_Strdup(D, entry->in_fields[1]);
       }
-
-      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 (_GD_CheckCodeAffixes(D, entry->in_fields[0], entry->fragment_index,
-            1))
+            flags))
       {
         break;
       }
@@ -417,7 +463,7 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
       E->EN(bit,bitnum) = entry->EN(bit,bitnum);
 
       if (_GD_CheckCodeAffixes(D, entry->in_fields[0], entry->fragment_index,
-            1))
+            flags))
       {
         break;
       }
@@ -440,7 +486,7 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
       E->EN(phase,shift) = entry->EN(phase,shift);
 
       if (_GD_CheckCodeAffixes(D, entry->in_fields[0], entry->fragment_index,
-            1))
+            flags))
       {
         break;
       }
@@ -454,27 +500,30 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
       E->EN(window,threshold) = entry->EN(window,threshold);
 
       if (_GD_CheckCodeAffixes(D, entry->in_fields[0], entry->fragment_index,
-            1) || _GD_CheckCodeAffixes(D, entry->in_fields[1],
-              entry->fragment_index, 1))
+            flags) || _GD_CheckCodeAffixes(D, entry->in_fields[1],
+              entry->fragment_index, flags))
       {
         break;
       }
 
+      if (_GD_BadWindop(E->EN(window,windop))) {
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_WINDOP, NULL,
+            entry->EN(window,windop), NULL);
+        break;
+      }
+
       _GD_CopyScalars(D, E, entry, 0x1);
 
       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);
       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, entry->in_fields[0], entry->fragment_index,
-            1) || _GD_CheckCodeAffixes(D, entry->in_fields[1],
-              entry->fragment_index, 1))
+            flags) || _GD_CheckCodeAffixes(D, entry->in_fields[1],
+              entry->fragment_index, flags))
       {
         break;
       }
@@ -488,20 +537,18 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
       if (!(mask & 2) && entry->EN(mplex,period) < 0)
         _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_PERIOD, NULL,
             entry->EN(mplex,period), NULL);
+
       break;
     case GD_CONST_ENTRY:
       E->EN(scalar,const_type) = entry->EN(scalar,const_type);
       E->EN(scalar,array_len) = -1;
 
-      if (E->EN(scalar,const_type) & 0x40 || GD_SIZE(E->EN(scalar,const_type))
-          == 0)
-      {
+      if (_GD_BadType(D->standards, E->EN(scalar,const_type)))
         _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, E->EN(scalar,const_type), NULL);
-      } else {
+      else {
         size_t size = GD_SIZE(_GD_ConstType(D, E->EN(scalar,const_type)));
-        if (!D->error)
-          E->e->u.scalar.d = _GD_Malloc(D, size);
-        if (E->e->u.scalar.d)
+        E->e->u.scalar.d = _GD_Malloc(D, size);
+        if (init_scalar && E->e->u.scalar.d)
           memset(E->e->u.scalar.d, 0, size);
       }
       break;
@@ -509,38 +556,46 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
       E->EN(scalar,const_type) = entry->EN(scalar,const_type);
       E->EN(scalar,array_len) = entry->EN(scalar,array_len);
 
-      if (E->EN(scalar,const_type) & 0x40 || GD_SIZE(E->EN(scalar,const_type))
-          == 0)
-      {
+      if (_GD_BadType(D->standards, E->EN(scalar,const_type)))
         _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, E->EN(scalar,const_type), NULL);
-      } else {
+      else {
         size_t size = GD_SIZE(_GD_ConstType(D, E->EN(scalar,const_type))) *
           E->EN(scalar,array_len);
-        if (!D->error)
-          E->e->u.scalar.d = _GD_Malloc(D, size);
-        if (E->e->u.scalar.d)
+        E->e->u.scalar.d = _GD_Malloc(D, size);
+        if (init_scalar && E->e->u.scalar.d)
           memset(E->e->u.scalar.d, 0, size);
       }
       break;
+    case GD_SARRAY_ENTRY:
+      E->EN(scalar,array_len) = entry->EN(scalar,array_len);
+
+      if (init_scalar) {
+        E->e->u.scalar.d = _GD_Malloc(D,
+            sizeof(const char *) * E->EN(scalar,array_len));
+        if (E->e->u.scalar.d)
+          for (z = 0; z < E->EN(scalar,array_len); ++z)
+            ((const char**)E->e->u.scalar.d)[z] = _GD_Strdup(D, "");
+      }
+      break;
     case GD_STRING_ENTRY:
-      E->e->u.string = _GD_Strdup(D, "");
+      if (init_scalar)
+        E->e->u.string = _GD_Strdup(D, "");
       break;
     case GD_POLYNOM_ENTRY:
-      E->EN(polynom,poly_ord) = entry->EN(polynom,poly_ord);
-
-      if (E->EN(polynom,poly_ord) < 1 || E->EN(polynom,poly_ord) >
+      if (entry->EN(polynom,poly_ord) < 1 || entry->EN(polynom,poly_ord) >
           GD_MAX_POLYORD)
       {
         _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL,
-            E->EN(polynom,poly_ord), NULL);
-      } else {
-        _GD_CheckCodeAffixes(D, entry->in_fields[0], entry->fragment_index, 1);
-        _GD_CheckCodeAffixes(D, entry->in_fields[1], entry->fragment_index, 1);
-      }
+            entry->EN(polynom,poly_ord), NULL);
+      } else
+        _GD_CheckCodeAffixes(D, entry->in_fields[0], entry->fragment_index,
+            flags);
 
       if (D->error)
         break;
 
+      E->EN(polynom,poly_ord) = entry->EN(polynom,poly_ord);
+
       _GD_CopyScalars(D, E, entry, (1 << (E->EN(polynom,poly_ord) + 1)) - 1);
 
       if (entry->flags & GD_EN_COMPSCAL) {
@@ -585,19 +640,6 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
   }
   D->entry = (gd_entry_t **)new_list;
 
-  if (is_dot) {
-    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(D, E, 1);
-      dreturn("%p", NULL);
-      return NULL;
-    }
-    E->flags |= GD_EN_DOTTED;
-    D->dot_list = (gd_entry_t **)new_list;
-  }
-
   if (P) {
     void *ptr = _GD_Realloc(D, P->e->p.meta_entry, (P->e->n_meta + 1) *
         sizeof(gd_entry_t*));
@@ -628,7 +670,7 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
       /* 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 = (char *)strdup((const char*)new_ref);
+          D->fragment[i].ref_name = strdup((const char*)new_ref);
           D->fragment[i].modified = 1;
         } else
           break;
@@ -640,12 +682,6 @@ static gd_entry_t *_GD_Add(DIRFILE *restrict D,
     }
   }
 
-  /* 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*), _GD_EntryCmp);
-  }
-
   /* add the entry and resort the entry list */
   _GD_InsertSort(D, E, u);
   D->n_entries++;
@@ -671,146 +707,106 @@ static int _GD_AddSpec(DIRFILE* D, const char* line, const char* parent,
 
   dtrace("%p, \"%s\", \"%s\", %i, \"%s\"", D, line, parent, me, name);
 
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  /* 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  _GD_ClearError(D);
+  if ((D->flags & GD_ACCMODE) == GD_RDONLY)
+    GD_SET_RETURN_ERROR(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
 
   if (parent) {
     /* 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, GD_E_CODE_MISSING, NULL, 0, parent);
-      dreturn("%i", -1);
-      return -1;
-    }
-    me = E->fragment_index;
-  } else {
-    /* check for fragment index out of range */
-    if (me < 0 || me >= D->n_fragment) {
-      _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, me, NULL);
-      dreturn("%i", -1);
-      return -1;
-    }
-  }
+    E = _GD_FindField(D, parent, strlen(parent), D->entry, D->n_entries, 0,
+        NULL);
+    if (E == NULL)
+      GD_SET_RETURN_ERROR(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
+    else
+      me = E->fragment_index;
+  } else if (me < 0 || me >= D->n_fragment) /* fragment index out of range */
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_INDEX, 0, NULL, me, NULL);
 
   /* check protection */
-  if (D->fragment[me].protection & GD_PROTECT_FORMAT) {
-    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+  if (D->fragment[me].protection & GD_PROTECT_FORMAT)
+    GD_SET_RETURN_ERROR(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
         D->fragment[me].cname);
-    dreturn("%i", -1);
-    return -1;
-  }
   
   /* start parsing */
   _GD_SimpleParserInit(D, name, &p);
   n_cols = _GD_Tokenise(D, &p, line, &outstring, &tok_pos, MAX_IN_COLS,
       in_cols);
 
-  /* Directive parsing is skipped -- The Field Spec parser will add the field */
-  if (!D->error)
-    _GD_ParseFieldSpec(D, &p, n_cols, in_cols, E, me, 1, 1, &outstring,
-        tok_pos);
+  if (!D->error) {
+    if (n_cols < 2) /* Sanity check */
+      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, name, 0, NULL);
+    else /* The Field Spec parser will add the field */
+      _GD_ParseFieldSpec(D, &p, n_cols, in_cols, strlen(in_cols[0]), E, me, 1,
+          1, &outstring, tok_pos);
+  }
 
   free(outstring);
 
-  if (D->error) {
-    dreturn("%i", -1); /* parser threw an error */
-    return -1;
-  }
+  if (D->error)
+    GD_RETURN_ERROR(D);
 
   /* Update aliases */
   _GD_UpdateAliases(D, 0);
 
   D->fragment[me].modified = 1;
   D->flags &= ~GD_HAVE_VERSION;
-  dreturn("%i", 0);
-  return 0;
+  dreturn("%i", GD_E_OK);
+  return GD_E_OK;
 }
 
 int gd_madd_spec(DIRFILE* D, const char* line, const char *parent)
 {
-  int ret;
-
   dtrace("%p, \"%s\", \"%s\"", D, line, parent);
 
-  ret = _GD_AddSpec(D, line, parent, 0, "gd_madd_spec()");
+  _GD_AddSpec(D, line, parent, 0, "gd_madd_spec()");
 
-  dreturn("%i", ret);
-  return ret;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a field by parsing a field spec */
 int gd_add_spec(DIRFILE* D, const char* line, int fragment_index)
 {
-  int ret;
-
   dtrace("%p, \"%s\", %i", D, line, fragment_index);
 
-  ret = _GD_AddSpec(D, line, NULL, fragment_index, "gd_add_spec()");
+  _GD_AddSpec(D, line, NULL, fragment_index, "gd_add_spec()");
 
-  dreturn("%i", ret);
-  return ret;
+  GD_RETURN_ERROR(D);
 }
 
 int gd_add(DIRFILE* D, const gd_entry_t* entry)
 {
-  int ret;
-
   dtrace("%p, %p", D, entry);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  ret = (_GD_Add(D, entry, NULL) == NULL) ? -1 : 0;
+  _GD_Add(D, entry, NULL, 1);
 
-  dreturn("%i", ret);
-  return ret;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a RAW entry */
 int gd_add_raw(DIRFILE* D, const char* field_code, gd_type_t data_type,
     unsigned int spf, int fragment_index)
 {
-  gd_entry_t R;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", 0x%X, %i, %i", D, field_code, data_type, spf,
       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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  memset(&R, 0, sizeof(gd_entry_t));
-  R.field = (char *)field_code;
-  R.field_type = GD_RAW_ENTRY;
-  R.EN(raw,spf) = spf;
-  R.EN(raw,data_type) = data_type;
-  R.fragment_index = fragment_index;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_RAW_ENTRY;
+  E.EN(raw,spf) = spf;
+  E.EN(raw,data_type) = data_type;
+  E.fragment_index = fragment_index;
 
-  if (_GD_Add(D, &R, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a LINCOM entry */
@@ -819,42 +815,32 @@ int gd_add_lincom(DIRFILE* D, const char* field_code, int n_fields,
     int fragment_index) gd_nothrow
 {
   int i;
-  gd_entry_t L;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", %i, %p, %p, %p, %i", D, field_code, n_fields, in_fields,
       m, b, 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if (n_fields < 1 || n_fields > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (n_fields < 1 || n_fields > GD_MAX_LINCOM)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields,
+        NULL);
 
-  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;
-  L.fragment_index = fragment_index;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_LINCOM_ENTRY;
+  E.EN(lincom,n_fields) = n_fields;
+  E.fragment_index = fragment_index;
 
   for (i = 0; i < n_fields; ++i) {
-    L.in_fields[i] = (char *)in_fields[i];
-    L.EN(lincom,m)[i] = m[i];
-    L.EN(lincom,b)[i] = b[i];
+    E.in_fields[i] = (char *)in_fields[i];
+    E.EN(lincom,m)[i] = m[i];
+    E.EN(lincom,b)[i] = b[i];
   }
 
-  if (_GD_Add(D, &L, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a LINCOM entry with complex scalars */
@@ -863,168 +849,126 @@ int gd_add_clincom(DIRFILE* D, const char* field_code, int n_fields,
     int fragment_index) gd_nothrow
 {
   int i;
-  gd_entry_t L;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", %i, %p, %p, %p, %i", D, field_code, n_fields, in_fields,
       cm, cb, 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if (n_fields < 1 || n_fields > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (n_fields < 1 || n_fields > GD_MAX_LINCOM)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields,
+        NULL);
 
-  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;
-  L.flags = GD_EN_COMPSCAL;
-  L.fragment_index = fragment_index;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_LINCOM_ENTRY;
+  E.EN(lincom,n_fields) = n_fields;
+  E.flags = GD_EN_COMPSCAL;
+  E.fragment_index = fragment_index;
 
   for (i = 0; i < n_fields; ++i) {
-    L.in_fields[i] = (char *)in_fields[i];
-    gd_ca2cs_(L.EN(lincom,cm)[i], cm, i);
-    gd_ca2cs_(L.EN(lincom,cb)[i], cb, i);
+    E.in_fields[i] = (char *)in_fields[i];
+    gd_ca2cs_(E.EN(lincom,cm)[i], cm, i);
+    gd_ca2cs_(E.EN(lincom,cb)[i], cb, i);
   }
 
-  if (_GD_Add(D, &L, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a LINTERP entry */
 int gd_add_linterp(DIRFILE* D, const char* field_code, const char* in_field,
     const char* table, int fragment_index) gd_nothrow
 {
-  gd_entry_t L;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", \"%s\", %i", D, field_code, in_field, table,
       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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  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 = fragment_index;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_LINTERP_ENTRY;
+  E.in_fields[0] = (char *)in_field;
+  E.EN(linterp,table) = (char *)table;
+  E.fragment_index = fragment_index;
 
-  if (_GD_Add(D, &L, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a BIT entry */
 int gd_add_bit(DIRFILE* D, const char* field_code, const char* in_field,
     int bitnum, int numbits, int fragment_index) gd_nothrow
 {
-  gd_entry_t B;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", %i, %i, %i", D, field_code, in_field, bitnum,
       numbits, 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  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;
-  B.EN(bit,bitnum) = bitnum;
-  B.EN(bit,numbits) = numbits;
-  B.fragment_index = fragment_index;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_BIT_ENTRY;
+  E.in_fields[0] = (char *)in_field;
+  E.EN(bit,bitnum) = bitnum;
+  E.EN(bit,numbits) = numbits;
+  E.fragment_index = fragment_index;
 
-  if (_GD_Add(D, &B, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a SBIT entry */
 int gd_add_sbit(DIRFILE* D, const char* field_code, const char* in_field,
     int bitnum, int numbits, int fragment_index) gd_nothrow
 {
-  gd_entry_t B;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", %i, %i, %i", D, field_code, in_field, bitnum,
       numbits, 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  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;
-  B.EN(bit,bitnum) = bitnum;
-  B.EN(bit,numbits) = numbits;
-  B.fragment_index = fragment_index;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_SBIT_ENTRY;
+  E.in_fields[0] = (char *)in_field;
+  E.EN(bit,bitnum) = bitnum;
+  E.EN(bit,numbits) = numbits;
+  E.fragment_index = fragment_index;
 
-  if (_GD_Add(D, &B, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 static int _GD_AddYoke(DIRFILE* D, gd_entype_t t, const char* field_code,
     const char* in_field1, const char* in_field2, int fragment_index) gd_nothrow
 {
-  gd_entry_t M;
+  gd_entry_t E;
 
   dtrace("%p, 0x%X, \"%s\", \"%s\", \"%s\", %i", D, t, field_code, in_field1,
       in_field2, 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  memset(&M, 0, sizeof(gd_entry_t));
-  M.field = (char *)field_code;
-  M.field_type = t;
-  M.in_fields[0] = (char *)in_field1;
-  M.in_fields[1] = (char *)in_field2;
-  M.fragment_index = fragment_index;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = t;
+  E.in_fields[0] = (char *)in_field1;
+  E.in_fields[1] = (char *)in_field2;
+  E.fragment_index = fragment_index;
 
-  if (_GD_Add(D, &M, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 int gd_add_multiply(DIRFILE* D, const char* field_code, const char* in_field1,
@@ -1041,7 +985,20 @@ int gd_add_divide(DIRFILE* D, const char* field_code, const char* in_field1,
       fragment_index);
 }
 
-/* add a RECIP entry */
+int gd_add_indir(DIRFILE* D, const char* field_code, const char* in_field1,
+    const char* in_field2, int fragment_index) gd_nothrow
+{
+  return _GD_AddYoke(D, GD_INDIR_ENTRY, field_code, in_field1, in_field2,
+      fragment_index);
+}
+
+int gd_add_sindir(DIRFILE* D, const char* field_code, const char* in_field1,
+    const char* in_field2, int fragment_index) gd_nothrow
+{
+  return _GD_AddYoke(D, GD_SINDIR_ENTRY, field_code, in_field1, in_field2,
+      fragment_index);
+}
+
 int gd_add_recip(DIRFILE* D, const char* field_code, const char* in_field,
     double dividend, int fragment_index) gd_nothrow
 {
@@ -1050,11 +1007,7 @@ int gd_add_recip(DIRFILE* D, const char* field_code, const char* in_field,
   dtrace("%p, \"%s\", \"%s\", %g, %i", D, field_code, in_field, dividend,
       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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1063,13 +1016,9 @@ int gd_add_recip(DIRFILE* D, const char* field_code, const char* in_field,
   E.in_fields[0] = (char *)in_field;
   E.fragment_index = fragment_index;
 
-  if (_GD_Add(D, &E, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 #ifndef GD_NO_C99_API
@@ -1097,11 +1046,7 @@ int gd_add_crecip89(DIRFILE* D, const char* field_code, const char* in_field,
   dtrace("%p, \"%s\", \"%s\", {%g, %g}, %i", D, field_code, in_field,
       cdividend[0], cdividend[1], 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1111,13 +1056,9 @@ int gd_add_crecip89(DIRFILE* D, const char* field_code, const char* in_field,
   E.in_fields[0] = (char *)in_field;
   E.fragment_index = fragment_index;
 
-  if (_GD_Add(D, &E, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a POLYNOM entry */
@@ -1130,17 +1071,11 @@ int gd_add_polynom(DIRFILE* D, const char* field_code, int poly_ord,
   dtrace("%p, \"%s\", %i, \"%s\", %p, %i", D, field_code, poly_ord, in_field,
       a, 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if (poly_ord < 1 || poly_ord > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (poly_ord < 1 || poly_ord > GD_MAX_POLYORD)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord,
+        NULL);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1152,13 +1087,9 @@ 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];
 
-  if (_GD_Add(D, &E, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 int gd_add_cpolynom(DIRFILE* D, const char* field_code, int poly_ord,
@@ -1170,17 +1101,11 @@ int gd_add_cpolynom(DIRFILE* D, const char* field_code, int poly_ord,
   dtrace("%p, \"%s\", %i, \"%s\", %p, %i", D, field_code, poly_ord, in_field,
       ca, 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if (poly_ord < 1 || poly_ord > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (poly_ord < 1 || poly_ord > GD_MAX_POLYORD)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord,
+        NULL);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1193,44 +1118,32 @@ int gd_add_cpolynom(DIRFILE* D, const char* field_code, int poly_ord,
   for (i = 0; i <= poly_ord; ++i)
     gd_ca2cs_(E.EN(polynom,ca)[i], ca, i);
 
-  if (_GD_Add(D, &E, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a PHASE entry */
 int gd_add_phase(DIRFILE* D, const char* field_code, const char* in_field,
-    gd_shift_t shift, int fragment_index) gd_nothrow
+    gd_int64_t shift, int fragment_index) gd_nothrow
 {
-  gd_entry_t P;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", %" PRId64 ", %i", D, field_code, in_field,
       (int64_t)shift, 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  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 = fragment_index;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_PHASE_ENTRY;
+  E.in_fields[0] = (char *)in_field;
+  E.EN(phase,shift) = shift;
+  E.fragment_index = fragment_index;
 
-  if (_GD_Add(D, &P, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a WINDOW entry */
@@ -1244,11 +1157,7 @@ int gd_add_window(DIRFILE *D, const char *field_code, const char *in_field,
       field_code, in_field, check_field, windop, threshold.r, threshold.u,
       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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1259,13 +1168,9 @@ int gd_add_window(DIRFILE *D, const char *field_code, const char *in_field,
   E.in_fields[1] = (char *)check_field;
   E.fragment_index = fragment_index;
 
-  if (_GD_Add(D, &E, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a MPLEX entry */
@@ -1278,11 +1183,7 @@ int gd_add_mplex(DIRFILE *D, const char *field_code, const char *in_field,
   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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1293,13 +1194,9 @@ int gd_add_mplex(DIRFILE *D, const char *field_code, const char *in_field,
   E.in_fields[1] = (char *)count_field;
   E.fragment_index = fragment_index;
 
-  if (_GD_Add(D, &E, NULL) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, NULL, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a STRING entry */
@@ -1307,21 +1204,17 @@ int gd_add_string(DIRFILE* D, const char* field_code, const char* value,
     int fragment_index) gd_nothrow
 {
   gd_entry_t *entry;
-  gd_entry_t S;
+  gd_entry_t E;
   char *ptr;
 
   dtrace("%p, \"%s\", \"%s\", %i", D, field_code, value, 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  memset(&S, 0, sizeof(gd_entry_t));
-  S.field = (char *)field_code;
-  S.field_type = GD_STRING_ENTRY;
-  S.fragment_index = fragment_index;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_STRING_ENTRY;
+  E.fragment_index = fragment_index;
 
   /* duplicate early, in case of failure */
   ptr = _GD_Strdup(D, value);
@@ -1330,18 +1223,14 @@ int gd_add_string(DIRFILE* D, const char* field_code, const char* value,
     return -1;
   }
 
-  entry = _GD_Add(D, &S, NULL);
+  entry = _GD_Add(D, &E, NULL, 0);
 
-  if (D->error) {
+  if (D->error)
     free(ptr);
-    dreturn("%i", -1);
-    return -1;
-  }
+  else
+    entry->e->u.string = ptr;
 
-  free(entry->e->u.string);
-  entry->e->u.string = ptr;
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a CONST entry */
@@ -1349,30 +1238,25 @@ int gd_add_const(DIRFILE* D, const char* field_code, gd_type_t const_type,
     gd_type_t data_type, const void* value, int fragment_index) gd_nothrow
 {
   gd_entry_t *entry;
-  gd_entry_t C;
+  gd_entry_t E;
 
   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 */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  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 = fragment_index;
-  entry = _GD_Add(D, &C, NULL);
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_CONST_ENTRY;
+  E.EN(scalar,const_type) = const_type;
+  E.fragment_index = fragment_index;
+  entry = _GD_Add(D, &E, NULL, 0);
 
   /* Actually store the constant, now */
   if (entry)
     _GD_DoFieldOut(D, entry, 0, 1, data_type, value);
 
-  dreturn("%i", D->error ? -1 : 0);
-  return D->error ? -1 : 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a CARRAY entry */
@@ -1381,49 +1265,89 @@ int gd_add_carray(DIRFILE* D, const char* field_code, gd_type_t const_type,
     int fragment_index) gd_nothrow
 {
   gd_entry_t *entry;
-  gd_entry_t C;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", 0x%X, %" PRIuSIZE ", 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);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_CARRAY_ENTRY;
+  E.EN(scalar,const_type) = const_type;
+  E.EN(scalar,array_len) = array_len;
+  E.fragment_index = fragment_index;
 
-  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 = fragment_index;
-  entry = _GD_Add(D, &C, NULL);
+  entry = _GD_Add(D, &E, NULL, 0);
 
   /* Actually store the carray, now */
   if (entry)
     _GD_DoFieldOut(D, entry, 0, array_len, data_type, values);
 
-  dreturn("%i", D->error ? -1 : 0);
-  return D->error ? -1 : 0;
+  GD_RETURN_ERROR(D);
 }
 
-int gd_madd(DIRFILE* D, const gd_entry_t* entry, const char* parent) gd_nothrow
+/* add a SARRAY entry */
+int gd_add_sarray(DIRFILE* D, const char* field_code, size_t array_len,
+    const char **values, int fragment_index) gd_nothrow
 {
-  int ret;
+  size_t i;
+  gd_entry_t *entry;
+  gd_entry_t E;
+  char **data;
 
-  dtrace("%p, %p, \"%s\"", D, entry, parent);
+  dtrace("%p, \"%s\", %" PRIuSIZE ", %p, %i", D, field_code, array_len, values,
+      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;
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_SARRAY_ENTRY;
+  E.EN(scalar,array_len) = array_len;
+  E.fragment_index = fragment_index;
+
+  /* duplicate early, in case of failure */
+  data = _GD_Malloc(D, array_len * sizeof(char *));
+  if (data == NULL)
+    GD_RETURN_ERROR(D);
+
+  for (i = 0; i < array_len; ++i) {
+    data[i] = _GD_Strdup(D, values[i]);
+
+    if (D->error) {
+      while (i-- > 0)
+        free(data[i]);
+      free(data);
+      GD_RETURN_ERROR(D);
+    }
+  }
+
+  entry = _GD_Add(D, &E, NULL, 0);
+
+  if (D->error) {
+    for (i = 0; i < array_len; ++i)
+      free(data[i]);
+    free(data);
+    GD_RETURN_ERROR(D);
   }
 
-  ret = (_GD_Add(D, entry, parent) == NULL) ? -1 : 0;
+  entry->e->u.scalar.d = data;
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+int gd_madd(DIRFILE* D, const gd_entry_t* entry, const char* parent) gd_nothrow
+{
+  dtrace("%p, %p, \"%s\"", D, entry, parent);
+
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  _GD_Add(D, entry, parent, 1);
 
-  dreturn("%i", ret);
-  return ret;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META LINCOM entry */
@@ -1432,44 +1356,34 @@ int gd_madd_lincom(DIRFILE* D, const char* parent, const char* field_code,
   gd_nothrow
 {
   int i;
-  gd_entry_t L;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", %i, %p, %p, %p", D, field_code, parent,
       n_fields, in_fields, m, b);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  if (n_fields < 1 || n_fields > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (n_fields < 1 || n_fields > GD_MAX_LINCOM)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields,
+        NULL);
 
-  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;
-  L.fragment_index = 0;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_LINCOM_ENTRY;
+  E.EN(lincom,n_fields) = n_fields;
+  E.fragment_index = 0;
 
   for (i = 0; i < n_fields; ++i) {
-    L.in_fields[i] = (char *)in_fields[i];
-    L.EN(lincom,m)[i] = m[i];
-    L.EN(lincom,b)[i] = b[i];
-    L.scalar[i] = NULL;
-    L.scalar[i + GD_MAX_LINCOM] = NULL;
+    E.in_fields[i] = (char *)in_fields[i];
+    E.EN(lincom,m)[i] = m[i];
+    E.EN(lincom,b)[i] = b[i];
+    E.scalar[i] = NULL;
+    E.scalar[i + GD_MAX_LINCOM] = NULL;
   }
 
-  if (_GD_Add(D, &L, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META LINCOM entry, with complex scalaras */
@@ -1478,173 +1392,131 @@ int gd_madd_clincom(DIRFILE* D, const char* parent, const char* field_code,
     const GD_DCOMPLEXP(cb)) gd_nothrow
 {
   int i;
-  gd_entry_t L;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", %i, %p, %p, %p", D, field_code, parent,
       n_fields, in_fields, cm, cb);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  if (n_fields < 1 || n_fields > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (n_fields < 1 || n_fields > GD_MAX_LINCOM)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields,
+        NULL);
 
-  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;
-  L.flags = GD_EN_COMPSCAL;
-  L.fragment_index = 0;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_LINCOM_ENTRY;
+  E.EN(lincom,n_fields) = n_fields;
+  E.flags = GD_EN_COMPSCAL;
+  E.fragment_index = 0;
 
   for (i = 0; i < n_fields; ++i) {
-    L.in_fields[i] = (char *)in_fields[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;
+    E.in_fields[i] = (char *)in_fields[i];
+    gd_ca2cs_(E.EN(lincom,cm)[i], cm, i);
+    gd_ca2cs_(E.EN(lincom,cb)[i], cb, i);
+    E.scalar[i] = NULL;
+    E.scalar[i + GD_MAX_LINCOM] = NULL;
   }
 
-  if (_GD_Add(D, &L, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META LINTERP entry */
 int gd_madd_linterp(DIRFILE* D, const char* parent,
     const char* field_code, const char* in_field, const char* table) gd_nothrow
 {
-  gd_entry_t L;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", \"%s\", \"%s\"", D, field_code, parent, in_field,
       table);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  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;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_LINTERP_ENTRY;
+  E.in_fields[0] = (char *)in_field;
+  E.EN(linterp,table) = (char *)table;
+  E.fragment_index = 0;
 
-  if (_GD_Add(D, &L, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META BIT entry */
 int gd_madd_bit(DIRFILE* D, const char* parent, const char* field_code,
     const char* in_field, int bitnum, int numbits) gd_nothrow
 {
-  gd_entry_t B;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", \"%s\", %i, %in", D, field_code, parent, in_field,
       bitnum, numbits);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  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;
-  B.EN(bit,bitnum) = bitnum;
-  B.EN(bit,numbits) = numbits;
-  B.fragment_index = 0;
-  B.scalar[0] = B.scalar[1] = NULL;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_BIT_ENTRY;
+  E.in_fields[0] = (char *)in_field;
+  E.EN(bit,bitnum) = bitnum;
+  E.EN(bit,numbits) = numbits;
+  E.fragment_index = 0;
+  E.scalar[0] = E.scalar[1] = NULL;
 
-  if (_GD_Add(D, &B, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META SBIT entry */
 int gd_madd_sbit(DIRFILE* D, const char* parent, const char* field_code,
     const char* in_field, int bitnum, int numbits) gd_nothrow
 {
-  gd_entry_t B;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", \"%s\", %i, %in", D, field_code, parent, in_field,
       bitnum, numbits);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  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;
-  B.EN(bit,bitnum) = bitnum;
-  B.EN(bit,numbits) = numbits;
-  B.fragment_index = 0;
-  B.scalar[0] = B.scalar[1] = NULL;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_SBIT_ENTRY;
+  E.in_fields[0] = (char *)in_field;
+  E.EN(bit,bitnum) = bitnum;
+  E.EN(bit,numbits) = numbits;
+  E.fragment_index = 0;
+  E.scalar[0] = E.scalar[1] = NULL;
 
-  if (_GD_Add(D, &B, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 static int _GD_MAddYoke(DIRFILE* D, gd_entype_t t, const char* parent,
     const char* field_code, const char* in_field1, const char* in_field2)
-gd_nothrow
+  gd_nothrow
 {
-  gd_entry_t M;
+  gd_entry_t E;
 
   dtrace("%p, 0x%X, \"%s\", \"%s\", \"%s\", \"%s\"", D, t, field_code, parent,
       in_field1, in_field2);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  memset(&M, 0, sizeof(gd_entry_t));
-  M.field = (char *)field_code;
-  M.field_type = t;
-  M.in_fields[0] = (char *)in_field1;
-  M.in_fields[1] = (char *)in_field2;
-  M.fragment_index = 0;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = t;
+  E.in_fields[0] = (char *)in_field1;
+  E.in_fields[1] = (char *)in_field2;
+  E.fragment_index = 0;
 
-  if (_GD_Add(D, &M, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 int gd_madd_multiply(DIRFILE* D, const char *parent, const char* field_code,
@@ -1656,34 +1528,26 @@ int gd_madd_multiply(DIRFILE* D, const char *parent, const char* field_code,
 
 /* add a META PHASE entry */
 int gd_madd_phase(DIRFILE* D, const char* parent, const char* field_code,
-    const char* in_field, gd_shift_t shift) gd_nothrow
+    const char* in_field, gd_int64_t shift) gd_nothrow
 {
-  gd_entry_t P;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", \"%s\", %" PRId64, D, field_code, parent,
       in_field, shift);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  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;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_PHASE_ENTRY;
+  E.in_fields[0] = (char *)in_field;
+  E.EN(phase,shift) = shift;
+  E.fragment_index = 0;
+  E.scalar[0] = NULL;
 
-  if (_GD_Add(D, &P, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META POLYNOM entry */
@@ -1696,17 +1560,11 @@ int gd_madd_polynom(DIRFILE* D, const char* parent, const char* field_code,
   dtrace("%p, \"%s\", \"%s\", %i, \"%s\", %p", D, field_code, parent, poly_ord,
       in_field, a);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  if (poly_ord < 1 || poly_ord > GD_MAX_POLYORD) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (poly_ord < 1 || poly_ord > GD_MAX_POLYORD)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord,
+        NULL);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1720,13 +1578,9 @@ int gd_madd_polynom(DIRFILE* D, const char* parent, const char* field_code,
     E.scalar[i] = NULL;
   }
 
-  if (_GD_Add(D, &E, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META POLYNOM entry */
@@ -1739,17 +1593,11 @@ int gd_madd_cpolynom(DIRFILE* D, const char* parent, const char* field_code,
   dtrace("%p, \"%s\", \"%s\", %i, \"%s\", %p", D, field_code, parent, poly_ord,
       in_field, ca);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  if (poly_ord < 1 || poly_ord > GD_MAX_POLYORD) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (poly_ord < 1 || poly_ord > GD_MAX_POLYORD)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord,
+        NULL);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1764,13 +1612,9 @@ int gd_madd_cpolynom(DIRFILE* D, const char* parent, const char* field_code,
     E.scalar[i] = NULL;
   }
 
-  if (_GD_Add(D, &E, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 int gd_madd_divide(DIRFILE* D, const char *parent, const char* field_code,
@@ -1780,7 +1624,20 @@ int gd_madd_divide(DIRFILE* D, const char *parent, const char* field_code,
       in_field2);
 }
 
-/* add a RECIP entry */
+int gd_madd_indir(DIRFILE* D, const char *parent, const char* field_code,
+        const char* in_field1, const char* in_field2) gd_nothrow
+{
+  return _GD_MAddYoke(D, GD_INDIR_ENTRY, parent, field_code, in_field1,
+      in_field2);
+}
+
+int gd_madd_sindir(DIRFILE *D, const char *parent, const char* field_code,
+    const char* in_field1, const char* in_field2) gd_nothrow
+{
+  return _GD_MAddYoke(D, GD_SINDIR_ENTRY, parent, field_code, in_field1,
+      in_field2);
+}
+
 int gd_madd_recip(DIRFILE* D, const char *parent, const char* field_code,
     const char* in_field, double dividend) gd_nothrow
 {
@@ -1789,11 +1646,7 @@ int gd_madd_recip(DIRFILE* D, const char *parent, const char* field_code,
   dtrace("%p, \"%s\", \"%s\", \"%s\", %g", D, parent, field_code, in_field,
       dividend);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1801,13 +1654,9 @@ int gd_madd_recip(DIRFILE* D, const char *parent, const char* field_code,
   E.EN(recip,dividend) = dividend;
   E.in_fields[0] = (char *)in_field;
 
-  if (_GD_Add(D, &E, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 #ifndef GD_NO_C99_API
@@ -1835,11 +1684,7 @@ int gd_madd_crecip89(DIRFILE* D, const char *parent, const char* field_code,
   dtrace("%p, \"%s\", \"%s\", \"%s\", {%g, %g}", D, parent, field_code,
       in_field, cdividend[0], cdividend[1]);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1848,13 +1693,9 @@ int gd_madd_crecip89(DIRFILE* D, const char *parent, const char* field_code,
   E.flags = GD_EN_COMPSCAL;
   E.in_fields[0] = (char *)in_field;
 
-  if (_GD_Add(D, &E, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META WINDOW entry */
@@ -1868,11 +1709,7 @@ int gd_madd_window(DIRFILE *D, const char *parent, const char *field_code,
       D, parent, field_code, in_field, check_field, windop, threshold.r,
       threshold.u, 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1882,13 +1719,9 @@ int gd_madd_window(DIRFILE *D, const char *parent, const char *field_code,
   E.in_fields[0] = (char *)in_field;
   E.in_fields[1] = (char *)check_field;
 
-  if (_GD_Add(D, &E, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META MPLEX entry */
@@ -1901,11 +1734,7 @@ int gd_madd_mplex(DIRFILE *D, const char *parent, const char *field_code,
   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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
@@ -1915,13 +1744,9 @@ int gd_madd_mplex(DIRFILE *D, const char *parent, const char *field_code,
   E.in_fields[0] = (char *)in_field;
   E.in_fields[1] = (char *)count_field;
 
-  if (_GD_Add(D, &E, parent) == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  _GD_Add(D, &E, parent, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META STRING entry */
@@ -1929,21 +1754,17 @@ int gd_madd_string(DIRFILE* D, const char* parent,
     const char* field_code, const char* value) gd_nothrow
 {
   gd_entry_t *entry;
-  gd_entry_t S;
+  gd_entry_t E;
   char *ptr;
 
   dtrace("%p, \"%s\", \"%s\", \"%s\"", D, parent, field_code, value);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  memset(&S, 0, sizeof(gd_entry_t));
-  S.field = (char *)field_code;
-  S.field_type = GD_STRING_ENTRY;
-  S.fragment_index = 0;
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_STRING_ENTRY;
+  E.fragment_index = 0;
 
   /* duplicate early, in case of failure */
   ptr = _GD_Strdup(D, value);
@@ -1952,18 +1773,14 @@ int gd_madd_string(DIRFILE* D, const char* parent,
     return -1;
   }
 
-  entry = _GD_Add(D, &S, parent);
+  entry = _GD_Add(D, &E, parent, 0);
 
-  if (D->error) {
+  if (D->error)
     free(ptr);
-    dreturn("%i", -1);
-    return -1;
-  }
+  else
+    entry->e->u.string = ptr;
 
-  free(entry->e->u.string);
-  entry->e->u.string = ptr;
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META CONST entry */
@@ -1971,30 +1788,25 @@ 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
 {
   gd_entry_t *entry;
-  gd_entry_t C;
+  gd_entry_t E;
 
   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 */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  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;
-  entry = _GD_Add(D, &C, parent);
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_CONST_ENTRY;
+  E.EN(scalar,const_type) = const_type;
+  E.fragment_index = 0;
+  entry = _GD_Add(D, &E, parent, 0);
 
   /* Actually store the constant, now */
   if (entry)
     _GD_DoFieldOut(D, entry, 0, 1, data_type, value);
 
-  dreturn("%i", D->error ? -1 : 0);
-  return D->error ? -1 : 0;
+  GD_RETURN_ERROR(D);
 }
 
 /* add a META CARRAY entry */
@@ -2003,31 +1815,76 @@ int gd_madd_carray(DIRFILE* D, const char* parent, const char* field_code,
     const void* values) gd_nothrow
 {
   gd_entry_t *entry;
-  gd_entry_t C;
+  gd_entry_t E;
 
   dtrace("%p, \"%s\", \"%s\", 0x%X, %" PRIuSIZE ", 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);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  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;
-  entry = _GD_Add(D, &C, parent);
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_CARRAY_ENTRY;
+  E.EN(scalar,const_type) = const_type;
+  E.EN(scalar,array_len) = array_len;
+  E.fragment_index = 0;
+  entry = _GD_Add(D, &E, parent, 0);
 
   /* Actually store the carray, now */
   if (entry)
     _GD_DoFieldOut(D, entry, 0, array_len, data_type, values);
 
-  dreturn("%i", D->error ? -1 : 0);
-  return D->error ? -1 : 0;
+  GD_RETURN_ERROR(D);
+}
+
+/* Add META SARRAY */
+int gd_madd_sarray(DIRFILE* D, const char *parent, const char *field_code,
+    size_t array_len, const char **values) gd_nothrow
+{
+  size_t i;
+  gd_entry_t *entry;
+  gd_entry_t E;
+  char **data;
+
+  dtrace("%p, \"%s\", \"%s\", %" PRIuSIZE ", %p", D, parent, field_code,
+      array_len, values);
+
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_SARRAY_ENTRY;
+  E.EN(scalar,array_len) = array_len;
+
+  /* duplicate early, in case of failure */
+  data = _GD_Malloc(D, array_len * sizeof(char *));
+  if (data == NULL)
+    GD_RETURN_ERROR(D);
+
+  for (i = 0; i < array_len; ++i) {
+    data[i] = _GD_Strdup(D, values[i]);
+
+    if (D->error) {
+      while (i-- > 0)
+        free(data[i]);
+      free(data);
+      GD_RETURN_ERROR(D);
+    }
+  }
+
+  entry = _GD_Add(D, &E, parent, 0);
+
+  if (D->error) {
+    for (i = 0; i < array_len; ++i)
+      free(data[i]);
+    free(data);
+    GD_RETURN_ERROR(D);
+  }
+
+  entry->e->u.scalar.d = data;
+
+  dreturn("%i", 0);
+  return 0;
 }
 
 /* add an alias */
@@ -2036,72 +1893,80 @@ static int _GD_AddAlias(DIRFILE *restrict D, const char *restrict parent,
     int fragment_index)
 {
   unsigned u;
-  int offset;
-  char *munged_code = NULL;
+  size_t nsl, subfield_offs, len = strlen(field_code);
+  char *name = 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);
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  if ((D->flags & GD_ACCMODE) == GD_RDONLY)
+    GD_SET_RETURN_ERROR(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);
+    GD_SET_RETURN_ERROR(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,
+    GD_SET_RETURN_ERROR(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);
+    P = _GD_FindField(D, parent, strlen(parent), D->entry, D->n_entries, 0,
+        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) {
+    /* make sure it's not a meta field already or an alias */
+    if (P->e->n_meta == -1 || P->field_type == GD_ALIAS_ENTRY) {
       _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 == NULL)
+    subfield_offs = P->e->len + 1;
+    name = _GD_Malloc(D, subfield_offs + strlen(field_code) + 1);
+    if (name == NULL)
       goto add_alias_error;
 
-    strcpy(munged_code, parent);
-    munged_code[offset - 1] = '/';
-    strcpy(munged_code + offset, field_code);
+    memcpy(name, parent, P->e->len);
+    name[subfield_offs - 1] = '/';
+    memcpy(name + subfield_offs, field_code, len + 1);
+    len += subfield_offs;
   } 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);
+    P = _GD_FixName(D, &name, &len, field_code, fragment_index, &subfield_offs);
 
     if (D->error)
       goto add_alias_error;
   }
 
-  /* check alias name */
-  if (_GD_ValidateField(munged_code + offset, D->standards, 1, GD_VF_CODE,
-        NULL))
-  {
+  /* Figure out the length of the attached namespace in the supplied field
+   * name.  If subfield_offs > 0, then there can't be a namespace because
+   * we're only checking the subfield name */
+  if (D->standards >= 10 && subfield_offs == 0) {
+    const char *dot, *slash;
+    _GD_SlashDot(name, len, GD_CO_NAME, &dot, &slash);
+    if (dot)
+      nsl = dot - name + 1;
+    else
+      nsl = 0;
+  } else
+    nsl = 0;
+
+  /* check alias name. */
+  if (_GD_ValidateField(name + subfield_offs, nsl, D->standards, 1, GD_VF_NAME))
     _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, 0, &u))
-    _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, munged_code);
+  else if (_GD_FindField(D, name, len, D->entry, D->n_entries, 0, &u))
+    _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, name);
   else
-    _GD_CheckCodeAffixes(D, target, fragment_index, 1); /* check target */
+    /* check target */
+    _GD_CheckCodeAffixes(D, target, fragment_index,
+        GD_CO_ERROR | ((D->standards <= 5) ? GD_CO_EARLY : 0));
 
   if (D->error)
     goto add_alias_error;
@@ -2112,19 +1977,19 @@ static int _GD_AddAlias(DIRFILE *restrict D, const char *restrict parent,
   D->entry = (gd_entry_t **)ptr;
 
   /* create and store */
-  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
+  E = _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_));
+  E->e = _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->field = name;
+  E->e->len = len;
   E->fragment_index = fragment_index;
   E->in_fields[0] = _GD_Strdup(D, target);
   E->field_type = GD_ALIAS_ENTRY;
@@ -2132,8 +1997,7 @@ static int _GD_AddAlias(DIRFILE *restrict D, const char *restrict parent,
 
   if (D->error) {
     _GD_FreeE(D, E, 1);
-    dreturn("%i", -1);
-    return -1;
+    GD_RETURN_ERROR(D);
   }
 
   /* add the entry and resort the entry list */
@@ -2154,42 +2018,31 @@ static int _GD_AddAlias(DIRFILE *restrict D, const char *restrict parent,
   /* Update aliases */
   _GD_UpdateAliases(D, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  dreturn("%i", GD_E_OK);
+  return GD_E_OK;
 
 add_alias_error:
   free(E);
-  free(munged_code);
-  dreturn("%i", -1);
-  return -1;
+  free(name);
+  GD_RETURN_ERROR(D);
 }
 
 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);
 
-  _GD_ClearError(D);
-
-  ret = _GD_AddAlias(D, NULL, alias_name, target_code, fragment_index);
+  _GD_AddAlias(D, NULL, alias_name, target_code, fragment_index);
 
-  dreturn("%i", ret);
-  return ret;
+  GD_RETURN_ERROR(D);
 }
 
 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);
+  _GD_AddAlias(D, parent, alias_name, target_code, 0);
 
-  dreturn("%i", ret);
-  return ret;
+  GD_RETURN_ERROR(D);
 }
diff --git a/src/ascii.c b/src/ascii.c
index cc08512..50338be 100644
--- a/src/ascii.c
+++ b/src/ascii.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2013, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2013, 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -27,17 +27,10 @@ int _GD_AsciiOpen(int fd, struct gd_raw_file_* file, gd_type_t type gd_unused_,
 {
   dtrace("%i, %p, <unused>, <unused>, %u", fd, file, mode);
 
-  if (!(mode & GD_FILE_TEMP)) {
-    if (file->mode & mode) {
-      dreturn("%i", 0);
-      return 0;
-    } else if (file->edata != NULL)
-      fclose((FILE*)file->edata);
-
+  if (!(mode & GD_FILE_TEMP))
     file->idata = gd_OpenAt(file->D, fd, file->name, ((mode & GD_FILE_WRITE)
           ? (O_RDWR | O_CREAT) : O_RDONLY) | O_BINARY, 0666);
-
-  } else
+  else
     file->idata = _GD_MakeTempFile(file->D, fd, file->name);
 
   if (file->idata < 0) {
@@ -237,8 +230,10 @@ ssize_t _GD_AsciiWrite(struct gd_raw_file_ *restrict file,
     case GD_FLOAT64:     WRITE_ASCII(".16g",   double); break;
     case GD_COMPLEX64:  WRITE_CASCII(".7g",     float); break;
     case GD_COMPLEX128: WRITE_CASCII(".16g",   double); break;
-    default:                            errno = EINVAL; break; /* internal error */
+    default:                            errno = EINVAL; break;
   }
+  
+  file->pos += nmemb;
 
   dreturn("%" PRIdSIZE, n);
   return n;
diff --git a/src/bzip.c b/src/bzip.c
index bf16405..b1980b3 100644
--- a/src/bzip.c
+++ b/src/bzip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013, 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2014, 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -53,6 +53,8 @@ static struct gd_bzdata *_GD_Bzip2DoOpen(int dirfd, struct gd_raw_file_* file,
 
   dtrace("%i, %p, 0x%X", dirfd, file, mode);
 
+  file->error = BZ_IO_ERROR;
+
   if (mode & GD_FILE_READ) {
     fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY | O_BINARY, 0666);
   } else if (mode & GD_FILE_TEMP) {
@@ -75,7 +77,7 @@ static struct gd_bzdata *_GD_Bzip2DoOpen(int dirfd, struct gd_raw_file_* file,
     return NULL;
   }
 
-  if ((ptr = (struct gd_bzdata *)malloc(sizeof(struct gd_bzdata))) == NULL) {
+  if ((ptr = malloc(sizeof(struct gd_bzdata))) == NULL) {
     fclose(stream);
     dreturn("%p", NULL);
     return NULL;
@@ -215,64 +217,39 @@ ssize_t _GD_Bzip2Write(struct gd_raw_file_ *file, const void *data,
   return n;
 }
 
-off64_t _GD_Bzip2Seek(struct gd_raw_file_* file, off64_t count,
+off64_t _GD_Bzip2Seek(struct gd_raw_file_* file, off64_t offset,
     gd_type_t data_type, unsigned int mode)
 {
   struct gd_bzdata *ptr;
 
-  dtrace("%p, %" PRId64 ", 0x%X, 0x%X", file, (int64_t)count, data_type, mode);
+  dtrace("%p, %" PRId64 ", 0x%X, 0x%X", file, (int64_t)offset, data_type, mode);
 
-  ptr = (struct gd_bzdata *)(file[(mode == GD_FILE_WRITE) ? 1 : 0].edata);
+  ptr = (struct gd_bzdata *)(file->edata);
 
   /* nothing to do */
-  if (ptr->base + ptr->pos == count * GD_SIZE(data_type)) {
-    dreturn("%" PRId64, (int64_t)count);
-    return count;
+  if (file->pos == offset) {
+    dreturn("%" PRId64, (int64_t)offset);
+    return offset;
   }
 
-  count *= GD_SIZE(data_type);
+  offset *= GD_SIZE(data_type);
 
   if (mode == GD_FILE_WRITE) {
+    off64_t remaining = offset - file->pos * GD_SIZE(data_type);
     /* we only get here when we need to pad */
-    count -= file->pos * GD_SIZE(data_type);
-    while (ptr->base < count) {
+    while (ptr->base + ptr->end < offset) {
       int n;
-      if (count > GD_BZIP_BUFFER_SIZE)
+      if (remaining > GD_BZIP_BUFFER_SIZE)
         n = GD_BZIP_BUFFER_SIZE;
       else
-        n = count;
+        n = remaining;
 
-      _GD_Bzip2Write(file + 1, ptr->data, GD_UINT8, n);
-      count -= n;
+      _GD_Bzip2Write(file, ptr->data, GD_UINT8, n);
+      remaining -= n;
     }
   } else {
-    if (ptr->base > count) {
-      /* a backwards seek: reopen the file */
-      ptr->bzerror = 0;
-      BZ2_bzReadClose(&ptr->bzerror, ptr->bzfile);
-      if (ptr->bzerror != BZ_OK) {
-        file->error = ptr->bzerror;
-        fclose(ptr->stream);
-        dreturn("%i", -1);
-        return -1;
-      }
-
-      rewind(ptr->stream);
-      ptr->bzfile = BZ2_bzReadOpen(&ptr->bzerror, ptr->stream, 0, 0, NULL, 0);
-
-      if (ptr->bzerror != BZ_OK) {
-        file->error = ptr->bzerror;
-        BZ2_bzReadClose(&ptr->bzerror, ptr->bzfile);
-        fclose(ptr->stream);
-        dreturn("%i", -1);
-        return -1;
-      }
-      ptr->pos = ptr->end = 0;
-      ptr->base = ptr->stream_end = 0;
-    }
-
     /* seek forward the slow way */
-    while (ptr->base + ptr->end < count) {
+    while (ptr->base + ptr->end < offset) {
       int n;
 
       /* eof */
@@ -295,8 +272,8 @@ off64_t _GD_Bzip2Seek(struct gd_raw_file_* file, off64_t count,
       }
     }
 
-    ptr->pos = (ptr->stream_end && count >= ptr->base + ptr->end) ? ptr->end :
-      count - ptr->base;
+    ptr->pos = (ptr->stream_end && offset >= ptr->base + ptr->end) ? ptr->end :
+      offset - ptr->base;
   }
   
   file->pos = (ptr->base + ptr->pos) / GD_SIZE(data_type);
diff --git a/src/close.c b/src/close.c
index eeb6995..94b5057 100644
--- a/src/close.c
+++ b/src/close.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2012, 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2012, 2014-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,22 +20,19 @@
  */
 #include "internal.h"
 
-/* _GD_FreeD: free the DIRFILE and its subordinates
-*/
-static void _GD_FreeD(DIRFILE *D, int keep_dirfile)
+/* Delete the run of fragments [start,stop) from the fragment list */
+void _GD_FreeF(DIRFILE *D, int start, int stop)
 {
-  unsigned int i;
   int j;
 
-  dtrace("%p, %i", D, keep_dirfile);
+  dtrace("%p, %i", D, start);
 
-  for (i = 0; i < D->n_entries; ++i)
-    _GD_FreeE(D, D->entry[i], 1);
-
-  for (j = 0; j < D->n_fragment; ++j) {
+  for (j = start; j < stop; ++j) {
+    _GD_ReleaseDir(D, D->fragment[j].dirfd);
     free(D->fragment[j].enc_data);
-    free(D->fragment[j].prefix);
-    free(D->fragment[j].suffix);
+    free(D->fragment[j].ns);
+    free(D->fragment[j].px);
+    free(D->fragment[j].sx);
     free(D->fragment[j].bname);
     free(D->fragment[j].cname);
     free(D->fragment[j].ename);
@@ -43,18 +40,39 @@ static void _GD_FreeD(DIRFILE *D, int keep_dirfile)
     free(D->fragment[j].ref_name);
   }
 
+  dreturnvoid();
+}
+
+/* _GD_FreeD: free the DIRFILE and its subordinates
+*/
+static void _GD_FreeD(DIRFILE *D, int keep_dirfile)
+{
+  unsigned int i;
+
+  dtrace("%p, %i", D, keep_dirfile);
+
+  for (i = 0; i < D->n_entries; ++i)
+    _GD_FreeE(D, D->entry[i], 1);
+
   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->regex_list);
   _GD_FreeFL(&D->fl);
   
+  _GD_FreeF(D, 0, D->n_fragment);
   free(D->fragment);
+
   free(D->name);
-  for (i = 0; i < D->ndir; ++i)
+  for (i = 0; i < D->ndir; ++i) {
     free(D->dir[i].path);
+#ifndef GD_NO_DIR_OPEN
+    close(D->dir[i].fd);
+#endif
+  }
   free(D->dir);
 
   if (!keep_dirfile)
@@ -84,21 +102,13 @@ int _GD_ShutdownDirfile(DIRFILE* D, int flush_meta, int keep_dirfile)
     if (D->entry[i]->field_type == GD_RAW_ENTRY)
       _GD_Flush(D, D->entry[i], 0, 1);
 
-  if (D->error) {
-    dreturn("%i", 1);
-    return -1;
-  }
-
-#ifndef GD_NO_DIR_OPEN
-  /* close the directory */
-  for (i = 0; i < (unsigned int)D->ndir; ++i)
-    close(D->dir[i].fd);
-#endif
+  if (D->error)
+    GD_RETURN_ERROR(D);
 
   _GD_FreeD(D, keep_dirfile);
 
-  dreturn("%i", 0);
-  return 0;
+  dreturn("%i", GD_E_OK);
+  return GD_E_OK;
 }
 
 int gd_close(DIRFILE *D)
@@ -109,6 +119,7 @@ int gd_close(DIRFILE *D)
 
   ret = _GD_ShutdownDirfile(D, 1, 0);
 
+  /* D->error may no longer be valid here */
   dreturn("%i", ret);
   return ret;
 }
@@ -121,6 +132,7 @@ int gd_discard(DIRFILE* D)
 
   ret = _GD_ShutdownDirfile(D, 0, 0);
 
+  /* D->error may no longer be valid here */
   dreturn("%i", ret);
   return ret;
 }
diff --git a/src/common.c b/src/common.c
index efbe58f..7d83a2e 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2015 D. V. Wiebe
+ * Copyright (C) 2005-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -31,9 +31,63 @@ int gd_col_count = 0;
 char gd_debug_col[GD_COL_SIZE + 1] = "";
 #endif
 
+/* compare two strings parent/namea and nameb of length total and lenb */
+static int _GD_pstrlencmp(const char *parent, size_t plen,
+    const char *namea, size_t total, const char *nameb, size_t lenb)
+{
+  int c;
+  dtrace("\"%s\", %" PRIuSIZE ", \"%s\", %" PRIuSIZE ", \"%s\", %" PRIuSIZE,
+      parent, plen, namea, total, nameb, lenb);
+
+  if (total < lenb)  {
+    dreturn("%i <", -1);
+    return -1;
+  }
+
+  if (lenb < total) {
+    dreturn("%i <", 1);
+    return 1;
+  }
+
+  /* Compare in two parts */
+  c = memcmp(parent, nameb, plen);
+  if (c == 0)
+    c = nameb[plen] - '/';
+  if (c == 0)
+    c = memcmp(namea, nameb + plen + 1, total - plen - 1);
+
+  dreturn("%i", c);
+  return c;
+}
+
+/* compare two strings namea and nameb of length lena and lenb */
+static int _GD_strlencmp(const char *namea, size_t lena,
+    const char *nameb, size_t lenb)
+{
+  int c;
+  dtrace("\"%s\", %" PRIuSIZE ", \"%s\", %" PRIuSIZE, namea, lena, nameb, lenb);
+
+  if (lena < lenb) {
+    dreturn("%i <", -1);
+    return -1;
+  }
+
+  if (lenb < lena) {
+    dreturn("%i <", 1);
+    return 1;
+  }
+
+  c = memcmp(namea, nameb, lena);
+
+  dreturn("%i", c);
+  return c;
+}
+
 int _GD_EntryCmp(const void *a, const void *b)
 {
-  return strcmp((*(gd_entry_t**)a)->field, (*(gd_entry_t**)b)->field);
+  const gd_entry_t *A = *((gd_entry_t**)a);
+  const gd_entry_t *B = *((gd_entry_t**)b);
+  return _GD_strlencmp(A->field, A->e->len, B->field, B->e->len);
 }
 
 /* _GD_GetLine: read non-comment line from format file.  The line is newly
@@ -95,27 +149,88 @@ gd_type_t _GD_LegacyType(char c)
   return GD_UNKNOWN;
 }
 
-/* Binary search to find the field */
+/* Like _GD_FindField, but look for a subfield code with the parent and
+ * subfield names separated.  This is only used when looking for a field code
+ * which specified a subfield by alias name.  The plen count includes the / */
+static gd_entry_t *_GD_FindFieldWithParent(const char *restrict parent,
+    size_t plen, const char *restrict name, size_t len, gd_entry_t *const *list,
+    unsigned int u, int dealias, unsigned int *restrict index)
+{
+  size_t total;
+  int c;
+  unsigned int i, l = 0;
+
+  dtrace("\"%s\", %" PRIuSIZE ", \"%s\", %" PRIuSIZE ", %p, %u, %i, %p",
+      parent, plen, name, len, list, u, dealias, index);
+
+  /* Drop an initial dot */
+  if (parent[0] == '.' && len > 1) {
+    parent++;
+    plen--;
+  }
+
+  total = plen + len + 1;
+
+  /* Binary search */
+  while (l < u) {
+    i = (l + u) / 2;
+    c = _GD_pstrlencmp(parent, plen, name, total, list[i]->field,
+        list[i]->e->len);
+    if (c < 0)
+      u = i;
+    else if (c > 0)
+      l = i + 1;
+    else {
+      gd_entry_t *E = list[i];
+      if (dealias && E && E->field_type == GD_ALIAS_ENTRY)
+        E = E->e->entry[0];
+
+      if (index != NULL)
+        *index = i;
+
+      dreturn("%p", E);
+      return E;
+    }
+  }
+
+  /* Not found */
+  dreturn("%p", NULL);
+  return NULL;
+}
+
+/* Binary search list of length u to find field_code.  len = strlen(field_code).
+ * If the field found is an alias, the target will be returned if dealias is
+ * non-zero */
 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)
+    const char *restrict field_code, size_t len, gd_entry_t *const *list,
+    unsigned int u, int dealias, unsigned int *restrict index)
 {
   int c;
-  char *ptr;
+  const char *ptr;
   gd_entry_t *E = NULL;
   unsigned int i, l = 0;
   const unsigned int ou = u;
 
-  dtrace("%p, \"%s\", %p, %u, %i, %p", D, field_code, list, u, dealias, index);
+  dtrace("%p, \"%s\", %" PRIuSIZE ", %p, %u, %i, %p", D, field_code, len, list,
+      u, dealias, index);
 
   /* handle FILEFRAM */
-  if (D->standards < 6 && (D->flags & GD_PEDANTIC) &&
-      strcmp(field_code, "FILEFRAM") == 0)
+  if (D->standards < 6 && (D->flags & GD_PEDANTIC) && len == 8 &&
+      memcmp(field_code, "FILEFRAM", 8) == 0)
+  {
     field_code = "INDEX";
+    len = 5;
+  }
+
+  /* Drop an initial dot */
+  if (field_code[0] == '.' && len > 1) {
+    field_code++;
+    len--;
+  }
 
   while (l < u) {
     i = (l + u) / 2;
-    c = strcmp(field_code, list[i]->field);
+    c = _GD_strlencmp(field_code, len, list[i]->field, list[i]->e->len);
     if (c < 0)
       u = i;
     else if (c > 0)
@@ -137,28 +252,15 @@ gd_entry_t *_GD_FindField(const DIRFILE *restrict D,
     *index = u;
 
   /* 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;
-    }
+  if (dealias && (ptr = memchr(field_code, '/', len)) != NULL) {
+    E = _GD_FindField(D, field_code, ptr - field_code, list, ou, 0, NULL);
+
+    if (E && E->field_type == GD_ALIAS_ENTRY && E->e->entry[0])
+      E = _GD_FindFieldWithParent(E->e->entry[0]->field,
+          E->e->entry[0]->e->len, ptr + 1, len - (ptr - field_code) - 1, list,
+          ou, 1, NULL);
+    else
+      E = NULL;
   }
 
   dreturn("%p", E);
@@ -186,24 +288,12 @@ void* _GD_Alloc(DIRFILE* D, gd_type_t type, size_t n)
   void* ptr = NULL;
 
   dtrace("%p, 0x%x, %" PRIuSIZE, D, type, n);
-  if (n == 0) {
+  if (type == GD_NULL)
+    ; /* just return the NULL */
+  else if (n * GD_SIZE(type) == 0)
     _GD_InternalError(D);
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  if (type == GD_NULL) {
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  if (GD_SIZE(type) == 0) {
-    _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, type, NULL);
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  ptr = _GD_Malloc(D, n * GD_SIZE(type));
+  else
+    ptr = _GD_Malloc(D, n * GD_SIZE(type));
 
   dreturn("%p", ptr);
   return ptr;
@@ -254,7 +344,7 @@ static int lutcmp(const void* a, const void* b)
 
 /* _GD_ReadLinterpFile: Read in the linterp data for this field
 */
-void _GD_ReadLinterpFile(DIRFILE *restrict D, gd_entry_t *restrict E)
+int _GD_ReadLinterpFile(DIRFILE *restrict D, gd_entry_t *restrict E)
 {
   FILE *fp;
   struct gd_lut_ *ptr;
@@ -270,23 +360,23 @@ void _GD_ReadLinterpFile(DIRFILE *restrict D, gd_entry_t *restrict E)
 
   if (E->e->u.linterp.table_file == NULL)
     if (_GD_SetTablePath(D, E, E->e)) {
-      dreturnvoid();
-      return;
+      dreturn("%i", 1);
+      return 1;
     }
 
   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_IO, GD_E_IO_OPEN, E->EN(linterp,table), 0, NULL);
-    dreturnvoid();
-    return;
+    dreturn("%i", 1);
+    return 1;
   }
 
   fp = fdopen(fd, "rb");
   if (fp == NULL) {
     _GD_SetError(D, GD_E_IO, GD_E_IO_OPEN, E->EN(linterp,table), 0, NULL);
-    dreturnvoid();
-    return;
+    dreturn("%i", 1);
+    return 1;
   }
 
   E->e->u.linterp.lut = _GD_Malloc(D, buf_len * sizeof(*E->e->u.linterp.lut));
@@ -309,7 +399,9 @@ void _GD_ReadLinterpFile(DIRFILE *restrict D, gd_entry_t *restrict E)
       /* line too long */
       _GD_SetError(D, GD_E_LINE_TOO_LONG, 0, E->EN(linterp,table), linenum,
           NULL);
-    else 
+    else if (errno)
+      _GD_SetError(D, GD_E_IO, GD_E_IO_READ, E->EN(linterp,table), 0, NULL);
+    else
       /* no data in file! */
       _GD_SetError(D, GD_E_LUT, GD_E_LUT_LENGTH, E->EN(linterp,table), 0, NULL);
     goto LUT_ERROR;
@@ -379,15 +471,16 @@ void _GD_ReadLinterpFile(DIRFILE *restrict D, gd_entry_t *restrict E)
     qsort(E->e->u.linterp.lut, i, sizeof(struct gd_lut_), lutcmp);
 
   fclose(fp);
-  dreturnvoid();
-  return;
+  dreturn("%i", 0);
+  return 0;
 
 LUT_ERROR:
   free(E->e->u.linterp.lut);
   E->e->u.linterp.lut = NULL;
   free(line);
   fclose(fp);
-  dreturnvoid();
+  dreturn("%i", 1);
+  return 1;
 }
 
 /* _GD_GetIndex: get LUT index.
@@ -505,7 +598,7 @@ void _GD_LinterpData(DIRFILE *restrict D, void *restrict data, gd_type_t type,
     case GD_FLOAT64:    LINTERP(double  ); break;
     case GD_COMPLEX64:  LINTERPC(float  ); break;
     case GD_COMPLEX128: LINTERPC(double ); break;
-    default:            _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, type, NULL);
+    default:         _GD_InternalError(D); break;
   }
 
   dreturnvoid();
@@ -762,33 +855,24 @@ void _GD_InvertData(DIRFILE *restrict D, void *restrict data,
 
 #ifdef GD_NO_C99_API
 #undef INVERTC
-#undef INVERT
 
 #define INVERTC(t) \
   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] = (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] - \
-          dividend[0] * ((t *)data)[2 * i]) / d); \
-    } \
-  } while (0)
-
-#define INVERT(t) \
-  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] = (t)((dividend[0] * ((t *)data)[2 * i] - \
-          dividend[1] * ((t *)data)[2 * i + 1]) / d); \
+      const t re = ((t*)data)[2 * i]; \
+      const t im = ((t*)data)[2 * i + 1]; \
+      const t d = (re * re + im * im); \
+      ((t *)data)[2 * i] = (t)((dividend[0] * re + dividend[1] * im) / d); \
+      ((t *)data)[2 * i + 1] = (t)((dividend[1] * re - dividend[0] * im) / d); \
     } \
   } while (0)
 
 #endif
 
-/* Invert a vector */
+/* Invert a vector using a complex valued dividend.  When this is
+ * called, return_type is always complex valued, too (because DoField
+ * decides to compute the full complex value first, and then convert
+ * to the real type afterwards. */
 void _GD_CInvertData(DIRFILE *restrict D, void *restrict data,
     gd_type_t return_type, GD_DCOMPLEXA(dividend), size_t n_read)
 {
@@ -799,35 +883,26 @@ void _GD_CInvertData(DIRFILE *restrict D, void *restrict data,
 
   switch(return_type) {
     case GD_NULL:                         break;
-    case GD_UINT8:      INVERT(uint8_t);  break;
-    case GD_INT8:       INVERT(int8_t);   break;
-    case GD_UINT16:     INVERT(uint16_t); break;
-    case GD_INT16:      INVERT(int16_t);  break;
-    case GD_UINT32:     INVERT(uint32_t); break;
-    case GD_INT32:      INVERT(int32_t);  break;
-    case GD_UINT64:     INVERT(uint64_t); break;
-    case GD_INT64:      INVERT(int64_t);  break;
-    case GD_FLOAT32:    INVERT(float);    break;
-    case GD_FLOAT64:    INVERT(double);   break;
     case GD_COMPLEX64:  INVERTC(float);   break;
     case GD_COMPLEX128: INVERTC(double);  break;
-    default:            _GD_InternalError(D);
+    default:            _GD_InternalError(D); /* Other types not allowed */
   }
 
   dreturnvoid();
 }
 
-int _GD_GetRepr(DIRFILE *restrict D, const char *restrict field_code_in,
-    char **restrict field_code, int err)
+/* Look for a representation suffix in field_code.  If one is found, decrement
+ * (*len) by two.  Returns the representation found.
+ */
+int _GD_GetRepr(const char *restrict field_code, size_t *restrict len)
 {
-  int repr = GD_REPR_NONE;
-  const int field_code_len = strlen(field_code_in);
+  int repr = -1;
 
-  dtrace("%p, \"%s\", %p, %i", D, field_code_in, field_code, err);
+  dtrace("\"%s\", %p", field_code, len);
 
   /* find the representation, if any */
-  if (field_code_len > 2 && field_code_in[field_code_len - 2] == '.') {
-    switch (field_code_in[field_code_len - 1]) {
+  if (*len > 2 && field_code[*len - 2] == '.') {
+    switch (field_code[*len - 1]) {
       case 'r':
         repr = GD_REPR_REAL;
         break;
@@ -840,63 +915,19 @@ int _GD_GetRepr(DIRFILE *restrict D, const char *restrict field_code_in,
       case 'a':
         repr = GD_REPR_ARG;
         break;
-      default:
-        if (err)
-          _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_REPR, NULL, 0,
-              field_code_in);
-        dreturn("%i", 0);
-        return 0;
-    }
-
-    /* make a copy of the field code without the representation */
-    *field_code = _GD_Strdup(D, field_code_in);
-    if (*field_code)
-      (*field_code)[field_code_len - 2] = '\0';
-  } else
-    *field_code = (char *)field_code_in;
-
-  dreturn("%i", repr);
-  return repr;
-}
-
-/* Ensure that an input field has been identified (with error checking) */
-int _GD_BadInput(DIRFILE *D, const gd_entry_t *E, int i, gd_entype_t t, int err)
-{
-  char *code;
-
-  dtrace("%p, %p, %i, 0x%X, %i", D, E, i, t, 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, err);
-
-    if (E->e->entry[i] == NULL) {
-      dreturn("%i", 1);
-      return 1;
+      case 'z':
+        repr = GD_REPR_NONE;
+        break;
     }
-
-    if (code != E->in_fields[i])
-      free(code);
   }
 
-  /* check field type */
-  if (t == GD_NO_ENTRY) {
-    /* scalar entries not allowed */
-    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);
-      return 1;
-    }
-  } else if (E->e->entry[i]->field_type != t) {
-    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_FORMAT, E->field, 0,
-        E->e->entry[i]->field);
-    dreturn("%i", 1);
-    return 1;
-  }
+  if (repr == -1) /* no match */
+    repr = GD_REPR_NONE;
+  else
+    *len -= 2;
 
-  dreturn("%i", 0);
-  return 0;
+  dreturn("0x%X (%" PRIuSIZE ")", repr, *len);
+  return repr;
 }
 
 /* Find an entry without a representation; this function will de-alias */
@@ -906,11 +937,9 @@ gd_entry_t *_GD_FindEntry(DIRFILE *restrict D, const char *restrict field_code)
 
   dtrace("%p, \"%s\"", D, field_code);
 
-  if (D->n_dot > 0)
-    E = _GD_FindField(D, field_code, D->dot_list, D->n_dot, 1, NULL);
-
   if (E == NULL)
-    E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
+    E = _GD_FindField(D, field_code, strlen(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);
@@ -921,40 +950,46 @@ gd_entry_t *_GD_FindEntry(DIRFILE *restrict D, const char *restrict field_code)
 
 /* Find the entry and the representation */
 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)
+    const char *restrict field_code, int *restrict repr,
+    unsigned int *restrict index, int err)
 {
+  size_t old_len, len;
   gd_entry_t *E = NULL;
 
-  dtrace("%p, \"%s\", %p, %p, %p, %i, %i", D, field_code_in, field_code, repr,
-      index, set, err);
+  dtrace("%p, \"%s\", %p, %p, %i", D, field_code, repr, index, err);
 
-  if (D->n_dot > 0)
-    E = _GD_FindField(D, field_code_in, D->dot_list, D->n_dot, 1, NULL);
+  old_len = len = strlen(field_code);
 
-  if (E == NULL) {
-    *repr = _GD_GetRepr(D, field_code_in, field_code, err);
+  /* Find a representaiton suffix.  We check this first in order to give
+   * the caller a chance to distinguish ambiguous codes by appending a .z */
+  *repr = _GD_GetRepr(field_code, &len);
 
-    if (D->error) {
-      dreturn("%p", NULL);
-      return NULL;
+  /* repr found? -- it's not enough to check that repr != GD_REPR_NONE, since
+   * _GD_GetRepr returns GD_REPR_NONE in that case
+   */
+  if (old_len != len) {
+    E = _GD_FindField(D, field_code, len, D->entry, D->n_entries, 1, index);
+  
+    /* SARRAY, SINDIR, STRING only permit the .z suffix */
+    if (E && *repr != GD_REPR_NONE && (E->field_type == GD_SARRAY_ENTRY
+          || E->field_type == GD_SINDIR_ENTRY
+          || E->field_type == GD_STRING_ENTRY))
+    {
+      E = NULL; /* Force match failed */
     }
-  } else {
-    *repr = GD_REPR_NONE;
-    *field_code = (char *)field_code_in;
   }
 
-  if (E == NULL || index != NULL)
-    E = _GD_FindField(D, *field_code, D->entry, D->n_entries, 1, index);
-
-  if (E == NULL && set) {
-    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);
+  /* No repr, or match failed. Try the whole code. */
+  if (E == NULL)  {
+    *repr = GD_REPR_NONE;
+    E = _GD_FindField(D, field_code, old_len, D->entry, D->n_entries, 1, index);
   }
 
-  dreturn("%p %i", E, *repr);
+  /* Set error, if requested */
+  if (E == NULL && err)
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+
+  dreturn("%p 0x%X", E, *repr);
   return E;
 }
 
@@ -1001,7 +1036,7 @@ char *_GD_CanonicalPath(const char *car, const char *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);
+      res = malloc(strlen(car) + strlen(cdr) + 2);
       if (res == NULL) {
         dreturn("%p", NULL);
         return NULL;
@@ -1029,7 +1064,7 @@ char *_GD_CanonicalPath(const char *car, const char *cdr)
   } 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);
+    res = malloc(res_size = PATH_MAX);
     if (res == NULL) {
       dreturn("%p", NULL);
       return NULL;
@@ -1053,8 +1088,8 @@ char *_GD_CanonicalPath(const char *car, const char *cdr)
      * 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);
+    res = malloc(res_size = PATH_MAX);
+    work = malloc(PATH_MAX);
     if (res == NULL || work == NULL) {
       free(res);
       dreturn("%p", NULL);
@@ -1074,7 +1109,7 @@ char *_GD_CanonicalPath(const char *car, const char *cdr)
       res_root = res_len = 0;
     } else {
       if ((len = strlen(work) + 2 + strlen(cdr)) < PATH_MAX) {
-        ptr = (char*)realloc(work, len);
+        ptr = realloc(work, len);
         if (ptr == NULL) {
           free(res);
           free(work);
@@ -1134,7 +1169,7 @@ char *_GD_CanonicalPath(const char *car, const char *cdr)
       /* 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);
+        ptr = realloc(res, res_size += (len < 1000) ? 1000 : len);
         if (ptr == NULL) {
           free(res);
           free(work);
@@ -1160,7 +1195,7 @@ char *_GD_CanonicalPath(const char *car, const char *cdr)
             if (*end) {
               len = strlen(end) + 1;
               if (res_len + len >= res_size) {
-                ptr = (char*)realloc(res, res_size += len);
+                ptr = realloc(res, res_size += len);
                 if (ptr == NULL) {
                   free(res);
                   free(work);
@@ -1248,7 +1283,7 @@ char *_GD_CanonicalPath(const char *car, const char *cdr)
               len--;
             }
 
-            new_work = (char*)malloc(len);
+            new_work = malloc(len);
             if (new_work == NULL) {
               free(res);
               free(work);
@@ -1271,7 +1306,7 @@ _GD_CanonicalPath_DONE:
   free(work);
 
   /* trim */
-  ptr = (char*)realloc(res, res_len + 1);
+  ptr = realloc(res, res_len + 1);
   if (ptr)
     res = ptr;
 
@@ -1434,6 +1469,11 @@ void _GD_ReleaseDir(DIRFILE *D, int dirfd)
   dreturnvoid();
 }
 
+/* Caller's memory manager */
+void *(*_GD_CMalloc)(size_t) = malloc;
+void (*_GD_CFree)(void*) = free;
+char *(*_GD_CStrdup)(const char*) = strdup;
+
 /* allocation boilerplates */
 void *_GD_Malloc(DIRFILE *D, size_t size)
 {
diff --git a/src/compat.c b/src/compat.c
index f2cecd7..4c9854f 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2015 D. V. Wiebe
+/* Copyright (C) 2010-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -184,7 +184,7 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream)
 
   /* create a new buffer, if necessary */
   if (*lineptr == NULL || *n == 0) {
-    *lineptr = (char *)malloc(*n = 100);
+    *lineptr = malloc(*n = 100);
     if (*lineptr == NULL) {
       dreturn("%i", -1);
       return -1;
@@ -253,7 +253,7 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream)
 
     /* realloc, if necessary */
     if (*n < new_len) {
-      char *ptr = (char *)realloc(*lineptr, new_len);
+      char *ptr = realloc(*lineptr, new_len);
       if (!ptr) {
         dreturn("%i", -1);
         return -1;
@@ -298,29 +298,22 @@ char *basename(char *path)
 }
 #endif
 
-/* emulate readdir_r(3) with non-threadsafe readdir(3) */
+/* emulate readdir_r(3) with readdir(3).  This implementation ignores
+ * 'entry' completely */
 #ifndef HAVE_READDIR_R
-int _GD_ReadDir(DIR *dirp, struct dirent *entry, struct dirent **result)
+int _GD_ReadDir(DIR *dirp, struct dirent *entry gd_unused_,
+    struct dirent **result)
 {
-  struct dirent *local_entry;
-
-  dtrace("%p, %p, %p", dirp, entry, result);
+  dtrace("%p, <unused>, %p", dirp, 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 = readdir(dirp);
+  if (*result == NULL && errno) {
+    dreturn("%i", errno);
+    return errno;
   }
 
-  *result = entry;
-  memcpy(entry, local_entry, sizeof(struct dirent));
-  dreturn("%i", 0);
+  dreturn("%i (%p)", 0, *result);
   return 0;
 }
 #endif
diff --git a/src/constant.c b/src/constant.c
index 01c792b..e826b0a 100644
--- a/src/constant.c
+++ b/src/constant.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2010-2015 D. V. Wiebe
+/* Copyright (C) 2008, 2010-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,32 +20,21 @@
  */
 #include "internal.h"
 
-int gd_get_carray_slice(DIRFILE *D, const char *field_code_in,
-    unsigned long start, size_t n, gd_type_t return_type, void *data_out)
-  gd_nothrow
+int gd_get_carray_slice(DIRFILE *D, const char *field_code, unsigned long start,
+    size_t n, gd_type_t return_type, void *data_out) gd_nothrow
 {
   gd_entry_t *entry;
-  char* field_code;
   int repr;
 
-  dtrace("%p, \"%s\", %lu, %" PRIuSIZE ", 0x%x, %p", D, field_code_in, start,
-      n, return_type, data_out);
+  dtrace("%p, \"%s\", %lu, %" PRIuSIZE ", 0x%x, %p", D, field_code, start, n,
+      return_type, data_out);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  _GD_ClearError(D);
+  entry = _GD_FindFieldAndRepr(D, 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 (D->error)
+    GD_RETURN_ERROR(D);
 
   if (entry->field_type != GD_CARRAY_ENTRY &&
       entry->field_type != GD_CONST_ENTRY)
@@ -55,98 +44,70 @@ int gd_get_carray_slice(DIRFILE *D, const char *field_code_in,
       entry->EN(scalar,array_len)))
   {
     _GD_SetError(D, GD_E_BOUNDS, 0, NULL, 0, NULL);
+  } else if (return_type != GD_NULL &&
+      _GD_BadType(GD_DIRFILE_STANDARDS_VERSION, return_type))
+  {
+    _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, return_type, NULL);
   } else if (!D->error)
     _GD_DoField(D, entry, repr, start, n, 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;
+  GD_RETURN_ERROR(D);
 }
 
-int gd_get_carray(DIRFILE *D, const char *field_code_in, gd_type_t return_type,
+int gd_get_carray(DIRFILE *D, const char *field_code, 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) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  dtrace("%p, \"%s\", 0x%x, %p", D, field_code, return_type, data_out);
 
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
-      1);
+  entry = _GD_FindFieldAndRepr(D, field_code, &repr, NULL, 1);
 
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (D->error)
+    GD_RETURN_ERROR(D);
 
   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)
+  } else if (return_type != GD_NULL &&
+      _GD_BadType(GD_DIRFILE_STANDARDS_VERSION, return_type))
+  {
+    _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, return_type, NULL);
+  } else
     _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);
-
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
-int gd_get_constant(DIRFILE* D, const char *field_code_in,
-    gd_type_t return_type, void *data_out) gd_nothrow
+int gd_get_constant(DIRFILE* D, const char *field_code, 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);
+  return gd_get_carray_slice(D, field_code, 0, 1, return_type, data_out);
 }
 
-size_t gd_array_len(DIRFILE *D, const char *field_code_in) gd_nothrow
+size_t gd_array_len(DIRFILE *D, const char *field_code) gd_nothrow
 {
   gd_entry_t *entry;
-  char* field_code;
-  int repr;
   size_t len = 0;
 
-  dtrace("%p, \"%s\"", D, field_code_in);
-
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", 0);
-    return 0;
-  }
+  dtrace("%p, \"%s\"", D, field_code);
 
-  _GD_ClearError(D);
+  GD_RETURN_IF_INVALID(D, "%i", 0);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
-      1);
+  entry = _GD_FindEntry(D, field_code);
 
   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_SARRAY_ENTRY)
   {
     len = entry->EN(scalar,array_len);
   } else if (entry->field_type == GD_CONST_ENTRY ||
@@ -156,9 +117,6 @@ size_t gd_array_len(DIRFILE *D, const char *field_code_in) gd_nothrow
   } else 
     _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);
-
   dreturn("%" PRIuSIZE, len);
   return len;
 }
@@ -169,7 +127,7 @@ size_t gd_carray_len(DIRFILE *D, const char *field_code) gd_nothrow
   return gd_array_len(D, field_code);
 }
 
-static int _GD_PutCarraySlice(DIRFILE* D, gd_entry_t *E, unsigned long first,
+static void _GD_PutCarraySlice(DIRFILE* D, gd_entry_t *E, unsigned long first,
     size_t n, gd_type_t data_type, const void *data_in) gd_nothrow
 {
   int i;
@@ -177,22 +135,20 @@ static int _GD_PutCarraySlice(DIRFILE* D, gd_entry_t *E, unsigned long first,
   dtrace("%p, %p, %lu, %" PRIuSIZE ", 0x%X, %p", D, E, first, n, data_type,
       data_in);
 
-  if ((D->flags & GD_ACCMODE) != GD_RDWR) {
+  if ((D->flags & GD_ACCMODE) != GD_RDWR)
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (first + n > ((E->field_type == GD_CONST_ENTRY) ? 1 :
+  else if (first + n > ((E->field_type == GD_CONST_ENTRY) ? 1 :
         E->EN(scalar,array_len)))
   {
     _GD_SetError(D, GD_E_BOUNDS, 0, NULL, 0, NULL);
-  } else
+  } else if (_GD_BadType(GD_DIRFILE_STANDARDS_VERSION, data_type))
+    _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, data_type, NULL);
+  else
     _GD_DoFieldOut(D, E, first, n, data_type, data_in);
 
   if (D->error) {
-    dreturn("%i", -1);
-    return -1;
+    dreturnvoid();
+    return;
   }
 
   /* Flag all clients as needing recalculation */
@@ -204,81 +160,56 @@ static int _GD_PutCarraySlice(DIRFILE* D, gd_entry_t *E, unsigned long first,
   E->e->u.scalar.client = NULL;
   E->e->u.scalar.n_client = 0;
 
-  dreturn("%i", 0);
-  return 0;
+  dreturnvoid();
 }
 
 int gd_put_carray_slice(DIRFILE* D, const char *field_code, unsigned long first,
     size_t n, gd_type_t data_type, const void *data_in) gd_nothrow
 {
   gd_entry_t *entry;
-  int r = -1;
 
   dtrace("%p, \"%s\", %lu, %" PRIuSIZE ", 0x%X, %p", D, field_code, first,
       n, data_type, data_in);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  entry = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
+  entry = _GD_FindEntry(D, field_code);
 
-  if (entry == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (entry->field_type != GD_CARRAY_ENTRY &&
+  if (entry == NULL)
+    ; /* error already set */
+  else 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
-    r = _GD_PutCarraySlice(D, entry, first, n, data_type, data_in);
+    _GD_PutCarraySlice(D, entry, first, n, data_type, data_in);
 
-  dreturn("%i", r);
-  return r;
+  GD_RETURN_ERROR(D);
 }
 
 int gd_put_carray(DIRFILE* D, const char *field_code, gd_type_t data_type,
     const void *data_in) gd_nothrow
 {
   gd_entry_t *entry;
-  int r = -1;
 
   dtrace("%p, \"%s\", 0x%x, %p", D, field_code, data_type, data_in);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  entry = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
+  entry = _GD_FindEntry(D, field_code);
 
-  if (entry == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (entry->field_type != GD_CARRAY_ENTRY &&
+  if (entry == NULL)
+    ; /* error already set */
+  else 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
-    r = _GD_PutCarraySlice(D, entry, 0,
+    _GD_PutCarraySlice(D, entry, 0,
         (entry->field_type == GD_CONST_ENTRY) ? 1 : entry->EN(scalar,array_len),
         data_type, data_in);
 
-  dreturn("%i", r);
-  return r;
+  GD_RETURN_ERROR(D);
 }
 
 int gd_put_constant(DIRFILE* D, const char *field_code, gd_type_t data_type,
diff --git a/src/del.c b/src/del.c
index d798c3d..9359d09 100644
--- a/src/del.c
+++ b/src/del.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,6 +20,29 @@
  */
 #include "internal.h"
 
+static int _GD_ClearInput(DIRFILE *restrict D, gd_entry_t *restrict E,
+    const gd_entry_t *restrict C, int i, int check)
+{
+  dtrace("%p, %p, %p, %i, %i", D, E, C, i, check);
+
+  /* If we're not checking and entry[i] is NULL, job's already done.
+   * Otherwise, find this entry, if it doesn't exist. */
+  if (check && E->e->entry[i] == NULL)
+    E->e->entry[i] = _GD_FindFieldAndRepr(D, E->in_fields[i], &E->e->repr[i],
+        NULL, 0);
+
+  if (E->e->entry[i] == C) {
+    if (check)
+      GD_SET_RETURN_ERROR(D, GD_E_DELETE, GD_E_DEL_DERIVED, E->field, 0,
+          C->field);
+    else
+      E->e->entry[i] = NULL;
+  }
+
+  dreturn("%i", 0);
+  return 0;
+}
+
 static void _GD_ClearDerived(DIRFILE *restrict D, gd_entry_t *restrict E,
     const gd_entry_t *restrict C, int check)
 {
@@ -30,26 +53,17 @@ static void _GD_ClearDerived(DIRFILE *restrict D, gd_entry_t *restrict E,
   switch(E->field_type) {
     case GD_LINCOM_ENTRY:
       for (i = 0; i < E->EN(lincom,n_fields); ++i)
-        if (strcmp(E->in_fields[i], C->field) == 0) {
-          if (check)
-            _GD_SetError(D, GD_E_DELETE, GD_E_DEL_DERIVED, E->field, 0,
-                C->field);
-          else
-            E->e->entry[i] = NULL;
-        }
+        if (_GD_ClearInput(D, E, C, i, check))
+          break;
       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,
-              C->field);
-        else
-          E->e->entry[1] = NULL;
-      }
-      break;
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
+      if (_GD_ClearInput(D, E, C, 1, check))
+        break;
       /* Fallthrough */
     case GD_RECIP_ENTRY:
     case GD_LINTERP_ENTRY:
@@ -57,13 +71,7 @@ static void _GD_ClearDerived(DIRFILE *restrict D, gd_entry_t *restrict E,
     case GD_PHASE_ENTRY:
     case GD_POLYNOM_ENTRY:
     case GD_SBIT_ENTRY:
-      if (strcmp(E->in_fields[0], C->field) == 0) {
-        if (check)
-          _GD_SetError(D, GD_E_DELETE, GD_E_DEL_DERIVED, E->field, 0,
-              C->field);
-        else
-          E->e->entry[0] = NULL;
-      }
+      _GD_ClearInput(D, E, C, 0, check);
       break;
     case GD_NO_ENTRY:
     case GD_RAW_ENTRY:
@@ -71,6 +79,7 @@ static void _GD_ClearDerived(DIRFILE *restrict D, gd_entry_t *restrict E,
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
     case GD_STRING_ENTRY:
+    case GD_SARRAY_ENTRY:
       break;
     case GD_ALIAS_ENTRY:
       if (E->e->entry[0] == C) {
@@ -89,22 +98,15 @@ static int _GD_DeReferenceOne(DIRFILE *restrict D, gd_entry_t *restrict E,
     void *restrict data)
 {
   int repr;
-  char *field_code;
+  size_t len;
 
   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, 1);
-
-    if (D->error) {
-      dreturn("%i", 1);
-      return 1;
-    }
-
-    if (strcmp(C->field, field_code) == 0) {
-      if (field_code != E->scalar[i])
-        free(field_code);
+    len = strlen(E->scalar[i]);
+    repr = _GD_GetRepr(E->scalar[i], &len);
 
+    if (len == C->e->len && memcmp(C->field, E->scalar[i], len) == 0) {
       if (check) {
         _GD_SetError(D, GD_E_DELETE, GD_E_DEL_CONST, E->field, 0, C->field);
 
@@ -116,9 +118,7 @@ static int _GD_DeReferenceOne(DIRFILE *restrict D, gd_entry_t *restrict E,
         free(E->scalar[i]);
         E->scalar[i] = NULL;
       }
-    } else if (field_code != E->scalar[i])
-      free(field_code);
-
+    }
   }
 
   dreturn("%i", 0);
@@ -174,7 +174,9 @@ static void _GD_DeReference(DIRFILE *restrict D, gd_entry_t *restrict E,
     case GD_SBIT_ENTRY:
       if (_GD_DeReferenceOne(D, E, C, check, 0, GD_INT_TYPE,
             &E->EN(bit,bitnum)))
+      {
         break;
+      }
 
       _GD_DeReferenceOne(D, E, C, check, 1, GD_INT_TYPE, &E->EN(bit,numbits));
       break;
@@ -212,6 +214,9 @@ static void _GD_DeReference(DIRFILE *restrict D, gd_entry_t *restrict E,
     case GD_STRING_ENTRY:
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_ALIAS_ENTRY:
       break;
@@ -220,11 +225,10 @@ static void _GD_DeReference(DIRFILE *restrict D, gd_entry_t *restrict E,
   dreturnvoid();
 }
 
-static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
+static void _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
     unsigned int index, unsigned int flags)
 {
-  unsigned int first, last = 0;
-  int n_del, i, len;
+  int n_del, i;
   unsigned int j;
   char **new_ref = NULL;
   gd_entry_t *reference = NULL;
@@ -232,65 +236,28 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
 
   dtrace("%p, %p, %u, 0x%X", D, E, index, flags);
 
-  if ((D->flags & GD_ACCMODE) != GD_RDWR) {
+  if ((D->flags & GD_ACCMODE) != GD_RDWR)
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  len = strlen(E->field);
-
-  /* check protection */
-  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
+  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);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  /* 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) {
+  else if (E->e->n_meta > 0 && ~flags & GD_DEL_META)
+    /* This field has metafields and we weren't asked to delete those too:
+     * complain */
     _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,
-          0, &first) == NULL)
-    {
-      _GD_InternalError(D);
-      dreturn("%i", -1);
-      return -1;
-    }
-    last = first;
-
-    /* The remaining meta fields will be contiguous with this one, so just
-     * 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, 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, E->field, len) == 0 &&
-          D->entry[last + 1]->field[len] == '/')
-        last++;
-      else
-        break;
+  if (D->error) {
+    dreturnvoid();
+    return;
   }
 
-  /* gather a list of fields */
+  /* gather a list of fields to delete (the target, plus all its metafields */
   del_list = _GD_Malloc(D, sizeof(*del_list) * (((E->e->n_meta == -1) ? 0 :
           E->e->n_meta) + 1));
 
   if (del_list == NULL) {
-    dreturn("%i", -1);
-    return -1;
+    dreturnvoid();
+    return;
   }
 
   del_list[0] = E;
@@ -314,8 +281,8 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
 
         if (D->error) {
           free(del_list);
-          dreturn("%i", -1);
-          return -1;
+          dreturnvoid();
+          return;
         }
       }
 
@@ -324,8 +291,8 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
     /* close data file, if open */
     if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_DISCARD)) {
       free(del_list);
-      dreturn("%i", -1);
-      return -1;
+      dreturnvoid();
+      return;
     }
 
     if (flags & GD_DEL_DATA) {
@@ -334,14 +301,14 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
         _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_DATA, NULL, 0,
             D->fragment[E->fragment_index].cname);
         free(del_list);
-        dreturn("%i", -1);
-        return -1;
+        dreturnvoid();
+        return;
       }
 
       if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_UNLINK)) {
         free(del_list);
-        dreturn("%i", -1);
-        return -1;
+        dreturnvoid();
+        return;
       }
 
       if ((*_GD_ef[E->e->u.raw.file[0].subenc].name)(D,
@@ -349,8 +316,8 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
             E->e->u.raw.file, E->e->u.raw.filebase, 0, 0))
       {
         free(del_list);
-        dreturn("%i", -1);
-        return -1;
+        dreturnvoid();
+        return;
       }
 
       if ((*_GD_ef[E->e->u.raw.file[0].subenc].unlink)(
@@ -359,8 +326,8 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
         if (errno != ENOENT) {
           _GD_SetEncIOError(D, GD_E_IO_UNLINK, E->e->u.raw.file + 0);
           free(del_list);
-          dreturn("%i", -1);
-          return -1;
+          dreturnvoid();
+          return;
         }
       }
     }
@@ -371,8 +338,8 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
     new_ref = _GD_Malloc(D, sizeof(*new_ref) * D->n_fragment);
     if (new_ref == NULL) {
       free(del_list);
-      dreturn("%i", -1);
-      return -1;
+      dreturnvoid();
+      return;
     }
     memset(new_ref, 0, sizeof(char*) * D->n_fragment);
 
@@ -402,8 +369,8 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
                   free(new_ref[f]);
                 free(new_ref);
                 free(del_list);
-                dreturn("%i", -1);
-                return -1;
+                dreturnvoid();
+                return;
               }
 
               if (i == 0)
@@ -436,21 +403,24 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
       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_STRING_ENTRY)
+      else
         _GD_ClearDerived(D, D->entry[j], del_list[i], 0);
 
-  free(del_list);
-
-  /* Remove meta fields, if present */
   if (E->e->n_meta >= 0) {
-    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, D->entry[j], 1);
+    if (n_del > 1) {
+      /* Sort the del list for easier searching */
+      qsort(del_list + 1, n_del - 1, sizeof del_list[0], _GD_EntryCmp);
 
-      memmove(D->entry + first, D->entry + last + 1,
-          sizeof(gd_entry_t*) * (D->n_entries - last - 1));
-      D->n_entries -= last - first + 1;
+      /* Remove all meta fields -- there are no RAW fields here */
+      for (i = 1, j = 0; i < n_del && j < D->n_entries; ++j) {
+        if (D->entry[j] == del_list[i]) {
+          _GD_FreeE(D, D->entry[j], 1);
+          memmove(D->entry + j, D->entry + j + 1,
+              sizeof(gd_entry_t *) * (D->n_entries - j - 1));
+          D->n_entries--;
+          i++;
+        }
+      }
     }
 
     /* Invalidate the field lists */
@@ -475,6 +445,8 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
     Pe->fl.value_list_validity = 0;
   }
 
+  free(del_list);
+
   /* 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 */
@@ -485,36 +457,25 @@ static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
       sizeof(gd_entry_t *) * (D->n_entries - index - 1));
   D->n_entries--;
 
-  dreturn("%i", 0);
-  return 0;
+  dreturnvoid();
 }
 
 int gd_delete(DIRFILE *D, const char *field_code, unsigned int flags)
 {
   unsigned index;
-  int ret;
   gd_entry_t *E;
 
   dtrace("%p, \"%s\", 0x%X", D, field_code, 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);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, &index);
+  E = _GD_FindField(D, field_code, strlen(field_code), D->entry, D->n_entries,
+      0, &index);
 
-  if (E == NULL) {
+  if (E == NULL) 
     _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  ret = _GD_Delete(D, E, index, flags);
+  else
+    _GD_Delete(D, E, index, flags);
 
-  dreturn("%i", ret);
-  return ret;
+  GD_RETURN_ERROR(D);
 }
diff --git a/src/encoding.c b/src/encoding.c
index e7bcc97..fbbb09f 100644
--- a/src/encoding.c
+++ b/src/encoding.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -73,7 +73,7 @@ struct encoding_t _GD_ef[GD_N_SUBENCODINGS] = {
   &_GD_GenericMove, &_GD_GenericUnlink, &_GD_GzipStrerr
 #else
 #define GD_EF_PROVIDES 0
-#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_INT_FUNCS GD_EF_GENERICNOP_SET
 #endif
   GD_EXT_ENCODING_GENOP(GD_GZIP_ENCODED, ".gz", GD_EF_ECOR | GD_EF_OOP, "Gzip",
       "gzip"),
@@ -90,7 +90,7 @@ struct encoding_t _GD_ef[GD_N_SUBENCODINGS] = {
   &_GD_Bzip2Read, &_GD_Bzip2Size, &_GD_Bzip2Write, &_GD_NopSync, \
   &_GD_GenericMove, &_GD_GenericUnlink, &_GD_Bzip2Strerr
 #else
-#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_INT_FUNCS GD_EF_GENERICNOP_SET
 #define GD_EF_PROVIDES 0
 #endif
   GD_EXT_ENCODING_GENOP(GD_BZIP2_ENCODED, ".bz2", GD_EF_ECOR | GD_EF_OOP,
@@ -107,7 +107,7 @@ struct encoding_t _GD_ef[GD_N_SUBENCODINGS] = {
   &_GD_SlimRead, &_GD_SlimSize, NULL /* WRITE */, &_GD_NopSync, \
   &_GD_GenericMove, &_GD_GenericUnlink, &_GD_SlimStrerr
 #else
-#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_INT_FUNCS GD_EF_GENERICNOP_SET
 #define GD_EF_PROVIDES 0
 #endif
   GD_EXT_ENCODING_GENOP(GD_SLIM_ENCODED, ".slm", GD_EF_ECOR, "Slim", "slim"),
@@ -125,7 +125,7 @@ struct encoding_t _GD_ef[GD_N_SUBENCODINGS] = {
   &_GD_LzmaRead, &_GD_LzmaSize, &_GD_LzmaWrite, &_GD_LzmaSync, \
   &_GD_GenericMove, &_GD_GenericUnlink, &_GD_LzmaStrerr
 #else
-#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_INT_FUNCS GD_EF_GENERIC_SET
 #define GD_EF_PROVIDES 0
 #endif
   GD_EXT_ENCODING_GEN(GD_LZMA_ENCODED, ".xz", GD_EF_ECOR | GD_EF_OOP, "Lzma",
@@ -141,7 +141,7 @@ struct encoding_t _GD_ef[GD_N_SUBENCODINGS] = {
   &_GD_LzmaRead, &_GD_LzmaSize, NULL /* WRITE */, NULL /* SYNC */, \
   &_GD_GenericMove, &_GD_GenericUnlink, &_GD_LzmaStrerr
 #else
-#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_INT_FUNCS GD_EF_GENERIC_SET
 #define GD_EF_PROVIDES 0
 #endif
   GD_EXT_ENCODING_GEN(GD_LZMA_ENCODED, ".lzma", GD_EF_ECOR, "Lzma", "lzma"),
@@ -207,10 +207,10 @@ struct encoding_t _GD_ef[GD_N_SUBENCODINGS] = {
   &_GD_FlacRead, &_GD_FlacSize, &_GD_FlacWrite, &_GD_NopSync, \
   &_GD_GenericMove, &_GD_GenericUnlink, &_GD_FlacStrerr
 #else
-#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_INT_FUNCS GD_EF_GENERICNOP_SET
 #define GD_EF_PROVIDES 0
 #endif
-  GD_EXT_ENCODING_GENOP(GD_FLAC_ENCODED, ".flac", GD_EF_ECOR | GD_EF_OOP,
+  GD_EXT_ENCODING_GENOP(GD_FLAC_ENCODED, ".flac", GD_EF_SWAP | GD_EF_OOP,
       "Flac", "flac"),
 #undef GD_INT_FUNCS
 #undef GD_EF_PROVIDES
@@ -286,7 +286,7 @@ int _GD_MissingFramework(int encoding, unsigned int funcs)
     lt_dlhandle lib;
 
     /* make the library name */
-    library = (char *)malloc(sizeof(GETDATA_MODULEDIR) +
+    library = malloc(sizeof(GETDATA_MODULEDIR) +
         strlen(_GD_ef[encoding].affix) + sizeof(GD_GETDATA_VERSION) + 13);
     if (!library) {
       _GD_ef[encoding].provides = 0;
@@ -450,7 +450,8 @@ int _GD_FiniRawIO(DIRFILE *D, const gd_entry_t *E, int fragment, int flags)
 
         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);
+              E->e->u.raw.file, buffer, E->EN(raw,data_type),
+              GD_BUFFER_SIZE / GD_SIZE(E->EN(raw,data_type)));
           if (n_read < 0) {
             free(buffer);
             _GD_SetEncIOError(D, GD_E_IO_READ, E->e->u.raw.file + 0);
@@ -467,7 +468,7 @@ int _GD_FiniRawIO(DIRFILE *D, const gd_entry_t *E, int fragment, int flags)
             }
             n_to_write -= n_wrote;
           }
-        } while (n_read == GD_BUFFER_SIZE);
+        } while (n_read > 0);
 
         free(buffer);
       }
@@ -602,6 +603,8 @@ int _GD_InitRawIO(DIRFILE *D, const gd_entry_t *E, const char *filebase,
         return 1;
       }
     }
+    if (oop_write)
+      E->e->u.raw.file[1].subenc = E->e->u.raw.file[0].subenc;
   }
 
   if (filebase == NULL)
@@ -679,7 +682,7 @@ static unsigned long _GD_ResolveEncoding(DIRFILE *restrict D,
   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);
+        candidate = malloc(len + strlen(_GD_ef[i].ext) + 1);
         if (!candidate)
           continue;
 
@@ -905,33 +908,15 @@ int gd_alter_encoding(DIRFILE* D, unsigned long encoding, int fragment,
 
   dtrace("%p, %lu, %i, %i", D, (unsigned long)encoding, fragment, move);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  if ((D->flags & GD_ACCMODE) != GD_RDWR) {
+  if ((D->flags & GD_ACCMODE) != GD_RDWR)
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (fragment < GD_ALL_FRAGMENTS || fragment >= D->n_fragment) {
+  else if (fragment < GD_ALL_FRAGMENTS || fragment >= D->n_fragment)
     _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (!_GD_EncodingUnderstood(encoding)) {
+  else if (!_GD_EncodingUnderstood(encoding))
     _GD_SetError(D, GD_E_UNKNOWN_ENCODING, GD_E_UNENC_TARGET, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
-
-  if (fragment == GD_ALL_FRAGMENTS) {
+  else if (fragment == GD_ALL_FRAGMENTS) {
     for (i = 0; i < D->n_fragment; ++i) {
       _GD_RecodeFragment(D, encoding, i, move);
 
@@ -941,8 +926,7 @@ int gd_alter_encoding(DIRFILE* D, unsigned long encoding, int fragment,
   } else
     _GD_RecodeFragment(D, encoding, fragment, move);
 
-  dreturn("%i", (D->error) ? -1 : 0);
-  return (D->error) ? -1 : 0;
+  GD_RETURN_ERROR(D);
 }
 
 unsigned long gd_encoding(DIRFILE* D, int fragment) gd_nothrow
@@ -952,11 +936,7 @@ unsigned long gd_encoding(DIRFILE* D, int fragment) gd_nothrow
 
   dtrace("%p, %i", D, fragment);
 
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", 0);
-    return 0;
-  }
+  GD_RETURN_IF_INVALID(D, "%i", 0);
 
   if (fragment < 0 || fragment >= D->n_fragment) {
     _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
@@ -964,8 +944,6 @@ unsigned long gd_encoding(DIRFILE* D, int fragment) gd_nothrow
     return 0;
   }
 
-  _GD_ClearError(D);
-
   /* Attempt to figure out the encoding, if it's not known */
   if (D->fragment[fragment].encoding == GD_AUTO_ENCODED) {
     /* locate a RAW field in this fragment */
@@ -1004,8 +982,8 @@ int gd_encoding_support(unsigned long encoding) gd_nothrow
 
   /* make sure we have a valid encoding */
   if (!_GD_EncodingUnderstood(encoding)) {
-    dreturn("%i", -1);
-    return -1;
+    dreturn("%i", GD_E_UNKNOWN_ENCODING);
+    return GD_E_UNKNOWN_ENCODING;
   }
 
   /* spin up ltdl if needed */
@@ -1030,8 +1008,8 @@ int gd_encoding_support(unsigned long encoding) gd_nothrow
     }
 
   /* nope */
-  dreturn("%i", -1);
-  return -1;
+  dreturn("%i", GD_E_UNSUPPORTED);
+  return GD_E_UNSUPPORTED;
 }
 
 /* This is basically the non-existant POSIX funcion mkstempat.  There are two
diff --git a/src/endian.c b/src/endian.c
index 5494685..a94e912 100644
--- a/src/endian.c
+++ b/src/endian.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013, 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2014, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -112,33 +112,15 @@ int gd_alter_endianness(DIRFILE* D, unsigned long byte_sex, int fragment,
 
   dtrace("%p, %lx, %i, %i", D, (unsigned long)byte_sex, fragment, move);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  if ((D->flags & GD_ACCMODE) != GD_RDWR) {
+  if ((D->flags & GD_ACCMODE) != GD_RDWR) 
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (fragment < GD_ALL_FRAGMENTS || fragment >= D->n_fragment) {
+  else if (fragment < GD_ALL_FRAGMENTS || fragment >= D->n_fragment)
     _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (byte_sex != GD_BIG_ENDIAN && byte_sex != GD_LITTLE_ENDIAN) {
+  else if (byte_sex != GD_BIG_ENDIAN && byte_sex != GD_LITTLE_ENDIAN)
     _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_ENDIANNESS, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
-
-  if (fragment == GD_ALL_FRAGMENTS) {
+  else if (fragment == GD_ALL_FRAGMENTS) {
     for (i = 0; i < D->n_fragment; ++i) {
       _GD_ByteSwapFragment(D, byte_sex, i, move);
 
@@ -148,19 +130,14 @@ int gd_alter_endianness(DIRFILE* D, unsigned long byte_sex, int fragment,
   } else
     _GD_ByteSwapFragment(D, byte_sex, fragment, move);
 
-  dreturn("%i", (D->error) ? -1 : 0);
-  return (D->error) ? -1 : 0;
+  GD_RETURN_ERROR(D);
 }
 
 unsigned long gd_endianness(DIRFILE* D, int fragment) gd_nothrow
 {
   dtrace("%p, %i", D, fragment);
 
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", 0);
-    return 0;
-  }
+  GD_RETURN_IF_INVALID(D, "%i", 0);
 
   if (fragment < 0 || fragment >= D->n_fragment) {
     _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
@@ -168,8 +145,6 @@ unsigned long gd_endianness(DIRFILE* D, int fragment) gd_nothrow
     return 0;
   }
 
-  _GD_ClearError(D);
-
   dreturn("0x%lx", (unsigned long)D->fragment[fragment].byte_sex);
   return D->fragment[fragment].byte_sex;
 }
diff --git a/src/entry.c b/src/entry.c
index 53d7d9b..f11aef4 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -37,12 +37,23 @@ void _GD_FreeFL(struct gd_flist_ *fl)
     free(fl->carray_value_list);
   }
 
+  if (fl->sarray_value_list) {
+    for (i = 0; fl->sarray_value_list[i] != NULL; ++i)
+      free(fl->sarray_value_list[i]);
+    free(fl->sarray_value_list);
+  }
+
   dreturnvoid();
 }
 
 void _GD_FreeE(DIRFILE *restrict D, gd_entry_t *restrict entry, int priv)
 {
-  int i;
+  int i, j;
+  size_t n;
+
+  /* If priv == 0, then we've been called via gd_free_entry_strings and
+   * need to use the caller's free function on the public strings */
+  void (*free_)(void*) = priv ? free : _GD_CFree;
 
   dtrace("%p, %p, %i", D, entry, priv);
 
@@ -51,19 +62,24 @@ void _GD_FreeE(DIRFILE *restrict D, gd_entry_t *restrict entry, int priv)
     return;
   }
 
-  free(entry->field);
+  free_(entry->field);
 
   switch(entry->field_type) {
     case GD_LINCOM_ENTRY:
-      for (i = 0; i < entry->EN(lincom,n_fields); ++i) {
-        free(entry->in_fields[i]);
-        free(entry->scalar[i]);
-        free(entry->scalar[i + GD_MAX_LINCOM]);
+      /* Don't trust the caller */
+      j = entry->EN(lincom,n_fields);
+      if (j > GD_MAX_LINCOM)
+        j = GD_MAX_LINCOM;
+
+      for (i = 0; i < j; ++i) {
+        free_(entry->in_fields[i]);
+        free_(entry->scalar[i]);
+        free_(entry->scalar[i + GD_MAX_LINCOM]);
       }
       break;
     case GD_LINTERP_ENTRY:
-      free(entry->in_fields[0]);
-      free(entry->EN(linterp,table));
+      free_(entry->in_fields[0]);
+      free_(entry->EN(linterp,table));
       if (priv) {
         if (entry->e->u.linterp.table_dirfd > 0)
           _GD_ReleaseDir(D, entry->e->u.linterp.table_dirfd);
@@ -74,29 +90,44 @@ void _GD_FreeE(DIRFILE *restrict D, gd_entry_t *restrict entry, int priv)
       break;
     case GD_DIVIDE_ENTRY:
     case GD_MULTIPLY_ENTRY:
-      free(entry->in_fields[1]);
-      free(entry->in_fields[0]);
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
+      free_(entry->in_fields[1]);
+      free_(entry->in_fields[0]);
       break;
     case GD_BIT_ENTRY:
     case GD_SBIT_ENTRY:
-      free(entry->scalar[0]);
-      free(entry->scalar[1]);
-      free(entry->in_fields[0]);
+      free_(entry->scalar[0]);
+      free_(entry->scalar[1]);
+      free_(entry->in_fields[0]);
       break;
     case GD_PHASE_ENTRY:
     case GD_RECIP_ENTRY:
-      free(entry->scalar[0]);
-      free(entry->in_fields[0]);
+      free_(entry->scalar[0]);
+      free_(entry->in_fields[0]);
       break;
     case GD_POLYNOM_ENTRY:
-      free(entry->in_fields[0]);
-      for (i = 0; i <= entry->EN(polynom,poly_ord); ++i)
-        free(entry->scalar[i]);
+      free_(entry->in_fields[0]);
+
+      /* Don't trust the caller */
+      j = entry->EN(polynom,poly_ord);
+      if (j > GD_MAX_POLYORD)
+        j = GD_MAX_POLYORD;
+
+      for (i = 0; i <= j; ++i)
+        free_(entry->scalar[i]);
       break;
     case GD_STRING_ENTRY:
       if (priv)
         free(entry->e->u.string);
       break;
+    case GD_SARRAY_ENTRY:
+      if (priv) {
+        for (n = 0; n < entry->EN(scalar,array_len); ++n)
+          free(((char **)entry->e->u.scalar.d)[n]);
+        free(entry->e->u.scalar.d);
+      }
+      break;
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
       if (priv) {
@@ -105,7 +136,7 @@ void _GD_FreeE(DIRFILE *restrict D, gd_entry_t *restrict entry, int priv)
       }
       break;
     case GD_RAW_ENTRY:
-      free(entry->scalar[0]);
+      free_(entry->scalar[0]);
       if (priv) {
         free(entry->e->u.raw.filebase);
         free(entry->e->u.raw.file[0].name);
@@ -113,18 +144,18 @@ void _GD_FreeE(DIRFILE *restrict D, gd_entry_t *restrict entry, int priv)
       }
       break;
     case GD_WINDOW_ENTRY:
-      free(entry->scalar[0]);
-      free(entry->in_fields[0]);
-      free(entry->in_fields[1]);
+      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]);
+      free_(entry->scalar[0]);
+      free_(entry->scalar[1]);
+      free_(entry->in_fields[0]);
+      free_(entry->in_fields[1]);
       break;
     case GD_ALIAS_ENTRY:
-      free(entry->in_fields[0]);
+      free_(entry->in_fields[0]);
       break;
     case GD_INDEX_ENTRY:
     case GD_NO_ENTRY:
@@ -164,21 +195,12 @@ int _GD_GetScalar(DIRFILE *restrict D, const char *restrict scalar,
 {
   gd_entry_t* C = NULL;
   int repr, e = 0;
-  char* field_code;
   int index = *index_in;
 
   dtrace("%p, \"%s\", %p(%i), 0x%02X, %p, %p", D, scalar, index_in, *index_in,
       type, data, E);
 
-  C = _GD_FindFieldAndRepr(D, scalar, &field_code, &repr, NULL, 0, 1);
-
-  if (D->error) {
-    dreturn("%i", 1);
-    return 1;
-  }
-
-  if (field_code != scalar)
-    free(field_code);
+  C = _GD_FindFieldAndRepr(D, scalar, &repr, NULL, 0);
 
   if (C == NULL)
     e = GD_E_SCALAR_CODE;
@@ -214,6 +236,8 @@ int _GD_GetScalar(DIRFILE *restrict D, const char *restrict scalar,
   return e;
 }
 
+/* Like _GD_GetScalar, but with more error checking.  And a different calling
+ * convention */
 static int _GD_GetScalar2(DIRFILE *restrict D, gd_entry_t *restrict E, int i,
     gd_type_t type, void *restrict data, int err)
 {
@@ -304,7 +328,8 @@ int _GD_CalculateEntry(DIRFILE *restrict D, gd_entry_t *restrict E, int err)
       switch (E->EN(window,windop)) {
         case GD_WINDOP_EQ:
         case GD_WINDOP_NE:
-          e = _GD_GetScalar2(D, E, 0, GD_INT64, &E->EN(window,threshold.i), err);
+          e = _GD_GetScalar2(D, E, 0, GD_INT64, &E->EN(window,threshold.i),
+              err);
           break;
         case GD_WINDOP_SET:
         case GD_WINDOP_CLR:
@@ -328,6 +353,9 @@ int _GD_CalculateEntry(DIRFILE *restrict D, gd_entry_t *restrict E, int err)
     case GD_STRING_ENTRY:
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_ALIAS_ENTRY:
       break;
@@ -347,18 +375,12 @@ int _GD_CalculateEntry(DIRFILE *restrict D, gd_entry_t *restrict E, int err)
 
 char* gd_raw_filename(DIRFILE* D, const char* field_code) gd_nothrow
 {
-  char *filename;
+  char *filename0, *filename;
   gd_entry_t *E;
 
   dtrace("%p, \"%s\"", D, field_code);
 
-  _GD_ClearError(D);
-
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%p", NULL);
-    return NULL;
-  }
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
   /* Check field */
   E = _GD_FindEntry(D, field_code);
@@ -375,7 +397,7 @@ char* gd_raw_filename(DIRFILE* D, const char* field_code) gd_nothrow
   }
 
   if (E->e->u.raw.file[0].name == NULL) {
-    /* ensure encoding sybtype is known */
+    /* ensure encoding subtype is known */
     if (!_GD_Supports(D, E, GD_EF_NAME)) {
       dreturn("%p", NULL);
       return NULL;
@@ -394,9 +416,23 @@ char* gd_raw_filename(DIRFILE* D, const char* field_code) gd_nothrow
     }
   }
 
-  filename = _GD_MakeFullPath(D, D->fragment[E->fragment_index].dirfd,
+  filename0 = _GD_MakeFullPath(D, D->fragment[E->fragment_index].dirfd,
       E->e->u.raw.file->name, 1);
 
+  if (D->error) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  /* move to caller's heap */
+  if (_GD_CMalloc != malloc) {
+    filename = _GD_CStrdup(filename0);
+    free(filename0);
+    if (filename == NULL)
+      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  } else
+    filename = filename0;
+
   dreturn("%p", filename);
   return filename;
 }
@@ -408,20 +444,12 @@ int gd_entry(DIRFILE* D, const char* field_code, gd_entry_t* entry) gd_nothrow
 
   dtrace("%p, \"%s\", %p", D, field_code, entry);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", 1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
   E = _GD_FindEntry(D, field_code);
 
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (D->error) 
+    GD_RETURN_ERROR(D);
 
   /* Calculate the entry, if necessary */
   if (!(E->flags & GD_EN_CALC))
@@ -431,70 +459,73 @@ int gd_entry(DIRFILE* D, const char* field_code, gd_entry_t* entry) gd_nothrow
   memcpy(entry, E, sizeof(gd_entry_t));
   entry->e = NULL;
 
-  /* duplicate strings */
-  entry->field = strdup(E->field);
+  /* duplicate strings using the caller's memory manager */
+  entry->field = _GD_CStrdup(E->field);
 
   switch(E->field_type) {
     case GD_LINCOM_ENTRY:
       for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-        entry->in_fields[i] = strdup(E->in_fields[i]);
+        entry->in_fields[i] = _GD_CStrdup(E->in_fields[i]);
         if (E->scalar[i])
-          entry->scalar[i] = strdup(E->scalar[i]);
+          entry->scalar[i] = _GD_CStrdup(E->scalar[i]);
         if (E->scalar[i + GD_MAX_LINCOM])
-          entry->scalar[i + GD_MAX_LINCOM] = strdup(E->scalar[i +
+          entry->scalar[i + GD_MAX_LINCOM] = _GD_CStrdup(E->scalar[i +
               GD_MAX_LINCOM]);
       }
       break;
     case GD_LINTERP_ENTRY:
-      entry->in_fields[0] = strdup(E->in_fields[0]);
-      entry->EN(linterp,table) = strdup(E->EN(linterp,table));
+      entry->in_fields[0] = _GD_CStrdup(E->in_fields[0]);
+      entry->EN(linterp,table) = _GD_CStrdup(E->EN(linterp,table));
       break;
     case GD_POLYNOM_ENTRY:
-      entry->in_fields[0] = strdup(E->in_fields[0]);
+      entry->in_fields[0] = _GD_CStrdup(E->in_fields[0]);
       for (i = 0; i <= E->EN(polynom,poly_ord); ++i)
         if (E->scalar[i])
-          entry->scalar[i] = strdup(E->scalar[i]);
+          entry->scalar[i] = _GD_CStrdup(E->scalar[i]);
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
-      entry->in_fields[0] = strdup(E->in_fields[0]);
-      entry->in_fields[1] = strdup(E->in_fields[1]);
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
+      entry->in_fields[0] = _GD_CStrdup(E->in_fields[0]);
+      entry->in_fields[1] = _GD_CStrdup(E->in_fields[1]);
       break;
     case GD_RECIP_ENTRY:
     case GD_PHASE_ENTRY:
-      entry->in_fields[0] = strdup(E->in_fields[0]);
+      entry->in_fields[0] = _GD_CStrdup(E->in_fields[0]);
       if (E->scalar[0])
-        entry->scalar[0] = strdup(E->scalar[0]);
+        entry->scalar[0] = _GD_CStrdup(E->scalar[0]);
       break;
     case GD_BIT_ENTRY:
     case GD_SBIT_ENTRY:
-      entry->in_fields[0] = strdup(E->in_fields[0]);
+      entry->in_fields[0] = _GD_CStrdup(E->in_fields[0]);
       if (E->scalar[0])
-        entry->scalar[0] = strdup(E->scalar[0]);
+        entry->scalar[0] = _GD_CStrdup(E->scalar[0]);
       if (E->scalar[1])
-        entry->scalar[1] = strdup(E->scalar[1]);
+        entry->scalar[1] = _GD_CStrdup(E->scalar[1]);
       break;
     case GD_RAW_ENTRY:
       if (E->scalar[0])
-        entry->scalar[0] = strdup(E->scalar[0]);
+        entry->scalar[0] = _GD_CStrdup(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]);
+      entry->in_fields[0] = _GD_CStrdup(E->in_fields[0]);
+      entry->in_fields[1] = _GD_CStrdup(E->in_fields[1]);
       if (E->scalar[0])
-        entry->scalar[0] = strdup(E->scalar[0]);
+        entry->scalar[0] = _GD_CStrdup(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]);
+      entry->in_fields[0] = _GD_CStrdup(E->in_fields[0]);
+      entry->in_fields[1] = _GD_CStrdup(E->in_fields[1]);
       if (E->scalar[0])
-        entry->scalar[0] = strdup(E->scalar[0]);
+        entry->scalar[0] = _GD_CStrdup(E->scalar[0]);
       if (E->scalar[1])
-        entry->scalar[1] = strdup(E->scalar[1]);
+        entry->scalar[1] = _GD_CStrdup(E->scalar[1]);
       break;
     case GD_INDEX_ENTRY:
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_STRING_ENTRY:
     case GD_NO_ENTRY:
     case GD_ALIAS_ENTRY:
@@ -511,13 +542,10 @@ const char *gd_alias_target(DIRFILE *D, const char *field_code) gd_nothrow
 
   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;
-  }
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
-  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, NULL);
+  E = _GD_FindField(D, field_code, strlen(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);
@@ -538,34 +566,21 @@ const char *gd_alias_target(DIRFILE *D, const char *field_code) gd_nothrow
 const char **gd_aliases(DIRFILE *D, const char *field_code) gd_nothrow
 {
   gd_entry_t *E;
-  int j = 1;
-  unsigned u, n;
+  unsigned u, n = 1, len = 10;
 
   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;
-  }
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
-  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
+  E = _GD_FindEntry(D, field_code);
 
   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);
+  free(E->e->alias_list);
+  E->e->alias_list = _GD_Malloc(D, sizeof(const char *) * len);
 
   if (D->error) {
     dreturn("%p", NULL);
@@ -578,11 +593,22 @@ const char **gd_aliases(DIRFILE *D, const char *field_code) gd_nothrow
     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;
+      if (n == len - 1) {
+        const char **ptr = _GD_Realloc(D, E->e->alias_list,
+            sizeof(const char*) * (len *= 2));
+        if (ptr == NULL) {
+          free(E->e->alias_list);
+          E->e->alias_list = NULL;
+          dreturn("%p", NULL);
+          return NULL;
+        }
+        E->e->alias_list = ptr;
+      }
+      E->e->alias_list[n++] = D->entry[u]->field;
     }
 
   /* terminate */
-  E->e->alias_list[j] = NULL;
+  E->e->alias_list[n] = NULL;
 
   dreturn("%p", E->e->alias_list);
   return E->e->alias_list;
@@ -595,16 +621,11 @@ unsigned int gd_naliases(DIRFILE *D, const char *field_code) gd_nothrow
 
   dtrace("%p, \"%s\"", D, field_code);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%u", 0);
-    return 0;
-  }
+  GD_RETURN_IF_INVALID(D, "%u", 0);
 
-  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
+  E = _GD_FindEntry(D, field_code);
 
   if (E == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
     dreturn("%u", 0);
     return 0;
   }
@@ -626,13 +647,7 @@ gd_entype_t gd_entry_type(DIRFILE* D, const char* field_code) gd_nothrow
 
   dtrace("%p, \"%s\"", D, field_code);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", GD_NO_ENTRY);
-    return GD_NO_ENTRY;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_IF_INVALID(D, "%i", GD_NO_ENTRY);
 
   E = _GD_FindEntry(D, field_code);
 
@@ -651,21 +666,14 @@ int gd_fragment_index(DIRFILE *D, const char *field_code) gd_nothrow
 
   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_RETURN_ERR_IF_INVALID(D);
 
-  _GD_ClearError(D);
+  E = _GD_FindField(D, field_code, strlen(field_code), D->entry, D->n_entries,
+      0, 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("%i", -1);
-    return -1;
-  }
+  if (E == NULL)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0,
+        field_code);
 
   dreturn("%i", E->fragment_index);
   return E->fragment_index;
@@ -677,40 +685,26 @@ int gd_hide(DIRFILE *D, const char *field_code) gd_nothrow
 
   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 (E == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  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->flags & GD_EN_HIDDEN)) {
-    E->flags |= GD_EN_HIDDEN;
-    D->fragment[E->fragment_index].modified = 1;
+  if ((D->flags & GD_ACCMODE) != GD_RDWR)
+    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+  else {
+    E = _GD_FindField(D, field_code, strlen(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);
+    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);
+    else if (!(E->flags & GD_EN_HIDDEN)) {
+      E->flags |= GD_EN_HIDDEN;
+      D->fragment[E->fragment_index].modified = 1;
+    }
   }
 
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 int gd_hidden(DIRFILE *D, const char *field_code) gd_nothrow
@@ -719,21 +713,14 @@ int gd_hidden(DIRFILE *D, const char *field_code) gd_nothrow
 
   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);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, NULL);
+  E = _GD_FindField(D, field_code, strlen(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 == NULL)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0,
+        field_code);
 
   dreturn("%i", (E->flags & GD_EN_HIDDEN) ? 1 : 0);
   return (E->flags & GD_EN_HIDDEN) ? 1 : 0;
@@ -745,83 +732,123 @@ int gd_unhide(DIRFILE *D, const char *field_code) gd_nothrow
 
   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_RETURN_ERR_IF_INVALID(D);
+
+  if ((D->flags & GD_ACCMODE) != GD_RDWR)
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+  else {
+    E = _GD_FindField(D, field_code, strlen(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);
+    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);
+    else if (E->flags & GD_EN_HIDDEN) {
+      E->flags &= ~GD_EN_HIDDEN;
+      D->fragment[E->fragment_index].modified = 1;
+    }
   }
 
-  _GD_ClearError(D);
+  GD_RETURN_ERROR(D);
+}
 
-  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, NULL);
+/* This function silently drops a representation suffix from field_code. */
+int gd_validate(DIRFILE *D, const char *field_code) gd_nothrow
+{
+  int repr;
+  gd_entry_t* E;
 
-  if (E == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
-    dreturn("%i", -1);
-    return -1;
-  }
+  dtrace("%p, \"%s\"", D, field_code);
 
-  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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if (E->flags & GD_EN_HIDDEN) {
-    E->flags &= ~GD_EN_HIDDEN;
-    D->fragment[E->fragment_index].modified = 1;
-  }
+  E = _GD_FindFieldAndRepr(D, field_code, &repr, NULL, 1);
 
-  dreturn("%i", 0);
-  return 0;
+  if (D->error)
+    GD_RETURN_ERROR(D);
+
+  /* calculate scalars */
+  if (!(E->flags & GD_EN_CALC))
+    _GD_CalculateEntry(D, E, 1);
+
+  if (D->error)
+    GD_RETURN_ERROR(D);
+
+  /* check input fields */
+  _GD_FindInputs(D, E, 1);
+
+  GD_RETURN_ERROR(D);
 }
 
-int gd_validate(DIRFILE *D, const char *field_code_in) gd_nothrow
+/* Ensure that an input field has been identified (with error checking) */
+static int _GD_BadInput(DIRFILE *D, const gd_entry_t *E, int i, gd_entype_t t,
+    int err)
 {
-  int i, repr;
-  gd_entry_t* E;
-  char *field_code;
+  dtrace("%p, %p, %i, 0x%X, %i", D, E, i, t, err);
 
-  dtrace("%p, \"%s\"", D, field_code_in);
-
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+  if (E->e->entry[i]) { /* Job done */
+    dreturn("%i", 0);
+    return 0;
   }
 
-  _GD_ClearError(D);
+  if (E->e->entry[i] == NULL) {
+    E->e->entry[i] = _GD_FindFieldAndRepr(D, E->in_fields[i], &E->e->repr[i],
+        NULL, err);
 
-  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1, 1);
+    if (E->e->entry[i] == NULL) {
+      dreturn("%i", 1);
+      return 1;
+    }
+  }
 
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
+  /* check field type */
+  if (t == GD_NO_ENTRY) {
+    /* scalar entries not allowed */
+    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);
+      E->e->entry[i] = NULL;
+      dreturn("%i", 1);
+      return 1;
+    }
+  } else if (E->e->entry[i]->field_type != t) {
+    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_FORMAT, E->field, 0,
+        E->e->entry[i]->field);
+    E->e->entry[i] = NULL;
+    dreturn("%i", 1);
+    return 1;
   }
 
-  if (field_code != field_code_in)
-    free(field_code);
+  dreturn("%i", 0);
+  return 0;
+}
 
-  /* calculate scalars */
-  if (!(E->flags & GD_EN_CALC))
-    _GD_CalculateEntry(D, E, 1);
+int _GD_FindInputs(DIRFILE *D, gd_entry_t *E, int err) gd_nothrow
+{
+  int i;
+
+  dtrace("%p, %p, %i", D, E, err);
 
-  /* 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_NO_ENTRY, 1);
+        _GD_BadInput(D, E, i, GD_NO_ENTRY, err);
+      break;
+    case GD_INDIR_ENTRY:
+      _GD_BadInput(D, E, 0, GD_NO_ENTRY, err);
+      _GD_BadInput(D, E, 1, GD_CARRAY_ENTRY, err);
+      break;
+    case GD_SINDIR_ENTRY:
+      _GD_BadInput(D, E, 0, GD_NO_ENTRY, err);
+      _GD_BadInput(D, E, 1, GD_SARRAY_ENTRY, err);
       break;
     case GD_DIVIDE_ENTRY:
     case GD_MULTIPLY_ENTRY:
     case GD_WINDOW_ENTRY:
     case GD_MPLEX_ENTRY:
-      _GD_BadInput(D, E, 1, GD_NO_ENTRY, 1);
+      _GD_BadInput(D, E, 1, GD_NO_ENTRY, err);
       /* fallthrough */
     case GD_LINTERP_ENTRY:
     case GD_BIT_ENTRY:
@@ -829,11 +856,12 @@ 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_NO_ENTRY, 1);
+      _GD_BadInput(D, E, 0, GD_NO_ENTRY, err);
       /* Fallthrough */
     case GD_RAW_ENTRY:
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_STRING_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_NO_ENTRY:
@@ -841,29 +869,17 @@ int gd_validate(DIRFILE *D, const char *field_code_in) gd_nothrow
       break;
   }
 
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  dreturn("%i", 0);
-  return 0;
+  GD_RETURN_ERROR(D);
 }
 
 char *gd_linterp_tablename(DIRFILE *D, const char *field_code) gd_nothrow
 {
   gd_entry_t *E;
-  char *table;
+  char *table0, *table;
 
   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;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
   E = _GD_FindEntry(D, field_code);
 
@@ -885,9 +901,23 @@ char *gd_linterp_tablename(DIRFILE *D, const char *field_code) gd_nothrow
       return NULL;
     }
 
-  table = _GD_MakeFullPath(D, E->e->u.linterp.table_dirfd,
+  table0 = _GD_MakeFullPath(D, E->e->u.linterp.table_dirfd,
       E->e->u.linterp.table_file, 1);
 
+  if (D->error) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  /* move to caller's heap */
+  if (_GD_CMalloc != malloc) {
+    table = _GD_CStrdup(table0);
+    free(table0);
+    if (table == NULL)
+      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  } else
+    table = table0;
+
   dreturn("%s", table);
   return table;
 }
diff --git a/src/errors.c b/src/errors.c
index 7861476..5904ffe 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2015 D. V. Wiebe
+ * Copyright (C) 2005-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -82,9 +82,9 @@ static const struct {
   { GD_E_BAD_CODE, GD_E_CODE_AMBIGUOUS, "Ambiguous field code: {4}", 0 },
   { GD_E_BAD_CODE, GD_E_CODE_INVALID_NS, "Bad namespace: {4}", 0 },
   { GD_E_BAD_CODE, GD_E_CODE_REPR, "Invalid representation suffix in: {4}", 0 },
-  /* GD_E_BAD_TYPE: 1 = suberror, 4 = data type */
+  /* GD_E_BAD_TYPE: 1 = suberror, 3 = data type */
   { GD_E_BAD_TYPE, GD_E_TYPE_NULL, "Bad data type: GD_NULL not allowed", 0 },
-  { GD_E_BAD_TYPE, 0, "Bad data type: {4}", 0 },
+  { GD_E_BAD_TYPE, 0, "Bad data type: {3}", 0 },
   /* GD_E_IO: 2 = filename; 3 = line; 4 = included file/encoding error */
   { GD_E_IO, GD_E_IO_OPEN, "Error opening {2}: ", 1 },
   { GD_E_IO, GD_E_IO_READ, "Error reading {2}: ", 1 },
@@ -103,7 +103,7 @@ static const struct {
   { GD_E_IO, 0, "Error accessing {2}: ", 1 },
   /* GD_E_INTERNAL_ERROR: 2 = source file, 3 = line */
   { GD_E_INTERNAL_ERROR, 0, "Internal error at [{2},{3}]; "
-    "please report to " PACKAGE_BUGREPORT , 0 },
+    "please report to <" PACKAGE_BUGREPORT ">", 0 },
   /* GD_E_ALLOC: (nothing) */
   { GD_E_ALLOC, 0, "Memory allocation error", 0 },
   /* GD_E_RANGE: (nothing) */
@@ -129,7 +129,9 @@ static const struct {
   { GD_E_BAD_FIELD_TYPE, GD_E_FIELD_STR, "Non-numeric data in {4}", 0 },
   /* GD_E_ACCMODE: (nothing) */
   { GD_E_ACCMODE, 0, "Dirfile has been opened read-only", 0 },
-  /* GD_E_UNSUPPORTED: (nothing) */
+  /* GD_E_UNSUPPORTED: 4 = regex type */
+  { GD_E_UNSUPPORTED, GD_E_SUPPORT_REGEX,
+    "Specified regular expression grammar not supported by library: {4}", 0 },
   { GD_E_UNSUPPORTED, 0, "Operation not supported by current encoding scheme",
     0 },
   /* GD_E_UNKNOWN_ENCODING: (nothing) */
@@ -179,7 +181,7 @@ static const struct {
   { GD_E_DELETE, GD_E_DEL_DERIVED,
     "Cannot delete field {4} used as input to field {2}", 0 },
   { GD_E_DELETE, GD_E_DEL_ALIAS, "Cannot delete field {4} with aliases", 0 },
-  /* GD_E_ARGUMENT: (nothing) */
+  /* GD_E_ARGUMENT: 3 = offset; 4 = string */
   { 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",
@@ -189,6 +191,9 @@ static const struct {
     0 },
   { GD_E_ARGUMENT, GD_E_ARG_BAD_VERS,
     "Dirfile does not conform to specified Standards Version", 0 },
+  { GD_E_ARGUMENT, GD_E_ARG_REGEX, "Bad regular expression: {4}", 0},
+  { GD_E_ARGUMENT, GD_E_ARG_PCRE, "Bad regular expression at offset {3}: {4}",
+    0},
   { GD_E_ARGUMENT, 0, "Bad argument", 0 },
   /* GD_E_CALLBACK: 3 = response */
   { GD_E_CALLBACK, 0, "Unrecognised response from callback function: {3}", 0 },
@@ -239,7 +244,7 @@ void _GD_SetError2(DIRFILE* D, int error, int suberror,
     char *error_string = gd_error_string(D, NULL, 0);
     fprintf(stderr, "%slibgetdata: %s\n",
         D->error_prefix ? D->error_prefix : "", error_string);
-    free(error_string);
+    _GD_CFree(error_string);
   }
 
   dreturnvoid();
@@ -271,6 +276,7 @@ void _GD_SetEncIOError(DIRFILE *D, int suberror, const struct gd_raw_file_ *f)
     _GD_SetError2(D, GD_E_IO, GD_E_IO_ENC_OFFSET + suberror, f->name, 0,
         buffer, 0);
   }
+  dreturnvoid();
 }
 
 /* Return the error */
@@ -287,7 +293,7 @@ int gd_error(const DIRFILE* D) gd_nothrow
  * library error.  The message may be truncated but will be null terminated.
  * Returns buffer, or NULL if buflen < 1.
  */
-#define UNKNOWN "Unknown error %i:%i. Please report to " PACKAGE_BUGREPORT
+#define UNKNOWN "Unknown error %i:%i. Please report to <" PACKAGE_BUGREPORT ">"
 char* gd_error_string(const DIRFILE* D, char* buffer, size_t buflen) gd_nothrow
 {
   const char* ip;
@@ -334,7 +340,7 @@ char* gd_error_string(const DIRFILE* D, char* buffer, size_t buflen) gd_nothrow
         buflen += GD_MAX_LINE_LENGTH;
     }
 
-    buffer = (char *)malloc(buflen);
+    buffer = _GD_CMalloc(buflen);
     if (buffer == NULL) {
       dreturn("%p", NULL);
       return NULL;
@@ -344,7 +350,7 @@ char* gd_error_string(const DIRFILE* D, char* buffer, size_t buflen) gd_nothrow
   bufend = buffer + buflen;
 
   if (s == -1) /* Unhandled error */
-    snprintf(buffer, buflen, UNKNOWN, D->error, D->suberror);
+    snprintf(buffer, buflen, UNKNOWN, -D->error, D->suberror);
   else {
     for (ip = error_string[s].format; *ip != '\0' && op < bufend - 1; ++ip) {
       if (*ip == '{') {
diff --git a/src/field_list.c b/src/field_list.c
index 8ac44d6..01a3d28 100644
--- a/src/field_list.c
+++ b/src/field_list.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,8 +20,12 @@
  */
 #include "internal.h"
 
+#ifdef HAVE_PCRE_H
+#include <pcre.h>
+#endif
+
 /* zero length lists */
-static const char* zero_list[1] = { NULL };
+static const char *zero_list[1] = { NULL };
 static gd_carray_t zero_carrays[1] = { {0, NULL} };
 
 gd_static_inline_ int _GD_EntryIndex(unsigned int t)
@@ -69,27 +73,36 @@ gd_static_inline_ int _GD_EntryIndex(unsigned int t)
     case GD_MPLEX_ENTRY:
       i = 12;
       break;
-    case GD_CONST_ENTRY:
+    case GD_INDIR_ENTRY:
       i = 13;
       break;
-    case GD_CARRAY_ENTRY:
+    case GD_SINDIR_ENTRY:
       i = 14;
       break;
-    case GD_STRING_ENTRY:
+    case GD_CONST_ENTRY:
       i = 15;
       break;
+    case GD_CARRAY_ENTRY:
+      i = 16;
+      break;
+    case GD_STRING_ENTRY:
+      i = 17;
+      break;
+    case GD_SARRAY_ENTRY:
+      i = 18;
+      break;
 
     case GD_VECTOR_ENTRIES:
-      i = 16;
+      i = 19;
       break;
     case GD_SCALAR_ENTRIES:
-      i = 17;
+      i = 20;
       break;
     case GD_ALIAS_ENTRY:
-      i = 18;
+      i = 21;
       break;
     case GD_ALL_ENTRIES:
-      i = 19;
+      i = 22;
       break;
     default:
       i = -1;
@@ -102,10 +115,10 @@ gd_static_inline_ int _GD_EntryIndex(unsigned int t)
 
 /* returns true if E a member of the given list */
 int _GD_ListEntry(const gd_entry_t *E, int meta_ok, int hidden_ok, int noalias,
-    int special, gd_entype_t type)
+    int special, int fragment, gd_entype_t type)
 {
-  dtrace("%p{%s}, %i, %i, %i, %i, 0x%X", E, E->field, meta_ok, hidden_ok,
-      noalias, special, type);
+  dtrace("%p{%s}, %i, %i, %i, %i, %i, 0x%X", E, E->field, meta_ok, hidden_ok,
+      noalias, special, fragment, type);
 
   /* check hidden */
   if (!hidden_ok && (E->flags & GD_EN_HIDDEN)) {
@@ -119,6 +132,12 @@ int _GD_ListEntry(const gd_entry_t *E, int meta_ok, int hidden_ok, int noalias,
     return 0;
   }
 
+  /* check fragment */
+  if (fragment != GD_ALL_FRAGMENTS && E->fragment_index != fragment) {
+    dreturn("%i (fragment)", 0);
+    return 0;
+  }
+
   /* aliases */
   if (E->field_type == GD_ALIAS_ENTRY) {
     int ret = 0;
@@ -135,13 +154,16 @@ int _GD_ListEntry(const gd_entry_t *E, int meta_ok, int hidden_ok, int noalias,
     }
       
     if (E->e->entry[0])
-      ret = _GD_ListEntry(E->e->entry[0], 1, 1, 0, special, type);
+      ret = _GD_ListEntry(E->e->entry[0], 1, 1, 0, special, GD_ALL_FRAGMENTS,
+          type);
     dreturn("%i", ret);
     return ret;
   }
 
   /* type check */
-  if (special == GD_VECTOR_ENTRIES && (E->field_type & GD_SCALAR_ENTRY_BIT)) {
+  if (special == GD_VECTOR_ENTRIES && ((E->field_type & GD_SCALAR_ENTRY_BIT) ||
+        (E->field_type == GD_SINDIR_ENTRY)))
+  {
     dreturn("%i (vector)", 0);
     return 0;
   } else if (special == GD_SCALAR_ENTRIES &&
@@ -222,8 +244,11 @@ static const char **_GD_EntryList(DIRFILE *D, struct gd_private_entry_ *p,
       el = ptr;
     }
 
-    if (_GD_ListEntry(entry[i], p ? 1 : 0, hidden, noalias, special, ctype))
+    if (_GD_ListEntry(entry[i], p ? 1 : 0, hidden, noalias, special,
+          GD_ALL_FRAGMENTS, ctype))
+    {
       el[n++] = entry[i]->field + offs;
+    }
   }
 
   if (n == 0) {
@@ -252,18 +277,15 @@ const char **gd_entry_list(DIRFILE* D, const char *parent, int type,
 
   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;
-  }
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
   if (parent) {
-    gd_entry_t *P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+    gd_entry_t *P = _GD_FindEntry(D, parent);
+
+    if (P && P->e->n_meta == -1)
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
 
-    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);
+    if (D->error) {
       dreturn("%u", 0);
       return 0;
     }
@@ -271,8 +293,6 @@ const char **gd_entry_list(DIRFILE* D, const char *parent, int type,
     offs = strlen(P->field) + 1;
   }
 
-  _GD_ClearError(D);
-
   el = _GD_EntryList(D, p, offs, type, flags);
   dreturn("%p", el);
   return el;
@@ -282,7 +302,7 @@ static void *_GD_Constants(DIRFILE* D, const char* parent,
     gd_type_t return_type) gd_nothrow
 {
   int i, nentries;
-  void* fl;
+  char *fl;
   gd_entry_t *P;
   gd_entry_t **entry;
   void **list;
@@ -292,24 +312,21 @@ static void *_GD_Constants(DIRFILE* D, const char* parent,
 
   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);
-    dreturn("%p", NULL);
-    return NULL;
-  } else if (return_type == GD_NULL) {
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
+
+  if (return_type == GD_NULL) {
     _GD_SetError(D, GD_E_BAD_TYPE, GD_E_TYPE_NULL, NULL, return_type, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  _GD_ClearError(D);
-
   if (parent) {
-    P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+    P = _GD_FindEntry(D, parent);
+
+    if (P && P->e->n_meta == -1)
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
 
-    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);
+    if (D->error) {
       dreturn("%p", NULL);
       return NULL;
     }
@@ -331,6 +348,14 @@ static void *_GD_Constants(DIRFILE* D, const char* parent,
     return NULL;
   }
 
+  if (return_type != GD_NULL &&
+      _GD_BadType(GD_DIRFILE_STANDARDS_VERSION, return_type))
+  {
+    _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, return_type, NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
   /* DoField will implicitly choose GD_REPR_AUTO for complex data being returned
    * as purely real */
   for (i = n = 0; i < nentries; ++i) {
@@ -344,7 +369,9 @@ static void *_GD_Constants(DIRFILE* D, const char* parent,
       fl = ptr;
     }
 
-    if (_GD_ListEntry(entry[i], e ? 1 : 0, 0, 0, 0, GD_CONST_ENTRY)) {
+    if (_GD_ListEntry(entry[i], e ? 1 : 0, 0, 0, 0, GD_ALL_FRAGMENTS,
+          GD_CONST_ENTRY))
+    {
       gd_entry_t *E = entry[i];
 
       if (E->field_type == GD_ALIAS_ENTRY)
@@ -384,20 +411,15 @@ static gd_carray_t *_GD_Carrays(DIRFILE* D, const char* parent,
 
   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);
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
   if (parent) {
-    P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+    P = _GD_FindEntry(D, parent);
+
+    if (P && P->e->n_meta == -1)
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
 
-    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);
+    if (D->error) {
       dreturn("%p", NULL);
       return NULL;
     }
@@ -419,10 +441,18 @@ static gd_carray_t *_GD_Carrays(DIRFILE* D, const char* parent,
     return NULL;
   }
 
+  if (return_type != GD_NULL &&
+      _GD_BadType(GD_DIRFILE_STANDARDS_VERSION, return_type))
+  {
+    _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, return_type, NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
   /* DoField will implicitly choose GD_REPR_AUTO for complex data being returned
    * as purely real */
   for (i = n = 0; i < nentries; ++i) {
-    if (n == len) {
+    if (n == len - 1) {
       void *ptr = _GD_Realloc(D, fl, sizeof(*fl) * (len *= 2));
       if (ptr == NULL) {
         free(fl);
@@ -432,7 +462,9 @@ static gd_carray_t *_GD_Carrays(DIRFILE* D, const char* parent,
       fl = ptr;
     }
 
-    if (_GD_ListEntry(entry[i], e ? 1 : 0, 0, 0, 0, GD_CARRAY_ENTRY)) {
+    if (_GD_ListEntry(entry[i], e ? 1 : 0, 0, 0, 0, GD_ALL_FRAGMENTS,
+          GD_CARRAY_ENTRY))
+    {
       gd_entry_t *E = entry[i];
 
       if (E->field_type == GD_ALIAS_ENTRY)
@@ -482,20 +514,15 @@ static const char **_GD_Strings(DIRFILE* D, const char* parent) gd_nothrow
 
   dtrace("%p, \"%s\"", D, parent);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
   if (parent) {
-    P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+    P = _GD_FindEntry(D, parent);
 
-    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);
+    if (P && P->e->n_meta == -1)
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
+    
+    if (D->error) {
       dreturn("%p", NULL);
       return NULL;
     }
@@ -518,7 +545,7 @@ static const char **_GD_Strings(DIRFILE* D, const char* parent) gd_nothrow
   }
 
   for (i = n = 0; i < nentries; ++i) {
-    if (n == len) {
+    if (n == len - 1) {
       void *ptr = _GD_Realloc(D, fl, sizeof(*fl) * (len *= 2));
       if (ptr == NULL) {
         free(fl);
@@ -528,7 +555,8 @@ static const char **_GD_Strings(DIRFILE* D, const char* parent) gd_nothrow
       fl = ptr;
     }
 
-    if (_GD_ListEntry(entry[i], e ? 1 : 0, 0, 0, 0, GD_STRING_ENTRY))
+    if (_GD_ListEntry(entry[i], e ? 1 : 0, 0, 0, 0, GD_ALL_FRAGMENTS,
+          GD_STRING_ENTRY))
     {
       if (entry[i]->field_type == GD_ALIAS_ENTRY)
         fl[n++] = entry[i]->e->entry[0]->e->u.string;
@@ -552,6 +580,98 @@ static const char **_GD_Strings(DIRFILE* D, const char* parent) gd_nothrow
   return fl;
 }
 
+static const char ***_GD_SArrays(DIRFILE* D, const char* parent) gd_nothrow
+{
+  int i, nentries;
+  const char ***fl;
+  gd_entry_t *P;
+  gd_entry_t **entry;
+  const char ****list;
+  struct gd_private_entry_ *e = NULL;
+  size_t n, len = 10;
+
+  dtrace("%p, \"%s\"", D, parent);
+
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
+
+  if (parent) {
+    P = _GD_FindEntry(D, parent);
+
+    if (P && P->e->n_meta == -1)
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
+
+    if (D->error) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
+
+    e = P->e;
+    nentries = e->n_meta;
+    entry = e->p.meta_entry;
+    list = &e->fl.sarray_value_list;
+  } else {
+    nentries = D->n_entries;
+    entry = D->entry;
+    list = &D->fl.sarray_value_list;
+  }
+
+  fl = _GD_Malloc(D, sizeof(*fl) * len);
+
+  if (fl == NULL) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  for (i = n = 0; i < nentries; ++i) {
+    if (n == len - 1) {
+      void *ptr = _GD_Realloc(D, fl, sizeof(*fl) * (len *= 2));
+      if (ptr == NULL)
+        goto SARRAYS_ERROR;
+      fl = ptr;
+    }
+
+    if (_GD_ListEntry(entry[i], e ? 1 : 0, 0, 0, 0, GD_ALL_FRAGMENTS,
+          GD_SARRAY_ENTRY))
+    {
+      gd_entry_t *E = entry[i];
+      if (E->field_type == GD_ALIAS_ENTRY)
+        E = E->e->entry[0];
+
+      /* We do it this way so we can append a NULL */
+      fl[n] = _GD_Malloc(D, sizeof(**fl) * (E->EN(scalar,array_len) + 1));
+      if (fl[n] == NULL)
+        goto SARRAYS_ERROR;
+
+      memcpy(fl[n], E->e->u.scalar.d, sizeof(char*) * E->EN(scalar,array_len));
+      fl[n++][E->EN(scalar,array_len)] = NULL;
+    }
+  }
+  fl[n] = NULL;
+
+  if (n == 0) {
+    free(fl);
+    dreturn("%p", zero_list);
+    return (const char***)zero_list;
+  }
+
+  if (*list) {
+    for (i = 0; (*list)[i] != NULL; ++i)
+      free((*list)[i]);
+    free(*list);
+  }
+  *list = fl;
+
+  dreturn("%p", fl);
+  return fl;
+
+SARRAYS_ERROR:
+  for (i = 0; i < (int)n; ++i)
+    free(fl[i]);
+  free(fl);
+  dreturn("%p", NULL);
+  return NULL;
+}
+
 const void *gd_constants(DIRFILE* D, gd_type_t return_type) gd_nothrow
 {
   void *ret;
@@ -588,6 +708,18 @@ const char **gd_strings(DIRFILE* D) gd_nothrow
   return ret;
 }
 
+const char ***gd_sarrays(DIRFILE *D) gd_nothrow
+{
+  const char ***ret;
+
+  dtrace("%p", D);
+
+  ret = _GD_SArrays(D, NULL);
+
+  dreturn("%p", ret);
+  return ret;
+}
+
 const char **gd_field_list_by_type(DIRFILE* D, gd_entype_t type) gd_nothrow
 {
   const char** el;
@@ -657,6 +789,18 @@ const char **gd_mstrings(DIRFILE* D, const char* parent) gd_nothrow
   return ret;
 }
 
+const char ***gd_msarrays(DIRFILE* D, const char* parent) gd_nothrow
+{
+  const char ***ret;
+
+  dtrace("%p, \"%s\"", D, parent);
+
+  ret = _GD_SArrays(D, parent);
+
+  dreturn("%p", ret);
+  return ret;
+}
+
 const char **gd_mfield_list_by_type(DIRFILE* D, const char* parent,
     gd_entype_t type) gd_nothrow
 {
@@ -687,3 +831,194 @@ const char **gd_mfield_list(DIRFILE* D, const char* parent) gd_nothrow
   dreturn("%p", el);
   return el;
 }
+
+#ifndef GD_NO_REGEX
+static void gd_compile_regex(DIRFILE *D, const char *regex, int cflags,
+    regex_t *preg)
+{
+  dtrace("%p, \"%s\", 0x%X, %p", D, regex, cflags, preg);
+
+  int regerr = regcomp(preg, regex, cflags);
+  if (regerr) {
+    /* Get error string length */
+    size_t rerror_len = regerror(regerr, preg, NULL, 0);
+
+    /* Allocate error buffer and save error string, if possible */
+    char *rerror = _GD_Malloc(D, rerror_len);
+    if (rerror) {
+      regerror(regerr, preg, rerror, rerror_len);
+      _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_REGEX, NULL, 0, rerror);
+      free(rerror);
+    }
+
+    regfree(preg);
+  }
+  
+  dreturnvoid();
+}
+#endif
+
+#ifndef GD_NO_PCRE
+static void gd_compile_pcre(DIRFILE *D, const char *regex, int options,
+    pcre **code)
+{
+  const char *errptr;
+  int erroffset;
+
+  dtrace("%p, \"%s\", 0x%X, %p", D, regex, options, code);
+
+  *code = pcre_compile(regex, options, &errptr, &erroffset, NULL);
+
+  if (*code == NULL) /* Error */
+    _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_PCRE, NULL, erroffset, errptr);
+
+  dreturnvoid();
+}
+#endif
+
+unsigned int gd_match_entries(DIRFILE *D, const char *regex, int fragment,
+    int type, unsigned int flags, const char ***list) gd_nothrow
+{
+#ifndef GD_NO_REGEX
+  regex_t preg;
+  const int regex_flags = ((flags & GD_REGEX_EXTENDED) ? REG_EXTENDED : 0)
+    | ((flags & GD_REGEX_ICASE) ? REG_ICASE : 0) | REG_NOSUB;
+#endif
+#ifndef GD_NO_PCRE
+  pcre *pcre_code = NULL;
+  const int pcre_exec_options =
+    (flags & GD_REGEX_UNICODE) ? PCRE_BSR_UNICODE : PCRE_BSR_ANYCRLF;
+  const int pcre_compile_options = pcre_exec_options
+    | PCRE_DOLLAR_ENDONLY | PCRE_DOTALL
+    | ((flags & GD_REGEX_JAVASCRIPT) ? PCRE_JAVASCRIPT_COMPAT : 0)
+    | ((flags & GD_REGEX_EXTENDED) ? PCRE_EXTENDED : 0)
+    | ((flags & GD_REGEX_ICASE) ? PCRE_CASELESS : 0)
+    | ((flags & GD_REGEX_UNICODE) ? PCRE_UTF8 : 0)
+    ;
+#endif
+  unsigned int len = 10, n = 0, i;
+
+  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);
+  const int use_pcre = flags & GD_REGEX_PCRE;
+
+  dtrace("%p, \"%s\", %i, %i, 0x%X, %p", D, regex, fragment, type, flags, list);
+
+  if (list)
+    *list = NULL;
+
+  GD_RETURN_IF_INVALID(D, "%i", 0);
+
+  /* We don't cache the result of this function */
+  if (D->regex_list) {
+    free(D->regex_list);
+    D->regex_list = NULL;
+  }
+
+  /* Check type */
+  if (_GD_EntryIndex(type) < 0) {
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_TYPE, NULL, type, NULL);
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  if (list) {
+    D->regex_list = _GD_Malloc(D, sizeof(D->regex_list[0]) * len);
+    if (D->regex_list == NULL) {
+      dreturn("%i", 0);
+      return 0;
+    }
+  }
+
+  if (regex) {
+    /* Compile */
+    if (use_pcre) {
+#ifndef GD_NO_PCRE
+      gd_compile_pcre(D, regex, pcre_compile_options, &pcre_code);
+#else
+      _GD_SetError(D, GD_E_UNSUPPORTED, GD_E_SUPPORT_REGEX, NULL, 0, "PCRE");
+#endif
+    } else {
+      /* POSIX regex */
+#ifndef GD_NO_REGEX
+      gd_compile_regex(D, regex, regex_flags, &preg);
+#else
+      _GD_SetError(D, GD_E_UNSUPPORTED, GD_E_SUPPORT_REGEX, NULL, 0, "POSIX");
+#endif
+    }
+
+    if (D->error) {
+      free(D->regex_list);
+      D->regex_list = NULL;
+      dreturn("%i", 0);
+      return 0;
+    }
+  }
+
+  /* Regex searches are always performed against the full entry list */
+  for (i = n = 0; i < D->n_entries; ++i) {
+    if (list && n == len - 1) { /* leave space for the terminating NULL */
+      void *ptr = _GD_Realloc(D, D->regex_list, sizeof(D->regex_list[0])
+          * (len *= 2));
+      if (ptr == NULL) {
+#ifndef GD_NO_REGEX
+        if (regex)
+          regfree(&preg);
+#endif
+        free(D->regex_list);
+        D->regex_list = NULL;
+        dreturn("%i", 0);
+        return 0;
+      }
+      D->regex_list = ptr;
+    }
+
+    /* Check Dirfile metadata */
+    if (_GD_ListEntry(D->entry[i], 1, hidden, noalias, special, fragment,
+          ctype))
+    {
+      /* Run the regex, if provided */
+      if (regex == NULL
+#ifndef GD_NO_PCRE
+          || (use_pcre && pcre_exec(pcre_code, NULL, D->entry[i]->field,
+              D->entry[i]->e->len, 0, pcre_exec_options, NULL, 0) == 0)
+#endif
+#ifndef GD_NO_REGEX
+          || (!use_pcre && regexec(&preg, D->entry[i]->field, 0, NULL, 0) == 0)
+#endif
+         )
+      {
+        if (list)
+          D->regex_list[n] = D->entry[i]->field;
+        n++;
+      }
+    }
+  }
+
+  if (regex) {
+#ifndef GD_NO_REGEX
+    if (!use_pcre)
+      regfree(&preg);
+#endif
+#ifndef GD_NO_PCRE
+    if (use_pcre)
+      pcre_free(pcre_code);
+#endif
+  }
+
+  if (list) {
+    if (n == 0) {
+      free(D->regex_list);
+      D->regex_list = NULL;
+      *list = zero_list;
+    } else {
+      D->regex_list[n] = NULL;
+      *list = D->regex_list;
+    }
+  }
+  dreturn("%u", n);
+  return n;
+}
diff --git a/src/flac.c b/src/flac.c
index 42f3ee2..4edd826 100644
--- a/src/flac.c
+++ b/src/flac.c
@@ -44,14 +44,16 @@ struct gd_flacdata {
   FILE* stream;
   unsigned bps; /* bits per sample */
   unsigned cps; /* channels per sample */
+  int swap; /* Byte-swapping required */
 
   int stream_end;
   int error; /* error flag */
   int *errnum; /* file->error */
 
+  /* Decoder (reader) only */
   char *data; /* Dechannelised frame of data */
   unsigned dlen; /* Length in samples of data */
-  unsigned pos; /* offset into the frame data */
+  unsigned pos; /* offset in samples into the frame data */
   off64_t base; /* sample number of the start of the frame */
 };
 
@@ -59,7 +61,7 @@ struct gd_flacdata {
  * open, idata = 0 otherwise idata = -1. */
 
 /* The decoder callback */
-static FLAC__StreamDecoderWriteStatus _GD_FlacWriteCallback(
+static FLAC__StreamDecoderWriteStatus _GD_FlacDecodeCallback(
     const FLAC__StreamDecoder *decoder gd_unused_, const FLAC__Frame *frame,
     const FLAC__int32 *const buffer[], void *client_data)
 {
@@ -79,14 +81,14 @@ static FLAC__StreamDecoderWriteStatus _GD_FlacWriteCallback(
   if (gdfl->cps != FLAC__stream_decoder_get_channels(gdfl->codec.d)) {
     gdfl->error = 1;
     *gdfl->errnum = GD_FLAC_E_CPS;
-    dreturn("%s", "FLAC__STREAM_DECODER_WRITE_STATUS_ABORT");
+    dreturn("%s (cps)", "FLAC__STREAM_DECODER_WRITE_STATUS_ABORT");
     return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
   }
 
   if (gdfl->bps != FLAC__stream_decoder_get_bits_per_sample(gdfl->codec.d)) {
     gdfl->error = 1;
     *gdfl->errnum = GD_FLAC_E_BPS;
-    dreturn("%s", "FLAC__STREAM_DECODER_WRITE_STATUS_ABORT");
+    dreturn("%s (bps)", "FLAC__STREAM_DECODER_WRITE_STATUS_ABORT");
     return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
   }
 
@@ -97,7 +99,7 @@ static FLAC__StreamDecoderWriteStatus _GD_FlacWriteCallback(
     if (gdfl->data == NULL) {
       gdfl->error = 1;
       *gdfl->errnum = GD_FLAC_E_MEM;
-      dreturn("%s", "FLAC__STREAM_DECODER_WRITE_STATUS_ABORT");
+      dreturn("%s (alloc)", "FLAC__STREAM_DECODER_WRITE_STATUS_ABORT");
       return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
     }
     gdfl->dlen = frame->header.blocksize;
@@ -110,6 +112,10 @@ static FLAC__StreamDecoderWriteStatus _GD_FlacWriteCallback(
     for (u = 0; u < frame->header.blocksize; ++u)
       /* there's only one channel in this case */
       gdfl->data[u] = (int8_t)buffer[0][u];
+  else if (gdfl->swap)
+    for (u = 0; u < frame->header.blocksize; ++u)
+      for (c = gdfl->cps; c > 0; --c)
+        *(ptr++) = (int16_t)buffer[c - 1][u];
   else
     for (u = 0; u < frame->header.blocksize; ++u)
       for (c = 0; c < gdfl->cps; ++c)
@@ -135,14 +141,14 @@ static void _GD_FlacErrorCallback(const FLAC__StreamDecoder *decoder gd_unused_,
 }
 
 static struct gd_flacdata *_GD_FlacDoOpen(int dirfd, struct gd_raw_file_* file,
-    gd_type_t data_type, unsigned int mode)
+    gd_type_t data_type, int swap, unsigned int mode)
 {
   int fd, status;
   struct gd_flacdata *gdfl;
   FILE *stream;
   const char *fdmode = "rb";
 
-  dtrace("%i, %p, 0x%X, 0x%X", dirfd, file, data_type, mode);
+  dtrace("%i, %p, 0x%X, %i, 0x%X", dirfd, file, data_type, swap, mode);
 
   if (mode & GD_FILE_READ) {
     fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY | O_BINARY, 0666);
@@ -184,9 +190,11 @@ static struct gd_flacdata *_GD_FlacDoOpen(int dirfd, struct gd_raw_file_* file,
   if (GD_SIZE(data_type) <= 2) {
     gdfl->bps = GD_SIZE(data_type) * 8;
     gdfl->cps = 1;
+    gdfl->swap = 0;
   } else {
     gdfl->bps = 16;
     gdfl->cps = GD_SIZE(data_type) / 2;
+    gdfl->swap = swap;
   }
 
   if (mode & GD_FILE_READ) {
@@ -196,7 +204,7 @@ static struct gd_flacdata *_GD_FlacDoOpen(int dirfd, struct gd_raw_file_* file,
     }
 
     status = FLAC__stream_decoder_init_FILE(gdfl->codec.d, stream,
-          _GD_FlacWriteCallback, NULL, _GD_FlacErrorCallback, gdfl);
+          _GD_FlacDecodeCallback, NULL, _GD_FlacErrorCallback, gdfl);
 
     if (status != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
       file->error = GD_FLAC_E_SDIS | status;
@@ -240,11 +248,11 @@ OPEN_ERROR:
 }
 
 int _GD_FlacOpen(int dirfd, struct gd_raw_file_* file, gd_type_t data_type,
-    int swap gd_unused_, unsigned int mode)
+    int swap, unsigned int mode)
 {
-  dtrace("%i, %p, 0x%X, <unused>, 0x%X", dirfd, file, data_type, mode);
+  dtrace("%i, %p, 0x%X, %i, 0x%X", dirfd, file, data_type, swap, mode);
 
-  file->edata = _GD_FlacDoOpen(dirfd, file, data_type, mode);
+  file->edata = _GD_FlacDoOpen(dirfd, file, data_type, swap, mode);
 
   if (file->edata == NULL) {
     dreturn("%i", 1);
@@ -268,7 +276,8 @@ static size_t _GD_FlacOutput(struct gd_flacdata *gdfl, gd_type_t data_type,
     ns = gdfl->dlen - gdfl->pos;
 
   if (ns > 0) {
-    memcpy(output, gdfl->data + gdfl->pos, ns * GD_SIZE(data_type));
+    memcpy(output, gdfl->data + gdfl->pos * GD_SIZE(data_type),
+        ns * GD_SIZE(data_type));
     gdfl->pos += ns;
   }
 
@@ -346,6 +355,10 @@ ssize_t _GD_FlacWrite(struct gd_raw_file_ *file, const void *data,
     if (gdfl->bps == 8)
       for (i = 0; i < nmemb; ++i)
         buffer[0][i] = *(i8++);
+    else if (gdfl->swap)
+      for (i = 0; i < nmemb; ++i)
+        for (c = gdfl->cps; c > 0; --c)
+          buffer[c - 1][i] = *(i16++);
     else
       for (i = 0; i < nmemb; ++i)
         for (c = 0; c < gdfl->cps; ++c)
@@ -378,22 +391,22 @@ WRITE_ERROR:
   return n;
 }
 
-off64_t _GD_FlacSeek(struct gd_raw_file_* file, off64_t count,
+off64_t _GD_FlacSeek(struct gd_raw_file_* file, off64_t offset,
     gd_type_t data_type, unsigned int mode)
 {
   struct gd_flacdata *gdfl;
 
-  dtrace("%p, %" PRId64 ", 0x%X, 0x%X", file, (int64_t)count, data_type, mode);
+  dtrace("%p, %" PRId64 ", 0x%X, 0x%X", file, (int64_t)offset, data_type, mode);
 
-  gdfl = (struct gd_flacdata *)(file[(mode == GD_FILE_WRITE) ? 1 : 0].edata);
-
-  /* nothing to do */
-  if (gdfl->base + gdfl->pos == count) {
-    dreturn("%" PRId64, (int64_t)count);
-    return count;
-  }
+  gdfl = (struct gd_flacdata *)(file->edata);
 
   if (mode == GD_FILE_WRITE) {
+    /* nothing to do */
+    if (file->pos == offset) {
+      dreturn("%" PRId64, (int64_t)offset);
+      return offset;
+    }
+
     /* we only get here when we need to pad */
     char *zero = malloc(GD_BUFFER_SIZE);
     if (zero == NULL) {
@@ -403,22 +416,27 @@ off64_t _GD_FlacSeek(struct gd_raw_file_* file, off64_t count,
     }
     memset(zero, 0, GD_BUFFER_SIZE);
 
-    count -= file->pos;
-    while (gdfl->base < count) {
-      int n = GD_BUFFER_SIZE / GD_SIZE(data_type);;
-      if (n > count)
-        n = count;
+    while (file->pos < offset) {
+      off64_t remaining = offset - file->pos;
+      int n = GD_BUFFER_SIZE / GD_SIZE(data_type);
+      if (n > remaining)
+        n = remaining;
 
-      _GD_FlacWrite(file + 1, zero, GD_UINT8, n);
+      _GD_FlacWrite(file, zero, GD_UINT8, n);
       if (file->error) {
         free(zero);
         dreturn("%i", -1);
         return -1;
       }
-      count -= n;
     }
     free(zero);
   } else {
+    /* nothing to do */
+    if (gdfl->base + gdfl->pos == offset) {
+      dreturn("%" PRId64, (int64_t)offset);
+      return offset;
+    }
+
     int eof = 0;
     off64_t last = FLAC__stream_decoder_get_total_samples(gdfl->codec.d) - 1;
 
@@ -428,12 +446,12 @@ off64_t _GD_FlacSeek(struct gd_raw_file_* file, off64_t count,
       return 0;
     }
 
-    if (count > last) {
-      count = last;
+    if (offset > last) {
+      offset = last;
       eof = 1;
     }
 
-    if (!FLAC__stream_decoder_seek_absolute(gdfl->codec.d, count)) {
+    if (!FLAC__stream_decoder_seek_absolute(gdfl->codec.d, offset)) {
       file->error = GD_FLAC_E_SDS |
         FLAC__stream_decoder_get_state(gdfl->codec.d);
       dreturn("%i", -1);
@@ -450,11 +468,11 @@ off64_t _GD_FlacSeek(struct gd_raw_file_* file, off64_t count,
       gdfl->pos = gdfl->dlen;
 
       gdfl->stream_end = 1;
-      count++;
+      offset++;
     }
   }
   
-  file->pos = count;
+  file->pos = offset;
 
   dreturn("%" PRId64, (int64_t)file->pos);
   return file->pos;
@@ -482,14 +500,14 @@ int _GD_FlacClose(struct gd_raw_file_ *file)
 }
 
 off64_t _GD_FlacSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
-    int swap gd_unused_)
+    int swap)
 {
   struct gd_flacdata *gdfl;
   off_t n;
 
-  dtrace("%i, %p, 0x%X, <unused>", dirfd, file, data_type);
+  dtrace("%i, %p, 0x%X, %i", dirfd, file, data_type, swap);
 
-  gdfl = _GD_FlacDoOpen(dirfd, file, data_type, GD_FILE_READ);
+  gdfl = _GD_FlacDoOpen(dirfd, file, data_type, swap, GD_FILE_READ);
 
   if (gdfl == NULL) {
     dreturn("%i", -1);
diff --git a/src/flimits.c b/src/flimits.c
index 1308970..a530b5e 100644
--- a/src/flimits.c
+++ b/src/flimits.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -96,33 +96,15 @@ int gd_alter_frameoffset64(DIRFILE* D, off64_t offset, int fragment, int move)
 
   dtrace("%p, %" PRId64 ", %i, %i", D, (int64_t)offset, fragment, move);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  if ((D->flags & GD_ACCMODE) != GD_RDWR) {
+  if ((D->flags & GD_ACCMODE) != GD_RDWR)
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (fragment < GD_ALL_FRAGMENTS || fragment >= D->n_fragment) {
+  else if (fragment < GD_ALL_FRAGMENTS || fragment >= D->n_fragment)
     _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (offset < 0) {
+  else if (offset < 0)
     _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
-
-  if (fragment == GD_ALL_FRAGMENTS) {
+  else if (fragment == GD_ALL_FRAGMENTS) {
     for (i = 0; i < D->n_fragment; ++i) {
       _GD_ShiftFragment(D, offset, i, move);
 
@@ -132,27 +114,17 @@ int gd_alter_frameoffset64(DIRFILE* D, off64_t offset, int fragment, int move)
   } else
     _GD_ShiftFragment(D, offset, fragment, move);
 
-  dreturn("%i", (D->error) ? -1 : 0);
-  return (D->error) ? -1 : 0;
+  GD_RETURN_ERROR(D);
 }
 
 off64_t gd_frameoffset64(DIRFILE* D, int fragment)
 {
   dtrace("%p, %i", D, fragment);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
-  if (fragment < 0 || fragment >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
+  if (fragment < 0 || fragment >= D->n_fragment)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
 
   dreturn("%" PRId64, (int64_t)D->fragment[fragment].frame_offset);
   return D->fragment[fragment].frame_offset;
@@ -169,7 +141,7 @@ off_t gd_frameoffset(DIRFILE* D, int fragment) gd_nothrow
   return gd_frameoffset64(D, fragment);
 }
 
-off64_t _GD_GetEOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
+off64_t _GD_GetEOF(DIRFILE *restrict D, gd_entry_t *restrict E,
     const char *restrict parent, int *restrict is_index)
 {
   off64_t ns = -1, ns1;
@@ -179,10 +151,15 @@ off64_t _GD_GetEOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
   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, GD_E_RECURSE_CODE, NULL, 0, E->field);
     D->recurse_level--;
-    dreturn("%i ?", -1);
-    return -1;
+    GD_SET_RETURN_ERROR(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0,
+        E->field);
+  }
+
+  if (_GD_FindInputs(D, E, 1)) {
+    D->recurse_level--;
+    dreturn("%i", D->error);
+    return D->error;
   }
 
   *is_index = 0;
@@ -215,21 +192,14 @@ off64_t _GD_GetEOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
     case GD_SBIT_ENTRY:
     case GD_POLYNOM_ENTRY:
     case GD_RECIP_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       ns = _GD_GetEOF(D, E->e->entry[0], E->field, is_index);
       break;
     case GD_DIVIDE_ENTRY:
     case GD_MULTIPLY_ENTRY:
     case GD_WINDOW_ENTRY:
     case GD_MPLEX_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1) ||
-          _GD_BadInput(D, E, 1, GD_NO_ENTRY, 1))
-      {
-        break;
-      }
-
       ns = _GD_GetEOF(D, E->e->entry[0], E->field, is_index);
 
       if (D->error)
@@ -265,9 +235,6 @@ off64_t _GD_GetEOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
       }
       break;
     case GD_LINCOM_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
       ns = _GD_GetEOF(D, E->e->entry[0], E->field, is_index);
 
       if (D->error) {
@@ -286,11 +253,6 @@ off64_t _GD_GetEOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
       }
 
       for (i = 1; i < E->EN(lincom,n_fields); ++i) {
-        if (_GD_BadInput(D, E, i, GD_NO_ENTRY, 1)) {
-          ns = -1;
-          break;
-        }
-
         ns1 = _GD_GetEOF(D, E->e->entry[i], E->field, &is_index1);
 
         if (D->error) {
@@ -315,9 +277,6 @@ off64_t _GD_GetEOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
       }
       break;
     case GD_PHASE_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
       ns = _GD_GetEOF(D, E->e->entry[0], E->field, is_index);
       if (!*is_index && !D->error)
         ns -= E->EN(phase,shift);
@@ -332,6 +291,7 @@ off64_t _GD_GetEOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
       break;
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_STRING_ENTRY:
       if (parent)
         _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_FORMAT, parent, 0, E->field);
@@ -348,6 +308,9 @@ off64_t _GD_GetEOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
 
   D->recurse_level--;
 
+  if (D->error) 
+    GD_RETURN_ERROR(D);
+
   dreturn("%" PRId64 " %i", (int64_t)ns, *is_index);
   return ns;
 }
@@ -360,25 +323,18 @@ off64_t gd_eof64(DIRFILE* D, const char *field_code)
 
   dtrace("%p, \"%s\"", D, field_code);
 
-  _GD_ClearError(D);
-
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   entry = _GD_FindEntry(D, field_code);
 
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (D->error)
+    GD_RETURN_ERROR(D);
 
   ns = _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);
+  if (!D->error && is_index)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0,
+        field_code);
 
   dreturn("%" PRId64, (int64_t)ns);
   return ns;
@@ -390,7 +346,7 @@ off_t gd_eof(DIRFILE* D, const char *field_code)
   return (off_t)gd_eof64(D, field_code);
 }
 
-static off64_t _GD_GetBOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
+static off64_t _GD_GetBOF(DIRFILE *restrict D, gd_entry_t *restrict E,
     const char *restrict parent, unsigned int *restrict spf,
     int64_t *restrict ds)
 {
@@ -402,10 +358,15 @@ static off64_t _GD_GetBOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
   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, GD_E_RECURSE_CODE, NULL, 0, E->field);
     D->recurse_level--;
-    dreturn("%i", -1);
-    return -1;
+    GD_SET_RETURN_ERROR(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0,
+        E->field);
+  }
+
+  if (_GD_FindInputs(D, E, 1)) {
+    D->recurse_level--;
+    dreturn("%i", D->error);
+    return D->error;
   }
 
   switch (E->field_type) {
@@ -419,15 +380,11 @@ static off64_t _GD_GetBOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
     case GD_LINTERP_ENTRY:
     case GD_POLYNOM_ENTRY:
     case GD_RECIP_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       bof = _GD_GetBOF(D, E->e->entry[0], E->field, spf, ds);
       break;
     case GD_PHASE_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
       bof = _GD_GetBOF(D, E->e->entry[0], E->field, spf, ds);
 
       if (!D->error) {
@@ -454,12 +411,6 @@ static off64_t _GD_GetBOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
     case GD_DIVIDE_ENTRY:
     case GD_WINDOW_ENTRY:
     case GD_MPLEX_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1) ||
-          _GD_BadInput(D, E, 1, GD_NO_ENTRY, 1))
-      {
-        break;
-      }
-
       bof = _GD_GetBOF(D, E->e->entry[0], E->field, spf, ds);
 
       if (D->error) {
@@ -482,9 +433,6 @@ static off64_t _GD_GetBOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
       }
       break;
     case GD_LINCOM_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
       bof = _GD_GetBOF(D, E->e->entry[0], E->field, spf, ds);
 
       if (D->error) {
@@ -493,11 +441,6 @@ static off64_t _GD_GetBOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
       }
 
       for (i = 1; i < E->EN(lincom,n_fields); ++i) {
-        if (_GD_BadInput(D, E, i, GD_NO_ENTRY, 1)) {
-          bof = -1;
-          break;
-        }
-
         bof1 = _GD_GetBOF(D, E->e->entry[i], E->field, &spf1, &ds1);
 
         if (D->error) {
@@ -520,6 +463,7 @@ static off64_t _GD_GetBOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
       break;
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_STRING_ENTRY:
       if (parent)
         _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_FORMAT, parent, 0, E->field);
@@ -534,6 +478,9 @@ static off64_t _GD_GetBOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
 
   D->recurse_level--;
 
+  if (D->error)
+    GD_RETURN_ERROR(D);
+
   dreturn("%" PRIu64 " %u %" PRId64, bof, *spf, *ds);
   return bof;
 }
@@ -547,24 +494,16 @@ off64_t gd_bof64(DIRFILE* D, const char *field_code) gd_nothrow
 
   dtrace("%p, \"%s\"", D, field_code);
 
-  _GD_ClearError(D);
-
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   entry = _GD_FindEntry(D, field_code);
 
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (D->error)
+    GD_RETURN_ERROR(D);
 
   bof = _GD_GetBOF(D, entry, NULL, &spf, &ds);
 
-  if (bof != -1)
+  if (bof >= 0) /* i.e. not an error code */
     bof = bof * spf + ds;
 
   dreturn("%" PRId64, (int64_t)bof);
diff --git a/src/flush.c b/src/flush.c
index 6eb152d..5304168 100644
--- a/src/flush.c
+++ b/src/flush.c
@@ -22,12 +22,32 @@
 
 #define GD_MAX_PRETTY_FIELD_WIDTH 80
 
+/* If we're writing to 'file', call the appropriate sync function */
+static void _GD_SyncRaw(DIRFILE *D, struct gd_raw_file_ *file)
+{
+  dtrace("%p, %p", D, file);
+  
+  if ((D->flags & GD_ACCMODE) == GD_RDWR && file->idata >= 0 && 
+      (file->mode & GD_FILE_WRITE) && _GD_ef[file->subenc].sync != NULL &&
+      (*_GD_ef[file->subenc].sync)(file))
+  {
+    _GD_SetEncIOError(D, GD_E_IO_WRITE, file);
+  }
+
+  dreturnvoid();
+}
+
 void _GD_Flush(DIRFILE *D, gd_entry_t *E, int syn, int clo)
 {
   int i;
 
   dtrace("%p, %p, %i, %i", D, E, syn, clo);
 
+  if (E == NULL) {
+    dreturnvoid();
+    return;
+  }
+
   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--;
@@ -35,37 +55,36 @@ void _GD_Flush(DIRFILE *D, gd_entry_t *E, int syn, int clo)
     return;
   }
 
+  _GD_FindInputs(D, E, 0);
+
   switch(E->field_type) {
     case GD_RAW_ENTRY:
-      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) {
+        /* We can't get here when a temporary file is open, so if we're dealing
+         * with an GD_EF_OOP encoding and file[1] is open, then it's a
+         * write-side file which we should sync.
+         */
+        if (_GD_ef[E->e->u.raw.file[0].subenc].flags & GD_EF_OOP)
+          _GD_SyncRaw(D, E->e->u.raw.file + 1);
+        else
+          _GD_SyncRaw(D, E->e->u.raw.file);
+      }
+      if (clo && D->error == 0 && (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_SetEncIOError(D, GD_E_IO_WRITE, E->e->u.raw.file + 0);
-        } else if (clo && _GD_FiniRawIO(D, E, E->fragment_index,
-              GD_FINIRAW_KEEP))
-        {
-          ; /* error already set */
-        }
+        _GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP);
       }
       break;
     case GD_LINCOM_ENTRY:
-      for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-        if (!_GD_BadInput(D, E, i, GD_NO_ENTRY, 0))
-            _GD_Flush(D, E->e->entry[i], syn, clo);
-      }
+      for (i = 0; i < E->EN(lincom,n_fields); ++i)
+        _GD_Flush(D, E->e->entry[i], syn, clo);
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
     case GD_WINDOW_ENTRY:
     case GD_MPLEX_ENTRY:
-      if (!_GD_BadInput(D, E, 1, GD_NO_ENTRY, 0))
-        _GD_Flush(D, E->e->entry[1], syn, clo);
+      _GD_Flush(D, E->e->entry[1], syn, clo);
       /* fallthrough */
     case GD_LINTERP_ENTRY:
     case GD_BIT_ENTRY:
@@ -73,10 +92,13 @@ void _GD_Flush(DIRFILE *D, gd_entry_t *E, int syn, int clo)
     case GD_POLYNOM_ENTRY:
     case GD_SBIT_ENTRY:
     case GD_RECIP_ENTRY:
-      if (!_GD_BadInput(D, E, 0, GD_NO_ENTRY, 0))
-        _GD_Flush(D, E->e->entry[0], syn, clo);
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
+      _GD_Flush(D, E->e->entry[0], syn, clo);
+      break;
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_STRING_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_NO_ENTRY:
@@ -290,30 +312,31 @@ WRITE_ERR:
 
 /* write a field code, taking care of stripping off affixes; returns the length
  * written */
-#define GD_WFC_SPACE      0x1
-#define GD_WFC_SCALAR     0x2
+#define GD_WFC_SPACE     0x01 /* Write a trailing space */
+#define GD_WFC_SCALAR    0x02 /* This is a scalar field code */
+#define GD_WFC_EARLY     0x04 /* This is an early field (no namespaces!) */
+#define GD_WFC_NAME      0x08 /* This is a field name (no repr) */
 static ssize_t _GD_WriteFieldCode(DIRFILE *D, FILE *stream, int me,
     const char *code, int index, int permissive, int standards, unsigned flags)
 {
   ssize_t len;
   char *ptr;
-
-  const int scalar     = flags & GD_WFC_SCALAR;
-  const int space      = flags & GD_WFC_SPACE;
+  const unsigned strip_flags = GD_CO_NSROOT | GD_CO_ASSERT
+    | ((flags & GD_WFC_EARLY) ? GD_CO_EARLY : 0)
+    | ((flags & GD_WFC_NAME) ? 0 : GD_CO_REPR)
+    | ((permissive || D->standards >= 10) ? GD_CO_REPRZ : 0);
 
   dtrace("%p, %p, %i, \"%s\", %i, %i, %i, 0x%X", D, stream, me, code, index,
       permissive, standards, flags);
 
-  ptr = _GD_MungeCode(D, NULL, 0, D->fragment[me].prefix,
-      D->fragment[me].suffix, NULL, NULL, code, NULL, NULL, GD_MC_RQ_PARTS);
+  ptr = _GD_StripCode(D, me, code, strip_flags);
 
   len = _GD_StringEscapeise(stream, ptr, 0, permissive, standards);
 
   /* If a scalar field code could be interpreted as a number, we must force
    * interpretation as a field code by appending a <0> scalar index, which is
-   * valid for both CARRAY and CONST fields.
-   */
-  if (len > 0 && scalar && index == -1)
+   * valid for both CARRAY and CONST fields.  */
+  if (len > 0 && (flags & GD_WFC_SCALAR) && index == -1)
     if (_GD_TokToNum(ptr, standards, !permissive, NULL, NULL, NULL, NULL) != -1)
     {
       if (permissive || standards >= 8) {
@@ -326,7 +349,7 @@ static ssize_t _GD_WriteFieldCode(DIRFILE *D, FILE *stream, int me,
     }
 
   /* append a space */
-  if (space && len > 0) {
+  if ((flags & GD_WFC_SPACE) && len > 0) {
     if (fputc(' ', stream) == EOF)
       len = -1;
     else
@@ -339,16 +362,17 @@ static ssize_t _GD_WriteFieldCode(DIRFILE *D, FILE *stream, int me,
   return len;
 }
 
-/* write a field, padding to the specified length */
+/* write a field name, padding to the specified length */
 static ssize_t _GD_PadField(DIRFILE *D, FILE *stream, int me, const char *in,
-    ssize_t len, int permissive, int standards)
+    ssize_t len, int early, int permissive, int standards)
 {
   ssize_t i;
 
-  dtrace("%p, %p, %i, \"%s\", %" PRIuSIZE ", %i, %i", D, stream, me, in, len,
-      permissive, standards);
+  dtrace("%p, %p, %i, \"%s\", %" PRIdSIZE ", %i, %i, %i", D, stream, me, in,
+      len, early, permissive, standards);
 
-  i = _GD_WriteFieldCode(D, stream, me, in, 0, permissive, standards, 0);
+  i = _GD_WriteFieldCode(D, stream, me, in, 0, permissive, standards,
+      GD_WFC_NAME | early);
 
   if (i >= 0)
     for (; i < len; ++i)
@@ -363,17 +387,17 @@ static ssize_t _GD_PadField(DIRFILE *D, FILE *stream, int me, const char *in,
 
 /* Write a litteral parameter or CONST name or CARRAY element */
 static int _GD_WriteConst(DIRFILE *D, FILE *stream, int me, int permissive,
-    int type, const void* value, const char *scalar, int index,
+    int type, const void* value, const char *scalar, int index, int early,
     const char *postamble)
 {
   int e;
 
-  dtrace("%p, %p, %i, %i, 0x%X, %p, \"%s\", %i, \"%s\"", D, stream, me,
-      permissive, type, value, scalar, index, postamble);
+  dtrace("%p, %p, %i, %i, 0x%X, %p, \"%s\", %i, %i, \"%s\"", D, stream, me,
+      permissive, type, value, scalar, index, early, postamble);
 
   if (scalar != NULL) {
     if (_GD_WriteFieldCode(D, stream, me, scalar, index, permissive,
-          D->standards, GD_WFC_SCALAR) < 0)
+          D->standards, GD_WFC_SCALAR | (early ? GD_WFC_EARLY : 0)) < 0)
     {
       dreturn("%i", -1);
       return -1;
@@ -410,6 +434,14 @@ static int _GD_WriteConst(DIRFILE *D, FILE *stream, int me, int permissive,
   return e;
 }
 
+#define GD_WRITE_INFIELD(n,f) \
+  (_GD_WriteFieldCode(D, stream, me, E->in_fields[n], 0, permissive, \
+                      D->standards, f | early) < 0)
+
+#define GD_WRITE_CONST(t,l,n,p) \
+  (_GD_WriteConst(D, stream, me, permissive, t, &(l), E->scalar[n], \
+                  E->scalar_ind[n], early, p) < 0)
+
 /* Write a field specification line */
 static int _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
     int me, int meta, size_t max_len, int pretty, int permissive)
@@ -419,6 +451,7 @@ static int _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
   ssize_t len, pos;
   char buffer[1000];
   size_t z;
+  const unsigned early = (E->flags & GD_EN_EARLY) ? GD_WFC_EARLY : 0;
 
   dtrace("%p, %p, %p, %i, %i, %" PRIuSIZE ", %i, %i", D, stream, E, me, meta,
       max_len, pretty, permissive);
@@ -434,42 +467,55 @@ static int _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
     if (fputs("/ALIAS ", stream) == EOF)
       goto WRITE_ERR;
     if (_GD_WriteFieldCode(D, stream, me, E->field, 0, permissive, D->standards,
-          GD_WFC_SPACE) < 0)
+          GD_WFC_SPACE | GD_WFC_NAME | early) < 0)
     {
       goto WRITE_ERR;
     }
-    if (_GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-          D->standards, 0) < 0)
-    {
+
+    if (GD_WRITE_INFIELD(0, 0))
       goto WRITE_ERR;
-    }
+
     if (fputc('\n', stream) == EOF)
       goto WRITE_ERR;
   } else {
-    ptr = E->field;
-
-    /* From Standards Version 7 and on, just use Barth-style */
+    /* For DSV 6, use the "META" directive.  Later verisons can just use
+     * the "parent/subfield" style of metafield definition (AKA "Barth-style")
+     */
     if (meta && D->standards < 7) {
+      /* Write "META <parent> " for DSV == 6 */
       if (fputs("META ", stream) == EOF)
         goto WRITE_ERR;
-      if (_GD_StringEscapeise(stream, ptr, 1, permissive, D->standards) < 0)
+
+      /* There's no need to use WriteFieldCode here because DSV < 7 doesn't
+       * support affixes */
+      if (_GD_StringEscapeise(stream, E->field, 1, permissive,
+            D->standards) < 0)
+      {
         goto WRITE_ERR;
+      }
+
       if (fputc(' ', stream) == EOF)
         goto WRITE_ERR;
+
+      /* Advance field name pointer */
       ptr = strchr(E->field, '/') + 1;
-    }
+    } else
+      ptr = E->field;
 
-    /* field name */
-    if (_GD_PadField(D, stream, me, ptr, max_len, permissive, D->standards) < 0)
+    /* field name -- with DSV >=7, for metafields, this will be parent/subfield
+     */
+    if (_GD_PadField(D, stream, me, ptr, max_len, early, permissive,
+          D->standards) < 0)
+    {
       goto WRITE_ERR;
+    }
 
     switch(E->field_type) {
       case GD_RAW_ENTRY:
         if (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))) < 0 ||
-            _GD_WriteConst(D, stream, me, permissive, GD_UINT_TYPE,
-              &E->EN(raw,spf), E->scalar[0], E->scalar_ind[0], "") < 0)
+            GD_WRITE_CONST(GD_UINT_TYPE, E->EN(raw,spf), 0, ""))
         {
           goto WRITE_ERR;
         }
@@ -481,29 +527,20 @@ static int _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
           goto WRITE_ERR;
         }
         for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-          if (_GD_WriteFieldCode(D, stream, me, E->in_fields[i], 0, permissive,
-                D->standards, GD_WFC_SPACE) < 0)
-          {
+          if (GD_WRITE_INFIELD(i, GD_WFC_SPACE))
             goto WRITE_ERR;
-          }
 
           if (E->flags & GD_EN_COMPSCAL) {
-            if (_GD_WriteConst(D, stream, me, permissive, GD_COMPLEX128,
-                  &E->EN(lincom,cm)[i], E->scalar[i], E->scalar_ind[i], " ") < 0
-                || _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],
-                  i == E->EN(lincom,n_fields) - 1 ? "" : " ") < 0)
+            if (GD_WRITE_CONST(GD_COMPLEX128, E->EN(lincom,cm)[i], i, " ") ||
+                GD_WRITE_CONST(GD_COMPLEX128, E->EN(lincom,cb)[i], i +
+                  GD_MAX_LINCOM, i == E->EN(lincom,n_fields) - 1 ? "" : " "))
             {
               goto WRITE_ERR;
             }
           } else {
-            if (_GD_WriteConst(D, stream, me, permissive, GD_FLOAT64,
-                  &E->EN(lincom,m)[i], E->scalar[i], E->scalar_ind[i], " ") < 0
-                || _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],
-                  i == E->EN(lincom,n_fields) - 1 ? "" : " ") < 0)
+            if (GD_WRITE_CONST(GD_FLOAT64, E->EN(lincom,m)[i], i, " ") ||
+                GD_WRITE_CONST(GD_FLOAT64, E->EN(lincom,b)[i], i +
+                  GD_MAX_LINCOM, i == E->EN(lincom,n_fields) - 1 ? "" : " "))
             {
               goto WRITE_ERR;
             }
@@ -512,8 +549,7 @@ static int _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
         break;
       case GD_LINTERP_ENTRY:
         if (fprintf(stream, " LINTERP%s ", pretty ? " " : "") < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0 ||
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) ||
             _GD_StringEscapeise(stream, E->EN(linterp,table), 0, permissive,
               D->standards) < 0)
         {
@@ -522,75 +558,59 @@ static int _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
         break;
       case GD_BIT_ENTRY:
         if (fprintf(stream, " BIT%s ", pretty ? "     " : "") < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0 ||
-            _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
-              &E->EN(bit,bitnum), E->scalar[0], E->scalar_ind[0], " ") < 0 ||
-            _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
-              &E->EN(bit,numbits), E->scalar[1], E->scalar_ind[1], "") < 0)
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) ||
+            GD_WRITE_CONST(GD_INT_TYPE, E->EN(bit,bitnum), 0, " ") ||
+            GD_WRITE_CONST(GD_INT_TYPE, E->EN(bit,numbits), 1, ""))
         {
           goto WRITE_ERR;
         }
         break;
       case GD_DIVIDE_ENTRY:
         if (fprintf(stream, " DIVIDE%s ", pretty ? "  " : "") < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[1], 0, permissive,
-              D->standards, 0) < 0)
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) || GD_WRITE_INFIELD(1, 0))
         {
           goto WRITE_ERR;
         }
         break;
       case GD_RECIP_ENTRY:
         if (fprintf(stream, " RECIP%s ", pretty ? "   " : "") < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0 ||
-            _GD_WriteConst(D, stream, me, permissive, GD_COMPLEX128,
-              &E->EN(recip,cdividend), E->scalar[0], E->scalar_ind[0], "") < 0)
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) ||
+            GD_WRITE_CONST(GD_COMPLEX128, E->EN(recip,cdividend), 0, ""))
         {
           goto WRITE_ERR;
         }
         break;
       case GD_MULTIPLY_ENTRY:
         if (fputs(" MULTIPLY ", stream) == EOF ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[1], 0, permissive,
-              D->standards, 0) < 0)
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) || GD_WRITE_INFIELD(1, 0))
         {
           goto WRITE_ERR;
         }
         break;
       case GD_PHASE_ENTRY:
         if (fprintf(stream, " PHASE%s ", pretty ? "   " : "") < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0 ||
-            _GD_WriteConst(D, stream, me, permissive, GD_INT64,
-              &E->EN(phase,shift), E->scalar[0], E->scalar_ind[0], "") < 0)
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) ||
+            GD_WRITE_CONST(GD_INT64, E->EN(phase,shift), 0, ""))
         {
           goto WRITE_ERR;
         }
         break;
       case GD_POLYNOM_ENTRY:
         if (fprintf(stream, " POLYNOM%s ", pretty ? " " : "") < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0)
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE))
         {
           goto WRITE_ERR;
         }
         for (i = 0; i <= E->EN(polynom,poly_ord); ++i)
           if (E->flags & GD_EN_COMPSCAL) {
-            if (_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)) ?  "" : " ") < 0)
+            if (GD_WRITE_CONST(GD_COMPLEX128, E->EN(polynom,ca)[i], i,
+                  (i == E->EN(polynom,poly_ord)) ?  "" : " "))
             {
               goto WRITE_ERR;
             }
           } else {
-            if (_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)) ?  "" : " ") < 0)
+            if (GD_WRITE_CONST(GD_FLOAT64, E->EN(polynom,a)[i], i,
+                  (i == E->EN(polynom,poly_ord)) ?  "" : " "))
             {
               goto WRITE_ERR;
             }
@@ -598,22 +618,17 @@ static int _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
         break;
       case GD_SBIT_ENTRY:
         if (fprintf(stream, " SBIT%s ", pretty ? "    " : "") < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0 ||
-            _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
-              &E->EN(bit,bitnum), E->scalar[0], E->scalar_ind[0], " ") < 0 ||
-            _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
-              &E->EN(bit,numbits), E->scalar[1], E->scalar_ind[1], "") < 0)
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) ||
+            GD_WRITE_CONST(GD_INT_TYPE, E->EN(bit,bitnum), 0, " ") ||
+            GD_WRITE_CONST(GD_INT_TYPE, E->EN(bit,numbits), 1, ""))
         {
           goto WRITE_ERR;
         }
         break;
       case GD_WINDOW_ENTRY:
         if (fprintf(stream, " WINDOW%s ", pretty ? "  " : "") < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[1], 0, permissive,
-              D->standards, 0) < 0 ||
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) ||
+            GD_WRITE_INFIELD(1, GD_WFC_SPACE) ||
             fprintf(stream, " %s ", _GD_WindopName(D, E->EN(window,windop)))
             < 0)
         {
@@ -622,42 +637,26 @@ static int _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
         switch (E->EN(window,windop)) {
           case GD_WINDOP_EQ:
           case GD_WINDOP_NE:
-            if (_GD_WriteConst(D, stream, me, permissive, GD_INT64,
-                  &E->EN(window,threshold.i), E->scalar[0], E->scalar_ind[0],
-                  "") < 0)
-            {
+            if (GD_WRITE_CONST(GD_INT64, E->EN(window,threshold.i), 0, ""))
               goto WRITE_ERR;
-            }
             break;
           case GD_WINDOP_SET:
           case GD_WINDOP_CLR:
-            if (_GD_WriteConst(D, stream, me, permissive, GD_UINT64,
-                  &E->EN(window,threshold.u), E->scalar[0], E->scalar_ind[0],
-                  "") < 0)
-            {
+            if (GD_WRITE_CONST(GD_UINT64, E->EN(window,threshold.u), 0, ""))
               goto WRITE_ERR;
-            }
             break;
           default:
-            if (_GD_WriteConst(D, stream, me, permissive, GD_FLOAT64,
-                  &E->EN(window,threshold.r), E->scalar[0], E->scalar_ind[0],
-                  "") < 0)
-            {
+            if (GD_WRITE_CONST(GD_FLOAT64, E->EN(window,threshold.r), 0, ""))
               goto WRITE_ERR;
-            }
             break;
         }
         break;
       case GD_MPLEX_ENTRY:
         if (fprintf(stream, " MPLEX%s ", pretty ? "   " : "") < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[0], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0 ||
-            _GD_WriteFieldCode(D, stream, me, E->in_fields[1], 0, permissive,
-              D->standards, GD_WFC_SPACE) < 0 ||
-            _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
-              &E->EN(mplex,count_val), E->scalar[0], E->scalar_ind[0], " ") < 0
-            || _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
-              &E->EN(mplex,period), E->scalar[1], E->scalar_ind[1], "") < 0)
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) ||
+            GD_WRITE_INFIELD(1, GD_WFC_SPACE) ||
+            GD_WRITE_CONST(GD_INT_TYPE, E->EN(mplex,count_val), 0, " ") ||
+            GD_WRITE_CONST(GD_INT_TYPE, E->EN(mplex,period), 1, ""))
         {
           goto WRITE_ERR;
         }
@@ -724,6 +723,50 @@ static int _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
           goto WRITE_ERR;
         }
         break;
+      case GD_SARRAY_ENTRY:
+        pos = fprintf(stream, " SARRAY%s", pretty ? "  " : "");
+        if (pos < 0)
+          goto WRITE_ERR;
+
+        for (z = 0; z < E->EN(scalar,array_len); ++z) {
+          if (fputc(' ', stream) == EOF)
+            goto WRITE_ERR;
+          pos++;
+
+          /* compute length */
+          len = _GD_StringEscapeise(NULL, ((char**)E->e->u.scalar.d)[z], 0,
+              permissive, D->standards);
+
+          /* don't write lines that are too long
+           * also, add one to length for the trailing '\n' */
+          if (GD_SSIZE_T_MAX - (len + 1) <= pos) {
+            _GD_SetError(D, GD_E_LINE_TOO_LONG, GD_E_LONG_FLUSH, E->field, 0,
+                NULL);
+            dreturn("%i", -1);
+            return -1;
+          }
+
+          if (_GD_StringEscapeise(stream, ((char**)E->e->u.scalar.d)[z], 0,
+                permissive, D->standards) < 0)
+          {
+            goto WRITE_ERR;
+          }
+        }
+        break;
+      case GD_INDIR_ENTRY:
+        if (fprintf(stream, " INDIR%s ", pretty ? "   " : "") < 0 ||
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) || GD_WRITE_INFIELD(1, 0))
+        {
+          goto WRITE_ERR;
+        }
+        break;
+      case GD_SINDIR_ENTRY:
+        if (fprintf(stream, " SINDIR%s ", pretty ? "  " : "") < 0 ||
+            GD_WRITE_INFIELD(0, GD_WFC_SPACE) || GD_WRITE_INFIELD(1, 0))
+        {
+          goto WRITE_ERR;
+        }
+        break;
       case GD_INDEX_ENTRY:
       case GD_ALIAS_ENTRY:
       case GD_NO_ENTRY:
@@ -742,7 +785,7 @@ static int _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
     if (fputs("/HIDDEN ", stream) == EOF)
       goto WRITE_ERR;
     if (_GD_WriteFieldCode(D, stream, me, E->field, 0, permissive, D->standards,
-          0) < 0)
+          GD_WFC_NAME | early) < 0)
     {
       goto WRITE_ERR;
     }
@@ -760,6 +803,88 @@ WRITE_ERR:
   return -1;
 }
 
+static int WriteInclude(DIRFILE *D, int i, int j, size_t ns_offset,
+    int permissive, FILE *stream)
+{
+  const char *ns = NULL, *px = NULL;
+  char *sx = NULL;
+  int free_sx = 0;
+
+  dtrace("%p, %i, %i, %" PRIuSIZE ", %i, %p", D, i, j, ns_offset,
+      permissive, stream);
+
+  if (D->fragment[j].nsl > D->fragment[i].nsl)
+    ns = D->fragment[j].ns + ns_offset;
+
+  if (D->fragment[j].pxl)
+    px = D->fragment[j].px + D->fragment[i].pxl;
+
+  if (D->fragment[j].sxl > 0) {
+    if (D->fragment[i].sxl == 0)
+      sx = D->fragment[j].sx;
+    else if (D->fragment[j].sxl == D->fragment[i].sxl)
+      sx = NULL;
+    else {
+      free_sx = 1;
+      sx = _GD_Strdup(D, D->fragment[j].sx);
+      if (sx)
+        sx[D->fragment[j].sxl - D->fragment[i].sxl] = 0;
+      else
+        goto WRITE_ERR;
+    }
+  }
+
+  if (fprintf(stream, "%sINCLUDE ", (D->standards >= 5) ? "/" : "") < 0 ||
+      _GD_StringEscapeise(stream, D->fragment[j].ename, 0, permissive,
+        D->standards) < 0)
+  {
+    goto WRITE_ERR;
+  }
+
+  if (ns || px || sx)
+    if (fputc(' ', stream) == EOF)
+      goto WRITE_ERR;
+
+  if (ns) {
+    if (_GD_StringEscapeise(stream, ns, 0, permissive, D->standards) < 0)
+      goto WRITE_ERR;
+    if (fputc('.', stream) == EOF)
+      goto WRITE_ERR;
+  }
+
+  /* An empty prefix must be written if there's a suffix, but no namespace */
+  if (px || (sx && !ns)) {
+    if (fputc(' ', stream) == EOF || _GD_StringEscapeise(stream, px, 0,
+          permissive, D->standards) < 0)
+    {
+      goto WRITE_ERR;
+    }
+  }
+
+  if (sx) {
+    if (fputc(' ', stream) == EOF || _GD_StringEscapeise(stream, sx, 0,
+          permissive, D->standards) < 0)
+    {
+      goto WRITE_ERR;
+    }
+  }
+
+  if (fputc('\n', stream) == EOF)
+    goto WRITE_ERR;
+
+  if (free_sx)
+    free(sx);
+
+  dreturn("%i", 0);
+  return 0;
+
+WRITE_ERR:
+  if (free_sx)
+    free(sx);
+  dreturn("%i", 1);
+  return 1;
+}
+
 static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
 {
   int j;
@@ -967,40 +1092,16 @@ 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) {
-        char *prefix = _GD_MungeCode(D, NULL, 0, D->fragment[i].prefix, NULL,
-            NULL, NULL, D->fragment[j].prefix, NULL, NULL, GD_MC_RQ_PARTS);
-        char *suffix = _GD_MungeCode(D, NULL, 0, NULL, D->fragment[i].suffix,
-            NULL, NULL, D->fragment[j].suffix, NULL, NULL, GD_MC_RQ_PARTS);
-
-        if (fprintf(stream, "%sINCLUDE ", (D->standards >= 5) ? "/" : "") < 0 ||
-            _GD_StringEscapeise(stream, D->fragment[j].ename, 0, permissive,
-              D->standards) < 0)
-        {
-          goto WRITE_ERR;
-        }
-        if (prefix || suffix) {
-          if (fputc(' ', stream) == EOF || _GD_StringEscapeise(stream, prefix,
-                0, permissive, D->standards) < 0)
-          {
-            goto WRITE_ERR;
-          }
-          free(prefix);
-        }
+  if (permissive || D->standards >= 3) {
+    size_t ns_offset = D->fragment[i].nsl;
+    if (ns_offset)
+      ns_offset++; /* for the dot */
 
-        if (suffix) {
-          if (fputc(' ', stream) == EOF || _GD_StringEscapeise(stream, suffix,
-                0, permissive, D->standards) < 0)
-          {
-            goto WRITE_ERR;
-          }
-          free(suffix);
-        }
-        if (fputc('\n', stream) == EOF)
+    for (j = 0; j < D->n_fragment; ++j)
+      if (D->fragment[j].parent == i)
+        if (WriteInclude(D, i, j, ns_offset, permissive, stream))
           goto WRITE_ERR;
-      }
+  }
 
   /* The fields */
   for (u = 0; u < D->n_entries; ++u)
@@ -1020,12 +1121,13 @@ static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
     }
 
   /* REFERENCE is written at the end, because its effect can propagate
-   * upwards */
+   * upwards.  In the WriteFieldCode call, early is always zero because the
+   * REFERENCE directive appeared in DSV 6 */
   if (permissive || D->standards >= 6)
     if (D->fragment[i].ref_name != NULL) {
       if (fputs("/REFERENCE ", stream) == EOF ||
           _GD_WriteFieldCode(D, stream, i, D->fragment[i].ref_name, 0,
-            permissive, D->standards, 0) < 0 ||
+            permissive, D->standards, GD_WFC_NAME) < 0 ||
           fputc('\n', stream) == EOF)
       {
         goto WRITE_ERR;
@@ -1089,54 +1191,30 @@ int gd_metaflush(DIRFILE* D)
 {
   dtrace("%p", D);
 
-  _GD_ClearError(D);
-
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
-    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if ((D->flags & GD_ACCMODE) == GD_RDONLY)
+    GD_SET_RETURN_ERROR(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
 
   _GD_FlushMeta(D, GD_ALL_FRAGMENTS, 0);
 
-  dreturn("%i", (D->error == GD_E_OK) ? 0 : -1);
-  return (D->error == GD_E_OK) ? 0 : -1;
+  GD_RETURN_ERROR(D);
 }
 
 int gd_rewrite_fragment(DIRFILE* D, int fragment)
 {
   dtrace("%p, %i", D, fragment);
 
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", 1);
-    return -1;
-  }
-
-  if (fragment < GD_ALL_FRAGMENTS || fragment >= D->n_fragment) {
+  if (fragment < GD_ALL_FRAGMENTS || fragment >= 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) {
+  else if ((D->flags & GD_ACCMODE) == GD_RDONLY)
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  _GD_FlushMeta(D, fragment, 1);
+  else
+    _GD_FlushMeta(D, fragment, 1);
 
-  dreturn("%i", (D->error == GD_E_OK) ? 0 : -1);
-  return (D->error == GD_E_OK) ? 0 : -1;
+  GD_RETURN_ERROR(D);
 }
 
 static int _GD_SyncOrClose(DIRFILE* D, const char* field_code, int syn, int clo)
@@ -1146,11 +1224,9 @@ static int _GD_SyncOrClose(DIRFILE* D, const char* field_code, int syn, int clo)
 
   dtrace("%p, \"%s\", %i, %i", D, field_code, syn, clo);
 
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if (D->flags & GD_INVALID) /* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-  else if (field_code == NULL) {
+  if (field_code == NULL) {
     _GD_FlushMeta(D, GD_ALL_FRAGMENTS, 0);
     if (!D->error)
       for (i = 0; i < D->n_entries; ++i)
@@ -1163,8 +1239,7 @@ static int _GD_SyncOrClose(DIRFILE* D, const char* field_code, int syn, int clo)
       _GD_Flush(D, E, syn, clo);
   }
 
-  dreturn("%i", (D->error == GD_E_OK) ? 0 : -1);
-  return (D->error == GD_E_OK) ? 0 : -1;
+  GD_RETURN_ERROR(D);
 }
 
 int gd_sync(DIRFILE *D, const char *field_code)
@@ -1203,26 +1278,28 @@ int gd_flush(DIRFILE *D, const char *field_code)
   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
+#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_GE_10  0xFFFFFC00UL
+
+#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
+#define GD_VERS_LE_10  0x000007ffUL
 
 uint64_t _GD_FindVersion(DIRFILE *D)
 {
@@ -1236,7 +1313,7 @@ uint64_t _GD_FindVersion(DIRFILE *D)
     D->av &= GD_VERS_GE_3;
 
   for (i = 0; D->av && i < (unsigned int)D->n_fragment; ++i) {
-    if (D->fragment[i].prefix || D->fragment[i].suffix)
+    if (D->fragment[i].px || D->fragment[i].sx)
       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
@@ -1308,6 +1385,11 @@ uint64_t _GD_FindVersion(DIRFILE *D)
         case GD_STRING_ENTRY:
           D->av &= GD_VERS_GE_6;
           break;
+        case GD_SARRAY_ENTRY:
+        case GD_INDIR_ENTRY:
+        case GD_SINDIR_ENTRY:
+          D->av &= GD_VERS_GE_10;
+          break;
         case GD_BIT_ENTRY:
           if (D->entry[i]->EN(bit,numbits) > 1)
             D->av &= GD_VERS_GE_1;
@@ -1354,8 +1436,10 @@ uint64_t _GD_FindVersion(DIRFILE *D)
           D->av &= GD_VERS_GE_6;
           break;
         case '.':
-          if (D->entry[i]->flags & GD_EN_DOTTED)
+          if (D->entry[i]->flags & GD_EN_EARLY)
             D->av &= GD_VERS_LE_5;
+          else
+            D->av &= GD_VERS_GE_10;
           break;
         case '&':
         case ';':
@@ -1406,13 +1490,7 @@ int gd_dirfile_standards(DIRFILE *D, int vers) gd_nothrow
 
   dtrace("%p, %i", D, vers);
 
-  _GD_ClearError(D);
-
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   if (~D->flags & GD_HAVE_VERSION)
     _GD_FindVersion(D);
@@ -1431,10 +1509,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_ARGUMENT, (D->av == 0) ? GD_E_ARG_NO_VERS :
+    GD_SET_RETURN_ERROR(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;
   }
 
   D->standards = vers;
diff --git a/src/fragment.c b/src/fragment.c
index 897f640..f598ca2 100644
--- a/src/fragment.c
+++ b/src/fragment.c
@@ -24,16 +24,10 @@ const char *gd_fragmentname(DIRFILE* D, int index) gd_nothrow
 {
   dtrace("%p, %i", D, index);
 
-  _GD_ClearError(D);
-
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%p", NULL);
-    return NULL;
-  }
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
   if (index < 0 || index >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
+    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, index, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -42,244 +36,554 @@ 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
+int gd_fragment_affixes(DIRFILE *D, int index, char **px, char **sx) gd_nothrow
 {
   char *p = NULL, *s = NULL;
-  dtrace("%p, %i, %p, %p", D, index, prefix, suffix);
+  dtrace("%p, %i, %p, %p", D, index, px, sx);
 
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(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_SET_RETURN_ERROR(D, GD_E_BAD_INDEX, 0, NULL, index, NULL);
 
-  if (index < 0 || index >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+  /* Copy to caller's heap */
+  if (D->fragment[index].px) {
+    p = _GD_CStrdup(D->fragment[index].px);
+    if (p == NULL)
+      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  }
+  if (D->fragment[index].sx) {
+    s = _GD_CStrdup(D->fragment[index].sx);
+    if (s == NULL)
+      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
   }
-
-  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;
+    GD_RETURN_ERROR(D);
   }
 
-  *prefix = p;
-  *suffix = s;
+  *px = p;
+  *sx = s;
   dreturn("%i", 0);
   return 0;
 }
 
-static char **_GD_CheckAffixes(DIRFILE *D, int i, const char *prefix,
-    const char *suffix, char **codes, unsigned *n)
+/* Replace the fragment rootspace, prefix and suffix of a field code with
+ * something else.  Name verification and duplicate checks are performed.
+ * Returns NULL on error or else a newly malloc'd string.
+ *
+ * The input code is this:
+ *
+ *     AAAA.BBBB.CCCC.DDDDEEEEGGGGHHHHIIII/KKKK.M0
+ *
+ * (See the definitions in the description of _GD_CodeOffsets in name.c).
+ *
+ * We replace BBBB. with new_ns (which is guaranteed to have the trailing '.'),
+ * EEEE with new_px and HHHH with new_sx, if they exist.  If the new codes are
+ * NULL, no change is made, but if they're the empty string, the old parts are
+ * deleted without adding new parts.
+ *
+ * For field name updates, this is the complement of _GD_RenameCode in name.c,
+ * which replaces CCCC. and GGGG, or /KKKK but leaves the rest unchanged.
+ * (AAAA., DDDD, and IIII are immutable, because they come from the parent's
+ * scope.)
+ */
+char *_GD_UpdateCode(DIRFILE *D, int index, const char *code, int early,
+    const char *new_ns, size_t new_nsl, const char *new_px, size_t new_pxl,
+    const char *new_sx, size_t new_sxl)
 {
-  int j;
-  unsigned u, nn = *n;
-  char **new_codes = codes, **ptr;
+  char *new_code, *ptr;
+  size_t new_len, offset[GD_N_CODEOFFSETS];
 
-  dtrace("%p, %i, \"%s\", \"%s\", %p, %p", D, i, prefix, suffix, new_codes, n);
+  dtrace("%p, %i, \"%s\", %i, \"%s\", %" PRIuSIZE ", \"%s\", %" PRIuSIZE
+      ", \"%s\", %" PRIuSIZE, D, index, code, early, new_ns, new_nsl, new_px,
+      new_pxl, new_sx, new_sxl);
 
-  ptr = _GD_Realloc(D, codes, sizeof(*ptr) * (nn + 2));
-  if (!ptr) {
-    dreturn("%p (%i)", codes, *n);
-    return codes;
-  }
-  new_codes = ptr;
+  /* Slice and dice */
+  _GD_CodeOffsets(D, index, code, early ? GD_CO_EARLY : 0, offset);
 
-  /* 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;
+  /* calculate the new code's length */
+  new_len = offset[9]; /* i.e. strlen(code) */
 
-  if (D->error) {
-    dreturn("%p (%i)", new_codes, *n);
-    return new_codes;
+  /* Only update these parts if we're changing them. */
+  if (new_ns)
+    new_len += new_nsl - (offset[1] - offset[0]);
+
+  if (new_px)
+    new_len += new_pxl - (offset[4] - offset[3]);
+
+  if (new_sx)
+    new_len += new_sxl - (offset[6] - offset[5]);
+
+  new_code = _GD_Malloc(D, new_len + 1);
+  if (new_code == NULL) {
+    dreturn("%p", NULL);
+    return NULL;
   }
 
-  /* Propagate changes downward */
-  for (j = 0; j < D->n_fragment; ++j)
-    if (D->fragment[j].parent == i) {
-      char *subprefix = _GD_MungeCode(D, NULL, 0, D->fragment[i].prefix,
-          NULL, prefix, NULL, D->fragment[j].prefix, NULL, NULL,
-          GD_MC_RQ_PARTS | GD_MC_ERROR_OK);
-      char *subsuffix = _GD_MungeCode(D, NULL, 0, NULL,
-          D->fragment[i].suffix, NULL, suffix, D->fragment[j].suffix, NULL,
-          NULL, GD_MC_RQ_PARTS | GD_MC_ERROR_OK);
-      if (D->error) {
-        free(subprefix);
-        dreturn("%p (%i)", new_codes, *n);
-        return new_codes;
-      }
+  /* Copy the stuff before the fragment local rootspace (AAAA.) */
+  if (offset[0])
+    memcpy(new_code, code, offset[0]);
+  ptr = new_code + offset[0];
+
+  if (new_ns && new_ns[0]) {
+    /* Add the new rootspace (including trailing '.') */
+    memcpy(ptr, new_ns, new_nsl);
+    ptr += new_nsl;
+  } else if (new_ns == NULL && offset[1] > offset[0]) {
+    /* Copy the old rootspace (BBBB.) */
+    memcpy(ptr, code + offset[0], offset[1] - offset[0]);
+    ptr = new_code + offset[1];
+  }
 
-      new_codes = _GD_CheckAffixes(D, j, subprefix, subsuffix, new_codes, n);
-      free(subprefix);
-      free(subsuffix);
-      nn = *n;
+  /* Copy the subnamespace and parent prefix, if any (CCCC.DDDD) */
+  if (offset[3] > offset[1]) {
+    memcpy(ptr, code + offset[1], offset[3] - offset[1]);
+    ptr += offset[3] - offset[1];
+  }
 
-      if (D->error) {
-        dreturn("%p (%i)", new_codes, *n);
-        return new_codes;
-      }
-    }
+  if (new_px && new_px[0]) {
+    /* Add the new prefix */
+    memcpy(ptr, new_px, new_pxl);
+    ptr += new_pxl;
+  } else if (new_px == NULL && offset[4] > offset[3]) {
+    /* Copy the old prefix (EEEE) */
+    memcpy(ptr, code + offset[3], offset[4] - offset[3]);
+    ptr += offset[4] - offset[3];
+  }
 
-  /* 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 = _GD_Realloc(D, new_codes, sizeof(*ptr) * ++nn);
-      if (ptr) {
-        char *nso;
-        new_codes = ptr;
-        /* remunge the code */
-        new_codes[nn - 1] = _GD_MungeCode(D, NULL, 0, D->fragment[i].prefix,
-            D->fragment[i].suffix, prefix, suffix, D->entry[u]->field, &nso,
-            NULL, GD_MC_RQ_PARTS);
-
-        /* look for a duplicate and validate */
-        if (new_codes[nn - 1] && _GD_FindField(D, new_codes[nn - 1], D->entry,
-              D->n_entries, 0, NULL))
-        {
-          _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, new_codes[nn - 1]);
-        } else if (_GD_ValidateField(nso, D->standards, 1, GD_VF_NAME, NULL)) {
-          _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0,
-              new_codes[nn - 1]);
-        }
-      } else
-        nn--;
-
-      if (D->error)
-        break;
-    }
+  /* Copy the field name (which may contain subaffixes).  This is guaranteed
+   * to be present. (GGGG) */
+  memcpy(ptr, code + offset[4], offset[5] - offset[4]);
+  ptr += offset[5] - offset[4];
+
+  if (new_sx && new_sx[0]) {
+    /* Add the new suffix */
+    memcpy(ptr, new_sx, new_sxl);
+    ptr += new_sxl;
+  } else if (new_sx == NULL && offset[6] > offset[5]) {
+    /* Copy the old sx (HHHH) */
+    memcpy(ptr, code + offset[5], offset[6] - offset[5]);
+    ptr += offset[6] - offset[5];
+  }
+
+  /* Copy the trailing garbage (IIII[/KKKK].M) */
+  if (offset[9] > offset[6]) {
+    memcpy(ptr, code + offset[6], offset[9] - offset[6]);
+    ptr += offset[9] - offset[6];
+  }
+  
+  /* And terminate */
+  *ptr = 0;
+
+  /* Now validate and check for duplicate -- metafields don't need to
+   * validate */
+  if (offset[7] == offset[8] && _GD_ValidateField(new_code, 0, D->standards, 1,
+        GD_VF_CODE))
+  {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, new_code);
+  } else if (_GD_FindField(D, new_code, new_len, D->entry, D->n_entries, 0,
+        NULL))
+  {
+    _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, new_code);
+  } else {
+    /* field code okay */
+    dreturn("\"%s\"", new_code);
+    return new_code;
+  }
 
-  *n = nn;
-  dreturn("%p (%i)", new_codes, *n);
-  return new_codes;
+  /* Checks failed */
+  free(new_code);
+  dreturn("%p", NULL);
+  return NULL;
 }
 
-static int _GD_ChangeAffixes(DIRFILE *D, int i, char **codes, int *resort)
+/* create a list of indices to subfragments, including this one */
+int _GD_SubFragmentList(DIRFILE *restrict D, int i, int **restrict ilist)
 {
-  int j;
-  unsigned u, n = 2;
+  int *list;
+  int j, n = 1;
 
-  dtrace("%p, %i, %p, %p", D, i, codes, resort);
+  dtrace("%p, %i, %p", D, i, ilist);
 
-  free(D->fragment[i].prefix);
-  free(D->fragment[i].suffix);
-  D->fragment[i].prefix = codes[0];
-  D->fragment[i].suffix = codes[1];
+  /* i is always in the list */
+  list = _GD_Malloc(D, sizeof(*list));
+  if (list == NULL) {
+    dreturn("%i", 0);
+    return 0;
+  }
+  list[0] = i;
 
-  /* Propagate changes downward */
+  /* search for children */
   for (j = 0; j < D->n_fragment; ++j)
-    if (D->fragment[j].parent == i)
-      n += _GD_ChangeAffixes(D, j, codes + n, resort);
+    if (D->fragment[j].parent == i) {
+      int nsub, *sublist, *ptr;
 
-  /* 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++];
+      nsub = _GD_SubFragmentList(D, j, &sublist);
+      if (nsub == 0) {
+        free(list);
+        dreturn("%i", 0);
+        return 0;
+      }
+
+      /* append to current list */
+      ptr = _GD_Realloc(D, list, (nsub + n) * sizeof(*list));
+      if (ptr == NULL) {
+        free(list);
+        dreturn("%i", 0);
+        return 0;
+      }
+      list = ptr;
+      memcpy(list + n, sublist, nsub * sizeof(*list));
+      free(sublist);
+
+      n += nsub;
     }
 
+  /* done */
+  *ilist = list;
   dreturn("%i", n);
   return n;
 }
 
-int gd_alter_affixes(DIRFILE *D, int index, const char *prefix,
-    const char *suffix) gd_nothrow
+/* Update code affixes for a fragment (including subfragments) with the new
+ * values.
+ *
+ * If non-NULL, this function steals nsin: the caller must malloc it.
+ * If it's not empty (or NULL), the caller also must ensure nsin has a
+ * trailing '.'.  Also: the string length in nsl should include this '.' in
+ * it's count, which is not typically how we store namespace lengths in, say,
+ * the gd_fragment_t struct.
+ *
+ * This function frees nsin on error.  It returns D->error.
+ */
+static int _GD_UpdateAffixes(DIRFILE *D, int index, char *nsin, size_t nsl,
+    const char *pxin, const char *sxin)
 {
-  unsigned u, n = 0;
-  char **new_codes;
-  int resort = 0;
-  dtrace("%p, %i, \"%s\", \"%s\"", D, index, prefix, suffix);
+  int ni, resort = 0;
+  int *ilist;
+  size_t u, pxl = 0, sxl = 0;
+  char *fullns = NULL, *fullpx = NULL;
+  char *ns = NULL, *px = NULL, *sx = NULL;
+  char **codes;
+  const struct gd_fragment_t *P;
+  struct gd_fragment_t *F;
+
+  dtrace("%p, %i, \"%s\", %" PRIuSIZE ", \"%s\", \"%s\"", D, index, nsin, nsl,
+      pxin, sxin);
+
+  F = D->fragment + index;
+  P = D->fragment + F->parent;
+
+  /* Forget about things that aren't changing. */
+  if (nsin && ((nsl == 0 && F->nsl == 0) ||
+      (nsl - 1 == F->nsl && strncmp(nsin, F->ns + P->nsl, F->nsl) == 0)))
+  {
+    nsl = 0;
+    free(nsin);
+    nsin = NULL;
+  }
 
-  _GD_ClearError(D);
+  if (pxin && F->px && strcmp(pxin, F->px + P->pxl) == 0)
+    pxin = NULL;
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+  if (sxin) {
+    sxl = strlen(sxin);
+    if (F->sx && sxl == F->sxl && strncmp(sxin, F->sx, F->sxl) == 0)
+      sxin = NULL;
   }
 
-  if (index <= 0 || index >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+  /* Nothing to do */
+  if (nsin == NULL && pxin == NULL && sxin == NULL) {
+    dreturn("%i", 0);
+    return 0;
   }
 
-  if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
-    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+  /* Compose the full namespace (i.e. containing the parent's space).
+   * This will eventually be used to replace the existing F->ns. */
+  if (nsin) {
+    if (nsl == 0) {
+      /* nsin is ""; fullns will be P->ns if it exists */
+      if (P->ns)
+        fullns = _GD_Strdup(D, P->ns);
+
+      /* but ns remains the empty string */
+      ns = "";
+      free(nsin); /* Don't need this anymore */
+    } else if (_GD_ValidateField(nsin, 0, D->standards, 1, GD_VF_NS)) {
+      /* invalid namespace */
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, nsin);
+      free(nsin);
+    } else if (P->nsl == 0) {
+      /* No P->ns: in this case we can just use the caller's string verbatim */
+      fullns = ns = nsin; /* steal nsin */
+    } else {
+      /* Combine P->ns and nsin */
+      size_t len;
+      /* If nsl is non-zero, then it also counts the trailing '.' (i.e. nsl is
+       * never 1).  Also add one for the intervening '.' */
+      len = P->nsl + nsl + 1;
+
+      fullns = _GD_Malloc(D, len + 1);
+      if (fullns) {
+        /* We copy from F not P because it already has the intervening '.' */
+        memcpy(fullns, F->ns, P->nsl + 1);
+        ns = fullns + P->nsl + 1;
+
+        /* We copy the trailing '.' and NUL here */
+        memcpy(ns, nsin, nsl + 1);
+        free(nsin); /* Don't need this anymore */
+      }
+    }
   }
 
-  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;
+  /* By this point, nsin has either been stolen or free'd */
+
+  if (!D->error && pxin) {
+    if (pxin[0] && _GD_ValidateField(pxin, 0, D->standards, 1, GD_VF_AFFIX))
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, pxin);
+    else {
+      pxl = strlen(pxin);
+      fullpx = _GD_Malloc(D, P->pxl + pxl + 1);
+      if (fullpx) {
+        if (P->px)
+          memcpy(fullpx, P->px, P->pxl);
+        px = fullpx + P->pxl;
+        memcpy(px, pxin, pxl + 1); /* includes the terminating NUL */
+      }
+    }
   }
 
-  /* affixes to keep */
-  if (!prefix)
-    prefix = D->fragment[index].prefix;
+  if (!D->error && sxin) {
+    /* Although we make the buffer big enough to hold the full suffix, we only
+     * copy the local part for now so we can use it in the _GD_UpdateCode calls.
+     * We'll add P->sx later
+     *
+     * Also note: no fullsx needed here because the local part is at the start
+     */
+    if (sxin[0] && _GD_ValidateField(sxin, 0, D->standards, 1, GD_VF_AFFIX))
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, sxin);
+    else {
+      sx = _GD_Malloc(D, P->sxl + sxl + 1);
+      if (sx)
+        memcpy(sx, sxin, sxl + 1); /* includes the terminating NUL */
+    }
+  }
 
-  if (!suffix)
-    suffix = D->fragment[index].suffix;
+  /* vaildation failed or alloc errors */
+  if (D->error) {
+    free(fullns);
+    free(fullpx);
+    free(sx);
+    GD_RETURN_ERROR(D);
+  }
 
-  /* nothing to do */
-  if (strcmp(prefix, D->fragment[index].prefix) == 0 &&
-      strcmp(suffix, D->fragment[index].suffix) == 0)
-  {
-    dreturn("%i", 0);
-    return 0;
+  /* find all affected fragments */
+  ni = _GD_SubFragmentList(D, index, &ilist);
+  if (ni == 0) { /* malloc error */
+    free(fullns);
+    free(fullpx);
+    free(sx);
+    GD_RETURN_ERROR(D);
   }
 
-  new_codes = _GD_CheckAffixes(D, index, prefix, suffix, NULL, &n);
+  /* array of new field codes */
+  codes = _GD_Malloc(D, sizeof(*codes) * D->n_entries);
+  if (codes == NULL) {
+    free(ilist);
+    free(fullns);
+    free(fullpx);
+    free(sx);
+    GD_RETURN_ERROR(D);
+  }
 
-  if (D->error) {
-    for (u = 0; u < n; ++u)
-      free(new_codes[u]);
-    free(new_codes);
-    dreturn("%i", -1);
-    return -1;
+  /* find all affected entries and generate new field codes */
+  for (u = 0; u < D->n_entries; ++u) {
+    /* check fragment list */
+    if (!_GD_ContainsFragment(ilist, ni, D->entry[u]->fragment_index)) {
+      codes[u] = NULL; /* skip this one */
+      continue; /* and try the next one */
+    }
+
+    /* Generate the new code and check it */
+    codes[u] = _GD_UpdateCode(D, index, D->entry[u]->field,
+        D->entry[u]->flags & GD_EN_EARLY, ns, nsl, px, pxl, sx, sxl);
+    if (codes[u] == NULL)
+      break;
   }
+  free(ilist);
 
-  _GD_ChangeAffixes(D, index, new_codes, &resort);
+  /* Change attempt failed */
+  if (D->error) {
+    do {
+      free(codes[u]);
+    } while (u--);
+    free(codes);
+    free(fullns);
+    free(fullpx);
+    free(sx);
+    GD_RETURN_ERROR(D);
+  }
 
-  free(new_codes);
+  /* update the codes */
+  for (u = 0; u < D->n_entries; ++u)
+    if (codes[u]) {
+      free(D->entry[u]->field);
+      D->entry[u]->field = codes[u];
+      D->entry[u]->e->len = strlen(codes[u]);
+      resort = 1;
+    }
+  free(codes);
 
-  if (resort) {
-    /* resort */
+  /* Resort */
+  if (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);
+
+  /* Kill the trailing '.', if it's present */
+  if (nsl)
+    ns[--nsl] = 0;
+
+  /* Finish up the suffix */
+  if (P->sx)
+    memcpy(sx + sxl, P->sx, P->sxl + 1); /* including the trailing NUL */
+
+  /* update the fragment itself, at the end */
+  if (nsin) {
+    free(F->ns);
+    F->ns = fullns;
+    F->nsl = nsl;
   }
 
-  dreturn("%i", 0);
-  return 0;
+  if (pxin) {
+    free(F->px);
+    F->px = fullpx;
+    F->pxl = pxl;
+  }
+
+  if (sxin) {
+    free(F->sx);
+    F->sx = sx;
+    F->sxl = sxl;
+  }
+  F->modified = 1;
+
+  GD_RETURN_ERROR(D);
 }
 
-int gd_nfragments(DIRFILE* D) gd_nothrow
+/* Removes initial '.' and adds trailing '.'.  Returns a newly malloc'd
+ * buffer and sets *nsl, or NULL on error.  nsin may not be NULL.
+ */
+char *_GD_NormaliseNamespace(DIRFILE *D, const char *nsin, size_t *nsl)
 {
-  dtrace("%p", D);
+  char *ns;
 
-  _GD_ClearError(D);
+  dtrace("%p, \"%s\", %p", D, nsin, nsl);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", 0);
-    return 0;
+  if (nsin[0] == '.') {
+    /* we check this here to catch the case where nsin is ".." */
+    if (nsin[1] == '.') {
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, nsin);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+    /* Otherwise, ignore a leading dot */
+    nsin++;
+  }
+
+  if (nsin[0] == '\0') {
+    /* Empty namespace.  It still needs duplication */
+    *nsl = 0;
+    ns = _GD_Malloc(D, 1);
+    if (ns == NULL) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
+    ns[0] = 0;
+  } else {
+    *nsl = strlen(nsin);
+
+    /* Add space for a trailing '.', if necessary */
+    if (nsin[*nsl - 1] != '.')
+      (*nsl)++;
+
+    ns = _GD_Malloc(D, *nsl + 1);
+    if (ns == NULL) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
+
+    memcpy(ns, nsin, *nsl);
+
+    /* If we incremented nsl before, ns[*nsl - 1] points to the trerminating
+     * NUL we just copied, and we need to replace that with '.' and a new
+     * NUL.  If we didn't increment nsl, then ns[*nsl - 1] is the '.' and we're
+     * unterminated. */
+    if (ns[*nsl - 1] == '\0')
+      ns[*nsl - 1] = '.';
+    ns[*nsl] = 0; /* terminate */
   }
 
+  dreturn("%p (%" PRIuSIZE ")", ns, *nsl);
+  return ns;
+}
+
+int gd_alter_affixes(DIRFILE *D, int index, const char *prefix,
+    const char *suffix) gd_nothrow
+{
+  const char *px;
+  char *ns = NULL;
+  size_t nsl = 0;
+  int ret;
+  dtrace("%p, %i, \"%s\", \"%s\"", D, index, prefix, suffix);
+
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  if (index <= 0 || index >= D->n_fragment) 
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_INDEX, 0, NULL, index, NULL);
+
+  /* split off the namespace, if present */
+  if (D->standards >= 10 && prefix) {
+    px = strrchr(prefix, '.');
+    if (px) {
+      px++; /* Advance the prefix pointer past the '.' */
+
+      /* Length of the namespace plus trailing dot */
+      nsl = px - prefix;
+
+      /* Allocate the buffer */
+      ns = _GD_Malloc(D, nsl + 1);
+      if (ns == NULL)
+        GD_RETURN_ERROR(D);
+
+      /* the ns we create includes the trailing '.', except when it's empty */
+      if (nsl == 1) {
+        /* This is the case where prefix is ".prefix"; ie. ns should be "" */
+        ns[0] = 0;
+        nsl = 0;
+      } else {
+        memcpy(ns, prefix, nsl);
+        ns[nsl] = 0;
+      }
+    } else
+      px = prefix;
+  } else
+    px = prefix;
+
+  /* UpdateAffixes will free ns */
+  ret = _GD_UpdateAffixes(D, index, ns, nsl, px, suffix);
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+int gd_nfragments(DIRFILE* D) gd_nothrow
+{
+  dtrace("%p", D);
+
+  GD_RETURN_ERR_IF_INVALID(D);
+
   dreturn("%i", D->n_fragment);
   return D->n_fragment;
 }
@@ -288,127 +592,47 @@ int gd_parent_fragment(DIRFILE* D, int fragment_index) gd_nothrow
 {
   dtrace("%p, %i", D, fragment_index);
 
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (fragment_index <= 0 || fragment_index >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (fragment_index <= 0 || fragment_index >= D->n_fragment)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
 
   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)
+const char *gd_fragment_namespace(DIRFILE *D, int index, const char *nsin)
 {
-  int changed = 0, i;
-  struct stat statbuf;
+  char *ns;
+  size_t nsl;
 
-  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
+  dtrace("%p, %i, \"%s\"", D, index, nsin);
 
   _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 = _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 = _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_IO, 0, buffer, 0, 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_IO, 0, D->fragment[i].cname, 0, NULL);
-        dreturn("%i", -1);
-        return -1;
-      }
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
-    if (statbuf.st_mtime != D->fragment[i].mtime) {
-      changed = 1;
-      break;
-    }
+  /* Modification of the root format file's root namespace is not permitted */
+  if (index < 0 || index >= D->n_fragment || (nsin && index == 0)) {
+    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, index, NULL);
+    dreturn("%p", NULL);
+    return NULL;
   }
 
-  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_IO, GD_E_OPEN, D->name, 0, NULL);
-        dreturn("%i", -1);
-        return -1;
-      }
+  if (nsin) {
+    ns = _GD_NormaliseNamespace(D, nsin, &nsl);
+    if (ns == NULL) {
+      dreturn("%p", NULL);
+      return NULL;
     }
 
-    D->name = NULL; /* so FreeD doesn't delete it */
-    if (_GD_ShutdownDirfile(D, 0, 1)) {
-      D->name = name;
-      if (dirfd >= 0)
-        close(dirfd);
-      dreturn("%i", -1);
-      return -1;
+    /* _GD_UpdateAffixes steals ns */
+    if (_GD_UpdateAffixes(D, index, ns, nsl, NULL, NULL)) {
+      dreturn("%p", NULL);
+      return NULL;
     }
-    _GD_Open(D, dirfd, name, flags, sehandler, extra);
-    free(name);
-
-    if (D->error)
-      changed = -1;
   }
 
-  dreturn("%i", changed);
-  return changed;
+  dreturn("\"%s\"", D->fragment[index].ns ? D->fragment[index].ns : "");
+  return  D->fragment[index].ns ? (const char*)D->fragment[index].ns : "";
 }
diff --git a/src/gd_config.h.in b/src/gd_config.h.in
index 76479b4..c33d8ac 100644
--- a/src/gd_config.h.in
+++ b/src/gd_config.h.in
@@ -144,6 +144,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define to 1 if you have the `dup2' function. */
+#undef HAVE_DUP2
+
 /* Define to 1 if you have the `fchmod' function. */
 #undef HAVE_FCHMOD
 
@@ -153,6 +156,9 @@
 /* Define to 1 if you have the `fdopendir' function. */
 #undef HAVE_FDOPENDIR
 
+/* Define to 1 if you have the <features.h> header file. */
+#undef HAVE_FEATURES_H
+
 /* Define to 1 if you have the <FLAC/all.h> header file. */
 #undef HAVE_FLAC_ALL_H
 
@@ -222,6 +228,9 @@
 /* Define to 1 if you have the `isnan' function. */
 #undef HAVE_ISNAN
 
+/* Define to 1 if you have the `kill' function. */
+#undef HAVE_KILL
+
 /* Define to 1 if you have the `bz2' library (-lbz2). */
 #undef HAVE_LIBBZ2
 
@@ -270,9 +279,6 @@
 /* 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
 
@@ -291,6 +297,15 @@
 /* Define to 1 if you have the `pathconf' function. */
 #undef HAVE_PATHCONF
 
+/* Define to 1 if you have the `pcre_compile' function. */
+#undef HAVE_PCRE_COMPILE
+
+/* Define to 1 if you have the <pcre.h> header file. */
+#undef HAVE_PCRE_H
+
+/* Define to 1 if you have the `pipe' function. */
+#undef HAVE_PIPE
+
 /* Define to 1 if you have the <pthread.h> header file. */
 #undef HAVE_PTHREAD_H
 
@@ -306,12 +321,21 @@
 /* Define to 1 if you have the `readlink' function. */
 #undef HAVE_READLINK
 
+/* Define to 1 if you have the `regcomp' function. */
+#undef HAVE_REGCOMP
+
+/* Define to 1 if you have the <regex.h> header file. */
+#undef HAVE_REGEX_H
+
 /* Define to 1 if you have the `renameat' function. */
 #undef HAVE_RENAMEAT
 
 /* Define to 1 if you have the `setrlimit' function. */
 #undef HAVE_SETRLIMIT
 
+/* Define to 1 if you have the <signal.h> header file. */
+#undef HAVE_SIGNAL_H
+
 /* Define to 1 if you have the `slimdopen' function. */
 #undef HAVE_SLIMDOPEN
 
@@ -503,9 +527,6 @@
 /* Define to the full Win32 path to the `sh.exe' binary */
 #undef MSYS_SHELL
 
-/* Define to disable assertions */
-#undef NDEBUG
-
 /* Define to 1 to disable tests that write large quantities (>1MB) of
    temporary data. */
 #undef NO_LARGE_TESTS
diff --git a/src/getdata.c b/src/getdata.c
index 1d60969..644abc2 100644
--- a/src/getdata.c
+++ b/src/getdata.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2015 D. V. Wiebe
+ * Copyright (C) 2005-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -49,10 +49,8 @@
     case GD_FLOAT64:    EXTRACT_REPRR2(        double, ot,fabs,fargs); break; \
     case GD_COMPLEX64:  EXTRACT_REPRC2(         float, ot); break; \
     case GD_COMPLEX128: EXTRACT_REPRC2(        double, ot); break; \
-    case GD_NULL: \
-      break; \
-    default: \
-      _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, in_type, NULL); \
+    case GD_NULL:                                           break; \
+    default: _GD_InternalError(D); \
   }
 
 #define EXTRACT_REPRC2(it,ot) \
@@ -108,16 +106,14 @@ static void _GD_ExtractRepr(DIRFILE *restrict D, const void *restrict cdata,
     } \
   } while(0)
 
-    case GD_COMPLEX64:  EXTRACT_REPRS(         float); break;
-    case GD_COMPLEX128: EXTRACT_REPRS(        double); break;
+    case GD_COMPLEX64:  EXTRACT_REPRS(         float);  break;
+    case GD_COMPLEX128: EXTRACT_REPRS(        double);  break;
 #else
-    case GD_COMPLEX64:  EXTRACT_REPRS( float complex); break;
-    case GD_COMPLEX128: EXTRACT_REPRS(double complex); break;
+    case GD_COMPLEX64:  EXTRACT_REPRS( float _Complex); break;
+    case GD_COMPLEX128: EXTRACT_REPRS(double _Complex); break;
 #endif
-    case GD_NULL:                                      break;
-    default:
-      _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, type, NULL);
-      break;
+    case GD_NULL:                                       break;
+    default:            _GD_InternalError(D);           break;
   }
 
   dreturnvoid();
@@ -232,11 +228,10 @@ static size_t _GD_DoRaw(DIRFILE *restrict D, gd_entry_t *restrict E, off64_t s0,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p)", D, E, (int64_t)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 -
-      s0;
-  else
-    s0 -= E->EN(raw,spf) * D->fragment[E->fragment_index].frame_offset;
+  if (ns * E->e->u.raw.size == 0) {
+    dreturn("%i", 0);
+    return 0;
+  }
 
   databuffer = _GD_Malloc(D, ns * E->e->u.raw.size);
   if (databuffer == NULL) {
@@ -244,45 +239,29 @@ static size_t _GD_DoRaw(DIRFILE *restrict D, gd_entry_t *restrict E, off64_t s0,
     return 0;
   }
 
-  if (zero_pad > 0) {
-    /* frame offset in samples */
-    const off64_t foffs = E->EN(raw,spf) *
-      D->fragment[E->fragment_index].frame_offset;
+  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 -
+      s0;
 
+  /* Generate padding before frameoffset */
+  if (zero_pad > 0) {
     zeroed_samples = _GD_FillZero(databuffer, E->EN(raw,data_type),
         (zero_pad > ns) ? ns : zero_pad);
     ns -= zeroed_samples;
-
-     /* Padding up to the end of the frameoffset, results in a "real" file
-      * position.  In this case we need to make sure the underlying file is
-      * actually at the BOF, for consistency.
-      */
-    if (s0 + (off64_t)zeroed_samples == foffs) /* ie. file->pos is zero */
-      _GD_Seek(D, E, foffs, GD_SEEK_SET);
-    else 
-      E->e->u.raw.file[0].pos = s0 + zeroed_samples - foffs;
-    s0 = 0;
+    s0 += zeroed_samples;
   }
 
-  if (ns > 0) {
-    /* open the file (and cache the fp) if it hasn't been opened yet. */
-    if (_GD_InitRawIO(D, E, NULL, -1, NULL, GD_EF_SEEK | GD_EF_READ,
-          GD_FILE_READ, _GD_FileSwapBytes(D, E)))
-    {
-      free(databuffer);
-      dreturn("%i", 0);
-      return 0;
-    }
-
-    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_SetEncIOError(D, GD_E_IO_READ, E->e->u.raw.file + 0);
+  /* We need to seek if we zero padded to get the file->pos in the right place
+   */
+  if (ns > 0 || zero_pad)
+    /* This will open the file if it's not open already */
+    if (_GD_Seek(D, E, s0, GD_FILE_READ)) {
       free(databuffer);
       dreturn("%i", 0);
       return 0;
     }
 
+  if (ns > 0) {
     samples_read = (*_GD_ef[E->e->u.raw.file[0].subenc].read)(E->e->u.raw.file,
           databuffer + zeroed_samples * E->e->u.raw.size, E->EN(raw,data_type),
           ns);
@@ -432,7 +411,7 @@ static size_t _GD_DoRaw(DIRFILE *restrict D, gd_entry_t *restrict E, off64_t s0,
     } \
   } while (0)
 #else
-#define POLYNOMC(t) POLYNOM(complex t)
+#define POLYNOMC(t) POLYNOM(_Complex t)
 #endif
 
 #define POLYNOM(t) \
@@ -472,8 +451,7 @@ static void _GD_PolynomData(DIRFILE *restrict D, void *restrict data,
       case GD_FLOAT64:    POLYNOM(  double); break;
       case GD_COMPLEX64:  POLYNOMC(  float); break;
       case GD_COMPLEX128: POLYNOMC( double); break;
-      default:            _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, type, NULL);
-                          break;
+      default:         _GD_InternalError(D); break;
     }
   }
 
@@ -607,20 +585,9 @@ static void _GD_CPolynomData(DIRFILE *restrict D, void *restrict data,
   } else {
     switch (type) {
       case GD_NULL:                          break;
-      case GD_INT8:
-      case GD_UINT8:
-      case GD_INT16:
-      case GD_UINT16:
-      case GD_INT32:
-      case GD_UINT32:
-      case GD_INT64:
-      case GD_UINT64:
-      case GD_FLOAT32:
-      case GD_FLOAT64: _GD_InternalError(D); break;
       case GD_COMPLEX64:  POLYNOMC(  float); break;
       case GD_COMPLEX128: POLYNOMC( double); break;
-      default:            _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, type, NULL);
-                          break;
+      default:         _GD_InternalError(D); break;
     }
   }
 
@@ -636,7 +603,7 @@ static void _GD_CPolynomData(DIRFILE *restrict D, void *restrict data,
     } \
   } while (0)
 #else
-#define MULTIPLYC(t) MULTIPLY(complex t)
+#define MULTIPLYC(t) MULTIPLY(_Complex t)
 #endif
 
 #define MULTIPLY(t) \
@@ -666,8 +633,7 @@ static void _GD_MultiplyData(DIRFILE *restrict D, void *restrict A,
     case GD_FLOAT64:    MULTIPLY(  double); break;
     case GD_COMPLEX64:  MULTIPLYC(  float); break;
     case GD_COMPLEX128: MULTIPLYC( double); break;
-    default:            _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, type, NULL);
-                        break;
+    default:          _GD_InternalError(D); break;
   }
 
   dreturnvoid();
@@ -702,20 +668,9 @@ static void _GD_CMultiplyData(DIRFILE *restrict D, void *restrict A,
 
   switch (type) {
     case GD_NULL:                           break;
-    case GD_UINT8:
-    case GD_INT8:
-    case GD_UINT16:
-    case GD_INT16:
-    case GD_UINT32:
-    case GD_INT32:
-    case GD_UINT64:
-    case GD_INT64:
-    case GD_FLOAT32:
-    case GD_FLOAT64: _GD_InternalError(D);  break;
     case GD_COMPLEX64:  MULTIPLYC(  float); break;
     case GD_COMPLEX128: MULTIPLYC( double); break;
-    default:            _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, type, NULL);
-                        break;
+    default:          _GD_InternalError(D); break;
   }
 
   dreturnvoid();
@@ -730,7 +685,7 @@ static void _GD_CMultiplyData(DIRFILE *restrict D, void *restrict A,
     } \
   } while(0)
 #else
-#define DIVIDEC(t) DIVIDE(complex t)
+#define DIVIDEC(t) DIVIDE(_Complex t)
 #endif
 
 #define DIVIDE(t) \
@@ -761,8 +716,7 @@ static void _GD_DivideData(DIRFILE *restrict D, void *restrict A,
     case GD_FLOAT64:    DIVIDE(  double); break;
     case GD_COMPLEX64:  DIVIDEC(  float); break;
     case GD_COMPLEX128: DIVIDEC( double); break;
-    default:            _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, type, NULL);
-                        break;
+    default:        _GD_InternalError(D); break;
   }
 
   dreturnvoid();
@@ -798,20 +752,9 @@ static void _GD_CDivideData(DIRFILE *restrict D, void *restrict A,
 
   switch (type) {
     case GD_NULL:                         break;
-    case GD_UINT8:
-    case GD_INT8:
-    case GD_UINT16:
-    case GD_INT16:
-    case GD_UINT32:
-    case GD_INT32:
-    case GD_UINT64:
-    case GD_INT64:
-    case GD_FLOAT32:
-    case GD_FLOAT64: _GD_InternalError(D); break;
     case GD_COMPLEX64:  DIVIDEC(  float); break;
     case GD_COMPLEX128: DIVIDEC( double); break;
-    default:            _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, type, NULL);
-                        break;
+    default:        _GD_InternalError(D); break;
   }
 
   dreturnvoid();
@@ -882,8 +825,7 @@ static void _GD_WindowData(DIRFILE *restrict D, void *restrict A,
     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, 0, NULL, type, NULL);
-                        break;
+    default:           _GD_InternalError(D); break;
   }
 
   dreturnvoid();
@@ -939,8 +881,7 @@ static void _GD_MplexData(DIRFILE *restrict D, void *restrict A,
     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, 0, NULL, type, NULL);
-                        break;
+    default:       _GD_InternalError(D); break;
   }
 
   dreturnvoid();
@@ -963,13 +904,8 @@ static size_t _GD_DoLincom(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, return_type, data_out);
 
-  /* input field checks */
+  /* Get SPF for all inputs */
   for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-    if (_GD_BadInput(D, E, i, GD_NO_ENTRY, 1)) {
-      dreturn("%i", 0);
-      return 0;
-    }
-
     spf[i] = _GD_GetSPF(D, E->e->entry[i]);
     if (D->error != GD_E_OK) {
       dreturn("%i", 0);
@@ -1097,17 +1033,6 @@ static size_t _GD_DoMultiply(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, return_type, data_out);
 
-  /* Check input fields */
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
-  if (_GD_BadInput(D, E, 1, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   /* find the samples per frame of the first field */
   spf1 = _GD_GetSPF(D, E->e->entry[0]);
   if (D->error != GD_E_OK) {
@@ -1190,12 +1115,6 @@ static size_t _GD_DoRecip(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, return_type, data_out);
 
-  /* Check input fields */
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   /* read the first 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);
@@ -1236,14 +1155,6 @@ static size_t _GD_DoDivide(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, return_type, data_out);
 
-  /* Check input fields */
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1) ||
-      _GD_BadInput(D, E, 1, GD_NO_ENTRY, 1))
-  {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   /* read the first 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);
@@ -1334,11 +1245,6 @@ static size_t _GD_DoBit(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %i, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E, is_signed,
       (int64_t)first_samp, num_samp, return_type, data_out);
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   if (is_signed)
     tmpbuf = _GD_Malloc(D, num_samp * sizeof(int64_t));
   else
@@ -1387,11 +1293,6 @@ static size_t _GD_DoPhase(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, return_type, data_out);
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   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);
 
@@ -1411,11 +1312,6 @@ static size_t _GD_DoLinterp(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, return_type, data_out);
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   /* allocate a temporary buffer */
   data_in = _GD_Alloc(D, GD_FLOAT64, num_samp);
 
@@ -1453,11 +1349,6 @@ static size_t _GD_DoPolynom(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, return_type, data_out);
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   /* read the input field */
   n_read = _GD_DoField(D, E->e->entry[0], E->e->repr[0], first_samp, num_samp,
       return_type, data_out);
@@ -1499,17 +1390,6 @@ static size_t _GD_DoWindow(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, return_type, data_out);
 
-  /* Check input fields */
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
-  if (_GD_BadInput(D, E, 1, GD_NO_ENTRY, 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) {
@@ -1605,17 +1485,6 @@ static size_t _GD_DoMplex(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, return_type, data_out);
 
-  /* Check input fields */
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
-  if (_GD_BadInput(D, E, 1, GD_NO_ENTRY, 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) {
@@ -1795,6 +1664,88 @@ static size_t _GD_DoConst(DIRFILE *restrict D, const gd_entry_t *restrict E,
   return len;
 }
 
+/* simple */
+static void _GD_IndirData(char *restrict cbuf, gd_type_t ctype,
+        const int64_t *restrict ibuf, size_t n, const void *carray, size_t len)
+{
+  size_t i;
+  const int size = GD_SIZE(ctype);
+
+  /* INDIR can only address the first 2**63 entries in a CARRAY */
+  int64_t ilen =
+#if SIZEOF_SIZE_T == 8
+    (len > GD_INT64_MAX) ? GD_INT64_MAX :
+#endif
+    len;
+
+  dtrace("%p, 0x%X, %p, %" PRIuSIZE ", %p, %" PRIuSIZE, cbuf, ctype, ibuf, n,
+      carray, len);
+
+  for (i = 0; i < n; ++i)
+    if (ibuf[i] < 0 || ibuf[i] >= ilen)
+      _GD_FillZero(cbuf + size * i, ctype, 1);
+    else
+      memcpy(cbuf + size * i, (const char*)carray + size * ibuf[i], size);
+
+  dreturnvoid();
+}
+
+/* _GD_DoIndir: Read from an indir. */
+static size_t _GD_DoIndir(DIRFILE *restrict D, const 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;
+  int64_t *ibuf = NULL;
+  void *cbuf = NULL;
+  gd_type_t ctype;
+
+  dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
+      (int64_t)first_samp, num_samp, return_type, data_out);
+
+  /* index buffer */
+  ibuf = _GD_Alloc(D, GD_INT64, num_samp);
+  if (D->error) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* read the index 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,
+      GD_INT64, ibuf);
+  
+  if (D->error || n_read == 0) {
+    free(ibuf);
+    dreturn("%i", 0);
+    return 0;
+  }
+  
+  /* the intermediate buffer: it has the load type of the carray */
+  ctype = _GD_ConstType(D, E->e->entry[1]->EN(scalar,const_type));
+  cbuf = _GD_Alloc(D, ctype, n_read);
+  if (D->error) {
+    free(ibuf);
+    dreturn("%i", 0);
+    return 0;
+  }
+  
+  _GD_IndirData(cbuf, GD_SIZE(ctype), ibuf, n_read,
+      E->e->entry[1]->e->u.scalar.d, E->e->entry[1]->EN(scalar,array_len));
+  
+  free(ibuf);
+  
+  /* type convert into output buffer */
+  _GD_ConvertType(D, cbuf, ctype, data_out, return_type, n_read);
+  
+  free(cbuf);
+  
+  if (D->error)
+    n_read = 0;
+  
+  dreturn("%" PRIuSIZE, n_read);
+  return n_read;
+}
+
 /* _GD_DoField: Locate the field in the database and read it.
 */
 size_t _GD_DoField(DIRFILE *restrict D, gd_entry_t *restrict E, int repr,
@@ -1928,7 +1879,12 @@ size_t _GD_DoField(DIRFILE *restrict D, gd_entry_t *restrict E, int repr,
     case GD_CARRAY_ENTRY:
       n_read = _GD_DoConst(D, E, first_samp, num_samp, return_type, data_out);
       break;
+    case GD_INDIR_ENTRY:
+      n_read = _GD_DoIndir(D, E, first_samp, num_samp, return_type, data_out);
+      break;
     case GD_STRING_ENTRY:
+    case GD_SARRAY_ENTRY:
+    case GD_SINDIR_ENTRY:
     case GD_ALIAS_ENTRY:
     case GD_NO_ENTRY:
       /* Can't get here */
@@ -1949,44 +1905,97 @@ size_t _GD_DoField(DIRFILE *restrict D, gd_entry_t *restrict E, int repr,
   return n_read;
 }
 
+/* this returns string vector data; it is called for SINDIRs instead of making
+ * a call to DoField */
+static size_t _GD_DoSindir(DIRFILE *D, gd_entry_t *E, off64_t first_samp,
+    size_t num_samp, gd_type_t return_type, const char **data_out)
+{
+  size_t i, n_read = 0;
+  int64_t *ibuf = NULL;
+  int64_t len;
+
+  dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
+      (int64_t)first_samp, num_samp, return_type, data_out);
+
+  if (_GD_FindInputs(D, E, 1)) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* check return type */
+  if (return_type != GD_STRING && return_type != GD_NULL) {
+    _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, return_type, NULL);
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* short circuit: no data requested */
+  if (num_samp == 0) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* index buffer */
+  ibuf = _GD_Alloc(D, GD_INT64, num_samp);
+  if (D->error) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* read the index 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,
+      GD_INT64, ibuf);
+
+  if (n_read == 0 || return_type == GD_NULL) {
+    free(ibuf);
+    dreturn("%" PRIuSIZE, n_read);
+    return n_read;
+  }
+
+  /* SINDIR can only address the first 2**63 entries in a SARRAY */
+  len =
+#if SIZEOF_SIZE_T == 8
+    (E->e->entry[1]->EN(scalar,array_len) > GD_INT64_MAX) ? GD_INT64_MAX :
+#endif
+    E->e->entry[1]->EN(scalar,array_len);
+
+  for (i = 0; i < n_read; ++i)
+    if (ibuf[i] < 0 || ibuf[i] >= len)
+      data_out[i] = NULL;
+    else
+      data_out[i] = ((const char **)E->e->entry[1]->e->u.scalar.d)[ibuf[i]];
+
+  free(ibuf);
+
+  dreturn("%" PRIuSIZE, n_read);
+  return n_read;
+}
+
 /* this function is little more than a public boilerplate for _GD_DoField */
-size_t gd_getdata64(DIRFILE* D, const char *field_code_in, off64_t first_frame,
+size_t gd_getdata64(DIRFILE* D, 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, void *data_out)
 {
   size_t n_read = 0;
   gd_entry_t* entry;
-  char* field_code;
   int repr;
   unsigned int spf;
 
   dtrace("%p, \"%s\", %" PRId64 ", %" PRId64 ", %" PRIuSIZE ", %" PRIuSIZE
-      ", 0x%X, %p", D, field_code_in, (int64_t)first_frame, (int64_t)first_samp,
+      ", 0x%X, %p", D, field_code, (int64_t)first_frame, (int64_t)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);
-    dreturn("%i", 0);
-    return 0;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_IF_INVALID(D, "%i", 0);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
-      1);
+  entry = _GD_FindFieldAndRepr(D, field_code, &repr, NULL, 1);
 
   if (D->error) {
     dreturn("%i", 0);
     return 0;
   }
 
-  if (entry->field_type & GD_SCALAR_ENTRY_BIT)
+  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);
-
-  if (D->error) {
     dreturn("%i", 0);
     return 0;
   }
@@ -1996,7 +2005,7 @@ size_t gd_getdata64(DIRFILE* D, const char *field_code_in, off64_t first_frame,
     first_frame = 0;
   }
 
-  if (first_frame > 0 || num_frames > 0) {
+  if (first_frame || num_frames) {
     /* get the samples per frame */
     spf = _GD_GetSPF(D, entry);
 
@@ -2025,8 +2034,18 @@ size_t gd_getdata64(DIRFILE* D, const char *field_code_in, off64_t first_frame,
     return 0;
   }
 
-  n_read = _GD_DoField(D, entry, repr, first_samp, num_samp, return_type,
-      data_out);
+  if (entry->field_type == GD_SINDIR_ENTRY)
+    n_read = _GD_DoSindir(D, entry, first_samp, num_samp, return_type,
+        data_out);
+  else {
+    if (return_type != GD_NULL &&
+        _GD_BadType(GD_DIRFILE_STANDARDS_VERSION, return_type))
+    {
+      _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, return_type, NULL);
+    } else
+      n_read = _GD_DoField(D, entry, repr, first_samp, num_samp, return_type,
+          data_out);
+  }
 
   dreturn("%" PRIuSIZE, n_read);
   return n_read;
diff --git a/src/getdata.h.in b/src/getdata.h.in
index 6276e79..f7dc62f 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-2015 D. V. Wiebe
+ * Copyright (C) 2005-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,7 +25,7 @@
  * --------------------------------------------------
  *
  * Several preprocessor symbols may be defined before including this file to
- * modify it's use:
+ * modify its use:
  *
  * - 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
@@ -33,22 +33,30 @@
  *
  * - 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.
+ *   array of doubles in place of the complex types.  It also changes the
+ *   gd_entry_t object as described in the gd_entry(3) manual page.  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
+ *   gd_getdata64()).  It will also define the 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.
- *   This feature is provided only to ease transistion, and will be removed in
- *   some unpecified future release.
+ * API DOCUMENTATION
+ * -----------------
+ *
+ * The GetData APIs which are declared in this file are documented in section 3
+ * of the Unix manual.  You should be able to access it using the standard
+ * man(1) command, e.g.:
+ *
+ *   man gd_getdata
+ *
+ * or equivalent.
  */
 
 #ifndef GETDATA_H
@@ -59,7 +67,7 @@ extern "C" {
 #endif
 
 /* The most recent standards version supported by this library */
-#define GD_DIRFILE_STANDARDS_VERSION 9
+#define GD_DIRFILE_STANDARDS_VERSION 10
 
 #include <math.h>
 #include <sys/types.h>
@@ -115,56 +123,52 @@ extern "C" {
 #define GD_MAX_LINE_LENGTH  4096
 
 /* error codes */
-#define GD_E_OK                0 /* this MUST be zero */
-/* unused                      1 */
-#define GD_E_FORMAT            2
-/* unused                      3 */
-#define GD_E_CREAT             4
-#define GD_E_BAD_CODE          5
-#define GD_E_BAD_TYPE          6
-#define GD_E_IO                7
-/* unused                      8 */
-#define GD_E_INTERNAL_ERROR    9
-#define GD_E_ALLOC            10
-#define GD_E_RANGE            11
-#define GD_E_LUT              12
-#define GD_E_RECURSE_LEVEL    13
-#define GD_E_BAD_DIRFILE      14
-#define GD_E_BAD_FIELD_TYPE   15
-#define GD_E_ACCMODE          16
-#define GD_E_UNSUPPORTED      17
-#define GD_E_UNKNOWN_ENCODING 18
-#define GD_E_BAD_ENTRY        19
-#define GD_E_DUPLICATE        20
-#define GD_E_DIMENSION        21
-#define GD_E_BAD_INDEX        22
-#define GD_E_BAD_SCALAR       23
-#define GD_E_BAD_REFERENCE    24
-#define GD_E_PROTECTED        25
-#define GD_E_DELETE           26
-#define GD_E_ARGUMENT         27
-#define GD_E_CALLBACK         28
-#define GD_E_EXISTS           29
-#define GD_E_UNCLEAN_DB       30
-#define GD_E_DOMAIN           31
-/* unused                     32, 33, 34 */
-#define GD_E_BOUNDS           35
-#define GD_E_LINE_TOO_LONG    36
-
-#define GD_N_ERROR_CODES      37 /* including unused codes */
+#define GD_E_OK               (  0) /* this MUST be zero */
+#define GD_E_FORMAT           ( -1)
+#define GD_E_CREAT            ( -2)
+#define GD_E_BAD_CODE         ( -3)
+#define GD_E_BAD_TYPE         ( -4)
+#define GD_E_IO               ( -5)
+#define GD_E_INTERNAL_ERROR   ( -6)
+#define GD_E_ALLOC            ( -7)
+#define GD_E_RANGE            ( -8)
+#define GD_E_LUT              ( -9)
+#define GD_E_RECURSE_LEVEL    (-10)
+#define GD_E_BAD_DIRFILE      (-11)
+#define GD_E_BAD_FIELD_TYPE   (-12)
+#define GD_E_ACCMODE          (-13)
+#define GD_E_UNSUPPORTED      (-14)
+#define GD_E_UNKNOWN_ENCODING (-15)
+#define GD_E_BAD_ENTRY        (-16)
+#define GD_E_DUPLICATE        (-17)
+#define GD_E_DIMENSION        (-18)
+#define GD_E_BAD_INDEX        (-19)
+#define GD_E_BAD_SCALAR       (-20)
+#define GD_E_BAD_REFERENCE    (-21)
+#define GD_E_PROTECTED        (-22)
+#define GD_E_DELETE           (-23)
+#define GD_E_ARGUMENT         (-24)
+#define GD_E_CALLBACK         (-25)
+#define GD_E_EXISTS           (-26)
+#define GD_E_UNCLEAN_DB       (-27)
+#define GD_E_DOMAIN           (-28)
+#define GD_E_BOUNDS           (-29)
+#define GD_E_LINE_TOO_LONG    (-30)
+
+#define GD_N_ERROR_CODES      31 /* including GD_E_OK and unused codes */
 
 /* Deprecated error codes */
-#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_E_BAD_REPR         GD_E_BAD_CODE
-#define GD_E_OPEN_LINFILE     GD_E_LUT
-#define GD_E_FLUSH            GD_E_IO
-#define GD_E_OPEN             GD_E_IO
-#define GD_E_OPEN_FRAGMENT    GD_E_IO
-#define GD_E_OPEN_INCLUDE     GD_E_IO
-#define GD_E_RAW_IO           GD_E_IO
-#define GD_E_TRUNC            GD_E_IO
+#define GD_E_BAD_ENDIANNESS   GD_E_ARGUMENT /* Deprecated in 0.8 */
+#define GD_E_BAD_PROTECTION   GD_E_ARGUMENT /* Deprecated in 0.8 */
+#define GD_E_BAD_VERSION      GD_E_ARGUMENT /* Deprecated in 0.8 */
+#define GD_E_BAD_REPR         GD_E_BAD_CODE /* Deprecated in 0.9 */
+#define GD_E_OPEN_LINFILE     GD_E_LUT      /* Deprecated in 0.9 */
+#define GD_E_FLUSH            GD_E_IO       /* Deprecated in 0.9 */
+#define GD_E_OPEN             GD_E_IO       /* Deprecated in 0.9 */
+#define GD_E_OPEN_FRAGMENT    GD_E_IO       /* Deprecated in 0.9 */
+#define GD_E_OPEN_INCLUDE     GD_E_IO       /* Deprecated in 0.9 */
+#define GD_E_RAW_IO           GD_E_IO       /* Deprecated in 0.9 */
+#define GD_E_TRUNC            GD_E_IO       /* Deprecated in 0.9 */
 
 /* the maximum number of input vectors in a LINCOM */
 #define GD_MAX_LINCOM 3
@@ -238,16 +242,19 @@ typedef enum {
   GD_RECIP_ENTRY    = 0x0B,
   GD_WINDOW_ENTRY   = 0x0C,
   GD_MPLEX_ENTRY    = 0x0D,
+  GD_INDIR_ENTRY    = 0x0E,
+  GD_SINDIR_ENTRY   = 0x0F,
   GD_CONST_ENTRY    = GD_SCALAR_ENTRY_BIT | 0x00,
   GD_STRING_ENTRY   = GD_SCALAR_ENTRY_BIT | 0x01,
   GD_CARRAY_ENTRY   = GD_SCALAR_ENTRY_BIT | 0x02,
+  GD_SARRAY_ENTRY   = GD_SCALAR_ENTRY_BIT | 0x03,
 
   /* not a real entry type, but it's convenient to put this here */
   GD_ALIAS_ENTRY    =   -1
 } gd_entype_t;
 
 /* GD_NO_ENTRY and GD_ALIAS_ENTRY are not part of this count */
-#define GD_N_ENTYPES 16
+#define GD_N_ENTYPES 19
 
 /* Special types for gd_nentries(3) and gd_entry_list(3) */
 #define GD_ALL_ENTRIES    0
@@ -255,9 +262,18 @@ typedef enum {
 #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
+/* gd_nentries(3), gd_entry_list(3) and gd_match_entries(3) flags */
+#define GD_ENTRIES_HIDDEN  0x01
+#define GD_ENTRIES_NOALIAS 0x02
+
+/* additional gd_match_entries(3) flags */
+#define GD_REGEX_PCRE       0x04
+#define GD_REGEX_EXTENDED   0x08
+#define GD_REGEX_ICASE      0x10
+#define GD_REGEX_CASELESS   GD_REGEX_ICASE /* synonym */
+/* The rest of these are ignored if GD_REGEX_PCRE is not also set */
+#define GD_REGEX_JAVASCRIPT 0x20
+#define GD_REGEX_UNICODE    0x40
 
 /* the current location of the I/O pointer */
 #define GD_HERE  (-1)
@@ -273,16 +289,16 @@ typedef enum {
 # 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_int64_t@
 @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 gd_int64_t gd_shift_t; /* This type is deprecated */
+
+/* Types deprecated in GetData-0.8 */
 typedef int gd_bit_t;
 typedef unsigned int gd_spf_t;
 
@@ -314,10 +330,11 @@ typedef enum {
   GD_FLOAT64    = GD_SIZE64  | GD_IEEE754,
   GD_COMPLEX64  = GD_SIZE64  | GD_COMPLEX,
   GD_COMPLEX128 = GD_SIZE128 | GD_COMPLEX,
+  GD_STRING     = GD_CHAR | (sizeof(char*))
 } gd_type_t;
 
 
-/* deprecated type aliases */
+/* Type aliases deprecated in GetData-0.8 */
 #define GD_FLOAT     GD_FLOAT32
 #define GD_DOUBLE    GD_FLOAT64
 
@@ -346,8 +363,6 @@ typedef union {
 #define GD_EN_COMPSCAL 0x1 /* entry has complex scalar parameters */
 #define GD_EN_CALC     0x2 /* scalar field codes have been resolved */
 #define GD_EN_HIDDEN   0x4 /* entry is hidden */
-#define GD_EN_DOTTED   0x8 /* the field's name contains a dot (.) (i.e.
-                              Standards Version 5 or earlier) */
 
 /* ANSI C does not permit anonymous structs/unions */
 #ifdef GD_C89_API
@@ -393,7 +408,7 @@ struct gd_unified_entry_ {
       char *table;
     } GD_ANON(linterp);
     struct { /* PHASE */
-      gd_shift_t shift;
+      gd_int64_t shift;
     } GD_ANON(phase);
     struct { /* WINDOW */
       gd_windop_t windop;
@@ -506,6 +521,9 @@ typedef int (*gd_parser_callback_t)(gd_parser_data_t*, void*);
 #define GD_DESYNC_PATHCHECK 0x1
 #define GD_DESYNC_REOPEN    0x2
 
+void gd_alloc_funcs(void *(*malloc_func)(size_t),
+    void (*free_func)(void*)) gd_nothrow;
+
 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));
@@ -535,19 +553,23 @@ extern int gd_add_cpolynom(DIRFILE *dirfile, const char *field_code,
 #if ! defined GD_C89_API
 extern int gd_add_crecip(DIRFILE *dirfile, const char *field_code,
     const char *in_field, _Complex double cdividend, int fragment_index)
-  gd_nothrow gd_nonnull ((1,2,3));
+gd_nothrow gd_nonnull ((1,2,3));
 #else
 #define gd_add_crecip gd_add_crecip89
 #endif
 
 extern int gd_add_crecip89(DIRFILE *dirfile, const char *field_code,
     const char *in_field, const double cdividend[2], int fragment_index)
-  gd_nothrow gd_nonnull ((1,2,3));
+gd_nothrow gd_nonnull ((1,2,3));
 
 extern int gd_add_divide(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));
 
+extern int gd_add_indir(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));
+
 extern int gd_add_lincom(DIRFILE *dirfile, const char *field_code, int n_fields,
     const char **in_fields, const double *m, const double *b,
     int fragment_index) gd_nothrow gd_nonnull ((1,2,4,5,6));
@@ -576,10 +598,18 @@ extern int gd_add_recip(DIRFILE *dirfile, const char *field_code,
     const char *in_field, double dividend, int fragment_index) gd_nothrow
 gd_nonnull ((1,2,3));
 
+extern int gd_add_sarray(DIRFILE *dirfile, const char *field_code,
+    size_t array_len, const char **values, int fragment_index) gd_nothrow
+gd_nonnull ((1,2,4));
+
 extern int gd_add_sbit(DIRFILE *dirfile, const char *field_code,
     const char *in_field, int bitnum, int numbits,
     int fragment_index) gd_nothrow gd_nonnull ((1,2,3));
 
+extern int gd_add_sindir(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));
+
 extern int gd_add_string(DIRFILE *dirfile, const char *field_code,
     const char *value, int fragment_index) gd_nothrow gd_nonnull((1,2,3));
 
@@ -630,6 +660,9 @@ gd_nonnull((1,2));
 extern int gd_alter_divide(DIRFILE *dirfile, const char *field_code,
     const char *in_field1, const char *in_field2) gd_nothrow gd_nonnull((1,2));
 
+extern int gd_alter_indir(DIRFILE *dirfile, const char *field_code,
+    const char *in_field1, const char *in_field2) gd_nothrow gd_nonnull((1,2));
+
 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));
@@ -651,10 +684,16 @@ gd_nonnull((1,2));
 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_sarray(DIRFILE *dirfile, const char *field_code,
+    size_t array_len) gd_nothrow gd_nonnull((1,2));
+
 extern int gd_alter_sbit(DIRFILE *dirfile, const char *field_code,
     const char *in_field, int bitnum, int numbits) gd_nothrow
 gd_nonnull((1,2));
 
+extern int gd_alter_sindir(DIRFILE *dirfile, const char *field_code,
+    const char *in_field1, const char *in_field2) 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));
@@ -662,6 +701,7 @@ extern int gd_alter_window(DIRFILE *dirfile, const char *field_code,
 extern size_t gd_array_len(DIRFILE *dirfile, const char *field_code) gd_nothrow
 gd_nonnull((1,2));
 
+/* Deprecated in GetData-0.9.  Use gd_array_len() instead */
 extern size_t gd_carray_len(DIRFILE *dirfile, const char *field_code) gd_nothrow
 gd_nonnull((1,2)) gd_deprecated;
 
@@ -732,6 +772,9 @@ extern int gd_fragment_index(DIRFILE *dirfile,
 extern const char *gd_fragmentname(DIRFILE *dirfile,
     int index) gd_nothrow gd_nonnull ((1));
 
+extern const char *gd_fragment_namespace(DIRFILE *D, int index,
+    const char *ns) gd_nothrow;
+
 extern gd_entry_t *gd_free_entry_strings(gd_entry_t *entry) gd_nothrow;
 
 extern int gd_hidden(DIRFILE *dirfile, const char *field_code) gd_nothrow
@@ -789,6 +832,10 @@ extern int gd_madd_divide(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));
 
+extern int gd_madd_indir(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));
+
 extern int gd_madd_lincom(DIRFILE *dirfile, const char *parent,
     const char *field_code, int n_fields, const char **in_fields,
     const double *m, const double *b) gd_nothrow gd_nonnull((1,2,3,5,6,7));
@@ -818,10 +865,18 @@ extern int gd_madd_recip(DIRFILE *dirfile, const char *parent,
     const char *field_code, const char *in_field, double dividend) gd_nothrow
 gd_nonnull ((1,2,3,4));
 
+extern int gd_madd_sarray(DIRFILE *dirfile, const char *parent,
+    const char *field_code, size_t array_len, const char **values) gd_nothrow
+gd_nonnull ((1,2,3,5));
+
 extern int gd_madd_sbit(DIRFILE *dirfile, const char *parent,
     const char *field_code, const char *in_field, int bitnum,
     int numbits) gd_nothrow gd_nonnull ((1,2,3,4));
 
+extern int gd_madd_sindir(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));
+
 extern int gd_madd_spec(DIRFILE *dirfile, const char *line,
     const char *parent) gd_nothrow gd_nonnull ((1,2,3));
 
@@ -834,6 +889,10 @@ extern int gd_madd_window(DIRFILE *dirfile, const char *parent,
     gd_windop_t windop, gd_triplet_t threshold) gd_nothrow
 gd_nonnull ((1,2,3,4,5));
 
+extern unsigned int gd_match_entries(DIRFILE *D, const char *regex,
+    int fragment, int type, unsigned int flags, const char ***list) gd_nothrow
+gd_nonnull ((1));
+
 extern int gd_dirfile_standards(DIRFILE *dirfile, int vers) gd_nothrow
 gd_nonnull ((1));
 
@@ -852,6 +911,9 @@ extern const char **gd_mfield_list_by_type(DIRFILE *dirfile,
 extern void gd_mplex_lookback(DIRFILE *dirfile, int lookback) gd_nothrow
 gd_nonnull((1));
 
+extern const char ***gd_msarrays(DIRFILE *dirfile,
+    const char *parent) gd_nothrow gd_nonnull ((1,2));
+
 extern const char **gd_mstrings(DIRFILE *dirfile, const char *parent) gd_nothrow
 gd_nonnull((1,2));
 
@@ -905,15 +967,31 @@ extern char *gd_raw_filename(DIRFILE *dirfile,
 extern const char *gd_reference(DIRFILE *dirfile,
     const char *field_code) gd_nothrow gd_nonnull ((1));
 
+extern int gd_get_sarray(DIRFILE *dirfile, const char *field_code,
+    const char **data_out) gd_nothrow gd_nonnull((1,2));
+
+extern int gd_get_sarray_slice(DIRFILE *dirfile, const char *field_code,
+    unsigned long start, size_t n, const char **data_out) gd_nothrow
+gd_nonnull((1,2));
+
+extern int gd_put_sarray(DIRFILE *dirfile, const char *field_code,
+    const char **data_in) gd_nothrow gd_nonnull((1,2,3));
+
+extern int gd_put_sarray_slice(DIRFILE *dirfile, const char *field_code,
+    unsigned long first, size_t n, const char **data_in) gd_nothrow
+gd_nonnull((1,2,5));
+
 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,
     size_t len, char *data) gd_nothrow gd_nonnull ((1, 2));
 
-extern size_t gd_put_string(DIRFILE *dirfile, const char *field_code,
+extern int gd_put_string(DIRFILE *dirfile, const char *field_code,
     const char *data) gd_nothrow gd_nonnull ((1, 2, 3));
 
+const char ***gd_sarrays(DIRFILE *dirfile) gd_nothrow gd_nonnull ((1));
+
 extern const char **gd_strings(DIRFILE *dirfile) gd_nothrow gd_nonnull ((1));
 
 extern char *gd_strtok(DIRFILE *D, const char *string) gd_nothrow
@@ -981,6 +1059,9 @@ 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 int gd_include_ns(DIRFILE *D, const char *file, int fragment_index,
+    const char *ns, unsigned long flags) gd_nonnull ((1,2));
+
 extern double gd_framenum(DIRFILE *dirfile, const char *field_code,
     double value) gd_nonnull ((1,2));
 
@@ -1054,7 +1135,7 @@ extern off_t gd_bof(DIRFILE *dirfile, const char *field_code) gd_nothrow
 gd_nonnull ((1,2));
 
 extern off_t gd_eof(DIRFILE *dirfile, const char *field_code)
-  gd_nonnull ((1,2));
+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));
@@ -1105,7 +1186,7 @@ extern gd_off64_t gd_bof64(DIRFILE *dirfile, const char *field_code) gd_nothrow
 gd_nonnull ((1,2));
 
 extern gd_off64_t gd_eof64(DIRFILE *dirfile, const char *field_code)
-  gd_nonnull ((1,2));
+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));
@@ -1138,117 +1219,10 @@ gd_nonnull ((1,2));
 /* This is (major * 10000) + (minor * 100) + revision */
 @DEFINE_GD_GETDATA_INT_VERSION@
 
-/* function aliases */
-#ifdef GD_FUNCTION_ALIASES
-#  warning "Using deprecated function aliases."
-#  define dirfile_add gd_add
-#  define dirfile_add_bit gd_add_bit
-#  define dirfile_add_clincom gd_add_clincom
-#  define dirfile_add_const gd_add_const
-#  define dirfile_add_cpolynom gd_add_cpolynom
-#  define dirfile_add_lincom gd_add_lincom
-#  define dirfile_add_linterp gd_add_linterp
-#  define dirfile_add_multiply gd_add_multiply
-#  define dirfile_add_phase gd_add_phase
-#  define dirfile_add_polynom gd_add_polynom
-#  define dirfile_add_raw gd_add_raw
-#  define dirfile_add_sbit gd_add_sbit
-#  define dirfile_add_spec gd_add_spec
-#  define dirfile_add_string gd_add_string
-#  define dirfile_alter_bit gd_alter_bit
-#  define dirfile_alter_clincom gd_alter_clincom
-#  define dirfile_alter_const gd_alter_const
-#  define dirfile_alter_cpolynom gd_alter_cpolynom
-#  define dirfile_alter_encoding gd_alter_encoding
-#  define dirfile_alter_endianness gd_alter_endianness
-#  define dirfile_alter_entry gd_alter_entry
-#  define dirfile_alter_frameoffset gd_alter_frameoffset
-#  define dirfile_alter_frameoffset64 gd_alter_frameoffset64
-#  define dirfile_alter_lincom gd_alter_lincom
-#  define dirfile_alter_linterp gd_alter_linterp
-#  define dirfile_alter_multiply gd_alter_multiply
-#  define dirfile_alter_phase gd_alter_phase
-#  define dirfile_alter_polynom gd_alter_polynom
-#  define dirfile_alter_raw gd_alter_raw
-#  define dirfile_alter_sbit gd_alter_sbit
-#  define dirfile_alter_spec gd_alter_spec
-#  define dirfile_cbopen gd_cbopen
-#  define dirfile_close gd_close
-#  define get_constant gd_get_constant
-#  define put_constant gd_put_constant
-#  define get_constants gd_constants
-#  define getdata gd_getdata
-#  define putdata gd_putdata
-#  define getdata64 gd_getdata64
-#  define putdata64 gd_putdata64
-#  define dirfile_delete gd_delete
-#  define dirfile_discard gd_discard
-#  define get_encoding gd_encoding
-#  define get_endianness gd_endianness
-#  define get_entry gd_entry
-#  define get_entry_type gd_entry_type
-#  define get_error gd_error
-#  define get_error_string gd_error_string
-#  define get_field_list gd_field_list
-#  define get_field_list_by_type gd_field_list_by_type
-#  define dirfile_flush gd_flush
-#  define get_fragment_index gd_fragment_index
-#  define get_fragmentname gd_fragmentname
-#  define get_framenum_subset gd_framenum_subset
-#  define get_framenum_subset64 gd_framenum_subset64
-#  define get_frameoffset gd_frameoffset
-#  define get_frameoffset64 gd_frameoffset64
-#  define dirfile_free_entry_strings gd_free_entry_strings
-#  define dirfile_include gd_include
-#  define dirfile_madd gd_madd
-#  define dirfile_madd_bit gd_madd_bit
-#  define dirfile_madd_clincom gd_madd_clincom
-#  define dirfile_madd_const gd_madd_const
-#  define dirfile_madd_cpolynom gd_madd_cpolynom
-#  define dirfile_madd_lincom gd_madd_lincom
-#  define dirfile_madd_linterp gd_madd_linterp
-#  define dirfile_madd_multiply gd_madd_multiply
-#  define dirfile_madd_phase gd_madd_phase
-#  define dirfile_madd_polynom gd_madd_polynom
-#  define dirfile_madd_sbit gd_madd_sbit
-#  define dirfile_madd_spec gd_madd_spec
-#  define dirfile_madd_string gd_madd_string
-#  define dirfile_malter_spec gd_malter_spec
-#  define get_mconstants gd_mconstants
-#  define dirfile_metaflush gd_metaflush
-#  define get_mfield_list gd_mfield_list
-#  define get_mfield_list_by_type gd_mfield_list_by_type
-#  define dirfile_move gd_move
-#  define get_mstrings gd_mstrings
-#  define get_mvector_list gd_mvector_list
-#  define dirfilename gd_dirfilename
-#  define get_native_type gd_native_type
-#  define get_nfields gd_nfields
-#  define get_nfields_by_type gd_nfields_by_type
-#  define get_nfragments gd_nfragments
-#  define get_nframes gd_nframes
-#  define get_nframes64 gd_nframes64
-#  define get_nmfields gd_nmfields
-#  define get_nmfields_by_type gd_nmfields_by_type
-#  define get_nmvectors gd_nmvectors
-#  define get_nvectors gd_nvectors
-#  define dirfile_open gd_open
-#  define get_parent_fragment gd_parent_fragment
-#  define dirfile_parser_callback gd_parser_callback
-#  define dirfile_protect gd_alter_protection
-#  define get_protection gd_protection
-#  define get_raw_filename gd_raw_filename
-#  define dirfile_reference gd_reference
-#  define get_reference(D) gd_reference(D,NULL)
-#  define dirfile_rename gd_rename
-#  define get_spf gd_spf
-#  define dirfile_standards gd_dirfile_standards
-#  define get_string gd_get_string
-#  define put_string gd_put_string
-#  define get_strings gd_strings
-#  define dirfile_uninclude gd_uninclude
-#  define dirfile_validate gd_validate
-#  define get_vector_list gd_vector_list
-#endif
+/* If this symbol is defined here, the library lacks POSIX regex support */
+ at DEFINE_GD_NO_REGEX@
+
+/* If this symbol is defined here, the library lacks PCRE regex support */
+ at DEFINE_GD_NO_PCRE@
 
 #endif
diff --git a/src/globals.c b/src/globals.c
index ff00378..b4c328c 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2012, 2014 D. V. Wiebe
+/* Copyright (C) 2008-2012, 2014, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -28,13 +28,7 @@ const char *gd_dirfilename(DIRFILE* D) gd_nothrow
 {
   dtrace("%p", D);
 
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
   dreturn("\"%s\"", D->dir[0].path);
   return D->dir[0].path;
@@ -47,13 +41,7 @@ const char *gd_reference(DIRFILE* D, const char* field_code) gd_nothrow
 
   dtrace("%p, \"%s\"", D, field_code);
 
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
   
   /* if no field specified, return only the field name */
   if (field_code == NULL) {
@@ -74,10 +62,9 @@ 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, 1, NULL);
+  E = _GD_FindEntry(D, field_code);
 
   if (E == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -142,10 +129,8 @@ int gd_verbose_prefix(DIRFILE *D, const char *prefix) gd_nothrow
 
   if (prefix) {
     ptr = _GD_Strdup(D, prefix);
-    if (D->error) {
-      dreturn("%i", -1);
-      return -1;
-    }
+    if (D->error) 
+      GD_RETURN_ERROR(D);
   }
 
   free(D->error_prefix);
@@ -165,3 +150,43 @@ void gd_mplex_lookback(DIRFILE *D, int lookback) gd_nothrow
 
   dreturnvoid();
 }
+
+/* Used only when _GD_CMalloc isn't malloc(3), and always via _GD_CStrdup */
+static __attribute_malloc__ char *_GD_CallerStrdup(const char *str)
+{
+  char *ptr;
+  size_t len;
+  dtrace("%s", str);
+
+  len = strlen(str) + 1;
+  ptr = _GD_CMalloc(len);
+  if (ptr)
+    memcpy(ptr, str, len);
+
+  dreturn("%p", ptr);
+  return ptr;
+}
+
+void gd_alloc_funcs(void *(*malloc_func)(size_t),
+    void (*free_func)(void*)) gd_nothrow
+{
+  dtrace("%p, %p", malloc_func, free_func);
+
+  if (malloc_func == NULL)
+    _GD_CMalloc = malloc;
+  else
+    _GD_CMalloc = malloc_func;
+
+  if (free_func == NULL)
+    _GD_CFree = free;
+  else
+    _GD_CFree = free_func;
+
+  /* Divert strdup if necessary */
+  if (_GD_CMalloc == malloc)
+    _GD_CStrdup = strdup;
+  else
+    _GD_CStrdup = _GD_CallerStrdup;
+
+  dreturnvoid();
+}
diff --git a/src/gzip.c b/src/gzip.c
index 1388796..f5e45df 100644
--- a/src/gzip.c
+++ b/src/gzip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -65,6 +65,7 @@ int _GD_GzipOpen(int fd, struct gd_raw_file_* file,
 
   if (file->edata == NULL) {
     close(file->idata);
+    errno = ENOMEM;
     file->idata = -1;
     dreturn("%i", 1);
     return 1;
@@ -76,38 +77,36 @@ int _GD_GzipOpen(int fd, struct gd_raw_file_* file,
   return 0;
 }
 
-off64_t _GD_GzipSeek(struct gd_raw_file_* file, off64_t count,
+off64_t _GD_GzipSeek(struct gd_raw_file_* file, off64_t offset,
     gd_type_t data_type, unsigned int mode)
 {
   off64_t n = 0;
 
-  dtrace("%p, %" PRId64 ", 0x%X, 0x%X", file, (int64_t)count, data_type, mode);
+  dtrace("%p, %" PRId64 ", 0x%X, 0x%X", file, (int64_t)offset, data_type, mode);
 
-  if (file->pos == count) {
-    dreturn("%" PRId64, (int64_t)count);
-    return count;
+  if (file->pos == offset) {
+    dreturn("%" PRId64, (int64_t)offset);
+    return offset;
   }
 
-  count *= GD_SIZE(data_type);
+  offset *= GD_SIZE(data_type);
 
-  if (count >= 0) {
-    n = gd_gzseek((gzFile)file[(mode == GD_FILE_WRITE) ? 1 : 0].edata, count,
-        SEEK_SET);
+  n = gd_gzseek((gzFile)file->edata, offset, SEEK_SET);
 
-    if (n == -1) {
-      /* gzseek returns error on attempts to seek past the EOF in read mode */
-      if (mode != GD_FILE_WRITE && gzeof((gzFile)file[0].edata))
-        n = gd_gztell((gzFile)file[0].edata);
-      else {
-        dreturn("%i", -1);
-        return -1;
-      }
+  if (n == -1) {
+    /* some implementations of gzseek return error on attempts to seek past the
+     * EOF in read mode, and set the position to the EOF. */
+    if (mode != GD_FILE_WRITE && gzeof((gzFile)file->edata))
+      n = gd_gztell((gzFile)file->edata);
+    else {
+      dreturn("%i", -1);
+      return -1;
     }
-
-    n /= GD_SIZE(data_type);
-    file->pos = n;
   }
 
+  n /= GD_SIZE(data_type);
+  file->pos = n;
+
   dreturn("%" PRId64, (int64_t)n);
   return n;
 }
@@ -149,7 +148,7 @@ ssize_t _GD_GzipWrite(struct gd_raw_file_ *file, const void *ptr,
     n /= GD_SIZE(data_type);
     file->pos += n;
   } else {
-    gzerror((gzFile)file[1].edata, &errnum);
+    gzerror((gzFile)file->edata, &errnum);
     if (errnum < 0)
       n = -1;
   }
@@ -220,13 +219,14 @@ int _GD_GzipStrerr(const struct gd_raw_file_ *file, char *buf, size_t buflen)
 {
   int r = 0;
   int gzerrnum = 0;
-  const char *gzerr;
+  const char *gzerr = NULL;
 
   dtrace("%p, %p, %" PRIuSIZE, file, buf, buflen);
 
-  gzerr = gzerror((gzFile)file->edata, &gzerrnum);
+  if (file->edata)
+    gzerr = gzerror((gzFile)file->edata, &gzerrnum);
 
-  if (gzerrnum == Z_ERRNO)
+  if (gzerrnum == Z_ERRNO || gzerr == NULL)
     r = gd_StrError(errno, buf, buflen);
   else {
     strncpy(buf, gzerr, buflen);
diff --git a/src/include.c b/src/include.c
index ec3c763..f0d16df 100644
--- a/src/include.c
+++ b/src/include.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,63 +21,158 @@
 #include "internal.h"
 
 /* Create new affixes given the current affixes and the new parts indicated
- * on a /INCLUDE line.  Also, change the root namespace, if necessary.  The
- * caller is responsible for freeing strings on error */
+ * on a /INCLUDE line.  If there's a new namespace, clear the parser's current
+ * namespace.  The caller is responsible for zeroing all the output parameters
+ * before the call.
+ *
+ * Returns 1 on error.  In this case, the caller is responsible for free'ing
+ * all the returned buffers.
+ *
+ * If a new rootspace is created, *newns is set to 1 (to let the caller know it
+ * needs to zero p->ns). */
 static int _GD_SetFieldAffixes(DIRFILE *D, const struct parser_state *p, int me,
-    const char *prefix_in, const char *suffix_in, char **prefix, char **suffix)
+    const char *pxin, const char *sxin, char **ns, size_t *nsl, char **px,
+    size_t *pxl, char **sx, size_t *sxl, int *newns)
 {
-  dtrace("%p, %p, %i, \"%s\", \"%s\", %p, %p", D, p, me, prefix_in, suffix_in,
-      prefix, suffix);
+  dtrace("%p, %p, %i, \"%s\", \"%s\", %p, %p, %p, %p, %p, %p, %p", D, p, me,
+      pxin, sxin, ns, nsl, px, pxl, sx, sxl, newns);
 
   /* suffix first, for some reason */
-  if (suffix_in && suffix_in[0] != '\0') {
-    if (_GD_ValidateField(suffix_in, p->standards, p->pedantic, GD_VF_AFFIX,
-          NULL))
-    {
+  if (sxin && sxin[0] != '\0') {
+    if (_GD_ValidateField(sxin, 0, p->standards, p->pedantic, GD_VF_AFFIX)) {
       _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, p->file, p->line,
-          suffix_in);
+          sxin);
       dreturn("%i", 1);
       return 1;
     }
 
-    if (D->fragment[me].suffix == NULL)
-      *suffix = _GD_Strdup(D, suffix_in);
-    else {
-      *suffix = _GD_Malloc(D, strlen(D->fragment[me].suffix) + strlen(suffix_in)
-          + 1);
-      if (*suffix)
-        sprintf(*suffix, "%s%s", suffix_in, D->fragment[me].suffix);
+    if (D->fragment[me].sx == NULL) {
+      *sxl = strlen(sxin);
+      *sx = _GD_Malloc(D, *sxl + 1);
+      if (*sx)
+        memcpy(*sx, sxin, *sxl + 1); /* includes terminating NUL */
+    } else {
+      size_t sxinl = strlen(sxin);
+      *sxl = D->fragment[me].sxl + sxinl + 1;
+      *sx = _GD_Malloc(D, *sxl);
+      if (*sx) {
+        memcpy(*sx, sxin, sxinl);
+        memcpy(*sx + sxinl, D->fragment[me].sx, D->fragment[me].sxl + 1);
+      }
     }
-  } else if (D->fragment[me].suffix)
-    *suffix = _GD_Strdup(D, D->fragment[me].suffix);
+  } else if (D->fragment[me].sx) {
+    *sxl = D->fragment[me].sxl;
+    *sx = _GD_Malloc(D, *sxl + 1);
+    if (*sx)
+      memcpy(*sx, D->fragment[me].sx, *sxl + 1); /* includes terminating NUL */
+  }
 
   if (D->error) {
     dreturn("%i", 1);
     return 1;
   }
 
-  /* now the prefix */
-  if (prefix_in && prefix_in[0] != '\0') {
-    if (_GD_ValidateField(prefix_in, p->standards, p->pedantic, GD_VF_AFFIX,
-          NULL))
-    {
+  /* now the namespace */
+  if (GD_PVERS_GE(*p, 10)) {
+    const char *nsin = NULL;
+    size_t nsinl;
+
+    if (pxin && pxin[0] != '\0') {
+      /* try to find a namespace */
+      for (nsinl = strlen(pxin); nsinl > 0; --nsinl)
+        if (pxin[nsinl - 1] == '.')
+          break;
+
+      if (nsinl > 0) { /* found a namespace */
+        /* ignore a leading dot: ns is always relative to root */
+        if (pxin[0] == '.') {
+          pxin++;
+          nsinl--;
+        }
+        nsin = pxin;
+        pxin += nsinl;
+        if (nsinl)
+          nsinl--; /* drop the '.' we found */
+      }
+    }
+
+    if (nsin == NULL && p->ns) {
+      /* If there's a current namespace but no namespace specified in the
+       * /INCLUDE directive, then the current namespace becomes the new
+       * rootspace */
+      nsin = p->ns;
+      nsinl = p->nsl;
+    }
+
+    if (nsin) {
+      /* Signal caller to push and reset the parer's current namespace */
+      *newns = 1;
+
+      if (_GD_ValidateField(nsin, 0, p->standards, p->pedantic, GD_VF_NS)) {
+        _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, p->file, p->line,
+            *ns);
+        dreturn("%i", 1);
+        return 1;
+      }
+
+      if (D->fragment[me].ns == NULL) {
+        *nsl = nsinl;
+        *ns = _GD_Malloc(D, nsinl + 1);
+        if (*ns) {
+          memcpy(*ns, nsin, nsinl);
+          (*ns)[nsinl] = 0; /* nsin isn't necessarily terminated */
+        }
+      } else {
+        *nsl = D->fragment[me].nsl + nsinl;
+        if (nsinl)
+          (*nsl)++; /* for the intervening '.' */
+
+        *ns = _GD_Malloc(D, *nsl + 1);
+        if (*ns) {
+          memcpy(*ns, D->fragment[me].ns, D->fragment[me].nsl);
+          if (nsinl) {
+            (*ns)[D->fragment[me].nsl] = '.';
+            memcpy(*ns + D->fragment[me].nsl + 1, nsin, nsinl);
+          }
+          (*ns)[*nsl] = 0;
+        }
+      }
+    } else if (D->fragment[me].ns) {
+      *nsl = D->fragment[me].nsl;
+      *ns = _GD_Malloc(D, *nsl + 1);
+      if (*ns)
+        memcpy(*ns, D->fragment[me].ns, *nsl + 1);
+    }
+  }
+
+  /* Now the prefix */
+  if (pxin && pxin[0] != '\0') {
+    if (_GD_ValidateField(pxin, 0, p->standards, p->pedantic, GD_VF_AFFIX)) {
       _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, p->file, p->line,
-          prefix_in);
+          pxin);
       dreturn("%i", 1);
       return 1;
     }
 
-    if (D->fragment[me].prefix == NULL)
-      *prefix = _GD_Strdup(D, prefix_in);
-    else {
-      *prefix = _GD_Malloc(D, strlen(D->fragment[me].prefix) + strlen(prefix_in)
-          + 1);
-      if (*prefix)
-        sprintf(*prefix, "%s%s", D->fragment[me].prefix, prefix_in);
+    if (D->fragment[me].px == NULL) {
+      *pxl = strlen(pxin);
+      *px = _GD_Malloc(D, *pxl + 1);
+      if (*px)
+        memcpy(*px, pxin, *pxl + 1); /* includes terminating NUL */
+    } else {
+      size_t pxinl = strlen(pxin);
+      *pxl = D->fragment[me].pxl + pxinl + 1;
+      *px = _GD_Malloc(D, *pxl);
+      if (*px) {
+        memcpy(*px, D->fragment[me].px, D->fragment[me].pxl);
+        memcpy(*px + D->fragment[me].pxl, pxin, pxinl + 1); /* incl. NUL */
+      }
     }
-  } else {
-    if (D->fragment[me].prefix)
-      *prefix = _GD_Strdup(D, D->fragment[me].prefix);
+  } else if (D->fragment[me].px) {
+    *pxl = D->fragment[me].pxl;
+    *px = _GD_Malloc(D, *pxl + 1);
+    if (*px)
+      memcpy(*px, D->fragment[me].px, *pxl + 1); /* includes terminating NUL */
   }
 
   if (D->error) {
@@ -85,30 +180,31 @@ static int _GD_SetFieldAffixes(DIRFILE *D, const struct parser_state *p, int me,
     return 1;
   }
 
-  dreturn("%i (\"%s\", \"%s\")", 0, *prefix, *suffix);
+  dreturn("%i (\"%s\"/%" PRIuSIZE ", \"%s\"/%" PRIuSIZE ", \"%s\"/%" PRIuSIZE 
+      ", %i)", 0, *ns, *nsl, *px, *pxl, *sx, *sxl, *newns);
   return 0;
 }
 
 /* Include a format file fragment -- returns the new fragment index, or
  * -1 on error */
 int _GD_Include(DIRFILE *D, struct parser_state *p, const char *ename,
-    char **ref_name, int parent, const char *prefix_in, const char *suffix_in,
+    char **ref_name, int parent, const char *pxin, const char *sxin,
     int immediate)
 {
-  int i;
+  int i, newns = 0;
   int me = D->n_fragment;
   struct parser_state oldp = *p;
-  int dirfd = -1, pop_ns = 0, free_ns = 1;
+  int dirfd = -1, pop_ns = 0;
   char *temp_buf1 = NULL, *temp_buf2, *sname = NULL;
-  char *base = NULL, *prefix = NULL, *suffix = NULL, *ns = NULL;
-  size_t nsl = 0;
+  char *base = NULL, *px = NULL, *sx = NULL, *ns = NULL;
+  size_t pxl = 0, sxl = 0, nsl = 0;
   void *ptr = NULL;
   FILE* new_fp = NULL;
   time_t mtime = 0;
   struct stat statbuf;
 
   dtrace("%p, %p, \"%s\", %p, %i, \"%s\", \"%s\", %i", D, p, ename, ref_name,
-      parent, prefix_in, suffix_in, immediate);
+      parent, pxin, sxin, immediate);
 
   if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
     _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_INCLUDE, p->file, p->line,
@@ -116,30 +212,20 @@ int _GD_Include(DIRFILE *D, struct parser_state *p, const char *ename,
     goto include_error;
   }
 
-  if (_GD_SetFieldAffixes(D, p, parent, prefix_in, suffix_in, &prefix, &suffix))
+  if (_GD_SetFieldAffixes(D, p, parent, pxin, sxin, &ns, &nsl, &px, &pxl, &sx,
+        &sxl, &newns))
   {
     goto include_error;
   }
 
-  if (ns) {
-    /* namespace change, remember old one so we can pop at the end */
+  /* when the rootspace changes, the current namespace gets reset to "", since
+   * it's relative to rootspace.  But, remember old current namespace so we can
+   * pop at the end
+   */
+  if (newns) {
     pop_ns = 1;
-    if (ns[0] == '\0') {
-      /* revert to NULLspace */
-      free(ns);
-      ns = p->ns = NULL;
-    } else {
-      /* new namespace */
-      p->ns = _GD_Strdup(D, ns);
-      if (p->ns == NULL)
-        goto include_error;
-      p->nsl = nsl;
-    }
-  } else {
-    /* no namespace change; inherit from parent */
-    free_ns = 0;
-    ns = D->fragment[parent].ns;
-    nsl = D->fragment[parent].nsl;
+    p->ns = NULL; /* Don't free: we'll need it back when we pop */
+    p->nsl = 0;
   }
 
   /* isolate filename */
@@ -247,8 +333,10 @@ int _GD_Include(DIRFILE *D, struct parser_state *p, const char *ename,
   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].px = px;
+  D->fragment[me].pxl = px ? strlen(px) : 0;
+  D->fragment[me].sx = sx;
+  D->fragment[me].sxl = sx ? strlen(sx) : 0;
   D->fragment[me].ns = ns;
   D->fragment[me].nsl = nsl;
   D->fragment[me].mtime = mtime;
@@ -276,7 +364,7 @@ int _GD_Include(DIRFILE *D, struct parser_state *p, const char *ename,
   /* catch alloc errors */
   if (D->error) {
     D->n_fragment--;
-    temp_buf1 = prefix = suffix = base = NULL;
+    temp_buf1 = px = sx = base = NULL;
     fclose(new_fp);
     _GD_ReleaseDir(D, dirfd);
     goto include_error;
@@ -312,10 +400,9 @@ int _GD_Include(DIRFILE *D, struct parser_state *p, const char *ename,
   return me;
 
 include_error:
-  if (free_ns)
-    free(ns);
-  free(prefix);
-  free(suffix);
+  free(ns);
+  free(px);
+  free(sx);
   free(base);
   free(sname);
   free(temp_buf1);
@@ -324,48 +411,32 @@ include_error:
   return -1;
 }
 
-int gd_include_affix(DIRFILE* D, const char* file, int fragment_index,
-    const char *prefix, const char *suffix, unsigned long flags)
+static int _GD_IncludeAffix(DIRFILE* D, const char *funcname, const char* file,
+    int fragment_index, const char *px, const char *sx, unsigned long flags)
 {
   char* ref_name = NULL;
   int i, new_fragment;
+  /* Remember the last fragment, in case we have to undo everything */
+  int old_nfrag = D->n_fragment;
 
   struct parser_state p = {
-    "gd_include_affix()", 0, GD_DIRFILE_STANDARDS_VERSION, flags & GD_PEDANTIC,
+    funcname, 0, GD_DIRFILE_STANDARDS_VERSION, flags & GD_PEDANTIC,
     NULL, 0, flags
   };
 
-  dtrace("%p, \"%s\", %i, \"%s\", \"%s\", 0x%lX", D, file, fragment_index,
-      prefix, suffix, flags);
-
-  _GD_ClearError(D);
-
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-  /* 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;
-  }
+  dtrace("%p, \"%s\", \"%s\", %i, \"%s\", \"%s\", 0x%lX", D, funcname, file,
+      fragment_index, px, sx, flags); 
 
-  /* check for include index out of range */
-  if (fragment_index < 0 || fragment_index >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  /* Early checks */
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  /* check protection */
-  if (D->fragment[fragment_index].protection & GD_PROTECT_FORMAT) {
-    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+  if ((D->flags & GD_ACCMODE) == GD_RDONLY) 
+    GD_SET_RETURN_ERROR(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+  else if (fragment_index < 0 || fragment_index >= D->n_fragment) 
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
+  else if (D->fragment[fragment_index].protection & GD_PROTECT_FORMAT)
+    GD_SET_RETURN_ERROR(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
         D->fragment[fragment_index].cname);
-    dreturn("%i", -1);
-    return -1;
-  }
 
   if (~D->flags & GD_HAVE_VERSION)
     _GD_FindVersion(D);
@@ -379,14 +450,92 @@ int gd_include_affix(DIRFILE* D, const char* file, int fragment_index,
   if ((p.flags & (GD_ENCODING | GD_CREAT)) == GD_CREAT)
     p.flags |= D->fragment[fragment_index].encoding;
 
-  new_fragment = _GD_Include(D, &p, file, &ref_name, fragment_index, prefix,
-      suffix, 1);
+  /* Perform the include */
+  new_fragment = _GD_Include(D, &p, file, &ref_name, fragment_index, px, sx, 1);
+
+  /* Honour the reference directive, if not prohibited by the caller */
+  if (!D->error && ref_name != NULL && ~flags & GD_IGNORE_REFS) {
+    gd_entry_t *E = _GD_FindField(D, ref_name, strlen(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.
+     */
+
+    if (E == NULL)
+      _GD_SetError(D, GD_E_BAD_REFERENCE, GD_E_REFERENCE_CODE, NULL, 0,
+          ref_name);
+    else if (E->field_type != GD_RAW_ENTRY)
+      _GD_SetError(D, GD_E_BAD_REFERENCE, GD_E_REFERENCE_TYPE, NULL, 0,
+          ref_name);
+    else
+      D->reference_field = E;
+  }
+  free(ref_name);
+
+  /* If there was an error, we now have to:
+   *
+   * - delete all the entries that were added
+   * - delete all the fragemnts that were added
+   *
+   * This is the same thing that gd_uninclude() does, but it's easier here
+   * because we know none of the fields we delete are open, have been reference
+   * by the old fields, and all the fragment numbers are contiguous. */
+  if (D->error) {
+    unsigned int i, first = 0;
+    unsigned int next = 0;
+    int found_good = 0;
+
+    /* First delete all the new fields */
+    for (i = 0; i < D->n_entries; ++i) {
+      if (D->entry[i]->fragment_index >= old_nfrag) {
+        /* found an entry to delete */
+        _GD_FreeE(D, D->entry[i], 1);
+
+        if (found_good) { /* The last entry was good */
+          /* There is a run of entries spanning [first,i-1] that need to be
+           * moved to [next,next+i-first] */
+          memmove(D->entry + next, D->entry + first,
+              sizeof(D->entry[0]) * (i - first));
+
+          /* advance next to here */
+          next += i - first;
+
+          /* and change modes */
+          found_good = 0;
+        }
+      } else {
+        /* found a good entry */
+
+        if (!found_good) { /* The last entry was bad */
+          first = i; /* This is the start of the next good run */
+          found_good = 1; /* Change modes */
+        }
+      }
+    }
+
+    /* Handle the last bunch of good entries, if necessary */
+    if (found_good) {
+      memmove(D->entry + next, D->entry + first,
+          sizeof(D->entry[0]) * (i - first));
+      next += i - first;
+    }
+    
+    D->n_entries = next; /* Done.  Reset entry count. */
+
+    /* Now delete all the new fragments.  This is easier because we don't
+     * have to search for them.
+     */
+    _GD_FreeF(D, old_nfrag, D->n_fragment);
+    D->n_fragment = old_nfrag;
 
-  if (!D->error) {
-    D->fragment[fragment_index].modified = 1;
-    D->flags &= ~GD_HAVE_VERSION;
+    GD_RETURN_ERROR(D);
   }
 
+  /* Successful include.  Mark the parent as dirty */
+  D->fragment[fragment_index].modified = 1;
+  D->flags &= ~GD_HAVE_VERSION;
+
   /* If ref_name is non-NULL, the included fragment contained a REFERENCE
    * directive.  If ref_name is NULL but D->fragment[new_fragment].ref_name is
    * non-NULL, no REFERENCE directive was present, but the parser found a RAW
@@ -402,24 +551,20 @@ int gd_include_affix(DIRFILE* D, const char* file, int fragment_index,
         break;
     }
 
-  /* 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, 1, NULL);
+  dreturn("%i", new_fragment);
+  return new_fragment;
+}
 
-    /* FIXME: These errors are problematic, since they'll cause the call to
-     * fail, even though the new fragment has been integrated into the DIRFILE.
-     */
+int gd_include_affix(DIRFILE* D, const char* file, int fragment_index,
+    const char *prefix, const char *suffix, unsigned long flags)
+{
+  int new_fragment;
 
-    if (E == NULL)
-      _GD_SetError(D, GD_E_BAD_REFERENCE, GD_E_REFERENCE_CODE, NULL, 0,
-          ref_name);
-    else if (E->field_type != GD_RAW_ENTRY)
-      _GD_SetError(D, GD_E_BAD_REFERENCE, GD_E_REFERENCE_TYPE, NULL, 0,
-          ref_name);
-    else
-      D->reference_field = E;
-  }
-  free(ref_name);
+  dtrace("%p, \"%s\", %i, \"%s\", \"%s\", 0x%lX", D, file, fragment_index,
+      prefix, suffix, flags);
+
+  new_fragment = _GD_IncludeAffix(D, "gd_include_affix()", file, fragment_index,
+      prefix, suffix, flags);
 
   dreturn("%i", new_fragment);
   return new_fragment;
@@ -432,40 +577,39 @@ int gd_include(DIRFILE* D, const char* file, int fragment_index,
 
   dtrace("%p, \"%s\", %i, 0x%lX", D, file, fragment_index, flags);
 
-  new_fragment = gd_include_affix(D, file, fragment_index, NULL, NULL, flags);
+  new_fragment = _GD_IncludeAffix(D, "gd_include()", 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 gd_include_ns(DIRFILE *D, const char *file, int fragment_index,
+    const char *nsin, unsigned long flags)
 {
-  int i;
-  int *new_f;
+  int new_fragment;
+  size_t len = 0;
+  char *ns = NULL;
 
-  dtrace("%p, %p, %i, %i", D, f, fragment, nf);
+  dtrace("%p, \"%s\", %i, \"%s\", 0x%lX", D, file, fragment_index, nsin, flags);
 
-  new_f = _GD_Realloc(D, *f, sizeof(*new_f) * ++nf);
-  if (new_f == NULL) {
-    dreturn("%i", -1);
-    return -1;
-  }
-  new_f[nf - 1] = fragment;
+  if (nsin) {
+    ns = _GD_NormaliseNamespace(D, nsin, &len);
+    if (ns == NULL)
+      GD_RETURN_ERROR(D);
+  } 
 
-  for (i = 0; i < D->n_fragment; ++i)
-    if (D->fragment[i].parent == fragment) {
-      nf = _GD_CollectFragments(D, &new_f, i, nf);
-      if (nf == -1)
-        break;
-    }
+  new_fragment = _GD_IncludeAffix(D, "gd_include_ns()", file, fragment_index,
+      ns, NULL, flags);
 
-  *f = new_f;
+  if (ns)
+    free(ns);
 
-  dreturn("%i", nf);
-  return nf;
+  dreturn("%i", new_fragment);
+  return new_fragment;
 }
 
-static int _GD_ContainsFragment(int* f, int nf, int fragment)
+int _GD_ContainsFragment(const int* f, int nf, int fragment)
 {
   int i;
 
@@ -489,42 +633,25 @@ int gd_uninclude(DIRFILE* D, int fragment_index, int del)
 
   dtrace("%p, %i, %i", D, fragment_index, del);
 
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  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_RDONLY) {
-    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (fragment_index <= 0 || fragment_index >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if ((D->flags & GD_ACCMODE) == GD_RDONLY) 
+    GD_SET_RETURN_ERROR(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+  if (fragment_index <= 0 || fragment_index >= D->n_fragment)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
 
   parent = D->fragment[fragment_index].parent;
 
-  if (D->fragment[parent].protection & GD_PROTECT_FORMAT) {
-    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+  if (D->fragment[parent].protection & GD_PROTECT_FORMAT)
+    GD_SET_RETURN_ERROR(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
         D->fragment[parent].cname);
-    dreturn("%i", -1);
-    return -1;
-  }
 
   /* find all affected fragments */
-  nf = _GD_CollectFragments(D, &f, fragment_index, 0);
+  nf = _GD_SubFragmentList(D, fragment_index, &f);
 
   if (D->error) {
     free(f);
-    dreturn("%i", -1);
-    return -1;
+    GD_RETURN_ERROR(D);
   }
 
   /* close affected raw fields */
@@ -542,8 +669,7 @@ int gd_uninclude(DIRFILE* D, int fragment_index, int del)
 
   if (D->error) {
     free(f);
-    dreturn("%i", -1);
-    return -1;
+    GD_RETURN_ERROR(D);
   }
 
   /* Nothing from now on may fail */
@@ -571,11 +697,7 @@ 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]].ename);
-    free(D->fragment[f[j]].bname);
-    free(D->fragment[f[j]].ref_name);
+    _GD_FreeF(D, f[j], f[j] + 1);
 
     memcpy(D->fragment + f[j], D->fragment + D->n_fragment - 1,
         sizeof(struct gd_fragment_t));
@@ -588,7 +710,6 @@ int gd_uninclude(DIRFILE* D, int fragment_index, int del)
   }
 
   /* Clear the cache of all fields */
-  /* FIXME: Should probably just clear affected fields */
   for (i = 0; i < D->n_entries; ++i) {
     D->entry[i]->flags &= ~GD_EN_CALC;
     for (j = 0; j < GD_MAX_LINCOM; ++j)
diff --git a/src/index.c b/src/index.c
index a5f8a64..bf71c94 100644
--- a/src/index.c
+++ b/src/index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2013, 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -204,28 +204,20 @@ static double _GD_GetIndex(DIRFILE* D, gd_entry_t *E, int repr, double value,
   return sample;
 }
 
-double gd_framenum_subset64(DIRFILE* D, const char* field_code_in,
-    double value, off64_t field_start, off64_t field_end)
+double gd_framenum_subset64(DIRFILE* D, const char* field_code, double value,
+    off64_t field_start, off64_t field_end)
 {
   double frame = NAN;
   gd_entry_t* entry;
-  char* field_code;
   int repr = GD_REPR_NONE;
   unsigned int spf;
 
-  dtrace("%p, \"%s\", %g, %" PRId64 ", %" PRId64, D, field_code_in, value,
+  dtrace("%p, \"%s\", %g, %" PRId64 ", %" PRId64, D, field_code, value,
       (int64_t)field_start, (int64_t)field_end);
 
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%.15g", frame);
-    return frame;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_IF_INVALID(D, "%.15g", frame);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
-      1);
+  entry = _GD_FindFieldAndRepr(D, field_code, &repr, NULL, 1);
 
   if (D->error) {
     dreturn("%.15g", frame);
@@ -237,9 +229,6 @@ double gd_framenum_subset64(DIRFILE* D, const char* field_code_in,
   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);
-
   if (D->error) {
     dreturn("%.15g", frame);
     return frame;
diff --git a/src/internal.h b/src/internal.h
index 1754eb2..8c0c605 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2015 D. V. Wiebe
+ * Copyright (C) 2005-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -48,6 +48,9 @@
 #endif
 
 /* library headers */
+#ifdef HAVE_FEATURES_H
+#include <features.h>
+#endif
 #ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>
 #endif
@@ -106,16 +109,19 @@
 #ifdef HAVE_IO_H
 #include <io.h>
 #endif
-
-#ifndef SIZEOF_SIZE_T
-#define SIZEOF_SIZE_T (sizeof size_t)
+#ifdef HAVE_REGEX_H
+#include <regex.h>
 #endif
 
+
 /* MSCVRT defines size_t but not ssize_t */
 #ifdef __MSVCRT__
-#if SIZEOF_SIZE_T == 8
+#undef SIZEOF_SIZE_T
+#ifdef _WIN64
+#define SIZEOF_SIZE_T 8
 typedef __int64 ssize_t;
 #else
+#define SIZEOF_SIZE_T 4
 typedef int ssize_t;
 #endif
 #endif
@@ -159,7 +165,7 @@ typedef gd_off64_t off64_t;
 /* the open() in the MSVCRT doesn't permit open()ing directories */
 #ifdef __MSVCRT__
 #define GD_NO_DIR_OPEN
-/* rename open() flags */
+/* rename open() 0 */
 #define O_RDWR _O_RDWR
 #define O_RDONLY _O_RDONLY
 #define O_CREAT _O_CREAT
@@ -313,6 +319,10 @@ double cimag(double complex z);
 #define GD_UINT_TYPE ((gd_type_t)(SIZEOF_UNSIGNED_INT))
 
 /* a few integer limits */
+#ifndef SIZEOF_SIZE_T
+#define SIZEOF_SIZE_T (sizeof(size_t))
+#endif
+
 #define GD_INT64_MAX ((int64_t)((uint64_t)-1>>1))
 #define GD_SSIZE_T_MAX ((ssize_t)((size_t)-1>>1))
 #define GD_SIZE_T_MAX ((size_t)-1)
@@ -415,6 +425,9 @@ extern "C" {
 }
 #endif
 
+#ifdef WIN32
+#define __func__ __FUNCTION__
+#endif
 
 #define dtracevoid() printf("%s %s()\n", gd_coladd(), __func__)
 #define dtrace(fmt, ...) printf("%s %s(" fmt ")\n", gd_coladd(), \
@@ -435,6 +448,34 @@ extern "C" {
 #define dwatch(...)
 #endif
 
+/* These doesn't return */
+#define GD_SET_RETURN_ERROR(D,e,s,f,l,t) do { \
+  _GD_SetError(D,e,s,f,l,t); \
+  dreturn("%i", e); \
+  return e; \
+} while(0)
+
+#define GD_RETURN_ERROR(D) do { \
+  dreturn("%i", D->error); \
+  return D->error; \
+} while(0)
+
+#define GD_RETURN_ERR_IF_INVALID(D) do { \
+  if (D->flags & GD_INVALID) \
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL); \
+  else \
+    _GD_ClearError(D); \
+} while(0)
+
+#define GD_RETURN_IF_INVALID(D,f,v) do { \
+  if (D->flags & GD_INVALID) { \
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL); \
+    dreturn(f, v); \
+    return v; \
+  } else \
+    _GD_ClearError(D); \
+} while(0)
+
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
@@ -493,6 +534,12 @@ char *basename(char *path);
 #define offsetof(t,m) ((size_t)(((char*)&((t*)0)->m) - (char*)0))
 #endif
 
+/* glibc 2.24 deprecates readdir_r */
+#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 \
+      && defined(__GLIBC_MINOR__) && __GLIBC_MINOR__ >= 24))
+#undef HAVE_READDIR_R
+#endif
+
 #ifdef HAVE_READDIR_R
 # define _GD_ReadDir readdir_r
 #else
@@ -806,6 +853,8 @@ ssize_t getdelim(char**, size_t*, int, FILE*);
 #define GD_E_FIELD_FORMAT      4
 #define GD_E_FIELD_STR         5
 
+#define GD_E_SUPPORT_REGEX     1
+
 #define GD_E_ENTRY_TYPE      1
 #define GD_E_ENTRY_METARAW   2
 #define GD_E_ENTRY_SPF       3
@@ -856,6 +905,8 @@ ssize_t getdelim(char**, size_t*, int, FILE*);
 #define GD_E_ARG_NODATA         4
 #define GD_E_ARG_NO_VERS        5
 #define GD_E_ARG_BAD_VERS       6
+#define GD_E_ARG_REGEX          7
+#define GD_E_ARG_PCRE           8
 
 #define GD_E_LONG_FLUSH         1
 
@@ -873,6 +924,7 @@ ssize_t getdelim(char**, size_t*, int, FILE*);
 #define GD_N_ENTRY_LISTS (GD_N_ENTYPES + 4)
 
 #define GD_LIST_VALID_STRING_VALUE 0x01
+#define GD_LIST_VALID_SARRAY_VALUE 0x02
 
 /* name types for ValidateField */
 #define GD_VF_NAME  0
@@ -880,22 +932,46 @@ ssize_t getdelim(char**, size_t*, int, FILE*);
 #define GD_VF_NS    2
 #define GD_VF_CODE  3
 
-/* MungeCode flags */
-#define GD_MC_RQ_PARTS 0x01
-#define GD_MC_CHECK_NS 0x02
-#define GD_MC_ERROR_OK 0x04
-#define GD_MC_NO_NS    0x08
-#define GD_MC_NO_ALLOC 0x10
+/* CodeOffsets flags (also used by StripCode, SlashDot, CheckCodeAffixes) */
+#define GD_CO_NSALL  0x001
+#define GD_CO_NSROOT 0x002
+#define GD_CO_ASSERT 0x004
+#define GD_CO_CHECK  0x008
+#define GD_CO_EARLY  0x010
+#define GD_CO_NAME   0x020
+#define GD_CO_ERROR  0x040
+#define GD_CO_REPR   0x080
+#define GD_CO_REPRZ  0x100
+
+/* Number of offsets returned by CodeOffsets */
+#define GD_N_CODEOFFSETS 10
+
+/* Internal rename flags */
+#define GD_REN_META 0x10 /* Updating a metafield */
 
 /* database metadata update data for a field rename */
+struct gd_rename_update_ {
+  char *new_code; /* The newly minted code */
+  size_t new_len; /* The new code's length */
+  char **dst; /* A pointer to the old code */
+  size_t *dst_len; /* Non-NULL if we need to store new_len here */
+  int index; /* The affected metadata fragment */
+};
+
 struct gd_rename_data_ {
-  int n_meta, n_code, old_dot, new_dot;
-  gd_entype_t type;
-  unsigned flags, dot_ind;
+  gd_entype_t type; /* the type of the renamed field */
+  unsigned flags; /* GD_REN_ flags */
+  struct gd_flist_ *fl; /* The affected field_list struct */
+
+  int src_frag; /* Source fragment */
+  int dst_frag; /* Destination fragment for moves (for renames, this is -1) */
+
+  /* Old and new names */
   size_t old_len, new_len;
+  const char *old_name, *new_name;
 
-  char **meta_name, **code_list, *old_code, *new_code;
-  gd_entry_t *E, **meta_entry;
+  struct gd_rename_update_ *up; /* The list of updates */
+  unsigned n_up, up_size;
 };
 
 /* data file book-keeping record */
@@ -905,7 +981,7 @@ struct gd_raw_file_ {
   void* edata;
   int subenc;
   int error;
-  const DIRFILE *D;
+  DIRFILE *D;
   unsigned int mode;
   off64_t pos;
 };
@@ -921,10 +997,10 @@ struct gd_lut_ {
 
 /* field lists */
 struct gd_flist_ {
-  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;
+  const char ***sarray_value_list;
   void *const_value_list;
   gd_carray_t *carray_value_list;
   uint32_t value_list_validity;
@@ -933,6 +1009,10 @@ struct gd_flist_ {
 
 /* Unified entry struct */
 struct gd_private_entry_ {
+  size_t len; /* strlen(E->field) */
+
+  /* Input entries.  Aliases use entry[0] for the proximal target and
+   * entry[1] for the distal target */
   gd_entry_t* entry[GD_MAX_LINCOM];
   int repr[GD_MAX_LINCOM];
 
@@ -987,6 +1067,9 @@ struct gd_private_entry_ {
 /* the last record of the _GD_ef array is always the unknown encoding */
 #define GD_ENC_UNKNOWN (GD_N_SUBENCODINGS - 1)
 
+/* Internal gd_entry_t flags */
+#define GD_EN_EARLY 0x8000 /* field spec. contains non-namespace-related '.' */
+
 /* external module function provides flags */
 #define GD_EF_NAME    0x0001
 #define GD_EF_OPEN    0x0002
@@ -1083,8 +1166,6 @@ struct gd_fragment_t {
   char* sname; /* Subdirectory name (path relative to dirfile or absolute) */
   char *bname; /* basename (filename) */
   char* ename; /* External name (the one that appears in the format file) */
-  char *ns; /* unused */
-  size_t nsl; /* strlen(ns) */
   void *enc_data;
   int modified;
   int parent;
@@ -1097,8 +1178,12 @@ struct gd_fragment_t {
   off64_t frame_offset;
   uint32_t vers;
 
-  char *prefix;
-  char *suffix;
+  char *ns; /* root namespace */
+  size_t nsl; /* strlen(ns) */
+  char *px; /* prefix */
+  size_t pxl; /* strlen(px) */
+  char *sx; /* suffix */
+  size_t sxl; /* strlen(sx) */
 };
 
 /* directory metadata */
@@ -1153,11 +1238,9 @@ struct gd_dirfile_ {
 
   /* field counts */
   unsigned int n_entries;
-  unsigned int n_dot;
 
   /* field array */
   gd_entry_t** entry;
-  gd_entry_t** dot_list;
 
   /* the reference field */
   gd_entry_t* reference_field;
@@ -1177,6 +1260,7 @@ struct gd_dirfile_ {
   int n_fragment;
 
   /* field lists */
+  const char **regex_list;
   struct gd_flist_ fl;
 
   /* syntax error callback */
@@ -1184,6 +1268,11 @@ struct gd_dirfile_ {
   void* sehandler_extra;
 };
 
+/* The caller's preferred memory manager */
+extern void *(*_GD_CMalloc)(size_t);
+extern char *(*_GD_CStrdup)(const char*);
+extern void (*_GD_CFree)(void*);
+
 /* These are internal functions we need to expose so that modules can use them
  */
 #ifdef USE_MODULES
@@ -1225,7 +1314,6 @@ int _GD_MakeTempFile(const DIRFILE*, int, char*);
 
 /* forward declarations */
 void *_GD_Alloc(DIRFILE*, gd_type_t, size_t) __attribute_malloc__;
-int _GD_BadInput(DIRFILE *, const gd_entry_t *, int, gd_entype_t, int);
 
 #define _GD_BadWindop(op) \
   ( \
@@ -1234,13 +1322,17 @@ int _GD_BadInput(DIRFILE *, const gd_entry_t *, int, gd_entype_t, int);
    (op != GD_WINDOP_SET) && (op != GD_WINDOP_CLR) \
   )
 
+int _GD_BadType(int, gd_type_t);
+char *_GD_BuildCode(DIRFILE*, int, const char*, size_t, const char*, int,
+    size_t *restrict) __attribute_malloc__;
 int _GD_CalculateEntry(DIRFILE *restrict, gd_entry_t *restrict, int);
 char *_GD_CanonicalPath(const char *restrict, const char *restrict);
 int _GD_CheckByteSex(gd_type_t, unsigned, unsigned, int, int *restrict);
-gd_entry_t *_GD_CheckParent(DIRFILE *restrict D,
-    const struct parser_state *restrict, char **restrict name, int me);
-int _GD_CheckCodeAffixes(DIRFILE *D, const char *field_code, int fragment,
-    int set_error);
+gd_entry_t *_GD_CheckParent(DIRFILE *restrict,
+    const struct parser_state *restrict, char **restrict, size_t *restrict,
+    int);
+int _GD_CheckCodeAffixes(DIRFILE *restrict, const char *restrict, int,
+    unsigned);
 void _GD_CInvertData(DIRFILE *restrict, void *restrict, gd_type_t,
     GD_DCOMPLEXA(dividend), size_t);
 void _GD_CleanUpRename(struct gd_rename_data_*, int);
@@ -1251,6 +1343,9 @@ void _GD_CleanUpRename(struct gd_rename_data_*, int);
 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);
+int _GD_CodeOffsets(DIRFILE *restrict, int, const char *restrict, unsigned,
+    size_t offset[GD_N_CODEOFFSETS]);
+int _GD_ContainsFragment(const int *, int, int);
 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);
@@ -1264,9 +1359,10 @@ off64_t _GD_DoSeek(DIRFILE *restrict, gd_entry_t *restrict,
 int _GD_EntryCmp(const void*, const void*);
 gd_entry_t *_GD_FindEntry(DIRFILE *restrict, const char *restrict);
 gd_entry_t *_GD_FindField(const DIRFILE *restrict, const char *restrict,
-    gd_entry_t *const *, unsigned int, int, unsigned int *restrict);
+    size_t, 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);
+    int *restrict, unsigned int *restrict, int);
+int _GD_FindInputs(DIRFILE *restrict, gd_entry_t *restrict, int) gd_nothrow;
 uint64_t _GD_FindVersion(DIRFILE *D);
 void _GD_FixEndianness(void*, size_t, gd_type_t, unsigned, unsigned);
 int _GD_FileSwapBytes(const DIRFILE *restrict, const gd_entry_t *restrict);
@@ -1274,13 +1370,13 @@ 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(DIRFILE *restrict, gd_entry_t *restrict, int);
+void _GD_FreeF(DIRFILE *restrict, int, int);
 void _GD_FreeFL(struct gd_flist_ *);
-off64_t _GD_GetEOF(DIRFILE *restrict, const gd_entry_t *restrict,
+off64_t _GD_GetEOF(DIRFILE *restrict, gd_entry_t *restrict,
     const char *restrict, int *restrict);
 off64_t _GD_GetIOPos(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);
+int _GD_GetRepr(const char *restrict, size_t *restrict);
 int _GD_GetScalar(DIRFILE *restrict, const char *restrict, int*, gd_type_t,
    void *restrict, gd_entry_t*);
 unsigned int _GD_GetSPF(DIRFILE*, gd_entry_t*);
@@ -1305,33 +1401,27 @@ void _GD_LincomData(DIRFILE *restrict, int n, void *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);
+int _GD_ListEntry(const gd_entry_t*, int, int, int, int, int, gd_entype_t);
 char *_GD_MakeFullPath(DIRFILE *restrict, int, const char *restrict, int);
-void *_GD_Malloc(DIRFILE *D, size_t size);
+void *_GD_Malloc(DIRFILE *D, size_t size) __attribute_malloc__;
 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 char *restrict, size_t,
-    const char *restrict, const char *restrict, const char *restrict,
-    const char *restrict, const char *restrict, char **restrict,
-    int *restrict, unsigned);
 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*);
+char *_GD_NormaliseNamespace(DIRFILE *restrict, const char *restrict,
+    size_t *restrict) __attribute_malloc__;
 gd_entry_t *_GD_ParseFieldSpec(DIRFILE *restrict,
-    const struct parser_state *restrict, int, char**,
+    const struct parser_state *restrict, int, char**, size_t,
     const gd_entry_t *restrict, int, int, int, char **, const char *);
 char *_GD_ParseFragment(FILE *restrict, DIRFILE*, struct parser_state *restrict,
     int, int);
 void _GD_PerformRename(DIRFILE *restrict, struct gd_rename_data_ *restrict);
 struct gd_rename_data_ *_GD_PrepareRename(DIRFILE *restrict, char *restrict,
-    gd_entry_t *restrict, int, unsigned, int, unsigned);
-void _GD_ReadLinterpFile(DIRFILE *restrict, gd_entry_t *restrict);
+    size_t, gd_entry_t *restrict, int, unsigned);
+int _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_SlashDot(const char*, size_t, unsigned, const char**, const char**);
 int _GD_Seek(DIRFILE *restrict, gd_entry_t *restrict, off64_t offset,
     unsigned int mode);
 void _GD_SetEncIOError(DIRFILE*, int suberror, const struct gd_raw_file_ *);
@@ -1344,13 +1434,19 @@ void _GD_SimpleParserInit(DIRFILE *restrict D, const char *restrict name,
 int _GD_ShutdownDirfile(DIRFILE*, int, int);
 int _GD_StrCmpNull(const char *restrict, const char *restrict);
 char *_GD_Strdup(DIRFILE *restrict, const char *restrict);
+char *_GD_StripCode(DIRFILE *restrict, int, const char *restrict, unsigned)
+  __attribute_malloc__;
+int _GD_SubFragmentList(DIRFILE *restrict, int, int **restrict);
 int _GD_Supports(DIRFILE *, const gd_entry_t*, unsigned int funcs);
 int _GD_Tokenise(DIRFILE *restrict, const struct parser_state *restrict,
     const char *restrict, char **, const char **, int, char **);
 int _GD_TokToNum(const char *restrict, int, int, double*, double*, uint64_t*,
     int64_t*);
 void _GD_UpdateAliases(DIRFILE*, int);
-int _GD_ValidateField(const char*, int, int, unsigned, int*);
+char *_GD_UpdateCode(DIRFILE *restrict, int, const char *restrict, int,
+    const char *restrict, size_t, const char *restrict, size_t,
+    const char *restrict, size_t) __attribute_malloc__;
+int _GD_ValidateField(const char*, size_t, int, int, unsigned);
 ssize_t _GD_WriteOut(const gd_entry_t*, const struct encoding_t*, const void*,
     gd_type_t, size_t, int);
 
diff --git a/src/iopos.c b/src/iopos.c
index 8a0b695..a629e85 100644
--- a/src/iopos.c
+++ b/src/iopos.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2015 D. V. Wiebe
+/* Copyright (C) 2011-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -23,15 +23,20 @@
 off64_t _GD_GetIOPos(DIRFILE *D, gd_entry_t *E, off64_t index_pos)
 {
   int i;
-  off64_t pos = -1, pos2;
+  off64_t pos = GD_E_INTERNAL_ERROR, pos2;
 
   dtrace("%p, %p, %" PRId64, D, E, (int64_t)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);
     D->recurse_level--;
-    dreturn("%u", -1);
-    return -1;
+    GD_SET_RETURN_ERROR(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0,
+        E->field);
+  }
+
+  if (_GD_FindInputs(D, E, 1)) {
+    D->recurse_level--;
+    dreturn("%i", D->error);
+    return D->error;
   }
 
   switch (E->field_type) {
@@ -47,20 +52,12 @@ off64_t _GD_GetIOPos(DIRFILE *D, gd_entry_t *E, off64_t index_pos)
         D->fragment[E->fragment_index].frame_offset;
       break;
     case GD_LINCOM_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
       pos = _GD_GetIOPos(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, GD_NO_ENTRY, 1)) {
-            pos = -1;
-            break;
-          }
           pos2 = _GD_GetIOPos(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;
           }
         }
@@ -70,31 +67,22 @@ off64_t _GD_GetIOPos(DIRFILE *D, gd_entry_t *E, off64_t index_pos)
     case GD_POLYNOM_ENTRY:
     case GD_SBIT_ENTRY:
     case GD_RECIP_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-          break;
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       pos = _GD_GetIOPos(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, GD_NO_ENTRY, 1) ||
-          _GD_BadInput(D, E, 1, GD_NO_ENTRY, 1))
-      {
-          break;
-      }
       pos = _GD_GetIOPos(D, E->e->entry[0], -1);
       if (D->error)
         break;
       pos2 = _GD_GetIOPos(D, E->e->entry[1], pos);
-      if (!D->error && pos != pos2) {
+      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, GD_NO_ENTRY, 1))
-        break;
       pos = _GD_GetIOPos(D, E->e->entry[0], -1);
       if (pos >= 0)
         pos += E->EN(phase,shift);
@@ -109,10 +97,14 @@ off64_t _GD_GetIOPos(DIRFILE *D, gd_entry_t *E, off64_t index_pos)
     case GD_CONST_ENTRY:
     case GD_STRING_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_ALIAS_ENTRY:
       _GD_InternalError(D);
   }
 
+  if (D->error)
+    pos = D->error;
+
   D->recurse_level--;
   dreturn("%" PRId64, (int64_t)pos);
   return pos;
@@ -127,23 +119,16 @@ off64_t gd_tell64(DIRFILE *D, const char *field_code) gd_nothrow
 
   dtrace("%p, \"%s\"", D, field_code);
 
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%u", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
   entry = _GD_FindEntry(D, field_code);
 
-  if (D->error) {
-    dreturn("%u", -1);
-    return -1;
-  }
+  if (D->error)
+    GD_RETURN_ERROR(D);
 
   if (entry->field_type & GD_SCALAR_ENTRY_BIT)
-    _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0, field_code);
+    GD_SET_RETURN_ERROR(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0,
+        field_code);
   else
     pos = _GD_GetIOPos(D, entry, -1);
 
@@ -160,9 +145,10 @@ off64_t _GD_DoSeek(DIRFILE *D, gd_entry_t *E, const struct encoding_t *enc,
     off64_t offset, unsigned int mode)
 {
   off64_t pos;
-  const int which = (mode & GD_FILE_TEMP) ? 1 : 0;
-  const int oop_write = ((enc->flags & GD_EF_OOP) && (mode & GD_FILE_WRITE))
-    ? 1 : 0;
+  const int oop_write = ((enc->flags & GD_EF_OOP) &&
+      (E->e->u.raw.file[1].idata >= 0)) ? 1 : 0;
+  const int temp = (mode & GD_FILE_TEMP) ? 1 : 0;
+  const int which = (oop_write || temp) ? 1 : 0;
 
   dtrace("%p, %p, %p, %" PRId64 ", 0x%X", D, E, enc, (int64_t)offset, mode);
 
@@ -170,40 +156,40 @@ off64_t _GD_DoSeek(DIRFILE *D, gd_entry_t *E, const struct encoding_t *enc,
   if (GD_SIZE(E->EN(raw,data_type)) > 0 &&
       offset > GD_INT64_MAX / GD_SIZE(E->EN(raw,data_type)))
   {
-    _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+    GD_SET_RETURN_ERROR(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
   }
 
   if (oop_write) {
     /* in this case we need to close and then re-open the file */
-    if (offset < E->e->u.raw.file[which].pos) {
-      if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP)) {
-        dreturn("%i", -1);
-        return -1;
-      } else if (_GD_InitRawIO(D, E, NULL, -1, NULL, GD_EF_SEEK, GD_FILE_WRITE,
+    if (offset < E->e->u.raw.file[1].pos) {
+      if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP))
+        GD_RETURN_ERROR(D);
+      else if (_GD_InitRawIO(D, E, NULL, -1, NULL, GD_EF_SEEK, GD_FILE_WRITE,
             _GD_FileSwapBytes(D, E)))
       {
-        dreturn("%i", -1);
-        return -1;
+        GD_RETURN_ERROR(D);
       }
     }
 
-    if (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 */
+    /* If the read-side file is open, and the read and write pointers agree,
+     * and the I/O pointers are less than the target offset, then read data
+     * from the read-side until we reach the point we're interested in, or
+     * we run out of data */
+    if (E->e->u.raw.file[0].idata >= 0 &&
+        E->e->u.raw.file[0].pos == E->e->u.raw.file[1].pos &&
+        offset > E->e->u.raw.file[1].pos)
+    {
       char *buffer, *ptr;
       ssize_t n_read, n_wrote;
       const off64_t chunk_size = GD_BUFFER_SIZE / GD_SIZE(E->EN(raw,data_type));
 
-      off64_t count, remaining = offset - E->e->u.raw.file[which].pos;
+      off64_t count, remaining = offset - E->e->u.raw.file[1].pos;
 
       buffer = _GD_Malloc(D, GD_BUFFER_SIZE);
-      if (buffer == NULL) {
-        dreturn("%i", -1);
-        return -1;
-      }
+      if (buffer == NULL)
+        GD_RETURN_ERROR(D);
 
+      /* Read loop */
       while (remaining > 0) {
         if (remaining > chunk_size)
           count = chunk_size;
@@ -216,11 +202,11 @@ off64_t _GD_DoSeek(DIRFILE *D, gd_entry_t *E, const struct encoding_t *enc,
         if (n_read < 0) {
           _GD_SetEncIOError(D, GD_E_IO_READ, E->e->u.raw.file + 0);
           free(buffer);
-          dreturn("%i", -1);
-          return -1;
-        } else if (n_read == 0) /* EOF */
+          GD_RETURN_ERROR(D);
+        } else if (n_read == 0) /* early EOF - will need to pad writer */
           break;
 
+        /* Write loop */
         ptr = buffer;
         while (n_read > 0) {
           n_wrote = (*enc->write)(E->e->u.raw.file + 1, ptr,
@@ -228,8 +214,7 @@ off64_t _GD_DoSeek(DIRFILE *D, gd_entry_t *E, const struct encoding_t *enc,
           if (n_wrote < 0) {
             _GD_SetEncIOError(D, GD_E_IO_WRITE, E->e->u.raw.file + 1);
             free(buffer);
-            dreturn("%i", -1);
-            return -1;
+            GD_RETURN_ERROR(D);
           }
           remaining -= n_wrote;
           n_read -= n_wrote;
@@ -238,14 +223,30 @@ off64_t _GD_DoSeek(DIRFILE *D, gd_entry_t *E, const struct encoding_t *enc,
       }
 
       free(buffer);
+
+      /* We can exit early if there's nothing remaining, since that means
+       * we successfully moved the write pointer to the right place
+       */
+      if (remaining == 0) {
+        dreturn("%" PRId64, (int64_t)offset);
+        return offset;
+      }
     }
   }
 
+  /* Do the seek.  For OOP writes, this function is only called when we need
+   * to pad, since the OOP loop above should have already copied everything
+   * appropriate from the read-side to the write-side.
+   */
   pos = (*enc->seek)(E->e->u.raw.file + which, offset, E->EN(raw,data_type),
       mode);
-  if (pos < 0)
+
+  /* Seek error */
+  if (pos < 0) {
     _GD_SetEncIOError(D, (mode & GD_FILE_WRITE) ? GD_E_IO_WRITE : GD_E_IO_READ,
         E->e->u.raw.file + 0);
+    GD_RETURN_ERROR(D);
+  }
 
   dreturn("%" PRId64, (int64_t)pos);
   return pos;
@@ -258,18 +259,21 @@ int _GD_Seek(DIRFILE *D, gd_entry_t *E, off64_t offset, unsigned int mode)
   dtrace("%p, %p, %" PRId64 ", 0x%X", D, E, (int64_t)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;
+    GD_SET_RETURN_ERROR(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0,
+        E->field);
   }
 
-  if (offset < 0) {
-    _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
-    dreturn("%i", 1);
-    return 1;
+  _GD_FindInputs(D, E, 1);
+
+  if (D->error) {
+    D->recurse_level--;
+    GD_RETURN_ERROR(D);
   }
 
+  if (offset < 0)
+    GD_SET_RETURN_ERROR(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
+
   switch (E->field_type) {
     case GD_RAW_ENTRY:
       /* open/create the file, if necessary */
@@ -294,17 +298,12 @@ int _GD_Seek(DIRFILE *D, gd_entry_t *E, off64_t offset, unsigned int mode)
       break;
     case GD_LINCOM_ENTRY:
       for (i = 0; i < E->EN(lincom,n_fields); ++i)
-        if (!_GD_BadInput(D, E, i, GD_NO_ENTRY, 1))
-          _GD_Seek(D, E->e->entry[i], offset, mode);
-        else
-          break;
+        _GD_Seek(D, E->e->entry[i], offset, mode);
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
     case GD_WINDOW_ENTRY:
     case GD_MPLEX_ENTRY:
-      if (_GD_BadInput(D, E, 1, GD_NO_ENTRY, 1))
-        break;
       if (_GD_Seek(D, E->e->entry[1], offset, mode))
         break;
       /* fallthrough */
@@ -313,12 +312,12 @@ int _GD_Seek(DIRFILE *D, gd_entry_t *E, off64_t offset, unsigned int mode)
     case GD_POLYNOM_ENTRY:
     case GD_SBIT_ENTRY:
     case GD_RECIP_ENTRY:
-      if (!_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        _GD_Seek(D, E->e->entry[0], offset, mode);
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
+      _GD_Seek(D, E->e->entry[0], offset, mode);
       break;
     case GD_PHASE_ENTRY:
-      if (!_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        _GD_Seek(D, E->e->entry[0], offset - E->EN(phase,shift), mode);
+      _GD_Seek(D, E->e->entry[0], offset - E->EN(phase,shift), mode);
       break;
     case GD_INDEX_ENTRY:
       E->e->u.index_pos = offset;
@@ -327,13 +326,13 @@ int _GD_Seek(DIRFILE *D, gd_entry_t *E, off64_t offset, unsigned int mode)
     case GD_CONST_ENTRY:
     case GD_STRING_ENTRY:
     case GD_CARRAY_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_ALIAS_ENTRY:
       _GD_InternalError(D);
   }
 
   D->recurse_level--;
-  dreturn("%i", (D->error == 0) ? 0 : 1);
-  return (D->error == 0) ? 0 : 1;
+  GD_RETURN_ERROR(D);
 }
 
 /* Set the I/O position of the given field
@@ -350,42 +349,28 @@ off64_t gd_seek64(DIRFILE *D, const char *field_code, off64_t frame_num,
   dtrace("%p, \"%s\", %" PRId64 ", %" PRId64 ", 0x%X", D, field_code,
       (int64_t)frame_num, (int64_t)sample_num, whence);
 
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%u", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
   entry = _GD_FindEntry(D, field_code);
 
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (D->error)
+    GD_RETURN_ERROR(D);
 
-  if (entry->field_type & GD_SCALAR_ENTRY_BIT) {
-    _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0, field_code);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (entry->field_type & GD_SCALAR_ENTRY_BIT)
+    GD_SET_RETURN_ERROR(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0,
+        field_code);
 
   if (frame_num) {
     spf = _GD_GetSPF(D, entry);
 
-    if (D->error) {
-      dreturn("%i", -1);
-      return -1;
-    }
+    if (D->error)
+      GD_RETURN_ERROR(D);
 
     /* don't overflow */
     if ((frame_num > 0 && sample_num > GD_INT64_MAX - spf * frame_num) ||
         (frame_num < 0 && sample_num < -GD_INT64_MAX - spf * frame_num))
     {
-      _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
-      dreturn("%i", -1);
-      return -1;
+      GD_SET_RETURN_ERROR(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
     }
     sample_num += frame_num * spf;
   }
@@ -402,22 +387,20 @@ off64_t gd_seek64(DIRFILE *D, const char *field_code, off64_t frame_num,
   } else
     _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_WHENCE, NULL, 0, NULL);
 
-  /* Check for overflow again */
-  if ((sample_num > 0 && pos > GD_INT64_MAX - sample_num) ||
-      (sample_num < 0 && pos < -GD_INT64_MAX - sample_num))
-  {
-    _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
-    dreturn("%i", 0);
-    return 0;
+  if (!D->error) {
+    /* Check for overflow again */
+    if ((sample_num > 0 && pos > GD_INT64_MAX - sample_num) ||
+        (sample_num < 0 && pos < -GD_INT64_MAX - sample_num))
+    {
+      _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
+    } else
+      _GD_Seek(D, entry, sample_num + pos, mode);
   }
 
-  if (!D->error)
-    _GD_Seek(D, entry, sample_num + pos, mode);
-
   if (D->error)
-    pos = -1;
-  else
-    pos = _GD_GetIOPos(D, entry, -1);
+    GD_RETURN_ERROR(D);
+
+  pos = _GD_GetIOPos(D, entry, -1);
 
   dreturn("%" PRId64, (int64_t)pos);
   return pos;
diff --git a/src/legacy.c b/src/legacy.c
index 66c4890..69ce152 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-2015 D. V. Wiebe
+ * Copyright (C) 2005-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -45,14 +45,11 @@ static DIRFILE _GD_GlobalErrors = {
 /* old error strings */
 const char *GD_ERROR_CODES[GD_N_ERROR_CODES] = {
   "Success", /* GD_E_OK */
-  NULL, /* unused */
   "Error in Format file", /* GD_E_FORMAT */
-  NULL, /* unused */
   NULL, /* GD_E_CREAT */
   "Bad field code", /* GD_E_BAD_CODE */
   "Bad data type", /* GD_E_BAD_TYPE */
   "I/O error", /* GD_E_IO */
-  NULL, /* unused */
   "Internal error", /* GD_E_INTERNAL_ERROR */
   "Memory allocation failed", /* GD_E_ALLOC */
   "Request out-of-range", /* GD_E_RANGE */
@@ -76,9 +73,6 @@ const char *GD_ERROR_CODES[GD_N_ERROR_CODES] = {
   NULL, /* GD_E_EXISTS */
   NULL, /* GD_E_UNCLEAN_DB */
   "Improper domain", /* GD_E_DOMAIN */
-  NULL, /* unused */
-  NULL, /* unused */
-  NULL, /* unused */
   NULL, /* GD_E_BOUNDS */
   "Line too long", /* GD_E_LINE_TOO_LONG */
 };
@@ -125,7 +119,7 @@ static DIRFILE *_GD_GetDirfile(const char *filename_in, int mode,
   filedir = strdup(filename_in);
 
   if (!filedir) {
-    *error_code = GD_E_ALLOC;
+    *error_code = -GD_E_ALLOC;
     dreturn("%p", NULL);
     return NULL;
   }
@@ -160,7 +154,7 @@ static DIRFILE *_GD_GetDirfile(const char *filename_in, int mode,
   /*  we will have to free the memory... */
   ptr = realloc(_GD_Dirfiles.D, (_GD_Dirfiles.n + 1) * sizeof(*_GD_Dirfiles.D));
   if (ptr == NULL) {
-    *error_code = _GD_GlobalErrors.error = GD_E_ALLOC;
+    *error_code = -(_GD_GlobalErrors.error = GD_E_ALLOC);
     free(filedir);
     dreturn("%p", NULL);
     return NULL;
@@ -174,7 +168,7 @@ static DIRFILE *_GD_GetDirfile(const char *filename_in, int mode,
 
   /* Error encountered -- clean up */
   if (_GD_Dirfiles.D[_GD_Dirfiles.n]->error != GD_E_OK) {
-    *error_code = _GD_CopyGlobalError(_GD_Dirfiles.D[_GD_Dirfiles.n]);
+    *error_code = -_GD_CopyGlobalError(_GD_Dirfiles.D[_GD_Dirfiles.n]);
     gd_discard(_GD_Dirfiles.D[_GD_Dirfiles.n]);
     dreturn("%p", NULL);
     return NULL;
@@ -441,6 +435,8 @@ struct FormatType *GetFormat(const char *filedir, int *error_code) gd_nothrow
         break;
       case GD_MULTIPLY_ENTRY:
       case GD_DIVIDE_ENTRY:
+      case GD_INDIR_ENTRY:
+      case GD_SINDIR_ENTRY:
         Format.n_multiply++;
         break;
       case GD_PHASE_ENTRY:
@@ -454,6 +450,7 @@ struct FormatType *GetFormat(const char *filedir, int *error_code) gd_nothrow
       case GD_ALIAS_ENTRY:
       case GD_CONST_ENTRY:
       case GD_CARRAY_ENTRY:
+      case GD_SARRAY_ENTRY:
       case GD_INDEX_ENTRY:
       case GD_STRING_ENTRY:
         break;
@@ -485,7 +482,7 @@ struct FormatType *GetFormat(const char *filedir, int *error_code) gd_nothrow
       Format.phaseEntries == NULL)
   {
     D->error = GD_E_ALLOC;
-    *error_code = _GD_CopyGlobalError(D);
+    *error_code = -_GD_CopyGlobalError(D);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -514,6 +511,8 @@ struct FormatType *GetFormat(const char *filedir, int *error_code) gd_nothrow
         break;
       case GD_MULTIPLY_ENTRY:
       case GD_DIVIDE_ENTRY:
+      case GD_INDIR_ENTRY:
+      case GD_SINDIR_ENTRY:
         CopyMultDivEntry(&Format.multiplyEntries[nmultiply++], D->entry[i]);
         break;
       case GD_PHASE_ENTRY:
@@ -528,6 +527,7 @@ struct FormatType *GetFormat(const char *filedir, int *error_code) gd_nothrow
       case GD_STRING_ENTRY:
       case GD_CONST_ENTRY:
       case GD_CARRAY_ENTRY:
+      case GD_SARRAY_ENTRY:
       case GD_INDEX_ENTRY:
       case GD_ALIAS_ENTRY:
       case GD_NO_ENTRY:
@@ -560,7 +560,7 @@ int GetData(const char *filename, const char *field_code,
   nread = (int)gd_getdata64(D, field_code, (off64_t)first_frame,
       (off64_t)first_samp, (size_t)num_frames, (size_t)num_samp,
       _GD_LegacyType(return_type), data_out);
-  *error_code = _GD_CopyGlobalError(D);
+  *error_code = -_GD_CopyGlobalError(D);
 
   dreturn("%i", nread);
   return nread;
@@ -586,7 +586,7 @@ int GetNFrames(const char *filename, int *error_code,
   }
 
   nf = (int)gd_nframes(D);
-  *error_code = _GD_CopyGlobalError(D);
+  *error_code = -_GD_CopyGlobalError(D);
 
   dreturn("%i", nf);
   return nf;
@@ -610,7 +610,7 @@ int GetSamplesPerFrame(const char *filename, const char *field_code,
   }
 
   spf = (int)gd_spf(D, field_code);
-  *error_code = _GD_CopyGlobalError(D);
+  *error_code = -_GD_CopyGlobalError(D);
 
   dreturn("%i", spf);
   return spf;
@@ -639,7 +639,7 @@ int PutData(const char *filename, const char *field_code,
   n_write = (int)gd_putdata64(D, field_code, (off64_t)first_frame,
       (off64_t)first_samp, (size_t)num_frames, (size_t)num_samp,
       _GD_LegacyType(data_type), data_in);
-  *error_code = _GD_CopyGlobalError(D);
+  *error_code = -_GD_CopyGlobalError(D);
 
   dreturn("%i", n_write);
   return n_write;
diff --git a/src/lzma.c b/src/lzma.c
index c0fab1a..b85d68e 100644
--- a/src/lzma.c
+++ b/src/lzma.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2015 D. V. Wiebe
+/* Copyright (C) 2009-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,11 +25,11 @@
 #endif
 
 #if SIZEOF_INT < 4
-#define GD_LZMA_DATA_OUT 32767
+#define GD_LZMA_DATA_OUT 32752
 #else
 #define GD_LZMA_DATA_OUT 1000000
 #endif
-#define GD_LZMA_DATA_IN 4096
+#define GD_LZMA_DATA_IN 32752
 #define GD_LZMA_LOOKBACK 4096
 
 struct gd_lzmadata {
@@ -37,7 +37,7 @@ struct gd_lzmadata {
   FILE* stream;
   int stream_end;
   int input_eof;
-  int offset;
+  int offset; /* Offset into the output buffer */
   uint8_t data_in[GD_LZMA_DATA_IN];
   uint8_t data_out[GD_LZMA_DATA_OUT];
 };
@@ -148,15 +148,18 @@ int _GD_LzmaOpen(int dirfd, struct gd_raw_file_* file,
  * This doesn't update next_out, so we don't have to worry about updating
  * offset.
  */
-static int _GD_LzmaReady(struct gd_lzmadata *lzd, size_t nreq, int *errnum)
+static int _GD_LzmaReady(struct gd_lzmadata *lzd, size_t nreq, int size,
+    int *errnum)
 {
   lzma_ret e;
-  int ready = READY(*lzd);
+  int ready;
+  
+  dtrace("%p, %" PRIuSIZE ", %i, %p", lzd, nreq, size, errnum);
 
-  dtrace("%p, %" PRIuSIZE " %p", lzd, nreq, errnum);
+  ready = READY(*lzd);
 
-  /* already have enough data, or no more data to read */
-  if (LZEOF(*lzd) || (size_t)ready >= nreq) {
+  /* already have some data, or no more data to read */
+  if (LZEOF(*lzd) || ready >= size) {
     dreturn("%i", ready);
     return ready;
   }
@@ -198,12 +201,14 @@ static int _GD_LzmaReady(struct gd_lzmadata *lzd, size_t nreq, int *errnum)
   return ready;
 }
 
-/* clear the output buffer, retaining a bit of data for lookback purposes */
-static void _GD_LzmaClear(struct gd_lzmadata *lzd)
+/* clear the output buffer, retaining a bit of data for lookback purposes
+ * If "part" is non-zero, then it gives the length of a partial sample
+ * found at the end of the buffer. */
+static void _GD_LzmaClear(struct gd_lzmadata *lzd, int part)
 {
-  int n;
+  int n = 0;
 
-  dtrace("%p", lzd);
+  dtrace("%p, %i", lzd, part);
   
   /* amount of data to keep */
   n = NOUT(*lzd);
@@ -213,6 +218,7 @@ static void _GD_LzmaClear(struct gd_lzmadata *lzd)
   memmove(lzd->data_out, lzd->xz.next_out - n, n);
   lzd->xz.next_out = lzd->data_out + n; 
   lzd->xz.avail_out = GD_LZMA_DATA_OUT - n;
+  lzd->offset = n - part;
 
   dreturnvoid();
 }
@@ -274,6 +280,7 @@ ssize_t _GD_LzmaWrite(struct gd_raw_file_ *file, const void *data,
   }
 
   /* we always write all the input, if successful */
+  file->pos += nmemb;
   dreturn("%" PRIdSIZE, (ssize_t)nmemb);
   return nmemb;
 }
@@ -283,28 +290,27 @@ off64_t _GD_LzmaSeek(struct gd_raw_file_* file, off64_t count,
 {
   struct gd_lzmadata *lzd;
   lzma_ret e;
-  uint64_t bcount;
+  uint64_t byte_count;
+  const unsigned size = GD_SIZE(data_type);
 
   dtrace("%p, %" PRId64 ", 0x%X, 0x%X", file, (int64_t)count, data_type, mode);
 
-  bcount = count * GD_SIZE(data_type);
+  byte_count = count * size;
 
-  if (mode == GD_FILE_WRITE)
-    lzd = (struct gd_lzmadata *)file[1].edata;
-  else
-    lzd = (struct gd_lzmadata *)file[0].edata;
+  lzd = (struct gd_lzmadata *)file->edata;
 
-  /* the easy case -- position is somewhere within our current output buffer */
-  if (bcount < lzd->xz.total_out && bcount >= BASE(*lzd)) {
-    lzd->offset = bcount - BASE(*lzd);
-    file->pos = count;
+  if (mode != GD_FILE_WRITE) {
+    /* the easy case -- position is somewhere within our current output buffer
+     */
+    if (byte_count < lzd->xz.total_out && byte_count >= BASE(*lzd)) {
+      lzd->offset = byte_count - BASE(*lzd);
+      file->pos = count;
 
-    dreturn("%" PRId64, (int64_t)(file->pos));
-    return file->pos;
-  }
+      dreturn("%" PRId64, (int64_t)(file->pos));
+      return file->pos;
+    }
 
-  if (mode != GD_FILE_WRITE) {
-    if (BASE(*lzd) > bcount) {
+    if (BASE(*lzd) > byte_count) {
       /* a backwards seek -- rewind to the beginning */
       lzd->xz.avail_in = 0;
       lzd->xz.avail_out = GD_LZMA_DATA_OUT;
@@ -326,11 +332,11 @@ off64_t _GD_LzmaSeek(struct gd_raw_file_* file, off64_t count,
     }
 
     /* seek forward the slow way */
-    while (lzd->xz.total_out < bcount) {
+    while (lzd->xz.total_out < byte_count) {
       /* discard output */
-      _GD_LzmaClear(lzd);
+      _GD_LzmaClear(lzd, 0);
 
-      if (_GD_LzmaReady(lzd, lzd->xz.avail_out, &file->error) < 0) {
+      if (_GD_LzmaReady(lzd, lzd->xz.avail_out, size, &file->error) < 0) {
         dreturn("%i", -1);
         return -1;
       }
@@ -340,25 +346,24 @@ off64_t _GD_LzmaSeek(struct gd_raw_file_* file, off64_t count,
         break;
     }
 
-    if (lzd->xz.total_out < bcount) {
+    if (lzd->xz.total_out < byte_count) {
       /* ran out of data */
       lzd->offset = NOUT(*lzd);
-      file->pos = lzd->xz.total_out / GD_SIZE(data_type);
+      file->pos = lzd->xz.total_out / size;
     } else {
-      lzd->offset = bcount - BASE(*lzd);
+      lzd->offset = byte_count - BASE(*lzd);
       file->pos = count;
     }
   } else {
     /* we only get here when we need to pad */
-    while (lzd->xz.total_in < bcount) {
-      int n = bcount - lzd->xz.total_in;
+    while (lzd->xz.total_in < byte_count) {
+      int n = byte_count - lzd->xz.total_in;
       if (n > GD_LZMA_DATA_IN)
         n = GD_LZMA_DATA_IN;
 
-      _GD_LzmaWrite(file + 1, lzd->data_in, GD_UINT8, n);
+      _GD_LzmaWrite(file, lzd->data_in, data_type, n / size);
     }
     lzd->offset = 0;
-    file->pos = lzd->xz.total_in / GD_SIZE(data_type);
   }
 
   dreturn("%" PRId64, (int64_t)file->pos);
@@ -368,49 +373,52 @@ off64_t _GD_LzmaSeek(struct gd_raw_file_* file, off64_t count,
 ssize_t _GD_LzmaRead(struct gd_raw_file_ *file, void *data, gd_type_t data_type,
     size_t nmemb)
 {
-  uint64_t bcount;
+  uint64_t bytes_remaining;
   struct gd_lzmadata *lzd = (struct gd_lzmadata *)file->edata;
-  ssize_t nread = 0;
+  ssize_t samples_read = 0;
+  const unsigned size = GD_SIZE(data_type);
 
   dtrace("%p, %p, 0x%X, %" PRIuSIZE, file, data, data_type, nmemb);
 
-  if (nmemb > GD_SSIZE_T_MAX / GD_SIZE(data_type))
-    nmemb = GD_SSIZE_T_MAX / GD_SIZE(data_type);
-  bcount = nmemb * GD_SIZE(data_type);
+  if (nmemb > GD_SSIZE_T_MAX / size)
+    nmemb = GD_SSIZE_T_MAX / size;
+  bytes_remaining = nmemb * size;
 
   /* decoding loop */
-  while (bcount > 0) {
-    int bready, nready;
-
-    /* clear the output buffer if it's full */
-    if (lzd->xz.avail_out == 0)
-      _GD_LzmaClear(lzd);
-    
-    bready = _GD_LzmaReady(lzd, bcount, &file->error);
-    if (bready < 0) {
+  while (bytes_remaining > 0) {
+    int bytes_ready, samples_ready;
+
+    bytes_ready = _GD_LzmaReady(lzd, bytes_remaining, size, &file->error);
+    if (bytes_ready < 0) {
       dreturn("%i", -1);
       return -1;
-    }
+    } else if (bytes_ready < (int)size) {
+      /* clear the output buffer */
+      _GD_LzmaClear(lzd, bytes_ready);
+    } else {
+      /* copy whole samples */
+      samples_ready = bytes_ready / size;
 
-    /* copy whole samples */
-    nready = bready / GD_SIZE(data_type);
-    if (nready > (ssize_t)nmemb)
-      nready = nmemb;
+      if (samples_read + samples_ready > (ssize_t)nmemb)
+        samples_ready = nmemb - samples_read;
 
-    bready = nready * GD_SIZE(data_type);
+      bytes_ready = samples_ready * size;
 
-    memcpy(data, lzd->data_out + lzd->offset, bready);
-    lzd->offset += bready;
-    bcount -= bready;
-    data += bready;
-    nread += nready;
+      memcpy(data, lzd->data_out + lzd->offset, bytes_ready);
 
+      lzd->offset += bytes_ready;
+      bytes_remaining -= bytes_ready; 
+      data += bytes_ready;
+      samples_read += samples_ready;
+    }
     if (LZEOF(*lzd))
       break;
   }
 
-  dreturn("%" PRIdSIZE, nread);
-  return nread;
+  file->pos += samples_read;
+
+  dreturn("%" PRIdSIZE, samples_read);
+  return samples_read;
 }
 
 int _GD_LzmaClose(struct gd_raw_file_ *file)
@@ -464,7 +472,7 @@ int _GD_LzmaSync(struct gd_raw_file_ *file)
   dtrace("%p", file);
 
   if (file->mode & GD_FILE_WRITE) {
-    struct gd_lzmadata *lzd = (struct gd_lzmadata *)file[1].edata;
+    struct gd_lzmadata *lzd = (struct gd_lzmadata *)file->edata;
 
     r = fflush(lzd->stream);
   }
@@ -478,6 +486,7 @@ off64_t _GD_LzmaSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
 {
   struct gd_lzmadata *lzd;
   off64_t n;
+  const unsigned size = GD_SIZE(data_type);
 
   dtrace("%i, %p, 0x%X, <unused>", dirfd, file, data_type);
 
@@ -490,7 +499,7 @@ off64_t _GD_LzmaSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
 
   /* read until EOF */
   while (!LZEOF(*lzd)) {
-    if (_GD_LzmaReady(lzd, GD_LZMA_DATA_OUT, &file->error) < 0) {
+    if (_GD_LzmaReady(lzd, GD_LZMA_DATA_OUT, size, &file->error) < 0) {
       dreturn("%i", -1);
       return -1;
     }
@@ -501,7 +510,7 @@ off64_t _GD_LzmaSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
   }
 
   /* liblzma very graciously does the bookkeeping for us */
-  n = lzd->xz.total_out / GD_SIZE(data_type);
+  n = lzd->xz.total_out / size;
 
   lzma_end(&lzd->xz);
   fclose(lzd->stream);
diff --git a/src/mod.c b/src/mod.c
index 44c3973..c25f11b 100644
--- a/src/mod.c
+++ b/src/mod.c
@@ -50,15 +50,17 @@ static unsigned int gd_max_(unsigned int A, unsigned int B)
  *  iQ - scalar index in Q
  *  lQ - literal value in Q
  *
- *  calculated: whether E was calculated (GD_EN_CALCULATED) before _GD_Change
- *              was called.
+ *  calculated: whether E was calculated (GD_EN_CALC) before _GD_Change was
+ *                          called.
  *
  *  alter_literal: boolean; true if lN and lQ differ and lN is not a special
  *                          "keep-as-is" value
  *
- * This function performs one of five actions, inicated by 0 through 4
+ *  early: whether E is from DSV <= 5 (GD_EN_EARLY)
+ *
+ * This function performs one of five actions, indicated by 0 through 4,
  * according to the values of sN, sQ, and alter_literal as given in 
- * the following table where:
+ * the following table, where:
  *
  * - sQ can be 'N' (NULL) or 'a' (a non-NULL field code from the
  *                                                     original entry)
@@ -90,13 +92,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 *lQ, const void *lN, char **sQ, int *iQ, const char *sN,
-    int iN, int calculated, int fragment_index)
+    int iN, int calculated, int early, int fragment_index)
 {
   int r = 0;
   int set_lQ = 0;
 
-  dtrace("%p, %i, 0x%X, %p, %p, %p, %p, %p, %i, %i, %i", D, alter_literal, type,
-      lQ, lN, sQ, iQ, sN, iN, calculated, fragment_index);
+  dtrace("%p, %i, 0x%X, %p, %p, %p, %p, %p, %i, %i, %i, %i", D, alter_literal,
+      type, lQ, lN, sQ, iQ, sN, iN, calculated, early, fragment_index);
 
   if (sN == NULL) {
     if (*sQ != NULL) {
@@ -148,9 +150,11 @@ static int _GD_AlterScalar(DIRFILE* D, int alter_literal, gd_type_t type,
      *    been asked to move the raw file, _GD_Change is going to need to
      *    recalculate the entry; no need to change lQ: it's ignored. */
 
-    if (_GD_CheckCodeAffixes(D, sN, fragment_index, 1))
+    if (_GD_CheckCodeAffixes(D, sN, fragment_index,
+          GD_CO_ERROR | (early ? GD_CO_EARLY : 0)))
+    {
       ; /* reject codes with bad affixes */
-    else if (iN == -1 && !(D->flags & GD_NOSTANDARD) && D->standards <= 7 &&
+    } else if (iN == -1 && !(D->flags & GD_NOSTANDARD) && D->standards <= 7 &&
         _GD_TokToNum(sN, D->standards, 1, NULL, NULL, NULL, NULL) != -1)
     {
       /* when using early Standards, reject ambiguous field codes */
@@ -265,12 +269,15 @@ static void _GD_SPFConvert(DIRFILE* D, void *A, unsigned int spfA, void *B,
 
 /* 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)
+    char *const *E, int early, int fragment_index, int force)
 {
-  dtrace("%p, %i, %p, %p, %p, %i, %i", D, i, Q, N, E, fragment_index, force);
+  dtrace("%p, %i, %p, %p, %p, %i, %i, %i", D, i, Q, N, E, early, fragment_index,
+      force);
 
   if (force || (N[i] != NULL && strcmp(E[i], N[i]))) {
-    if (_GD_CheckCodeAffixes(D, N[i], fragment_index, 1)) {
+    if (_GD_CheckCodeAffixes(D, N[i], fragment_index,
+          GD_CO_ERROR | (early ? GD_CO_EARLY : 0)))
+    {
       dreturn("%i", -1);
       return -1;
     } else if ((Q[i] = _GD_Strdup(D, N[i])) == NULL) {
@@ -292,7 +299,7 @@ static int _GD_AlterInField(DIRFILE *D, int i, char **Q, char *const *N,
 static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
     int flags)
 {
-  int i, j;
+  int i, j, early, calc;
   int field_free = 0;
   int scalar_free = 0;
   int modified = 0;
@@ -307,20 +314,19 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
 
   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, 1, NULL))
-      == NULL)
-  {
-    _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)
+  else if ((E = _GD_FindEntry(D, field_code)) == NULL)
+    ; /* Error already set */
+  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);
   else if (E->field_type != N->field_type)
     _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_MATCH, NULL, 0, field_code);
 
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (D->error)
+    GD_RETURN_ERROR(D);
+
+  early = E->flags & GD_EN_EARLY ? 1 : 0;
+  calc = E->flags & GD_EN_CALC ? 1 : 0;
 
   memcpy(&Qe, E->e, sizeof(struct gd_private_entry_));
   memcpy(&Q, E, sizeof(gd_entry_t));
@@ -338,8 +344,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
     case GD_RAW_ENTRY:
       j = _GD_AlterScalar(D, N->EN(raw,spf) && N->EN(raw,spf) != E->EN(raw,spf),
           GD_UINT_TYPE, &Q.EN(raw,spf), &N->EN(raw,spf), Q.scalar, Q.scalar_ind,
-          N->scalar[0], N->scalar_ind[0], E->flags & GD_EN_CALC,
-          E->fragment_index);
+          N->scalar[0], N->scalar_ind[0], calc, early, E->fragment_index);
 
       if (j & GD_AS_ERROR)
         break;
@@ -354,17 +359,15 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       /* nothing to do */
       if (Q.EN(raw,spf) == E->EN(raw,spf) && Q.EN(raw,data_type) ==
           E->EN(raw,data_type) && Q.scalar[0] == E->scalar[0])
+      {
         break;
+      }
 
       modified = 1;
 
-      if (Q.EN(raw,data_type) & 0x40 ||
-          (Qe.u.raw.size = GD_SIZE(Q.EN(raw,data_type))) == 0)
-      {
-        _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, Q.EN(raw,data_type), NULL);
-        dreturn("%i", -1);
-        return -1;
-      }
+      if (_GD_BadType(D->standards, Q.EN(raw,data_type)))
+        GD_SET_RETURN_ERROR(D, GD_E_BAD_TYPE, 0, NULL, Q.EN(raw,data_type),
+            NULL);
 
       if (flags) {
         ssize_t nread, nwrote;
@@ -376,8 +379,8 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         if (!(Q.flags & GD_EN_CALC))
           if (gd_get_constant(D, Q.scalar[0], GD_UINT_TYPE, &Q.EN(raw,spf)))
             break;
-        
-        if (!(E->flags & GD_EN_CALC))
+
+        if (!calc)
           if (!_GD_CalculateEntry(D, E, 1))
             break;
 
@@ -515,7 +518,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       for (i = 0; i < Q.EN(lincom,n_fields); ++i) {
         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);
+              early, E->fragment_index, E->EN(lincom,n_fields) <= i);
           if (j < 0)
             break;
           else if (j) {
@@ -529,14 +532,13 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
             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->flags & GD_EN_CALC,
-                E->fragment_index);
+                N->scalar[i], N->scalar_ind[i], calc, early, 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->flags & GD_EN_CALC, E->fragment_index);
+                calc, early, E->fragment_index);
             gd_rs2cs_(Q.EN(lincom,cm)[i], Q.EN(lincom,m)[i]);
           }
 
@@ -556,7 +558,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
                   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->flags & GD_EN_CALC,
+                N->scalar_ind[i + GD_MAX_LINCOM], calc, early,
                 E->fragment_index);
             Q.EN(lincom,b)[i] = creal(Q.EN(lincom,cb)[i]);
           } else {
@@ -564,7 +566,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
                 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->flags & GD_EN_CALC, E->fragment_index);
+                calc, early, E->fragment_index);
             gd_rs2cs_(Q.EN(lincom,cb)[i], Q.EN(lincom,b)[i]);
           }
 
@@ -587,7 +589,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       break;
     case GD_LINTERP_ENTRY:
       j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
-          E->fragment_index, 0);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -639,7 +641,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       j = _GD_AlterScalar(D, N->EN(bit,numbits) >= 1 && E->EN(bit,numbits) !=
           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->flags & GD_EN_CALC, E->fragment_index);
+          N->scalar_ind[1], calc, early, E->fragment_index);
 
       if (j & GD_AS_ERROR)
         break;
@@ -652,8 +654,8 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
 
       j = _GD_AlterScalar(D, N->EN(bit,bitnum) >= 0 && E->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->flags & GD_EN_CALC, E->fragment_index);
+          Q.scalar, Q.scalar_ind, N->scalar[0], N->scalar_ind[0], calc, early,
+          E->fragment_index);
 
       if (j & GD_AS_ERROR)
         break;
@@ -665,7 +667,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         modified = 1;
 
       j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
-          E->fragment_index, 0);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -676,8 +678,10 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
-          E->fragment_index, 0);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -686,7 +690,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       }
 
       j = _GD_AlterInField(D, 1, Q.in_fields, N->in_fields, E->in_fields,
-          E->fragment_index, 0);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -697,7 +701,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       break;
     case GD_RECIP_ENTRY:
       j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
-          E->fragment_index, 0);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -710,8 +714,8 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         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->flags & GD_EN_CALC, E->fragment_index);
+            Q.scalar, Q.scalar_ind, N->scalar[0], N->scalar_ind[0], calc, early,
+            E->fragment_index);
         Q.EN(recip,dividend) = creal(Q.EN(recip,cdividend));
         if (cimag(Q.EN(recip,cdividend)) != 0)
           Q.flags |= GD_EN_COMPSCAL;
@@ -719,8 +723,8 @@ 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->flags & GD_EN_CALC, E->fragment_index);
+            Q.scalar_ind, N->scalar[0], N->scalar_ind[0], calc, early,
+            E->fragment_index);
         gd_rs2cs_(Q.EN(recip,cdividend), Q.EN(recip,dividend));
       }
 
@@ -740,20 +744,19 @@ 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->flags & GD_EN_CALC,
-          E->fragment_index);
+          N->scalar[0], N->scalar_ind[0], calc, early, E->fragment_index);
 
       if (j & GD_AS_ERROR)
         break;
       if (j & GD_AS_FREE_SCALAR)
-        scalar_free |= 1;
+        scalar_free = 1;
       if (j & GD_AS_NEED_RECALC)
         Q.flags &= ~GD_EN_CALC;
       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);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -764,7 +767,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       break;
     case GD_POLYNOM_ENTRY:
       j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
-          E->fragment_index, 0);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -785,14 +788,13 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
             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->flags & GD_EN_CALC,
-                E->fragment_index);
+                N->scalar[i], N->scalar_ind[i], calc, early, 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->flags & GD_EN_CALC, E->fragment_index);
+                calc, early, E->fragment_index);
             gd_rs2cs_(Q.EN(polynom,ca)[i], Q.EN(polynom,a)[i]);
           }
 
@@ -826,20 +828,20 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
           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->flags & GD_EN_CALC, E->fragment_index);
+              N->scalar_ind[0], calc, early, 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->flags & GD_EN_CALC, E->fragment_index);
+              N->scalar_ind[0], calc, early, 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->flags & GD_EN_CALC, E->fragment_index);
+              N->scalar_ind[0], calc, early, E->fragment_index);
           break;
       }
 
@@ -853,7 +855,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         modified = 1;
 
       j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
-          E->fragment_index, 0);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -862,7 +864,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       }
 
       j = _GD_AlterInField(D, 1, Q.in_fields, N->in_fields, E->in_fields,
-          E->fragment_index, 0);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -875,8 +877,8 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       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 + 1,
-          Q.scalar_ind + 1, N->scalar[1], N->scalar_ind[1],
-          E->flags & GD_EN_CALC, E->fragment_index);
+          Q.scalar_ind + 1, N->scalar[1], N->scalar_ind[1], calc, early,
+          E->fragment_index);
 
       if (j & GD_AS_ERROR)
         break;
@@ -889,8 +891,8 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
 
       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[0], N->scalar_ind[0],
-          E->flags & GD_EN_CALC, E->fragment_index);
+          Q.scalar, Q.scalar_ind, N->scalar[0], N->scalar_ind[0], calc, early,
+          E->fragment_index);
 
       if (j & GD_AS_ERROR)
         break;
@@ -902,7 +904,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         modified = 1;
 
       j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
-          E->fragment_index, 0);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -911,7 +913,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       }
 
       j = _GD_AlterInField(D, 1, Q.in_fields, N->in_fields, E->in_fields,
-          E->fragment_index, 0);
+          early, E->fragment_index, 0);
       if (j < 0)
         break;
       else if (j) {
@@ -924,13 +926,9 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       Q.EN(scalar,const_type) = (N->EN(scalar,const_type) == GD_NULL) ?
         E->EN(scalar,const_type) : N->EN(scalar,const_type);
 
-      if (Q.EN(scalar,const_type) & 0x40 || GD_SIZE(Q.EN(scalar,const_type))
-          == 0)
-      {
-        _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, Q.EN(scalar,const_type), NULL);
-        dreturn("%i", -1);
-        return -1;
-      }
+      if (_GD_BadType(D->standards, Q.EN(scalar,const_type)))
+        GD_SET_RETURN_ERROR(D, GD_E_BAD_TYPE, 0, NULL, Q.EN(scalar,const_type),
+            NULL);
 
       type = _GD_ConstType(D, Q.EN(scalar,const_type));
       if (Q.EN(scalar,const_type) != E->EN(scalar,const_type))
@@ -941,10 +939,9 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       else {
         /* type convert */
         Qe.u.scalar.d = _GD_Malloc(D, GD_SIZE(type));
-        if (Qe.u.scalar.d == NULL) {
-          dreturn("%i", -1);
-          return -1;
-        }
+        if (Qe.u.scalar.d == NULL)
+          GD_RETURN_ERROR(D);
+
         if (type == GD_COMPLEX128) {
           *(double*)Qe.u.scalar.d = (E->EN(scalar,const_type) & GD_IEEE754) ?
             *(double*)E->e->u.scalar.d : (E->EN(scalar,const_type) & GD_SIGNED)
@@ -980,9 +977,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       {
         modified = 1;
 
-        if (Q.EN(scalar,const_type) & 0x40 ||
-            GD_SIZE(Q.EN(scalar,const_type)) == 0)
-        {
+        if (_GD_BadType(D->standards, Q.EN(scalar,const_type))) {
           _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, Q.EN(scalar,const_type),
               NULL);
           break;
@@ -1012,6 +1007,38 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       } else
         Qe.u.scalar.d = E->e->u.scalar.d;
       break;
+    case GD_SARRAY_ENTRY:
+      if (N->EN(scalar,array_len) == 0) {
+        Q.EN(scalar,array_len) = E->EN(scalar,array_len);
+        Qe.u.scalar.d = E->e->u.scalar.d;
+      } else {
+        Q.EN(scalar,array_len) = N->EN(scalar,array_len);
+
+        if (Q.EN(scalar,array_len) != E->EN(scalar,array_len)) {
+          modified = 1;
+
+          if (Q.EN(scalar,array_len) < E->EN(scalar,array_len)) {
+            /* Free dropped elements */
+            size_t i;
+            for (i = Q.EN(scalar,array_len); i < E->EN(scalar,array_len); ++i)
+              free(((char**)E->e->u.scalar.d)[i]);
+          }
+
+          Qe.u.scalar.d = _GD_Realloc(D, E->e->u.scalar.d,
+              sizeof(const char *) * Q.EN(scalar,array_len));
+          if (Qe.u.scalar.d == NULL)
+            break;
+
+          if (Q.EN(scalar,array_len) > E->EN(scalar,array_len)) {
+            /* Zero new elements */
+            size_t i;
+            for (i = E->EN(scalar,array_len); i < Q.EN(scalar,array_len); ++i)
+              ((char**)Qe.u.scalar.d)[i] = _GD_Strdup(D, "");
+          }
+        } else
+          Qe.u.scalar.d = E->e->u.scalar.d;
+      }
+      break;
     case GD_INDEX_ENTRY:
       /* INDEX may not be modified */
       _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
@@ -1021,10 +1048,8 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       break;
   }
 
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (D->error)
+    GD_RETURN_ERROR(D);
 
   if (modified) {
     for (i = 0; i < GD_MAX_LINCOM; ++i) {
@@ -1061,16 +1086,11 @@ int gd_alter_entry(DIRFILE* D, const char* field_code,
 
   dtrace("%p, \"%s\", %p, %i", D, field_code, entry, move);
 
-  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);
+  GD_RETURN_ERR_IF_INVALID(D);
 
   /* To ensure .e is NULLed */
   memcpy(&N, entry, sizeof(gd_entry_t));
+  N.e = NULL;
 
   /* for these field types, move is a set of bitflags; we set them all */
   if (N.field_type == GD_LINCOM_ENTRY || N.field_type == GD_POLYNOM_ENTRY)
@@ -1090,13 +1110,7 @@ int gd_alter_raw(DIRFILE *D, const char *field_code,
 
   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);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_RAW_ENTRY;
@@ -1120,31 +1134,20 @@ int gd_alter_lincom(DIRFILE* D, const char* field_code, int n_fields,
   dtrace("%p, \"%s\", %i, %p, %p, %p", D, field_code, n_fields, in_fields, m,
       b);
 
-  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);
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_LINCOM_ENTRY;
-  if (n_fields > GD_MAX_LINCOM || n_fields < 0) {
-    _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)
+  if (n_fields > GD_MAX_LINCOM || n_fields < 0)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields,
+        NULL);
+  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, 1,
-        NULL);
+    gd_entry_t *E = _GD_FindEntry(D, field_code);
 
-    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 == NULL)
+      GD_RETURN_ERROR(D);
 
     N.EN(lincom,n_fields) = E->EN(lincom,n_fields);
   }
@@ -1187,32 +1190,21 @@ int gd_alter_clincom(DIRFILE* D, const char* field_code, int n_fields,
   dtrace("%p, \"%s\", %i, %p, %p, %p", D, field_code, n_fields, in_fields, cm,
       cb);
 
-  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);
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_LINCOM_ENTRY;
   N.flags = GD_EN_COMPSCAL;
-  if (n_fields > GD_MAX_LINCOM || n_fields < 0) {
-    _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)
+  if (n_fields > GD_MAX_LINCOM || n_fields < 0)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields,
+        NULL);
+  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, 1,
-        NULL);
+    gd_entry_t *E = _GD_FindEntry(D, field_code);
 
-    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 == NULL)
+      GD_RETURN_ERROR(D);
 
     N.EN(lincom,n_fields) = E->EN(lincom,n_fields);
   }
@@ -1253,11 +1245,7 @@ int gd_alter_linterp(DIRFILE* D, const char* field_code, const char* in_field,
   dtrace("%p, \"%s\", \"%s\", \"%s\", %i", D, field_code, in_field, table,
       move);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_LINTERP_ENTRY;
@@ -1279,11 +1267,7 @@ int gd_alter_bit(DIRFILE* D, const char* field_code, const char* in_field,
   dtrace("%p, \"%s\", \"%s\", %i, %i", D, field_code, in_field, bitnum,
       numbits);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_BIT_ENTRY;
@@ -1308,11 +1292,7 @@ int gd_alter_sbit(DIRFILE* D, const char* field_code, const char* in_field,
   dtrace("%p, \"%s\", \"%s\", %i, %i", D, field_code, in_field, bitnum,
       numbits);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_SBIT_ENTRY;
@@ -1336,11 +1316,7 @@ int gd_alter_recip(DIRFILE* D, const char* field_code, const char* in_field,
 
   dtrace("%p, \"%s\", \"%s\", %g", D, field_code, in_field, dividend);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_RECIP_ENTRY;
@@ -1380,11 +1356,7 @@ int gd_alter_crecip89(DIRFILE* D, const char* field_code, const char* 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);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_RECIP_ENTRY;
@@ -1414,11 +1386,7 @@ static int _GD_AlterYoke(DIRFILE* D, gd_entype_t t, const char* field_code,
   dtrace("%p, 0x%X, \"%s\", \"%s\", \"%s\"", D, t, field_code, in_field1,
       in_field2);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = t;
@@ -1443,6 +1411,18 @@ int gd_alter_multiply(DIRFILE* D, const char* field_code, const char* in_field1,
   return _GD_AlterYoke(D, GD_MULTIPLY_ENTRY, field_code, in_field1, in_field2);
 }
 
+int gd_alter_indir(DIRFILE* D, const char* field_code, const char* in_field1,
+    const char* in_field2) gd_nothrow
+{
+  return _GD_AlterYoke(D, GD_INDIR_ENTRY, field_code, in_field1, in_field2);
+}
+
+int gd_alter_sindir(DIRFILE* D, const char* field_code, const char* in_field1,
+    const char* in_field2) gd_nothrow
+{
+  return _GD_AlterYoke(D, GD_SINDIR_ENTRY, field_code, in_field1, in_field2);
+}
+
 int gd_alter_phase(DIRFILE* D, const char* field_code, const char* in_field,
     gd_shift_t shift) gd_nothrow
 {
@@ -1451,11 +1431,7 @@ int gd_alter_phase(DIRFILE* D, const char* field_code, const char* in_field,
 
   dtrace("%p, \"%s\", \"%s\", %" PRId64, D, field_code, in_field, shift);
 
-  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_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_PHASE_ENTRY;
@@ -1477,11 +1453,7 @@ int gd_alter_const(DIRFILE* D, const char* field_code, gd_type_t 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);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_CONST_ENTRY;
@@ -1501,11 +1473,7 @@ int gd_alter_carray(DIRFILE* D, const char* field_code, gd_type_t const_type,
 
   dtrace("%p, \"%s\", 0x%X, %" PRIuSIZE, D, field_code, const_type, array_len);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_CARRAY_ENTRY;
@@ -1518,6 +1486,25 @@ int gd_alter_carray(DIRFILE* D, const char* field_code, gd_type_t const_type,
   return ret;
 }
 
+int gd_alter_sarray(DIRFILE* D, const char* field_code, size_t array_len)
+  gd_nothrow
+{
+  gd_entry_t N;
+
+  dtrace("%p, \"%s\", %" PRIuSIZE, D, field_code, array_len);
+
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  memset(&N, 0, sizeof(gd_entry_t));
+  N.field_type = GD_SARRAY_ENTRY;
+  N.EN(scalar,array_len) = array_len;
+
+  _GD_Change(D, field_code, &N, 0);
+
+  dreturn("%i", D->error);
+  return D->error;
+}
+
 int gd_alter_polynom(DIRFILE* D, const char* field_code, int poly_ord,
     const char* in_field, const double* a) gd_nothrow
 {
@@ -1527,31 +1514,20 @@ int gd_alter_polynom(DIRFILE* D, const char* field_code, int poly_ord,
 
   dtrace("%p, \"%s\", %i, \"%s\", %p", D, field_code, poly_ord, in_field, a);
 
-  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);
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_POLYNOM_ENTRY;
-  if (poly_ord > GD_MAX_POLYORD || poly_ord < 0) {
-    _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)
+  if (poly_ord > GD_MAX_POLYORD || poly_ord < 0)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord,
+        NULL);
+  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, 1,
-        NULL);
+    gd_entry_t *E = _GD_FindEntry(D, field_code);
 
-    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 == NULL)
+      GD_RETURN_ERROR(D);
 
     N.EN(polynom,poly_ord) = E->EN(polynom,poly_ord);
   }
@@ -1582,32 +1558,21 @@ int gd_alter_cpolynom(DIRFILE* D, const char* field_code, int poly_ord,
 
   dtrace("%p, \"%s\", %i, \"%s\", %p", D, field_code, poly_ord, in_field, ca);
 
-  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);
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_POLYNOM_ENTRY;
   N.flags = GD_EN_COMPSCAL;
-  if (poly_ord > GD_MAX_POLYORD || poly_ord < 0) {
-    _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)
+  if (poly_ord > GD_MAX_POLYORD || poly_ord < 0)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord,
+        NULL);
+  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, 1,
-        NULL);
+    gd_entry_t *E = _GD_FindEntry(D, field_code);
 
-    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 == NULL)
+      GD_RETURN_ERROR(D);
 
     N.EN(polynom,poly_ord) = E->EN(polynom,poly_ord);
   }
@@ -1631,7 +1596,7 @@ int gd_alter_cpolynom(DIRFILE* D, const char* field_code, int poly_ord,
 
 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
+  gd_nothrow
 {
   int ret;
   gd_entry_t N;
@@ -1640,11 +1605,7 @@ gd_nothrow
       field_code, in_field, check_field, windop, threshold.r, threshold.u,
       threshold.i);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_WINDOW_ENTRY;
@@ -1661,8 +1622,7 @@ gd_nothrow
 }
 
 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
+    const char *count_field, int count_val, int period) gd_nothrow
 {
   int ret;
   gd_entry_t N;
@@ -1670,11 +1630,7 @@ gd_nothrow
   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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_MPLEX_ENTRY;
@@ -1695,6 +1651,7 @@ static int _GD_AlterSpec(DIRFILE* D, const char* line, const char* parent,
 {
   char *outstring = NULL, *new_code;
   const char *tok_pos;
+  size_t len0;
   char *in_cols[MAX_IN_COLS];
   int n_cols, ret;
   gd_entry_t *N = NULL;
@@ -1702,20 +1659,10 @@ static int _GD_AlterSpec(DIRFILE* D, const char* line, const char* parent,
 
   dtrace("%p, \"%s\", \"%s\", \"%s\", %i", D, line, parent, name, move);
 
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  /* 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;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  _GD_ClearError(D);
+  if ((D->flags & GD_ACCMODE) == GD_RDONLY)
+    GD_SET_RETURN_ERROR(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
 
   /* start parsing */
   _GD_SimpleParserInit(D, name, &p);
@@ -1728,54 +1675,57 @@ static int _GD_AlterSpec(DIRFILE* D, const char* line, const char* parent,
 
   if (D->error) {
     free(outstring);
-    dreturn("%i", -1); /* tokeniser threw an error */
-    return -1;
+    GD_RETURN_ERROR(D); /* tokeniser threw an error */
   }
 
-  if (parent) {
-    N = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
-    if (N == NULL)
-      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
-  } else {
-    N = _GD_FindField(D, in_cols[0], D->entry, D->n_entries, 1, NULL);
-    if (N == NULL)
-      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, in_cols[0]);
-  }
+  if (parent)
+    N = _GD_FindEntry(D, parent);
+  else
+    N = _GD_FindEntry(D, in_cols[0]);
 
   if (D->error) {
     free(outstring);
-    dreturn("%i", -1);
-    return -1;
+    GD_RETURN_ERROR(D);
   }
 
   /* the parser will modifiy in_cols[0] if it contains a metafield code */
+  len0 = strlen(in_cols[0]);
   if (parent) {
-    if ((new_code = _GD_Malloc(D, strlen(parent) + strlen(in_cols[0]) + 2)))
-      sprintf(new_code, "%s/%s", parent, in_cols[0]);
-  } else
-    new_code = _GD_Strdup(D, in_cols[0]);
+    new_code = _GD_Malloc(D, N->e->len + len0 + 2);
+
+    if (new_code) {
+      memcpy(new_code, N->field, N->e->len);
+      new_code[N->e->len] = '/';
+      memcpy(new_code + N->e->len + 1, in_cols[0], len0 + 1);
+    }
+    len0 += N->e->len + 1;
+  } else {
+    new_code = _GD_Malloc(D, len0 + 1);
+    if (new_code)
+      memcpy(new_code, in_cols[0], len0 + 1);
+  }
 
   if (D->error) { /* malloc error */
     free(outstring);
-    dreturn("%i", -1);
-    return -1;
+    GD_RETURN_ERROR(D);
   }
 
   /* Let the parser compose the entry */
-  N = _GD_ParseFieldSpec(D, &p, n_cols, in_cols, parent ? N : NULL,
+  N = _GD_ParseFieldSpec(D, &p, n_cols, in_cols, len0, parent ? N : NULL,
       N->fragment_index, 0, 0, &outstring, tok_pos);
 
-  /* The parser will have re-applied the prefix and suffix, undo that */
-  free(N->field);
-  N->field = new_code;
-
   free(outstring);
 
   if (D->error) {
-    dreturn("%i", -1); /* field spec parser threw an error */
-    return -1;
+    free(new_code);
+    GD_RETURN_ERROR(D); /* field spec parser threw an error */
   }
 
+  /* The parser will have re-applied the prefix and suffix, undo that */
+  free(N->field);
+  N->field = new_code;
+  N->e->len = len0;
+
   if (N->field_type == GD_LINCOM_ENTRY || N->field_type == GD_POLYNOM_ENTRY)
     move = 7;
 
diff --git a/src/move.c b/src/move.c
index 0b74cb1..f773b65 100644
--- a/src/move.c
+++ b/src/move.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2015 D. V. Wiebe
+/* Copyright (C) 2008-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -318,66 +318,50 @@ int _GD_StrCmpNull(const char *s1, const char *s2)
 static int _GD_Move(DIRFILE *D, gd_entry_t *E, int new_fragment, unsigned flags)
 {
   char *new_filebase, *new_code;
+  size_t new_len;
   struct gd_rename_data_ *rdat = NULL;
   int i;
 
   dtrace("%p, %p, %i, 0x%X", D, E, new_fragment, 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;
-  }
+  if ((D->flags & GD_ACCMODE) == GD_RDONLY)
+    GD_SET_RETURN_ERROR(D, GD_E_ACCMODE, 0, NULL, 0, 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,
+    GD_SET_RETURN_ERROR(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
         D->fragment[E->fragment_index].cname);
-    dreturn("%i", -1);
-    return -1;
   }
 
   /* Compose the field's new name */
 
   /* remove the old affixes */
-  new_filebase = _GD_MungeCode(D, NULL, 0,
-      D->fragment[E->fragment_index].prefix,
-      D->fragment[E->fragment_index].suffix, NULL, NULL, E->field, NULL,
-      NULL, GD_MC_RQ_PARTS);
+  new_filebase = _GD_StripCode(D, E->fragment_index, E->field, GD_CO_NSALL 
+      | GD_CO_ASSERT);
   
-  if (!new_filebase) {
-    _GD_InternalError(D); /* the prefix/suffix wasn't found */
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (!new_filebase) /* Alloc error */
+    GD_RETURN_ERROR(D);
 
   /* add the new affixes */
-  new_code = _GD_MungeCode(D, NULL, 0, NULL, NULL,
-      D->fragment[new_fragment].prefix, D->fragment[new_fragment].suffix,
-      new_filebase, NULL, NULL, GD_MC_RQ_PARTS);
+  new_code = _GD_BuildCode(D, new_fragment, NULL, 0, new_filebase,
+      E->flags & GD_EN_EARLY, NULL);
+  new_len = strlen(new_code);
 
-  if (strcmp(new_code, E->field)) {
+  if (new_len != E->e->len || memcmp(new_code, E->field, new_len)) {
     /* duplicate check */
-    if (_GD_FindField(D, new_code, D->entry, D->n_entries, 1, NULL)) {
+    if (_GD_FindField(D, new_code, new_len, 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;
+      GD_RETURN_ERROR(D);
     }
 
-    /* moving a field can't add or remove a field from the dot list, so
-     * we just set both old_dot and new_dot to one to ensure that the
-     * dot_list is resorted, if necessary */
-    rdat = _GD_PrepareRename(D, new_code, E, 1, 0, 1, flags);
+    rdat = _GD_PrepareRename(D, new_code, new_len, E, new_fragment, flags);
     if (rdat == NULL) {
       free(new_filebase);
-      free(new_code);
-      dreturn("%i", -1);
-      return -1;
+      GD_RETURN_ERROR(D);
     }
   } else {
     free(new_code);
@@ -400,9 +384,7 @@ static int _GD_Move(DIRFILE *D, gd_entry_t *E, int new_fragment, unsigned flags)
           new_filebase))
     {
       _GD_CleanUpRename(rdat, 1);
-      free(new_code);
-      dreturn("%i", -1);
-      return -1;
+      GD_RETURN_ERROR(D);
     }
   } else
     free(new_filebase);
@@ -411,19 +393,18 @@ static int _GD_Move(DIRFILE *D, gd_entry_t *E, int new_fragment, unsigned flags)
   D->fragment[E->fragment_index].modified = 1;
   D->fragment[new_fragment].modified = 1;
   D->flags &= ~GD_HAVE_VERSION;
-  E->fragment_index = new_fragment;
 
   /* update metadata */
+  E->fragment_index = new_fragment;
   for (i = 0; i < E->e->n_meta; ++i)
     E->e->p.meta_entry[i]->fragment_index = new_fragment;
 
-  _GD_PerformRename(D, rdat);
+  if (rdat)
+    _GD_PerformRename(D, rdat);
 
-  if (new_code) {
-    /* resort */
+  /* resort */
+  if (new_code)
     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;
@@ -437,33 +418,23 @@ int gd_move(DIRFILE *D, const char *field_code, int new_fragment,
 
   dtrace("%p, \"%s\", %i, 0x%X", D, field_code, new_fragment, flags);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  _GD_ClearError(D);
+  E = _GD_FindField(D, field_code, strlen(field_code), D->entry, D->n_entries,
+      0, NULL);
 
-  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, NULL);
+  if (E == NULL)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0,
+        field_code);
 
-  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_SET_RETURN_ERROR(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0,
+        "INDEX");
 
-  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_SET_RETURN_ERROR(D, GD_E_BAD_INDEX, 0, NULL, new_fragment, NULL);
 
-  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) {
+  if (E->fragment_index == new_fragment) {
     dreturn("%i", 0);
     return 0;
   }
diff --git a/src/name.c b/src/name.c
index e6dc4c5..f1d60b5 100644
--- a/src/name.c
+++ b/src/name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2010-2015 D. V. Wiebe
+/* Copyright (C) 2008, 2010-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,245 +20,563 @@
  */
 #include "internal.h"
 
-/* compose/modify a field code.  This function takes care of adding and
- * removing affixes and namespaces */
-char *_GD_MungeCode(DIRFILE *D, const char *ns, size_t len_newns,
-    const char *old_prefix, const char *old_suffix, const char *new_prefix,
-    const char *new_suffix, const char *code, char **nso, int *offset,
-    unsigned flags)
+/* Given str with length len, find the last '.' and last '/'.  Points *dot
+ * and *slash to the character in question, or NULL if not found.  Also detects
+ * a representation suffix.  Returns the suffix (cast to an int) or 0 if no
+ * suffix was found.  This functions never fails.
+ *
+ * flags are _GD_CodeOffset flags.  Specifically:
+ *
+ * GD_CO_EARLY:  (indicating DSV 5 or earlier) dots is always NULL and
+ *               no representation suffix (return value always zero)
+ * GD_CO_NAME:   no representation suffix (return value always zero)
+ * GD_CO_REPRZ:  '.z' is a valid representation suffix (ie. DSV 10 or later)
+ */
+int _GD_SlashDot(const char *str, size_t len, unsigned flags, const char **dot,
+    const char **slash)
+{
+  const char *ptr;
+  int repr = 0;
+  const int early = flags & GD_CO_EARLY;
+
+  dtrace("%p(\"%s\"), %" PRIuSIZE ", 0x%X, %p, %p", str, str, len, flags, dot,
+      slash);
+
+  /* Record a representation suffix -- not supported by early standards
+   * and not allowed in a field name */
+  if (!(flags & (GD_CO_EARLY | GD_CO_NAME)) && len > 2 && str[len - 2] == '.')
+    if (str[len - 1] == 'r' ||
+        str[len - 1] == 'i' ||
+        str[len - 1] == 'm' ||
+        str[len - 1] == 'a' ||
+        (flags & GD_CO_REPRZ && str[len - 1] == 'z'))
+    {
+      repr = str[len - 1];
+      len -= 2;
+    }
+  
+  *dot = *slash = NULL;
+  for (ptr = str + len - 1; ptr >= str; --ptr) {
+    if (!early && *dot == NULL && *ptr == '.')
+        *dot = ptr;
+
+    if (*slash == NULL && *ptr == '/') {
+      /* If dot is already non-NULL, then there's either:
+       *
+       *   Situation 1: a dot in the subfield name, or else:
+       *   Situation 2: a slash in the namespace.
+       *
+       * Neither of these has ever been allowed by the standards: slash has
+       * always been a prohibited character; dot was allowed until DSV 5, but
+       * metafields weren't introduced until DSV 6.
+       *
+       * We assume we're in the the former situation.  It's "somewhat less" of
+       * a syntax error.)  So, forget the dot(s) seen earlier.
+       */
+      if (*dot)
+        *dot = NULL;
+      *slash = ptr;
+    }
+    if (*slash && (early || *dot))
+      break;
+  }
+
+  dreturn("0x%02X (%p, %p)", repr, *dot, *slash);
+  return repr;
+}
+
+/* This function computes the offset of the parts of a field code, as well
+ * as, optionally, verifying that the right bits are there. This is performed
+ * in the context of a particular fragment.  For a fragment F (=index), with
+ * parent P, a field code has this form:
+ *
+ *     AAAA.BBBB.CCCC.DDDDEEEEGGGGHHHHIIII/KKKK.M0
+ *     ^    ^    ^    ^   ^   ^   ^   ^   ^    ^^
+ *     0    b    c    d   e   g   h   i   k    lm
+ *
+ * where:
+ *
+ * AAAA.  is P's root namespace
+ * BBBB.  is F's local rootspace (in F's /INCLUDE statement)
+ * CCCC.  is the subspace under F's rootspace
+ * DDDD   is P's prefix
+ * EEEE   is F's local prefix (the part in F's /INCLUDE statement)
+ * GGGG   is the field name (or the parent's name for a metafield).  If
+ *        this field is defined in a subfragment, this may include more affixes.
+ *        This is the only required part.
+ * HHHH   is F's local suffix (again the part in F's /INCLUDE statement)
+ * IIII   is P's suffix
+ * /KKKK  is the subfield's name, if applicable
+ * .M     is the representation suffix, if any.
+ * 0      is the terminating NUL byte
+ *
+ * If successful, the function fills the passed offset[] with the following:
+ *   offset[0] = b: the start of F's namespace.  If AAAA. is missing, this
+ *                  is zero.
+ *   offset[1] = c: the character after F's namespace.  If BBBB. is missing,
+ *                  this equals b.
+ *   offset[2] = d: the first character after all the namespaces.  If CCCC. is
+ *                  empty, this equals c.
+ *   offset[3] = e: the start of F's local prefix.  If DDDD is empty,
+ *                  this equals d
+ *   offset[4] = g: the character after F's local prefix.  If EEEE is empty,
+ *                  this equals e
+ *   offset[5] = h: the start of F's local suffix.  If HHHH is empty, this
+ *                  equals i.
+ *   offset[6] = i: the character after F's local suffix.  If IIII is empty,
+ *                  this equals k.
+ *   offset[7] = k: the character after the last suffix.  If /KKKK is present,
+ *                  this points to the '/' character, otherwise this equals l.
+ *   offset[8] = l: the character after the whole field name.  If there is a
+ *                  representation suffix, this points to the '.' character.
+ *                  If there's no representation suffix, this equals m.
+ *   offset[9] = m: is strlen(code);
+ *
+ * Flags used are:
+ *
+ * GD_CO_NAME, GD_CO_RERPZ: passed on to _GD_SlashDot (q.v.)
+ * GD_CO_EARLY:             the code came from DSV <= 5: no namespaces
+ * GD_CO_CHECK:             check that the fragment affixes are present
+ *
+ * This function returns 0 if the checks all pass (or weren't run); 1 otherwise
+ */
+int _GD_CodeOffsets(DIRFILE *D, int index, const char *code, unsigned flags,
+    size_t offset[GD_N_CODEOFFSETS])
+{
+  int ret = 0, repr;
+  const char *dot = NULL, *slash = NULL;
+  const struct gd_fragment_t *F, *P;
+
+  dtrace("%p, %i, \"%s\", 0x%X, %p", D, index, code, flags, offset);
+
+  F = D->fragment + index;
+  if (index == 0)
+    P = D->fragment + 0;
+  else
+    P = D->fragment + F->parent;
+
+  offset[9] = strlen(code);
+
+  if (flags & GD_CO_EARLY)
+    offset[0] = offset[1] = 0;
+  else {
+    offset[0] = P->nsl; /* Length of parent namespace */
+    if (offset[0])
+      offset[0]++; /* for the trailing '.' */
+
+    offset[1] = F->nsl; /* Length of F's local namespace */
+    if (offset[1])
+      offset[1]++; /* Again, for the trailing '.' */
+  }
+
+  /* Find the last dot and the last slash */
+  repr = _GD_SlashDot(code + offset[1], offset[9] - offset[1], flags, &dot,
+      &slash);
+
+  if (repr)
+    offset[8] = offset[9] - 2;
+  else
+    offset[8] = offset[9];
+
+  if (dot == NULL) /* No dot (i.e. AAAA. is missing) */
+    offset[2] = offset[1];
+  else
+    offset[2] = dot - code + 1;
+
+  offset[3] = offset[2] + P->pxl;
+  offset[4] = offset[2] + F->pxl;
+
+  if (slash == NULL) /* Not a subfield */
+    offset[7] = offset[8];
+  else
+    offset[7] = slash - code;
+
+  offset[6] = offset[7] - P->sxl;
+  offset[5] = offset[7] - F->sxl;
+
+  if (flags & GD_CO_CHECK) {
+    /* Namespace present */
+    if (F->nsl && strncmp(code, F->ns, F->nsl))
+      ret = 1;
+    /* Namespace separated by a dot */
+    else if (offset[1] && code[offset[1] - 1] != '.')
+      ret = 2;
+    /* Prefix present */
+    else if (F->pxl && strncmp(code + offset[2], F->px, F->pxl))
+      ret = 3;
+    /* Suffix present */
+    else if (F->sxl && strncmp(code + offset[7] - F->sxl, F->sx, F->sxl))
+      ret = 4;
+  }
+
+  dreturn("%i (%" PRIuSIZE ", %" PRIuSIZE ", %" PRIuSIZE ", %" PRIuSIZE ", %"
+      PRIuSIZE ", %" PRIuSIZE ", %" PRIuSIZE ", %" PRIuSIZE ", %" PRIuSIZE ", %"
+      PRIuSIZE ")", ret, offset[0], offset[1], offset[2], offset[3], offset[4],
+      offset[5], offset[6], offset[7], offset[8], offset[9]);
+
+  return ret;
+}
+
+/* Strips affixes (and, optionally, namespaces) from a code.  Returns a
+ * newly malloc'd string, or NULL on error.  Also usually strips the
+ * representation suffix.
+ *
+ * Flags are:
+ *
+ * GD_CO_NSALL:  remove all namespaces
+ * GD_CO_NSROOT: remove only index's root namespace
+ * GD_CO_ASSERT: if the code doesn't have the right parts, raise
+ *                  GD_E_INTERNAL_ERROR
+ * GD_CO_CHECK:  if the code doesn't have the right parts, raise
+ *                  GD_E_BAD_CODE
+ * GD_CO_EARLY:  field code comes from DSV <= 5: '.' doesn't denote namespace
+ * GD_CO_REPR:   don't strip the representation suffix.  Also, if the code is
+ *               ambiguous (name.r), add a disambiguating ".z" to it.
+ * GD_CO_REPRZ:  '.z' is a valid representation suffix (ie. DSV 10 or later)
+ */
+char *_GD_StripCode(DIRFILE *D, int index, const char *code, unsigned flags)
 {
-  size_t len, len_oldpx = 0, len_oldsx = 0, len_newpx, len_newsx;
-  size_t len_sub = 0, len_oldns;
-  const char *ptr, *slash, *old_ns;
-  char *new_code, *nptr;
+  size_t ns_start, len, offset[GD_N_CODEOFFSETS];
+  char add_repr = 0;
+  char *stripped = NULL, *ptr;
+
+  dtrace("%p, %i, \"%s\", 0x%X", D, index, code, flags);
 
-  dtrace("%p, \"%s\", %" PRIuSIZE ", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", "
-      "%p, 0x%X", D, ns, len_newns, old_prefix, old_suffix, new_prefix,
-      new_suffix, code, nso, flags);
+  if (flags & GD_CO_ASSERT)
+    flags |= GD_CO_CHECK;
 
-  if (code == NULL) {
+  /* Slice and dice */
+  if (_GD_CodeOffsets(D, index, code, flags, offset)) {
+    if (flags & GD_CO_ASSERT)
+      _GD_InternalError(D);
+    else
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, code);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  old_ns = code;
-  len = strlen(code);
-
-  /* Check for a required namespace.  In this case, the supplied 'ns' is the
-   * namespace to check for and is not later prepended */
-  if (flags & GD_MC_CHECK_NS && ns) {
-    if (len <= len_newns || strncmp(ns, code, len_newns) ||
-        code[len_newns] != '.')
-    {
-      /* namespace missing */
-      if (flags & GD_MC_RQ_PARTS) {
-        if (flags & GD_MC_ERROR_OK)
-          _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID_NS, NULL, 0, code);
-        else
-          _GD_InternalError(D);
+  /* Namespace start depends on flags */
+  if (flags & GD_CO_NSALL) /* strip all namespaces */
+    ns_start = offset[2]; 
+  else if (flags & GD_CO_NSROOT) /* strip fragment rootspace */
+    ns_start = offset[1];
+  else /* Strip no namespace */
+    ns_start = 0;
+
+  /* Calculate length */
+  len = offset[2] - ns_start + offset[5] - offset[4] /* NS part + BBBB */
+    + offset[8] - offset[7]; /* subfield name (including '/') */
+
+  /* Figure out if this code needs a representation suffix */
+  if (flags & GD_CO_REPR) {
+    if (offset[8] != offset[9] && code[offset[9] - 1] != 'z') {
+      /* we have a "do something" repr, remember it */
+      add_repr = code[offset[9] - 1];
+    } else if (flags & GD_CO_REPRZ) {
+      size_t namelen;
+      char name0;
+      /* repr is currently none (either absent or .z).  Is this code
+       * ambiguous?  Look for a single-character name that is 'r' or 'i'
+       * or 'a' or 'm' */
+
+      if (offset[8] > offset[7]) { /* check subfield name */
+        name0 = code[offset[7] + 1];
+        namelen = offset[8] - offset[7] - 1;
+      } else { /* top-level name */
+        name0 = code[offset[4]];
+        namelen = offset[5] - offset[4];
       }
-      dreturn("%p", NULL);
-      return NULL;
-    }
-    /* don't re-add it if it's there already */
-    ns = NULL;
-  }
 
-  /* find the length of the current namespace tag */
-  if (flags & GD_MC_NO_NS)
-    len_oldns = 0;
-  else
-    for (len_oldns = len; len_oldns > 0; --len_oldns)
-      if (code[len_oldns - 1] == '.')
-        break;
-
-  code += len_oldns;
-  len -= len_oldns;
-
-  /* Verify the old prefix is present */
-  if (old_prefix) {
-    len_oldpx = strlen(old_prefix);
-    if (strncmp(old_prefix, code, len_oldpx)) {
-      /* prefix missing */
-      if (flags & GD_MC_RQ_PARTS) {
-        if (flags & GD_MC_ERROR_OK)
-          _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, code);
-        else
-          _GD_InternalError(D);
+      if (namelen == 1 && (name0 == 'r' || name0 == 'i' || name0 == 'a'
+            || name0 == 'm'))
+      {
+        add_repr = 'z';
       }
-      dreturn("%p", NULL);
-      return NULL;
     }
-    ptr = code + len_oldpx;
-    len -= len_oldpx;
-  } else {
-    ptr = code;
-    len_oldpx = 0;
   }
 
-  /* 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))) {
-    len_sub = len + (ptr - slash);
-    len = slash - ptr;
+  if (add_repr)
+    len += 2;
+
+  stripped = _GD_Malloc(D, len + 1); /* including trailing nul */
+  if (stripped == NULL) {
+    dreturn("%p", NULL);
+    return NULL;
   }
 
-  /* Verify the suffix is present */
-  if (old_suffix) {
-    len_oldsx = strlen(old_suffix);
-    if (strncmp(old_suffix, ptr + len - len_oldsx, len_oldsx)) {
-      /* suffix missing */
-      if (flags & GD_MC_RQ_PARTS) {
-        if (flags & GD_MC_ERROR_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 -= len_oldsx;
+  /* Now compose the stripped name.  First the namespace part */
+  if (ns_start < offset[2]) {
+    memcpy(stripped, code + ns_start, offset[2] - ns_start);
+    ptr = stripped + offset[2] - ns_start;
   } else
-    len_oldsx = 0;
+    ptr = stripped;
 
-  /* In this case, we're using MungeCode to verify affixes are present, so
-   * nothing more to do, return input code */
-  if (flags & GD_MC_NO_ALLOC) {
-    dreturn("%p", code);
-    return (char*)code;
+  /* BBBB */
+  memcpy(ptr, code + offset[4], offset[5] - offset[4]);
+  ptr += offset[5] - offset[4];
+
+  /* subfield name and '/' */
+  if (offset[7] != offset[8])
+    memcpy(ptr, code + offset[7], offset[8] - offset[7]);
+
+  /* representation suffix if any.  We only add a '.z' if it's necessary */
+  if (add_repr) {
+    stripped[len - 1] = add_repr;
+    stripped[len - 2] = '.';
   }
 
-  if (new_prefix)
-    len_newpx = strlen(new_prefix);
-  else
-    len_newpx = 0;
+  /* Terminate */
+  stripped[len] = 0;
 
-  if (new_suffix)
-    len_newsx = strlen(new_suffix);
-  else
-    len_newsx = 0;
+  dreturn("\"%s\"", stripped);
+  return stripped;
+}
 
-  if (ns == NULL)
-    len_newns = 0;
+/* Given a field code, add all the bits dictated by the specified fragment,
+ * and also possibly a subnamespace.  Returns a malloc'd string or NULL on
+ * error.
+ *
+ * The input code looks like this:
+ *
+ *     [.][AAAA.]BBBB[/CCCC][.R]
+ *
+ * where AAAA. is an optional attached subspace, /CCCC is only found in
+ * metafields, .R is an optional representation suffix, and a leading dot
+ * indicates the code is relative to the fragment's rootspace.  This function
+ * returns a newly-malloc'd buffer containing:
+ *
+ *     NN.[NS.][AAAA.]PPBBBBSS[/CCCC][.R]
+ *
+ * where NN, PP, SS are the parts from the fragment, and NS. is added only
+ * if the passed ns is non-NULL and the original code didn't have a leading
+ * dot.  The dot following NN is omitted if NN is empty.
+ *
+ * If nons is non-zero, then we're in strict mode with DSV <= 9, meaning no
+ * namespaces.  If it's <= DSV 5, then embedded '.' will be allowed as part of
+ * a field code, otherwise they'll cause a failure later because they're invalid
+ * characters.  In this case, NN. and NS. are always ignored, and there's
+ * never an AAAA.
+ *
+ * If offset is non-NULL, it's the offset to the first part of the field name
+ * (the first character of PPBBBBSS).  This is used in the parser to quickly
+ * find the field name which requires validation during field code composition.
+ * In this case, it's guaranteed that /CCCC is missing.
+ */
+char *_GD_BuildCode(DIRFILE *D, int index, const char *ns, size_t nslen,
+    const char *code, int nons, size_t *offset)
+{
+  char *newcode = NULL, *ptr;
+  const char *dot, *slash, *frag_ns, *name;
+  size_t frag_nsl, len, newlen;
+  int repr;
 
-  /* for the '.' */
-  if (len_newns)
-    len_newns++;
+  dtrace("%p, %i, \"%s\", %" PRIuSIZE ", \"%s\", %i, %p", D, index, ns, nslen,
+      code, nons, offset);
 
-  if ((new_code = _GD_Malloc(D, len_newns + len_oldns + len_newpx + len +
-          len_newsx + len_sub + 1)) == NULL)
-  {
+  if (nons) { /* No namespaces allowed! */
+    frag_ns = ns = NULL;
+    frag_nsl = nslen = 0;
+  } else {
+    frag_ns = D->fragment[index].ns;
+    frag_nsl = D->fragment[index].nsl;
+
+    if (code[0] == '.') {
+      /* If the input code is root-absolute, discard the subnamespace (and also
+       * the initial dot). */
+      code++;
+      ns = NULL;
+      nslen = 0;
+    }
+  }
+
+  if (nslen)
+    nslen++; /* for the '.' */
+
+  len = strlen(code);
+
+  newlen = len + frag_nsl + nslen + D->fragment[index].pxl +
+    D->fragment[index].sxl;
+  if (frag_nsl)
+    newlen++; /* for the '.' */
+  
+  if (newlen == len) { /* no change except maybe a removed initial '.' */
+    newcode = _GD_Strdup(D, code);
+
+    /* If we were passed offset (which only occurs in the parser), we have to do
+     * this, I guess */
+    if (newcode && offset) {
+      repr = _GD_SlashDot(newcode, len, nons ? GD_CO_EARLY : 0, &dot, &slash);
+      if (dot)
+        *offset = dot - newcode + 1; /* Advance past the '.' */
+      else
+        *offset = 0;
+    }
+
+    dreturn("%p", newcode); /* will be NULL on error */
+    return newcode;
+  }
+
+  ptr = newcode = _GD_Malloc(D, newlen + 1);
+  if (newcode == NULL) {
     dreturn("%p", NULL);
     return NULL;
   }
 
-  /* compose the new code */
-  nptr = new_code;
-  if (len_newns > 0) {
-    strcpy(nptr, ns);
-    nptr[len_newns - 1] = '.';
-    nptr += len_newns;
+  /* Compose.  First, NN. */
+  if (frag_nsl) {
+    memcpy(ptr, frag_ns, frag_nsl);
+    ptr[frag_nsl] = '.';
+    ptr += frag_nsl + 1;
   }
 
-  if (len_oldns > 0) {
-    strncpy(nptr, old_ns, len_oldns);
-    nptr += len_oldns;
+  /* Now NS. */
+  if (nslen) {
+    memcpy(ptr, ns, nslen - 1);
+    ptr[nslen - 1] = '.';
+    ptr += nslen;
   }
 
-  if (len_newpx > 0) {
-    strcpy(nptr, new_prefix);
-    nptr += len_newpx;
+  repr = _GD_SlashDot(code, len, nons ? GD_CO_EARLY : 0, &dot, &slash);
+
+  if (repr) /* forget about the representation suffix */
+    len -= 2;
+
+  /* Now AAAA. */
+  if (dot) {
+    size_t aalen = dot - code + 1; /* +1 to include the '.' */
+    memcpy(ptr, code, aalen);
+    ptr += aalen;
+    code += aalen; /* Now code points to BBBB in the input string */
+    len -= aalen; /* ... and len reflects the loss of AAAA. */
   }
 
-  strncpy(nptr, ptr, len);
-  nptr += len;
+  /* Offset should point here, if present */
+  name = ptr;
 
-  if (len_newsx > 0) {
-    strcpy(nptr, new_suffix);
-    nptr += len_newsx;
+  /* Now PP */
+  if (D->fragment[index].pxl) {
+    memcpy(ptr, D->fragment[index].px, D->fragment[index].pxl);
+    ptr += D->fragment[index].pxl;
   }
 
+  /* Now BBBB.  This is the only part guaranteed to exist. */
   if (slash) {
-    strcpy(nptr, slash);
-    nptr += len_sub;
+    /* Don't copy /CCCC */
+    size_t bblen = slash - code;
+    memcpy(ptr, code, bblen);
+    ptr += bblen;
+  } else {
+    /* No /CCCC to worry about: copy it all */
+    memcpy(ptr, code, len);
+    ptr += len;
+  }
+
+  /* Now SS */
+  if (D->fragment[index].sxl) {
+    memcpy(ptr, D->fragment[index].sx, D->fragment[index].sxl);
+    ptr += D->fragment[index].sxl;
   }
 
-  *nptr = '\0';
+  /* At this point, we check if PPBBBBSS is "INDEX" and if so, drop all the
+   * namespaces (including the AAAA. which was specified with the code itself).
+   */
+  if (ptr - name == 5 && strncmp(name, "INDEX", 5) == 0 && name != newcode) {
+    /* release the memory we don't need anymore.  It doesn't matter what
+     * newcode contained.  We know now that all it should contain is "INDEX". */
 
-  /* A field called "INDEX" can never take a namespace.   We have to check this
-   * late because the field name "INDEX" could be built up via /INCLUDE affixes
-   * (as crazy as that may be) */
-  if (len_newns + len_oldns > 0 &&
-      strncmp(new_code + len_newns + len_oldns, "INDEX", 5) == 0
-      && (new_code[len_newns + len_oldns + 5] == '\0'
-        || new_code[len_newns + len_oldns + 5] == '/'))
-  {
-    char *index = _GD_Strdup(D, new_code + len_newns + len_oldns);
-    free(new_code);
-    if (index == NULL) {
+    /* recompute length -- not just =5, because INDEX can have
+     * subfield and/or representation suffixes. */
+    newlen -= name - newcode;
+
+    free(newcode);
+    newcode = _GD_Malloc(D, newlen + 1);
+    if (newcode == NULL) {
       dreturn("%p", NULL);
       return NULL;
     }
-
-    new_code = index;
+    memcpy(newcode, "INDEX", 5);
+    ptr = newcode + 5;
+    name = newcode; /* for the *offset calculation later */
   }
-
-  if (nso)
-    *nso = new_code + len_newns + len_oldns;
   
-  if (offset)
-    *offset = len_newns + len_oldns;
+  /* Now /CCCC */
+  if (slash) {
+    size_t cclen = code + len - slash;
+    memcpy(ptr, slash, code + len - slash);
+    ptr += cclen;
+  }
+
+  /* Finally, the representation suffix, if present, and then the NUL */
+  if (repr) {
+    ptr[0] = '.';
+    ptr[1] = (char)repr;
+    ptr[2] = 0;
+  } else
+    *ptr = 0;
 
-  dreturn("\"%s\" (%i, %p)", new_code, offset ? *offset : -1,
-      nso ? *nso : NULL);
-  return new_code;
+  if (offset)
+    *offset = name - newcode;
+  
+  dreturn("\"%s\"", newcode);
+  return newcode;
 }
 
 /* Return non-zero if the a field code doesn't contain the correct affixes or
  * namespace. */
 int _GD_CheckCodeAffixes(DIRFILE *D, const char *field_code, int fragment,
-    int set_error)
+    unsigned flags)
 {
-  dtrace("%p, \"%s\", %i, %i", D, field_code, fragment, set_error);
+  size_t offset[GD_N_CODEOFFSETS];
+
+  dtrace("%p, \"%s\", %i, 0x%X", D, field_code, fragment, flags);
 
   if (field_code == NULL) {
     dreturn("%i", 0);
     return 0;
   }
 
-  if (_GD_MungeCode(D, D->fragment[fragment].ns, D->fragment[fragment].nsl,
-      D->fragment[fragment].prefix, D->fragment[fragment].suffix, NULL, NULL,
-      field_code, NULL, NULL, GD_MC_NO_ALLOC | GD_MC_CHECK_NS |
-      (set_error ? (GD_MC_RQ_PARTS | GD_MC_ERROR_OK) : 0)))
-  {
-    /* success */
-    dreturn("%i", 0);
-    return 0;
+  if (_GD_CodeOffsets(D, fragment, field_code, flags | GD_CO_CHECK, offset)) {
+    if (flags & GD_CO_ERROR)
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, field_code);
+    dreturn("%i", 1);
+    return 1;
   }
 
-  dreturn("%i", 1);
-  return 1;
+  dreturn("%i", 0);
+  return 0;
 }
 
-/* Check for a valid name -- returns 1 on error */
-int _GD_ValidateField(const char* field_code, int standards, int strict,
-    unsigned type, int* is_dot)
+/* Check for a code -- returns 1 on error.
+ * type is one of:
+ *
+ * GD_VF_CODE:  check a full field code
+ * GD_VF_NS:    check a namespace
+ * GD_VF_AFFIX: check an affix
+ * GD_VF_NAME:  check a field name - used only for new fields (mostly by
+ *              the parser)
+ *
+ * If type is GD_VF_NAME or GD_VF_CODE, and standards <= 5, and early is
+ * non-NULL, then it is set to 1 if the passed code contains a '.'.  This
+ * is used by the parser to flag fields which are incompatible with namespaces.
+ * They will be placed in the nullspace and flagged with GD_EN_EARLY.
+ */
+int _GD_ValidateField(const char* field_code, size_t nsl, int standards,
+    int strict, unsigned type)
 {
-  const size_t len = strlen(field_code);
-  size_t i;
-  int local_dot = 0, last_dot;
+  size_t len, i;
+  int last_dot = 0;
 
-  dtrace("\"%s\", %i, %i, %u, %p", field_code, standards, strict, type,
-      is_dot);
+  dtrace("\"%s\", %" PRIuSIZE ", %i, %i, %u", field_code, nsl, standards,
+      strict, type);
 
-  /* field codes may not start with a dot */
-  last_dot = (type == GD_VF_CODE && (!strict || standards >= 10)) ? 1 : 0;
+  len = strlen(field_code);
 
-  if (is_dot)
-    *is_dot = 0;
+  /* starting with DSV 6, field codes may not start with a dot, so last_dot is
+   * one to start.  Namespaces and affixes never were allowed to do this. */
+  if ((type == GD_VF_NS || type == GD_VF_AFFIX) || (strict && standards >= 6))
+    last_dot = 1;
 
+  /* Check name length.  Also fail on empty filed name */
   if ((type == GD_VF_NAME) && (field_code[0] == '\0' || (strict &&
           ((len > 50 && standards < 5) || (len > 16 && standards < 3)))))
   {
@@ -266,6 +584,7 @@ int _GD_ValidateField(const char* field_code, int standards, int strict,
     return 1;
   }
 
+  /* Find prohibited characters */
   for (i = 0; i < len; ++i)
     if (field_code[i] == '/' || (
           field_code[i] < 0x20
@@ -293,14 +612,15 @@ int _GD_ValidateField(const char* field_code, int standards, int strict,
           dreturn("%i [d]", 1);
           return 1;
         }
-        last_dot = 1;
-      } else if (type == GD_VF_AFFIX || is_dot == NULL ||
-          (standards >= 6 && strict))
+      } else if (type == GD_VF_AFFIX ||     /* '.' prohibited in affixes, */
+                                    /* and in DSV >= 10 past the ns part, */
+          ((standards >= 10 && strict) && i >= nsl) ||
+          (standards >= 6 && standards < 10 && strict)) /* and in DSV 6-9 */
       {
         dreturn("%i [e]", 1);
         return 1;
-      } else
-        local_dot = 1;
+      }
+      last_dot = 1;
     } else
       last_dot = 0;
 
@@ -310,7 +630,8 @@ int _GD_ValidateField(const char* field_code, int standards, int strict,
     return 1;
   }
 
-  /* forbidden field names */
+  /* forbidden field names -- directives added after DSV 7 don't need to
+   * go in this list because DSV 8 made the slash mandatory. */
   if (type == GD_VF_NAME) {
     if (strict && standards < 8)
       if ((strcmp("FRAMEOFFSET", field_code) == 0 && standards >= 1)
@@ -327,292 +648,253 @@ int _GD_ValidateField(const char* field_code, int standards, int strict,
       }
   }
 
-  if (is_dot)
-    *is_dot = local_dot;
-
-  dreturn("%i (%i)", 0, local_dot);
+  dreturn("%i", 0);
   return 0;
 }
 
-/* Compare field codes candidate and code. Returns:
- * 0    if they're identical
- * '.'  if they're the same code, but candidate has a representation suffix
- * '/'  if candidate is a subfield of code
- * -1   otherwise
+/* Given a field code, determine whether it needs to be updated.  If it does,
+ * and updb is non-zero, add a record to the rename data list; otherwise, do
+ * nothing.  If the renamed field is a metafield, meta is non-zero.
+ *
+ * Returns non-zero on error.
+ *
+ * For any updated field, this function replaces CCCC., GGGG, and/or /KKKK
+ * with new bits.  This is the complement of _GD_UpdateCode in fragment.c, which
+ * replaces BBBB. and EEEE, and HHHH but leaves the rest unchanged.  (AAAA.,
+ * DDDD, and IIII are immutable, because they come from the parent's scope.)
+ *
+ * NB: Not all matching codes can be updated.  Consider the following:
+ *
+ * Suppose a field (with attached subspace) named "AA.BBCCDD" is going to be
+ * renamed to "EE.FF".  If it's in a fragment with rootspace "GG",
+ * prefix "HH", suffix "II" then the full rename request looks like:
+ *
+ *              GG.AA.HHBBCCDDII -> GG.EE.HHFFII
+ *
+ * A (bare) field code "CC" in a different fragment with rootspace "GG.AA.",
+ * prefix "HHBB" and suffix "DDII" will also have the fully-formed field code
+ * "GG.AA.HHBBCCDDII", but the rename doesn't happen here, because the affixes
+ * don't match.
+ *
+ * In this case, if GD_REN_FORCE is set, the update is skipped and the code
+ * remains the old "GG.AA.HHBBCCDDII", which is later stored as "CC" in the
+ * format metadata, as before.  If GD_REN_FORCE is unset, the rename fails.
+ *
+ * This situation can't occur with metafield renames because their names (the
+ * part after the '/') never contains namespaces or affixes.
  */
-static int _GD_MatchCode(const char *candidate, const char *code, size_t len,
-    int meta_ok)
+static int _GD_RenameCode(DIRFILE *D, gd_entry_t *E, char **code,
+    size_t *len, int updb, int force, struct gd_rename_data_ *rdat)
 {
-  int c;
+  size_t end, offset[GD_N_CODEOFFSETS];
+  char *new_code;
+  const unsigned early = (E->flags & GD_EN_EARLY) ? GD_CO_EARLY : 0;
 
-  dtrace("\"%s\", \"%s\", %" PRIuSIZE ", %i", candidate, code, len,
-      meta_ok);
+  dtrace("%p, %p, %p, %p, %i, %i, %p", D, E, code, len, updb, force, rdat);
 
-  if (strncmp(candidate, code, len)) {
-    /* field not matched */
-    dreturn("%i (m)", -1);
-    return -1;
-  }
-
-  /* partial match only */
-  c = candidate[len];
-  if (c && c != '.' && (!meta_ok || c != '/')) {
-    dreturn("%i (p)", -1);
-    return -1;
-  }
+  /* Cut up the old code */
+  _GD_CodeOffsets(D, E->fragment_index, *code, early, offset);
 
-  dreturn("%i", c);
-  return c;
-}
-
-int _GD_MakeNewCode(DIRFILE *D, const char *old_code, int frag,
-    const gd_entry_t *E, int repr, int c, struct gd_rename_data_ *rdat)
-{
-  char **ptr, *base_code;
-  int ret = 0;
-
-  dtrace("%p, \"%s\", %i, %p, %i, %i, %p", D, old_code, frag, E, repr, c, rdat);
+  /* If we're renaming a metafield, match everything up to the end of the
+   * subfield, otherwise match only the parent. */
+  if (rdat->flags & GD_REN_META)
+    end = offset[8];
+  else
+    end = offset[7];
 
-  if ((ptr = _GD_Realloc(D, rdat->code_list, sizeof(*ptr) * (rdat->n_code + 1)))
-      == NULL)
-  {
-    dreturn("%i", -1);
-    return -1;
+  /* Try to match */
+  if (end != rdat->old_len || strncmp(*code, rdat->old_name, end)) {
+    /* No match */
+    dreturn("%i", 0);
+    return 0;
   }
-  rdat->code_list = ptr;
 
-  /* extract representation suffix, if necessary (if c is nil, we already
-   * know there's no representation) */
-  if (E == NULL && (c == '.' || c == '/')) {
-    repr = _GD_GetRepr(D, old_code, &base_code, 0);
-    if (D->error) {
+  /* Successful, match. */
+  if (!updb) {
+    /* No update required (just needed to check for match) */
+    dreturn("%i", 0);
+    return 0;
+  }
+  
+  /* For moves (dst_frag != -1), use UpdateCode to make the new code. */
+  if (rdat->dst_frag != -1) {
+    new_code = _GD_UpdateCode(D, rdat->src_frag, *code, early,
+        D->fragment[rdat->dst_frag].ns, D->fragment[rdat->dst_frag].nsl,
+        D->fragment[rdat->dst_frag].px, D->fragment[rdat->dst_frag].pxl,
+        D->fragment[rdat->dst_frag].sx, D->fragment[rdat->dst_frag].sxl);
+    if (new_code == NULL) {
       dreturn("%i", -1);
       return -1;
     }
-  } else
-    base_code = (char*)old_code;
-
-  if (c == '/') { /* a meta subfield of the field we're renaming */
-    size_t base_len = strlen(base_code);
-    rdat->code_list[rdat->n_code] = (char*)_GD_Malloc(D, base_len +
-        rdat->new_len - rdat->old_len + ((repr == GD_REPR_NONE) ? 1 : 3));
-    if (D->error) {
-      ret = -1;
-      goto DONE;
-    }
-    sprintf(rdat->code_list[rdat->n_code], "%s%s%s", rdat->new_code,
-        base_code + rdat->old_len,
-        (repr == GD_REPR_NONE) ? "" : (repr == GD_REPR_REAL) ? ".r" :
-        (repr == GD_REPR_IMAG) ? ".i" : (repr == GD_REPR_MOD) ? ".m" : ".a");
   } else {
-    rdat->code_list[rdat->n_code] = (char*)_GD_Malloc(D, rdat->new_len +
-        ((repr == GD_REPR_NONE) ? 1 : 3));
-    if (D->error) {
-      ret = -1;
-      goto DONE;
+    /* Otherwise, create the new code by hand. */
+    size_t new_len = rdat->new_len + offset[9] - end + 1;
+    new_code = _GD_Malloc(D, new_len);
+    if (new_code == NULL) {
+      dreturn("%i", -1);
+      return -1;
     }
-    sprintf(rdat->code_list[rdat->n_code], "%s%s", rdat->new_code,
-        (repr == GD_REPR_NONE) ? "" : (repr == GD_REPR_REAL) ? ".r" :
-        (repr == GD_REPR_IMAG) ? ".i" : (repr == GD_REPR_MOD) ? ".m" : ".a");
-  }
-  /* check that we haven't made a code that's invalid in the destination
-   * fragment
-   */
-  if (_GD_CheckCodeAffixes(D, rdat->code_list[rdat->n_code], frag,
-        !(rdat->flags & GD_REN_FORCE)))
-  {
-    free(rdat->code_list[rdat->n_code]);
-    if (rdat->flags & GD_REN_FORCE) {
-      rdat->code_list[rdat->n_code] = NULL;
-      rdat->n_code++;
-    } else
-      ret = -1;
-  } else
-    rdat->n_code++;
+    memcpy(new_code, rdat->new_name, rdat->new_len);
+    memcpy(new_code + rdat->new_len, *code + end, offset[9] - end + 1);
 
-DONE:
-  /* clean up after GetRepr */
-  if (base_code != old_code)
-    free(base_code);
-
-  dreturn("%i", ret);
-  return ret;
-}
+    /* For renames, verify that it's good -- _GD_BuildCode has already done this
+     * for moves. */
+    if (_GD_CodeOffsets(D, E->fragment_index, new_code, early | GD_CO_CHECK,
+          offset))
+    {
+      if (force) {
+        /* skip this code */
+        free(new_code);
+        dreturn("%i", 0);
+        return 0;
+      }
 
-static void _GD_SetNewCode(DIRFILE *D, char **code, int frag,
-    struct gd_rename_data_ *rdat)
-{
-  dtrace("%p, %p, %i, %p", D, code, frag, rdat);
+      /* otherwise, fail */
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, new_code);
+      free(new_code);
+      dreturn("%i", -1);
+      return -1;
+    }
+  }
 
-  /* a NULL here is a field we couldn't update but the rename was forced via
-   * GD_REN_FORCE
-   */
-  if (rdat->code_list[rdat->n_code]) {
-    D->fragment[frag].modified = 1;
-    free(*code);
-    *code = rdat->code_list[rdat->n_code];
+  /* Store the update in the struct */
+  if (rdat->up_size == rdat->n_up) {
+    void *ptr = _GD_Realloc(D, rdat->up,
+        (rdat->up_size *= 2) * sizeof rdat->up[0]);
+    if (ptr == NULL) {
+      free(new_code);
+      dreturn("%i", -1);
+      return -1;
+    }
+    rdat->up = ptr;
   }
-  rdat->n_code++;
+  rdat->up[rdat->n_up].index = E->fragment_index;
+  rdat->up[rdat->n_up].dst = code;
+  rdat->up[rdat->n_up].dst_len = len;
+  if (len)
+    rdat->up[rdat->n_up].new_len = strlen(new_code);
+  rdat->up[rdat->n_up++].new_code = new_code;
 
-  dreturnvoid();
+  dreturn("%i", 0);
+  return 0;
 }
 
-/* internal update flags */
-#define GD_UPDI 0x1 /* initialise */
-#define GD_UPDU 0x2 /* update */
-
-#define GD_UP_DO_CL 0
-#define GD_UP_IN_CL (GD_UPDI)
-#define GD_UP_DO_UP (GD_UPDU)
-#define GD_UP_IN_UP (GD_UPDI | GD_UPDU)
-static int _GD_UpdateScalar(DIRFILE *D, gd_entry_t *T,
-    struct gd_rename_data_ *rdat, int n, int search_meta, unsigned mode)
+/* Update E->scalar[n].  Returns non-zero on error */
+static int _GD_UpdateScalar(DIRFILE *D, gd_entry_t *E, int n, int updb,
+    int force, struct gd_rename_data_ *rdat)
 {
-  int c;
-
-  dtrace("%p, %p, %p, %i, %i, %u", D, T, rdat, n, search_meta, mode);
+  dtrace("%p, %p, %i, %i, %i, %p", D, E, n, updb, force, rdat);
 
   /* nothing to do */
-  if (T->scalar[n] == NULL) {
+  if (E->scalar[n] == NULL) {
     dreturn("%i (-)", 0);
     return 0;
   }
 
-  c = _GD_MatchCode(T->scalar[n], rdat->old_code, rdat->old_len, search_meta);
-  if (c < 0) {
-    dreturn("%i", 0);
-    return 0;
+  if (_GD_RenameCode(D, E, E->scalar + n, NULL, updb, force, rdat)) {
+    dreturn("%i", -1);
+    return -1;
   }
 
-  if (!(mode & GD_UPDI)) /* clear the cache */
-    T->flags &= ~GD_EN_CALC;
-
-  if (mode == GD_UP_IN_UP) { /* create new field codes */
-    if (_GD_MakeNewCode(D, T->scalar[n], T->fragment_index, NULL, 0, c, rdat)) {
-      dreturn("%i", -1);
-      return -1;
-    }
-  } else if (mode == GD_UP_DO_UP) /* move the new field codes into place */
-    _GD_SetNewCode(D, T->scalar + n, T->fragment_index, rdat);
+  /* Force recalculation */
+  E->flags &= ~GD_EN_CALC;
 
-  dreturn("%i (%i)", 0, rdat->n_code);
+  dreturn("%i", 0);
   return 0;
 }
 
-static int _GD_UpdateInField(DIRFILE *D, gd_entry_t *T,
-    struct gd_rename_data_ *rdat, int n, int search_meta, unsigned mode)
+/* Update E->in_field[n].  Returns non-zero on error */
+static int _GD_UpdateInField(DIRFILE *D, gd_entry_t *E, int n, int updb,
+    int force, struct gd_rename_data_ *rdat)
 {
-  int c;
-
-  dtrace("%p, %p, %p, %i, %i, %u", D, T, rdat, n, search_meta, mode);
-
-  c = _GD_MatchCode(T->in_fields[n], rdat->old_code, rdat->old_len,
-      search_meta);
-  if (c < 0) {
-    dreturn("%i", 0);
-    return 0;
-  }
+  dtrace("%p, %p, %i, %i, %i, %p", D, E, n, updb, force, rdat);
 
-  if (!(mode & GD_UPDI)) { /* clear the cache */
-    T->e->entry[n] = NULL;
-    if (T->field_type == GD_ALIAS_ENTRY)
-      T->e->entry[1] = NULL;
+  if (_GD_RenameCode(D, E, E->in_fields + n, NULL, updb, force, rdat)) {
+    dreturn("%i", -1);
+    return -1;
   }
 
-  if (mode == GD_UP_IN_UP) { /* create new field codes */
-    if (_GD_MakeNewCode(D, T->in_fields[n], T->fragment_index, T->e->entry[n],
-          T->e->repr[n], c, rdat))
-    {
-      dreturn("%i", -1);
-      return -1;
-    }
-  } else if (mode == GD_UP_DO_UP) /* move the new field codes into place */
-    _GD_SetNewCode(D, T->in_fields + n, T->fragment_index, rdat);
-
+  /* Clear the cached entry */
+  E->e->entry[n] = NULL;
 
-  dreturn("%i (%i)", 0, rdat->n_code);
+  dreturn("%i", 0);
   return 0;
 }
 
-/* search for and update field metadata to account for a renamed field -- this
- * is a combination of the old _GD_InvalidateVect and _GD_InvalidateConst */
-static int _GD_UpdateInputs(DIRFILE *D, struct gd_rename_data_ *rdat,
-    int perform)
+/* Search for and update field metadata to account for a renamed field */
+static int _GD_UpdateInputs(DIRFILE *D, struct gd_rename_data_ *rdat)
 {
   unsigned u;
   int i;
 
-  /* look for meta fields */
-  const int search_meta = (rdat->E->e->n_meta != -1);
+  /* this is a meta-field update */
+  const int meta = rdat->flags & GD_REN_META;
 
-  /* classes of things to update */
-  const int update_scalars = (search_meta ||
-      (rdat->E->field_type & GD_SCALAR_ENTRY_BIT));
-  const int update_vectors = (search_meta ||
-      !(rdat->E->field_type & GD_SCALAR_ENTRY_BIT));
-  const int update_aliases = !(rdat->flags & GD_REN_DANGLE);
+  /* Skip codes that can't be updated instead of failing */
+  const int force = rdat->flags & GD_REN_FORCE;
 
-  /* update mode for scalars and vectors */
-  const int mode = ((rdat->flags & GD_REN_UPDB) ? GD_UPDU : 0) |
-    (perform ? 0 : GD_UPDI);
-  /* update mode for aliases */
-  const int amode = (update_aliases ? GD_UPDU : 0) |
-    (perform ? 0 : GD_UPDI);
+  /* UPDB flag for non-aliases */
+  const int updb = rdat->flags & GD_REN_UPDB;
 
-  dtrace("%p, %p, %i", D, rdat, perform);
+  /* classes of things to update.  If we're renaming a top-level field, then
+   * we need to search everything because there may be scalar and/or vector
+   * subfields. */
+  const int update_scalars = (!meta || (rdat->type & GD_SCALAR_ENTRY_BIT));
+  const int update_vectors = (!meta || !(rdat->type & GD_SCALAR_ENTRY_BIT));
+  const int update_aliases = !(rdat->flags & GD_REN_DANGLE);
 
-  /* reset the code count */
-  rdat->n_code = 0;
+  dtrace("%p, %p", D, rdat);
 
   for (u = 0; u < D->n_entries; ++u) {
-    switch (D->entry[u]->field_type) {
-      case GD_LINCOM_ENTRY:
-        if (update_vectors)
+    if (update_vectors)
+      switch (D->entry[u]->field_type) {
+        case GD_LINCOM_ENTRY:
           for (i = 0; i < D->entry[u]->EN(lincom,n_fields); ++i) {
-            if (_GD_UpdateInField(D, D->entry[u], rdat, i, search_meta, mode)) {
+            if (_GD_UpdateInField(D, D->entry[u], i, updb, force, rdat)) {
               dreturn("%i", -1);
               return -1;
             }
           }
-        break;
-      case GD_MULTIPLY_ENTRY:
-      case GD_DIVIDE_ENTRY:
-      case GD_WINDOW_ENTRY:
-      case GD_MPLEX_ENTRY:
-        if (update_vectors)
-          if (_GD_UpdateInField(D, D->entry[u], rdat, 1, search_meta, mode)) {
+          break;
+        case GD_MULTIPLY_ENTRY:
+        case GD_DIVIDE_ENTRY:
+        case GD_WINDOW_ENTRY:
+        case GD_MPLEX_ENTRY:
+          if (_GD_UpdateInField(D, D->entry[u], 1, updb, force, rdat)) {
             dreturn("%i", -1);
             return -1;
           }
-        /* Fallthrough */
-      case GD_LINTERP_ENTRY:
-      case GD_BIT_ENTRY:
-      case GD_PHASE_ENTRY:
-      case GD_POLYNOM_ENTRY:
-      case GD_RECIP_ENTRY:
-      case GD_SBIT_ENTRY:
-        if (update_vectors)
-          if (_GD_UpdateInField(D, D->entry[u], rdat, 0, search_meta, mode)) {
+          /* Fallthrough */
+        case GD_LINTERP_ENTRY:
+        case GD_BIT_ENTRY:
+        case GD_PHASE_ENTRY:
+        case GD_POLYNOM_ENTRY:
+        case GD_RECIP_ENTRY:
+        case GD_SBIT_ENTRY:
+        case GD_INDIR_ENTRY:
+        case GD_SINDIR_ENTRY:
+          if (_GD_UpdateInField(D, D->entry[u], 0, updb, force, rdat)) {
             dreturn("%i", -1);
             return -1;
           }
-        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:
-      case GD_ALIAS_ENTRY:
-        break;
-    }
+          break;
+        case GD_INDEX_ENTRY:
+        case GD_RAW_ENTRY:
+        case GD_NO_ENTRY:
+        case GD_CONST_ENTRY:
+        case GD_CARRAY_ENTRY:
+        case GD_SARRAY_ENTRY:
+        case GD_STRING_ENTRY:
+        case GD_ALIAS_ENTRY:
+          break;
+      }
     if (update_scalars)
       switch (D->entry[u]->field_type) {
         case GD_LINCOM_ENTRY:
           for (i = 0; i < D->entry[u]->EN(lincom,n_fields); ++i)
-            if (_GD_UpdateScalar(D, D->entry[u], rdat, i, search_meta, mode) ||
-                _GD_UpdateScalar(D, D->entry[u], rdat, i + GD_MAX_LINCOM,
-                  search_meta, mode))
+            if (_GD_UpdateScalar(D, D->entry[u], i, updb, force, rdat) ||
+                _GD_UpdateScalar(D, D->entry[u], i + GD_MAX_LINCOM, updb,
+                  force, rdat))
             {
               dreturn("%i", -1);
               return -1;
@@ -620,7 +902,7 @@ static int _GD_UpdateInputs(DIRFILE *D, struct gd_rename_data_ *rdat,
           break;
         case GD_POLYNOM_ENTRY:
           for (i = 0; i <= D->entry[u]->EN(polynom,poly_ord); ++i)
-            if (_GD_UpdateScalar(D, D->entry[u], rdat, i, search_meta, mode)) {
+            if (_GD_UpdateScalar(D, D->entry[u], i, updb, force, rdat)) {
               dreturn("%i", -1);
               return -1;
             }
@@ -628,7 +910,7 @@ static int _GD_UpdateInputs(DIRFILE *D, struct gd_rename_data_ *rdat,
         case GD_BIT_ENTRY:
         case GD_SBIT_ENTRY:
         case GD_MPLEX_ENTRY:
-          if (_GD_UpdateScalar(D,D->entry[u], rdat, 1, search_meta, mode)) {
+          if (_GD_UpdateScalar(D, D->entry[u], 1, updb, force, rdat)) {
             dreturn("%i", -1);
             return -1;
           }
@@ -637,11 +919,25 @@ static int _GD_UpdateInputs(DIRFILE *D, struct gd_rename_data_ *rdat,
         case GD_RAW_ENTRY:
         case GD_RECIP_ENTRY:
         case GD_WINDOW_ENTRY:
-          if (_GD_UpdateScalar(D,D->entry[u], rdat, 0, search_meta, mode)) {
+          if (_GD_UpdateScalar(D, D->entry[u], 0, updb, force, rdat)) {
             dreturn("%i", -1);
             return -1;
           }
           break;
+        case GD_INDIR_ENTRY:
+          if (!meta || rdat->type == GD_CARRAY_ENTRY)
+            if (_GD_UpdateInField(D, D->entry[u], 1, updb, force, rdat)) {
+              dreturn("%i", -1);
+              return -1;
+            }
+          break;
+        case GD_SINDIR_ENTRY:
+          if (!meta || rdat->type == GD_SARRAY_ENTRY)
+            if (_GD_UpdateInField(D, D->entry[u], 1, updb, force, rdat)) {
+              dreturn("%i", -1);
+              return -1;
+            }
+          break;
         case GD_NO_ENTRY:
         case GD_LINTERP_ENTRY:
         case GD_MULTIPLY_ENTRY:
@@ -650,11 +946,18 @@ static int _GD_UpdateInputs(DIRFILE *D, struct gd_rename_data_ *rdat,
         case GD_STRING_ENTRY:
         case GD_CONST_ENTRY:
         case GD_CARRAY_ENTRY:
+        case GD_SARRAY_ENTRY:
         case GD_ALIAS_ENTRY:
           break;
       }
+
+    /* If we're updating aliases, then updb is always 1 (aliases will
+     * be re-hashed later, so there's no reason to manually flag them if
+     * we're not updating alias targets) */
     if (update_aliases && D->entry[u]->field_type == GD_ALIAS_ENTRY)
-      if (_GD_UpdateInField(D, D->entry[u], rdat, 0, search_meta, amode)) {
+      if (_GD_RenameCode(D, D->entry[u], D->entry[u]->in_fields + 0, NULL, 1,
+            force, rdat))
+      {
         dreturn("%i", -1);
         return -1;
       }
@@ -667,77 +970,48 @@ static int _GD_UpdateInputs(DIRFILE *D, struct gd_rename_data_ *rdat,
 /* delete rename data */
 void _GD_CleanUpRename(struct gd_rename_data_ *rdat, int abort)
 {
-  int i;
+  unsigned int i;
 
   dtrace("%p, %i", rdat, abort);
 
   if (rdat) {
     if (abort) {
-      if (rdat->meta_name)
-        for (i = 0; i < rdat->n_meta; ++i)
-          free(rdat->meta_name[i]);
-      if (rdat->code_list)
-        for (i = 0; i < rdat->n_code; ++i)
-          free(rdat->code_list[i]);
+      for (i = 0; i < rdat->n_up; ++i)
+        free(rdat->up[i].new_code);
     }
-    free(rdat->code_list);
-    free(rdat->meta_name);
-    free(rdat->old_code);
+    free(rdat->up);
     free(rdat);
   }
 
   dreturnvoid();
 }
 
-/* perform a database update due to a renamed field */
+/* perform a database update due to a renamed field.  This function
+ * cannot fail. */
 void _GD_PerformRename(DIRFILE *restrict D,
     struct gd_rename_data_ *restrict rdat)
 {
-  int i;
+  unsigned i;
 
   dtrace("%p, %p", D, rdat);
 
-  if (rdat == NULL) {
-    dreturnvoid();
-    return;
-  }
-
-  /* update meta field names */
-  for (i = 0; i < rdat->n_meta; ++i) {
-    free(rdat->meta_entry[i]->field);
-    rdat->meta_entry[i]->field = rdat->meta_name[i];
-  }
+  /* update all the codes in one go */
+  for (i = 0; i < rdat->n_up; ++i) {
+    free(*rdat->up[i].dst);
+    *(rdat->up[i].dst) = rdat->up[i].new_code;
+    if (rdat->up[i].dst_len)
+      *(rdat->up[i].dst_len) = rdat->up[i].new_len;
 
-  /* rename the field */
-  free(rdat->E->field);
-  rdat->E->field = rdat->new_code;
-
-  /* update derived/client fields/aliases */
-  _GD_UpdateInputs(D, rdat, 1);
-
-  /* Update the dot list */
-  if (rdat->old_dot && !rdat->new_dot) {
-    memmove(D->dot_list + rdat->dot_ind, D->dot_list + rdat->dot_ind + 1,
-        sizeof(gd_entry_t*) * (--D->n_dot - rdat->dot_ind));
-    rdat->E->flags &= ~GD_EN_DOTTED;
-  } else if (rdat->new_dot && !rdat->old_dot) {
-    D->dot_list[D->n_dot++] = rdat->E;
-    rdat->E->flags |= GD_EN_DOTTED;
+    /* Mark fragment dirty */
+    D->fragment[rdat->up[i].index].modified = 1;
   }
 
-  /* re-sort the lists */
+  /* re-sort the entry list */
   qsort(D->entry, D->n_entries, sizeof(gd_entry_t*), _GD_EntryCmp);
-  if (D->dot_list && rdat->new_dot)
-    qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), _GD_EntryCmp);
 
-  /* Invalidate the field lists */
-  if (rdat->E->e->n_meta == -1) {
-    rdat->E->e->p.parent->e->fl.value_list_validity = 0;
-    rdat->E->e->p.parent->e->fl.entry_list_validity = 0;
-  } else {
-    D->fl.value_list_validity = 0;
-    D->fl.entry_list_validity = 0;
-  }
+  /* Invalidate field lists */
+  rdat->fl->value_list_validity = 0;
+  rdat->fl->entry_list_validity = 0;
 
   /* rehash the aliases */
   _GD_UpdateAliases(D, 1);
@@ -748,50 +1022,35 @@ void _GD_PerformRename(DIRFILE *restrict D,
   dreturnvoid();
 }
 
-/* prepare for a database update due to a renamed field */
+/* Prepare for a database update due to a renamed field.  If this is a move
+ * request, new_fragment is the destination.  For a rename, new_fragment is -1.
+ *
+ * new_name must be malloc'd.  This function will steal it, even if it fails
+ * (returns NULL).
+ *
+ * Returns NULL on error otherwise a pointer to the gd_rename_data_ struct. */
 struct gd_rename_data_ *_GD_PrepareRename(DIRFILE *restrict D,
-    char *restrict new_code, gd_entry_t *restrict E, int old_dot,
-    unsigned dot_ind, int new_dot, unsigned flags)
+    char *restrict new_name, size_t new_len, gd_entry_t *restrict E,
+    int new_fragment, unsigned flags)
 {
   int i;
   struct gd_rename_data_ *rdat;
 
-  dtrace("%p, \"%s\", %p, %i, %u, %i, 0x%X", D, new_code, E, old_dot,
-      dot_ind, new_dot, flags);
-
-  /* Resize the dot list; this must be done early in case it fails; it's
-   * not a big deal if something else fails later: it will just be slightly too
-   * big */
-  if (new_dot && !old_dot) {
-    gd_entry_t** ptr = _GD_Realloc(D, D->dot_list, sizeof(*ptr) *
-        (D->n_dot + 1));
+  dtrace("%p, \"%s\", %" PRIuSIZE ", %p, %i, 0x%X", D, new_name, new_len, E,
+      new_fragment, flags);
 
-    if (ptr == NULL) {
-      dreturn("%p", NULL);
-      return NULL;
-    }
-
-    D->dot_list = ptr;
-  }
-
-  rdat = _GD_Malloc(D, sizeof(*rdat));
+  rdat = _GD_Malloc(D, sizeof *rdat);
   if (rdat == NULL) {
+    free(new_name);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(rdat, 0, sizeof(*rdat));
-
-  rdat->n_meta = E->e->n_meta;
-  rdat->meta_entry = E->e->p.meta_entry;
-  rdat->flags = flags;
-  rdat->E = E;
-  rdat->old_code = _GD_Strdup(D, E->field);
-  rdat->old_len = strlen(E->field);
-  rdat->new_code = new_code;
-  rdat->new_len = strlen(new_code);
-  rdat->new_dot = new_dot;
-  rdat->old_dot = old_dot;
-  rdat->dot_ind = dot_ind;
+
+  rdat->flags = flags | ((E->e->n_meta == -1) ? GD_REN_META : 0);
+  if (rdat->flags & GD_REN_META)
+    rdat->fl = &E->e->fl;
+  else
+    rdat->fl = &D->fl;
 
   /* resolve field type */
   if (E->field_type == GD_ALIAS_ENTRY && E->e->entry[0])
@@ -799,36 +1058,43 @@ struct gd_rename_data_ *_GD_PrepareRename(DIRFILE *restrict D,
   else
     rdat->type = E->field_type;
 
-  /* update other fields' metadata */
-  if (_GD_UpdateInputs(D, rdat, 0)) {
-    _GD_CleanUpRename(rdat, 1);
+  rdat->src_frag = E->fragment_index;
+  rdat->dst_frag = new_fragment;
+  rdat->old_name = E->field;
+  rdat->old_len = E->e->len;
+  rdat->new_name = new_name;
+  rdat->new_len = new_len;
+
+  rdat->up_size = 10;
+  rdat->up = _GD_Malloc(D, rdat->up_size * sizeof rdat->up[0]);
+  if (rdat->up == NULL) {
+    free(new_name);
+    free(rdat);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  if (rdat->n_meta > 0) {
-    /* compose all the new meta field names under a top-level field.  We must do
-     * this now in a temporary location in case it fails and/or subsequent stuff
-     * fails */
-    rdat->meta_name = _GD_Malloc(D, sizeof(*rdat->meta_name) * rdat->n_meta);
-    if (!rdat->meta_name) {
+  /* Add the new field name update, for a non-meta field, this is just new_name
+   */
+  rdat->n_up = 1;
+  rdat->up[0].new_code = new_name;
+  rdat->up[0].new_len = new_len;
+  rdat->up[0].index = E->fragment_index;
+  rdat->up[0].dst = &E->field;
+  rdat->up[0].dst_len = &E->e->len;
+
+  /* Add subfield name updates, too */
+  for (i = 0; i < E->e->n_meta; ++i)
+    if (_GD_RenameCode(D, E->e->p.meta_entry[i], &E->e->p.meta_entry[i]->field,
+          &E->e->p.meta_entry[i]->e->len, 1, 0, rdat))
+    {
       _GD_CleanUpRename(rdat, 1);
       dreturn("%p", NULL);
       return NULL;
     }
 
-    memset(rdat->meta_name, 0, sizeof(char *) * rdat->n_meta);
-    for (i = 0; i < rdat->n_meta; ++i) {
-      rdat->meta_name[i] = _GD_Malloc(D, strlen(rdat->meta_entry[i]->field)
-          + rdat->new_len - rdat->old_len + 1);
-      if (rdat->meta_name[i] == NULL)
-        break;
-      sprintf(rdat->meta_name[i], "%s/%s", new_code, rdat->meta_entry[i]->field
-          + rdat->old_len + 1);
-    }
-  }
-
-  if (D->error) {
+  /* update all input field codes across the whole database */
+  if (_GD_UpdateInputs(D, rdat)) {
     _GD_CleanUpRename(rdat, 1);
     dreturn("%p", NULL);
     return NULL;
@@ -839,45 +1105,44 @@ struct gd_rename_data_ *_GD_PrepareRename(DIRFILE *restrict D,
 }
 
 static int _GD_Rename(DIRFILE *D, gd_entry_t *E, const char *new_name,
-    int old_dot, unsigned dot_ind, unsigned flags)
+    unsigned flags)
 {
   gd_entry_t *Q;
   char *name;
-  int new_dot;
+  size_t len = strlen(new_name);
   struct gd_rename_data_ *rdat = NULL;
 
-  dtrace("%p, %p, \"%s\", %i, %u, 0x%X", D, E, new_name, old_dot, dot_ind,
-      flags);
+  dtrace("%p, %p, \"%s\", 0x%X", D, E, new_name, flags);
 
-  if (_GD_ValidateField(new_name, D->standards, 1, GD_VF_CODE, &new_dot)) {
-    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, new_name);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (_GD_ValidateField(new_name, 0, D->standards, 1, GD_VF_CODE))
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, new_name);
 
   if (E->e->n_meta == -1) {
-    name = _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);
+    size_t plen = strlen(E->e->p.parent->field);
+    name = _GD_Malloc(D, plen + len + 2);
+    if (name == NULL)
+      GD_RETURN_ERROR(D);
+    memcpy(name, E->e->p.parent->field, plen);
+    name[plen] = '/';
+    memcpy(name + plen + 1, new_name, len + 1); /* including NUL */
+    len += plen + 1;
   } else {
     /* Verify prefix and suffix */
-    if (_GD_CheckCodeAffixes(D, new_name, E->fragment_index, 1)) {
-      dreturn("%i", -1);
-      return -1;
+    if (_GD_CheckCodeAffixes(D, new_name, E->fragment_index,
+          GD_CO_ERROR | ((E->flags & GD_EN_EARLY) ? GD_CO_EARLY : 0)))
+    {
+      GD_RETURN_ERROR(D);
     }
 
-    name = _GD_Strdup(D, new_name);
-    if (name == NULL) {
-      dreturn("%i", -1);
-      return -1;
-    }
+    name = _GD_Malloc(D, len + 1);
+    if (name == NULL)
+      GD_RETURN_ERROR(D);
+
+    memcpy(name, new_name, len + 1);
   }
 
   /* Duplicate check */
-  Q = _GD_FindField(D, name, D->entry, D->n_entries, 1, NULL);
+  Q = _GD_FindField(D, name, len, D->entry, D->n_entries, 1, NULL);
 
   if (Q == E) {
     free(name);
@@ -888,35 +1153,30 @@ static int _GD_Rename(DIRFILE *D, gd_entry_t *E, const char *new_name,
   if (Q != NULL) {
     _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, name);
     free(name);
-    dreturn("%i", -1);
-    return -1;
+    GD_RETURN_ERROR(D);
   }
 
   /* prep for metadata update */
-  rdat = _GD_PrepareRename(D, name, E, old_dot, dot_ind, new_dot, flags);
+  rdat = _GD_PrepareRename(D, name, len, E, -1, flags);
 
-  if (rdat == NULL) {
-    free(name);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (rdat == NULL)
+    GD_RETURN_ERROR(D);
 
   if (E->field_type == GD_RAW_ENTRY) {
     /* Compose the new filename */
-    char *filebase = _GD_Strdup(D, new_name);
+    char *filebase = _GD_StripCode(D, E->fragment_index, new_name, GD_CO_NSALL
+        | ((E->flags & GD_EN_EARLY) ? GD_CO_EARLY : 0));
 
     if (filebase == NULL) {
-      free(name);
-      dreturn("%i", -1);
-      return -1;
+      _GD_CleanUpRename(rdat, 1);
+      GD_RETURN_ERROR(D);
     }
 
     /* Close the old file */
     if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP)) {
-      free(name);
+      _GD_CleanUpRename(rdat, 1);
       free(filebase);
-      dreturn("%i", -1);
-      return -1;
+      GD_RETURN_ERROR(D);
     }
 
     if (flags & GD_REN_DATA) {
@@ -924,19 +1184,16 @@ static int _GD_Rename(DIRFILE *D, gd_entry_t *E, const char *new_name,
 
       /* check data protection */
       if (D->fragment[E->fragment_index].protection & GD_PROTECT_DATA) {
-        _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_DATA, NULL, 0,
-            D->fragment[E->fragment_index].cname);
-        free(name);
+        _GD_CleanUpRename(rdat, 1);
         free(filebase);
-        dreturn("%i", -1);
-        return -1;
+        GD_SET_RETURN_ERROR(D, GD_E_PROTECTED, GD_E_PROTECTED_DATA, NULL, 0,
+            D->fragment[E->fragment_index].cname);
       }
 
       if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_MOVE)) {
-        free(name);
+        _GD_CleanUpRename(rdat, 1);
         free(filebase);
-        dreturn("%i", -1);
-        return -1;
+        GD_RETURN_ERROR(D);
       }
 
       memcpy(&temp, E->e->u.raw.file, sizeof(struct gd_raw_file_));
@@ -945,20 +1202,18 @@ static int _GD_Rename(DIRFILE *D, gd_entry_t *E, const char *new_name,
             (const char*)D->fragment[E->fragment_index].enc_data, &temp,
             filebase, 0, 0))
       {
-        free(name);
+        _GD_CleanUpRename(rdat, 1);
         free(filebase);
-        dreturn("%i", -1);
-        return -1;
+        GD_RETURN_ERROR(D);
       }
 
       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);
+        _GD_CleanUpRename(rdat, 1);
         free(filebase);
-        dreturn("%i", -1);
-        return -1;
+        GD_RETURN_ERROR(D);
       }
 
       if ((*_GD_ef[E->e->u.raw.file[0].subenc].move)(
@@ -966,9 +1221,9 @@ static int _GD_Rename(DIRFILE *D, gd_entry_t *E, const char *new_name,
             D->fragment[E->fragment_index].dirfd, temp.name))
       {
         _GD_SetEncIOError(D, GD_E_IO_RENAME, E->e->u.raw.file + 0);
+        _GD_CleanUpRename(rdat, 1);
         free(filebase);
-        dreturn("%i", -1);
-        return -1;
+        GD_RETURN_ERROR(D);
       }
 
       /* Nothing may fail from now on */
@@ -997,56 +1252,32 @@ int gd_rename(DIRFILE *D, const char *old_code, const char *new_name,
     unsigned flags)
 {
   gd_entry_t *E = NULL;
-  int ret, old_dot = 0;
-  unsigned dot_ind = 0;
+  int ret;
 
   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);
+  GD_RETURN_ERR_IF_INVALID(D);
 
   /* 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;
-  }
-
-  /* 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 ((D->flags & GD_ACCMODE) == GD_RDONLY)
+    GD_SET_RETURN_ERROR(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
 
-  if (E)
-    old_dot = 1;
-  else
-    E = _GD_FindField(D, old_code, D->entry, D->n_entries, 0, NULL);
+  E = _GD_FindField(D, old_code, strlen(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;
-  }
+  if (E == NULL)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, old_code);
 
-  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 (E->field_type == GD_INDEX_ENTRY)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0,
+        "INDEX");
 
   /* check metadata protection */
-  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
-    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT)
+    GD_SET_RETURN_ERROR(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
         D->fragment[E->fragment_index].cname);
-    dreturn("%i", -1);
-    return -1;
-  }
 
-  ret = _GD_Rename(D, E, new_name, old_dot, dot_ind, flags);
+  ret = _GD_Rename(D, E, new_name, flags);
 
   dreturn("%i", ret);
   return ret;
diff --git a/src/native.c b/src/native.c
index 11375ac..43bce00 100644
--- a/src/native.c
+++ b/src/native.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2014 D. V. Wiebe
+/* Copyright (C) 2009-2014, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,13 +25,23 @@ gd_type_t _GD_NativeType(DIRFILE *restrict D, gd_entry_t *restrict E, int repr)
   gd_type_t type = GD_UNKNOWN;
   int i;
 
-  dtrace("%p, %p, %i", D, E, repr);
+  dtrace("%p, %p, 0x%X", D, E, repr);
 
   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("%u", type);
-    return type;
+    dreturn("%u", GD_UNKNOWN);
+    return GD_UNKNOWN;
+  }
+
+  if (!(E->flags & GD_EN_CALC))
+    _GD_CalculateEntry(D, E, 1);
+
+  _GD_FindInputs(D, E, 1);
+
+  if (D->error) {
+    dreturn("%u", GD_UNKNOWN);
+    return GD_UNKNOWN;
   }
 
   switch(E->field_type) {
@@ -48,21 +58,16 @@ gd_type_t _GD_NativeType(DIRFILE *restrict D, gd_entry_t *restrict E, int repr)
       }
 
       type = GD_FLOAT64;
-      for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-        if (_GD_BadInput(D, E, i, GD_NO_ENTRY, 1))
-          break;
-
+      for (i = 0; i < E->EN(lincom,n_fields); ++i)
         if (_GD_NativeType(D, E->e->entry[i], E->e->repr[i]) & GD_COMPLEX) {
           type = GD_COMPLEX128;
           break;
         }
-      }
       break;
     case GD_LINTERP_ENTRY:
       /* initialise the table, if necessary */
       if (E->e->u.linterp.table_len < 0) {
-        _GD_ReadLinterpFile(D, E);
-        if (D->error != GD_E_OK)
+        if (_GD_ReadLinterpFile(D, E))
           break;
       }
 
@@ -70,23 +75,11 @@ gd_type_t _GD_NativeType(DIRFILE *restrict D, gd_entry_t *restrict E, int repr)
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1) ||
-          _GD_BadInput(D, E, 1, GD_NO_ENTRY, 1))
-      {
-        break;
-      }
-
       type = (_GD_NativeType(D, E->e->entry[0], E->e->repr[0]) & GD_COMPLEX
           || _GD_NativeType(D, E->e->entry[1], E->e->repr[1]) & GD_COMPLEX)
         ? GD_COMPLEX128 : GD_FLOAT64;
       break;
     case GD_RECIP_ENTRY:
-      if (!(E->flags & GD_EN_CALC))
-        _GD_CalculateEntry(D, E, 1);
-
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
       type = ((_GD_NativeType(D, E->e->entry[0], E->e->repr[0]) & GD_COMPLEX)
           || (E->flags & GD_EN_COMPSCAL)) ? GD_COMPLEX128 : GD_FLOAT64;
       break;
@@ -97,26 +90,16 @@ gd_type_t _GD_NativeType(DIRFILE *restrict D, gd_entry_t *restrict E, int repr)
     case GD_PHASE_ENTRY:
     case GD_WINDOW_ENTRY:
     case GD_MPLEX_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
       type = _GD_NativeType(D, E->e->entry[0], E->e->repr[0]);
       break;
     case GD_POLYNOM_ENTRY:
-      if (!(E->flags & GD_EN_CALC))
-        _GD_CalculateEntry(D, E, 1);
-
       if (E->flags & GD_EN_COMPSCAL) {
         type = GD_COMPLEX128;
         break;
       }
 
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
       type = (_GD_NativeType(D, E->e->entry[0], E->e->repr[0]) & GD_COMPLEX) ?
         GD_COMPLEX128 : GD_FLOAT64;
-
       break;
     case GD_SBIT_ENTRY:
       type = GD_INT64;
@@ -125,8 +108,13 @@ gd_type_t _GD_NativeType(DIRFILE *restrict D, gd_entry_t *restrict E, int repr)
     case GD_CARRAY_ENTRY:
       type = _GD_ConstType(D, E->EN(scalar,const_type));
       break;
+    case GD_INDIR_ENTRY:
+      type = _GD_NativeType(D, E->e->entry[1], E->e->repr[1]);
+      break;
     case GD_STRING_ENTRY:
-      type = GD_NULL;
+    case GD_SARRAY_ENTRY:
+    case GD_SINDIR_ENTRY:
+      type = GD_STRING;
       break;
     case GD_NO_ENTRY:
     case GD_ALIAS_ENTRY:
@@ -151,25 +139,17 @@ gd_type_t _GD_NativeType(DIRFILE *restrict D, gd_entry_t *restrict E, int repr)
   return type;
 }
 
-gd_type_t gd_native_type(DIRFILE* D, const char* field_code_in) gd_nothrow
+gd_type_t gd_native_type(DIRFILE* D, const char* field_code) gd_nothrow
 {
   gd_type_t type = GD_UNKNOWN;
   gd_entry_t* entry;
   int repr;
-  char* field_code;
-
-  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("0x%x", GD_UNKNOWN);
-    return GD_UNKNOWN;
-  }
+  dtrace("%p, \"%s\"", D, field_code);
 
-  _GD_ClearError(D);
+  GD_RETURN_IF_INVALID(D, "0x%X", GD_UNKNOWN);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
-      1);
+  entry = _GD_FindFieldAndRepr(D, field_code, &repr, NULL, 1);
 
   if (D->error) {
     dreturn("0x%x", GD_UNKNOWN);
@@ -178,9 +158,6 @@ gd_type_t gd_native_type(DIRFILE* D, const char* field_code_in) gd_nothrow
 
   type = _GD_NativeType(D, entry, repr);
 
-  if (field_code != field_code_in)
-    free(field_code);
-
   dreturn("0x%x", type);
   return type;
 }
diff --git a/src/nfields.c b/src/nfields.c
index 45cc1c9..f5f461f 100644
--- a/src/nfields.c
+++ b/src/nfields.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2010, 2012, 2013 D. V. Wiebe
+/* Copyright (C) 2008, 2010, 2012, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,68 +20,75 @@
  */
 #include "internal.h"
 
-unsigned int _GD_NEntries(DIRFILE *D, struct gd_private_entry_ *p, int type,
-    unsigned int flags)
+static unsigned int _GD_NEntries(DIRFILE *D, struct gd_private_entry_ *p,
+    int type, unsigned int flags)
 {
   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;
+  int special;
+  gd_entype_t ctype;
   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);
 
-  /* check for invalid type */
-  if (ctype && _GD_InvalidEntype(ctype)) {
+  if (type == GD_VECTOR_ENTRIES || type == GD_SCALAR_ENTRIES ||
+      type == GD_ALIAS_ENTRIES)
+  {
+    special = type;
+    ctype = GD_NO_ENTRY;
+  } else if (type != GD_NO_ENTRY && _GD_InvalidEntype(type)) {
     _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_TYPE, NULL, type, NULL);
     dreturn("%u", 0);
     return 0;
+  } else {
+    special = 0;
+    ctype = (gd_entype_t)type;
   }
 
   if (p) {
     for (i = 0; i < p->n_meta; ++i)
       if (_GD_ListEntry(p->p.meta_entry[i], 1, hidden, noalias, special,
-            ctype))
+            GD_ALL_FRAGMENTS, ctype))
+      {
         n++;
+      }
   } else {
     for (u = 0; u < D->n_entries; ++u)
-      if (_GD_ListEntry(D->entry[u], 0, hidden, noalias, special, ctype))
+      if (_GD_ListEntry(D->entry[u], 0, hidden, noalias, special,
+            GD_ALL_FRAGMENTS, ctype))
+      {
         n++;
+      }
   }
 
   dreturn("%u", n);
   return n;
 }
 
-unsigned int gd_nentries(DIRFILE *D, const char *parent, int type,
-    unsigned int flags) gd_nothrow
+unsigned int gd_nentries(DIRFILE *D, const char *parent,
+    int type, unsigned int flags) gd_nothrow
 {
   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);
-    dreturn("%u", 0);
-    return 0;
-  }
+  GD_RETURN_IF_INVALID(D, "%u", 0);
 
   if (parent) {
-    gd_entry_t *P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+    gd_entry_t *P = _GD_FindEntry(D, parent);
+
+    if (P && P->e->n_meta == -1)
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
 
-    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);
+    if (D->error) {
       dreturn("%u", 0);
       return 0;
     }
     p = P->e;
   }
 
-  _GD_ClearError(D);
-
   n = _GD_NEntries(D, p, type, flags);
   dreturn("%u", n);
   return n;
diff --git a/src/nframes.c b/src/nframes.c
index c919a27..5891c69 100644
--- a/src/nframes.c
+++ b/src/nframes.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2009, 2011-2015 D. V. Wiebe
+ * Copyright (C) 2005-2009, 2011-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -28,31 +28,22 @@ off64_t gd_nframes64(DIRFILE* D)
 
   dtrace("%p", D);
 
-  _GD_ClearError(D);
-
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", 0);
-    return 0;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
   if (D->reference_field == NULL) {
     dreturn("%i", 0);
     return 0;
   }
 
-  if (!_GD_Supports(D, D->reference_field, GD_EF_NAME | GD_EF_SIZE)) {
-    dreturn("%i", 0);
-    return 0;
-  }
+  if (!_GD_Supports(D, D->reference_field, GD_EF_NAME | GD_EF_SIZE))
+    GD_RETURN_ERROR(D);
 
   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;
+    GD_RETURN_ERROR(D);
   }
 
   /* If the reference field is open for writing, close it first to flush the
@@ -61,10 +52,8 @@ off64_t gd_nframes64(DIRFILE* D)
   if (D->reference_field->e->u.raw.file[0].mode & GD_FILE_WRITE) {
     _GD_FiniRawIO(D, D->reference_field, D->reference_field->fragment_index,
         GD_FINIRAW_KEEP);
-    if (D->error) {
-      dreturn("%i", 0);
-      return 0;
-    }
+    if (D->error)
+      GD_RETURN_ERROR(D);
   }
 
   nf = (*_GD_ef[D->reference_field->e->u.raw.file[0].subenc].size)(
@@ -74,8 +63,7 @@ off64_t gd_nframes64(DIRFILE* D)
 
   if (nf < 0) {
     _GD_SetEncIOError(D, GD_E_IO_READ, D->reference_field->e->u.raw.file);
-    dreturn("%i", 0);
-    return 0;
+    GD_RETURN_ERROR(D);
   }
 
   nf /= D->reference_field->EN(raw,spf);
diff --git a/src/open.c b/src/open.c
index b44766d..ab4b596 100644
--- a/src/open.c
+++ b/src/open.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2015 D. V. Wiebe
+ * Copyright (C) 2005-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,7 +26,8 @@ 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 dirent *result;
+  struct dirent unused;
   struct stat statbuf;
   size_t dirent_len = offsetof(struct dirent, d_name);
   size_t dirfile_len = strlen(dirfile);
@@ -71,34 +72,27 @@ static int _GD_TruncDir(DIRFILE *D, int dirfd, const char *dirfile, int root)
     return -1;
   }
 
-  if ((lamb = _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)) {
+  ret = _GD_ReadDir(dir, &unused, &result);
+  for (; result; ret = _GD_ReadDir(dir, &unused, &result)) {
     char *name;
-    if (lamb->d_name[0] == '.' && lamb->d_name[1] == '\0')
+    if (result->d_name[0] == '.' && result->d_name[1] == '\0')
       continue; /* skip current dir */
-    else if (lamb->d_name[0] == '.' && lamb->d_name[1] == '.' &&
-        lamb->d_name[2] == '\0')
+    else if (result->d_name[0] == '.' && result->d_name[1] == '.' &&
+        result->d_name[2] == '\0')
     {
       continue; /* skip parent dir */
     }
 
-    name = _GD_Malloc(D, dirfile_len + strlen(lamb->d_name) + 2);
+    name = _GD_Malloc(D, dirfile_len + strlen(result->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);
+    sprintf(name, "%s%c%s", dirfile, GD_DIRSEP, result->d_name);
     if (
 #if defined(HAVE_FSTATAT) && !defined(GD_NO_DIR_OPEN)
-        fstatat(dirfd, lamb->d_name, &statbuf, AT_SYMLINK_NOFOLLOW)
+        fstatat(dirfd, result->d_name, &statbuf, AT_SYMLINK_NOFOLLOW)
 #elif HAVE_LSTAT
         lstat(name, &statbuf)
 #else
@@ -128,19 +122,18 @@ static int _GD_TruncDir(DIRFILE *D, int dirfd, const char *dirfile, int root)
 #ifdef S_IFLNK
       case S_IFLNK:
 #endif
-        if (root && strcmp(lamb->d_name, "format") == 0) {
+        if (root && strcmp(result->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)
+            unlinkat(dirfd, result->d_name, 0)
 #else
             unlink(name)
 #endif
             )
         {
           _GD_SetError(D, GD_E_IO, GD_E_IO_UNLINK, name, 0, NULL);
-          free(lamb);
           free(name);
           closedir(dir);
           dreturn("%i", -1);
@@ -156,14 +149,13 @@ static int _GD_TruncDir(DIRFILE *D, int dirfd, const char *dirfile, int root)
 #else
           if ((
 #ifdef HAVE_OPENAT
-                subdirfd = openat(dirfd, lamb->d_name, O_RDONLY)
+                subdirfd = openat(dirfd, result->d_name, O_RDONLY)
 #else
                 subdirfd = open(name, O_RDONLY)
 #endif
               ) < 0)
           {
             _GD_SetError(D, GD_E_IO, 0, name, 0, NULL);
-            free(lamb);
             closedir(dir);
             free(name);
             dreturn("%i", -1);
@@ -176,13 +168,12 @@ static int _GD_TruncDir(DIRFILE *D, int dirfd, const char *dirfile, int root)
           /* delete */
           if (
 #ifdef HAVE_UNLINKAT
-              unlinkat(dirfd, lamb->d_name, AT_REMOVEDIR)
+              unlinkat(dirfd, result->d_name, AT_REMOVEDIR)
 #else
               rmdir(name)
 #endif
              ) {
             _GD_SetError(D, GD_E_IO, GD_E_IO_UNLINK, name, 0, NULL);
-            free(lamb);
             free(name);
             closedir(dir);
             dreturn("%i", -1);
@@ -192,7 +183,6 @@ static int _GD_TruncDir(DIRFILE *D, int dirfd, const char *dirfile, int root)
     }
     free(name);
   }
-  free(lamb);
 
   closedir(dir);
 
@@ -248,7 +238,7 @@ static FILE *_GD_CreateDirfile(DIRFILE *restrict D, int dirfd, int dir_error,
   /* Error reading the format file, and we weren't asked to create it; do
    * nothing else. */
   if (format_error == EACCES || (format_error && !(D->flags & GD_CREAT))) {
-    char *format_file = (char *)malloc(strlen(dirfile) + 8);
+    char *format_file = malloc(strlen(dirfile) + 8);
     sprintf(format_file, "%s%cformat", dirfile, GD_DIRSEP);
     _GD_SetError2(D, GD_E_IO, GD_E_IO_OPEN, format_file, 0, NULL, format_error);
     free(format_file);
@@ -332,7 +322,7 @@ static FILE *_GD_CreateDirfile(DIRFILE *restrict D, int dirfd, int dir_error,
     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);
+      char *format_file = malloc(strlen(dirfile) + 8);
       sprintf(format_file, "%s/format", dirfile);
       _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_FORMAT, format_file, 0, NULL);
       free(dirfile);
@@ -352,7 +342,7 @@ static FILE *_GD_CreateDirfile(DIRFILE *restrict D, int dirfd, int dir_error,
 
   /* associate a stream with the format file */
   if ((fp = fdopen(fd, "rb")) == NULL) {
-    char *format_file = (char *)malloc(strlen(dirfile) + 8);
+    char *format_file = malloc(strlen(dirfile) + 8);
     sprintf(format_file, "%s/format", dirfile);
     _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_FORMAT, format_file, 0, NULL);
     free(dirfile);
@@ -367,7 +357,7 @@ static FILE *_GD_CreateDirfile(DIRFILE *restrict D, int dirfd, int dir_error,
   }
 
   /* open succeeds */
-  D->dir = (struct gd_dir_t *)malloc(sizeof(struct gd_dir_t));
+  D->dir = malloc(sizeof(struct gd_dir_t));
   D->dir[0].fd = dirfd;
   D->dir[0].rc = 1;
   D->dir[0].path = dirfile;
@@ -398,7 +388,7 @@ DIRFILE* gd_invalid_dirfile(void) gd_nothrow
 
   dtracevoid();
 
-  D = (DIRFILE *)malloc(sizeof(DIRFILE));
+  D = malloc(sizeof(DIRFILE));
   if (D) {
     memset(D, 0, sizeof(DIRFILE));
     D->flags = GD_INVALID;
@@ -410,7 +400,7 @@ DIRFILE* gd_invalid_dirfile(void) gd_nothrow
 
 /* _GD_Open: open (or, perhaps, create) and parse the specified dirfile
 */
-DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
+static DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
     unsigned long flags, gd_parser_callback_t sehandler, void *extra)
 {
   FILE *fp;
@@ -454,7 +444,7 @@ DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
   _GD_InitialiseFramework();
 
   if (D == NULL)
-    D = (DIRFILE *)malloc(sizeof(DIRFILE));
+    D = malloc(sizeof(DIRFILE));
   if (D == NULL) {
     free(dirfile);
 #ifndef GD_NO_DIR_OPEN
@@ -468,6 +458,7 @@ DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
 
   /* 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;
@@ -519,6 +510,7 @@ DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
   }
   memset(D->entry[0]->e, 0, sizeof(struct gd_private_entry_));
   D->entry[0]->flags = GD_EN_CALC;
+  D->entry[0]->e->len = 5;
 
   /* open the format file (or create it) */
   if ((fp = _GD_CreateDirfile(D, dirfd, dirfd_error, dirfile, &mtime)) == NULL)
@@ -543,7 +535,7 @@ DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
     return D;
   }
 
-  /* Parse the file.  This will take care of any necessary inclusions */
+  /* Build the root fragment metadata */
   D->n_fragment = 1;
 
   D->fragment = _GD_Malloc(D, sizeof(*D->fragment));
@@ -567,8 +559,7 @@ DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
     return D;
   }
   D->fragment[0].sname = NULL;
-  /* The root format file needs no external name */
-  D->fragment[0].ename = NULL;
+  D->fragment[0].ename = NULL; /* The root format file needs no external name */
   D->fragment[0].enc_data = NULL;
   D->fragment[0].modified = 0;
   D->fragment[0].parent = -1;
@@ -587,9 +578,8 @@ DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
   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;
-  D->fragment[0].ns = NULL;
-  D->fragment[0].nsl = 0;
+  D->fragment[0].px = D->fragment[0].sx = D->fragment[0].ns = NULL;
+  D->fragment[0].pxl = D->fragment[0].sxl = D->fragment[0].nsl = 0;
 
   /* parser proto-state */
   p.line = 0;
@@ -599,8 +589,11 @@ DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
   p.flags = D->flags;
   p.ns = NULL;
   p.nsl = 0;
+
+  /* Parser invocation */
   ref_name = _GD_ParseFragment(fp, D, &p, 0, 1);
   fclose(fp);
+  free(p.ns);
 
   if (D->error != GD_E_OK) {
     dreturn("%p", D);
@@ -616,7 +609,8 @@ DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
 
   /* Find the reference field */
   if (ref_name != NULL) {
-    E = _GD_FindField(D, ref_name, D->entry, D->n_entries, 1, NULL);
+    E = _GD_FindField(D, ref_name, strlen(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);
@@ -674,5 +668,93 @@ DIRFILE* gd_open(const char* filedir, unsigned long flags)
   dreturn("%p", D);
   return D;
 }
+
+/* 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);
+
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  /* if we can't open directories, we're stuck with the full path method */
+#ifdef GD_NO_DIR_OPEN
+  flags |= GD_DESYNC_PATHCHECK;
+#endif
+
+  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 = _GD_Malloc(D, strlen(D->name) + strlen(D->fragment[i].bname) +
+            strlen(D->fragment[i].sname) + 3);
+        if (buffer == NULL)
+          GD_RETURN_ERROR(D);
+        sprintf(buffer, "%s%c%s%c%s", D->name, GD_DIRSEP, D->fragment[i].sname,
+            GD_DIRSEP, D->fragment[i].bname);
+      } else {
+        buffer = _GD_Malloc(D, strlen(D->name) + strlen(D->fragment[i].bname) +
+            2);
+        if (buffer == NULL)
+          GD_RETURN_ERROR(D);
+        sprintf(buffer, "%s%c%s", D->name, GD_DIRSEP, D->fragment[i].bname);
+      }
+      if (stat(buffer, &statbuf)) {
+        _GD_SetError(D, GD_E_IO, 0, buffer, 0, NULL);
+        free(buffer);
+        GD_RETURN_ERROR(D);
+      }
+      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_SET_RETURN_ERROR(D, GD_E_IO, 0, D->fragment[i].cname, 0, NULL);
+
+    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_SET_RETURN_ERROR(D, GD_E_IO, GD_E_OPEN, D->name, 0, NULL);
+    }
+
+    D->name = NULL; /* so FreeD doesn't delete it */
+    if (_GD_ShutdownDirfile(D, 0, 1)) {
+      D->name = name;
+      if (dirfd >= 0)
+        close(dirfd);
+      GD_RETURN_ERROR(D);
+    }
+    _GD_Open(D, dirfd, name, flags, sehandler, extra);
+    free(name);
+
+    if (D->error)
+      changed = D->error;
+  }
+
+  dreturn("%i", changed);
+  return changed;
+}
 /* vim: ts=2 sw=2 et tw=80
 */
diff --git a/src/parse.c b/src/parse.c
index 4de580e..a3959a9 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2015 D. V. Wiebe
+ * Copyright (C) 2005-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -50,21 +50,21 @@ static gd_type_t _GD_RawType(const char* type, int standards, int pedantic)
     else if (strcmp(type, "UINT64") == 0)
       t = GD_UINT64;
   } else if (type[0] == 'F') {
-    if (strcmp(type, "FLOAT32") == 0)
+    if (strcmp(type, "FLOAT64") == 0)
+      t = GD_FLOAT64;
+    else if (strcmp(type, "FLOAT32") == 0)
       t = GD_FLOAT32;
     else if (strcmp(type, "FLOAT") == 0)
       t = GD_FLOAT32;
-    else if (strcmp(type, "FLOAT64") == 0)
-      t = GD_FLOAT64;
   } else if (strcmp(type, "DOUBLE") == 0)
     t = GD_FLOAT64;
   else if (pedantic && standards < 7)
     t = GD_UNKNOWN;
 
-  else if (strcmp(type, "COMPLEX64") == 0)
-    t = GD_COMPLEX64;
   else if (strcmp(type, "COMPLEX128") == 0)
     t = GD_COMPLEX128;
+  else if (strcmp(type, "COMPLEX64") == 0)
+    t = GD_COMPLEX64;
 
   dreturn("0x%X", t);
   return t;
@@ -77,31 +77,31 @@ static gd_windop_t _GD_WindOp(const char *op)
 
   switch (op[0]) {
     case 'E':
-      if (op[1] == 'Q')
+      if (op[1] == 'Q' && op[2] == 0)
         o = GD_WINDOP_EQ;
       break;
     case 'L':
-      if (op[1] == 'T')
+      if (op[1] == 'T' && op[2] == 0)
         o = GD_WINDOP_LT;
-      else if (op[1] == 'E')
+      else if (op[1] == 'E' && op[2] == 0)
         o = GD_WINDOP_LE;
       break;
     case 'G':
-      if (op[1] == 'T')
+      if (op[1] == 'T' && op[2] == 0)
         o = GD_WINDOP_GT;
-      else if (op[1] == 'E')
+      else if (op[1] == 'E' && op[2] == 0)
         o = GD_WINDOP_GE;
       break;
     case 'N':
-      if (op[1] == 'E')
+      if (op[1] == 'E' && op[2] == 0)
         o = GD_WINDOP_NE;
       break;
     case 'S':
-      if (op[1] == 'E' && op[2] == 'T')
+      if (op[1] == 'E' && op[2] == 'T' && op[3] == 0)
         o = GD_WINDOP_SET;
       break;
     case 'C':
-      if (op[1] == 'L' && op[2] == 'R')
+      if (op[1] == 'L' && op[2] == 'R' && op[3] == 0)
         o = GD_WINDOP_CLR;
       break;
   }
@@ -216,7 +216,7 @@ int _GD_TokToNum(const char *restrict token, int standards, int pedantic,
         *im = ui;
     }
   } else if (u) { /* unsigned int -- reject negative values */
-    if (rt == GD_UINT64) 
+    if (rt == GD_UINT64)
       *u = ur;
     else if (rt == GD_INT64) {
       if (ir < 0) {
@@ -249,12 +249,12 @@ int _GD_TokToNum(const char *restrict token, int standards, int pedantic,
 /* Compose a subfield code from a parent code and a subfield name -- this
  * used to be done in _GD_MungeCode */
 static char *_GD_SubfieldCode(DIRFILE *D, const gd_entry_t *P, const char *code,
-    char **nso, int *offset)
+    size_t *offset)
 {
   size_t len, len_par;
   char *new_code;
 
-  dtrace("%p, %p, \"%s\", %p, %p", D, P, code, nso, offset);
+  dtrace("%p, %p, \"%s\", %p", D, P, code, offset);
 
   if (code == NULL) {
     dreturn("%p", NULL);
@@ -276,54 +276,31 @@ static char *_GD_SubfieldCode(DIRFILE *D, const gd_entry_t *P, const char *code,
   if (offset)
     *offset = len_par;
 
-  /* find the namespace, if necessary */
-  if (nso) {
-    size_t i;
-    for (i = strlen(new_code); i > 0; --i)
-      if (new_code[i - 1] == ',')
-        break;
-
-    *nso = new_code + i;
-  }
-
-  dreturn("\"%s\" (%i, %p)", new_code, offset ? *offset : -1,
-      nso ? *nso : NULL);
+  dreturn("\"%s\" (%" PRIuSIZE ")", new_code, offset ? *offset : 0);
   return new_code;
 }
 
 /* Create a field code using the prefix and suffix of the given fragment and the
  * current namespace.
  *
- * Returns a newly malloc'd code, or NULL on error.  nso points to the portion
- * of the code immediately after the namespace prefix.  Offset is the offset
- * from the start of the code to the field name (ie. the character following
- * / for a metafield. */
+ * Returns a newly malloc'd code, or NULL on error.  For subfields, offset is
+ * the offset to the character following / for a metafield.  For non-subfields,
+ * it's the length of the namespace. */
 static char *_GD_CodeFromFrag(DIRFILE *restrict D,
-    const struct parser_state *restrict p, const gd_entry_t *restrict P, int me,
-    const char *code, char **nso, int *offset)
+    const struct parser_state *restrict p, const gd_entry_t *restrict P,
+    int me, const char *code, size_t *offset)
 {
   char *new_code;
 
   dtrace("%p, %p, %p, %i, \"%s\", %p", D, p, P, me, code, offset);
 
   if (P)
-    new_code = _GD_SubfieldCode(D, P, code, nso, offset);
-  else {
-    const char *ns = p->ns;
-    size_t nsl = p->nsl;
-
-    /* set fragment root space, if necessary */
-    if (!ns) {
-      ns = D->fragment[me].ns;
-      nsl = D->fragment[me].nsl;
-    }
-
-    new_code = _GD_MungeCode(D, ns, nsl, NULL, NULL, D->fragment[me].prefix,
-        D->fragment[me].suffix, code, nso, offset,
-        GD_MC_RQ_PARTS | GD_MC_ERROR_OK | GD_MC_NO_NS);
-  }
+    new_code = _GD_SubfieldCode(D, P, code, offset);
+  else
+    new_code = _GD_BuildCode(D, me, p->ns, p->nsl, code,
+        p->pedantic && p->standards < 10, offset);
 
-  dreturn("\"%s\"", new_code);
+  dreturn("\"%s\" (%" PRIuSIZE ")", new_code, offset ? *offset : 0);
   return new_code;
 }
 
@@ -333,43 +310,42 @@ static char *_GD_InputCode(DIRFILE *D, const struct parser_state *restrict p,
     int me, const char *token)
 {
   char *code;
-  const char *ns = p->ns;
-  size_t nsl = p->nsl;
-  unsigned flags = GD_MC_RQ_PARTS | GD_MC_ERROR_OK;
 
   dtrace("%p, %p, %i, \"%s\"", D, p, me, token);
 
-  if (token[0] == '.') { /* absolute name */
-    token++;
-    ns = D->fragment[me].ns;
-    nsl = D->fragment[me].nsl;
-  } else if (ns == NULL) {
-    ns = D->fragment[me].ns;
-    nsl = D->fragment[me].nsl;
-  }
-
-  code = _GD_MungeCode(D, ns, nsl, NULL, NULL, D->fragment[me].prefix,
-      D->fragment[me].suffix, token, NULL, NULL, flags);
+  code = _GD_BuildCode(D, me, p->ns, p->nsl, token,
+      p->pedantic && p->standards <= 5, NULL);
 
   dreturn("\"%s\"", code);
   return code;
 }
-  
+
 /* Create E->field; frees the entry and returns non-zero on error. */
 static int _GD_SetField(DIRFILE *restrict D,
     const struct parser_state *restrict p, gd_entry_t *restrict E,
-    const gd_entry_t *restrict P, int me, const char *restrict name, int no_dot)
+    const gd_entry_t *restrict P, int me, const char *restrict name)
 {
-  int offset;
-  int is_dot = 0;
+  size_t offset;
 
-  dtrace("%p, %p{%s,%i}, %p, %p, %i, \"%s\", %i", D, p, p->file, p->line, E, P, me, name, no_dot);
+  dtrace("%p, %p{%s,%i}, %p, %p, %i, \"%s\"", D, p, p->file, p->line, E, P, me,
+      name);
 
-  E->field = _GD_CodeFromFrag(D, p, P, me, name, NULL, &offset);
-  if (E->field && _GD_ValidateField(E->field + offset, p->standards,
-        p->pedantic, GD_VF_NAME, (p->ns || no_dot) ? NULL : &is_dot))
-  {
-    _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, p->file, p->line, name);
+  E->field = _GD_CodeFromFrag(D, p, P, me, name, &offset);
+
+  /* The _GD_ValidateField call differs based on whether we're dealing with
+   * a subfield or not because the meaning of offset is different */
+  if (E->field) {
+    int bad_code;
+    if (P)
+      bad_code = _GD_ValidateField(E->field + offset, 0, p->standards,
+          p->pedantic, GD_VF_NAME);
+    else
+      bad_code = _GD_ValidateField(E->field, offset, p->standards, p->pedantic,
+          GD_VF_NAME);
+
+    if (bad_code)
+      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, p->file, p->line,
+          name);
   }
 
   if (D->error) {
@@ -377,10 +353,8 @@ static int _GD_SetField(DIRFILE *restrict D,
     dreturn("%i", 1);
     return 1;
   }
- 
-  if (is_dot)
-    E->flags |= GD_EN_DOTTED;
 
+  E->e->len = strlen(E->field);
   dreturn("%i", 0);
   return 0;
 }
@@ -404,12 +378,8 @@ static char *_GD_SetScalar(DIRFILE *restrict D,
 
     i = _GD_TokToNum(token, p->standards, p->pedantic, &re, &im, NULL, NULL);
 
-    if (i == -2) { /* malformed number */
-      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LITERAL, p->file, p->line,
-          token);
-      dreturn("%p", NULL);
-      return NULL;
-    } else if (i == -1) { /* assume it's a field name */
+    /* _GD_TokToNum can't return -2 for complex return type */
+    if (i == -1) { /* assume it's a field name */
       ptr = _GD_InputCode(D, p, me, token);
       if (D->error) {
         dreturn("%p", NULL);
@@ -538,7 +508,7 @@ carray_check:
         break;
     }
   }
-  
+
   dreturn("\"%s\" (%i)", ptr, *index);
   return ptr;
 }
@@ -588,16 +558,19 @@ static gd_entry_t *_GD_ParseRaw(DIRFILE *restrict D,
   E->e->u.raw.file[0].subenc = GD_ENC_UNKNOWN; /* don't know the encoding
                                                     subscheme yet */
 
-  if (_GD_SetField(D, p, E, NULL, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, NULL, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
 
+  if (p->pedantic && p->standards <= 5)
+    E->flags |= GD_EN_EARLY;
+
   E->e->u.raw.filebase = _GD_Strdup(D, in_cols[0]);
   E->EN(raw,data_type) = _GD_RawType(in_cols[2], p->standards, p->pedantic);
   E->e->u.raw.size = GD_SIZE(E->EN(raw,data_type));
 
-  if (E->e->u.raw.size == 0 || E->EN(raw,data_type) & 0x40)
+  if (E->e->u.raw.size == 0)
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_TYPE, p->file, p->line,
         in_cols[2]);
   else if ((E->scalar[0] = _GD_SetScalar(D, p, in_cols[3], &E->EN(raw,spf),
@@ -655,7 +628,7 @@ static gd_entry_t *_GD_ParseLincom(DIRFILE *restrict D,
 
   E->field_type = GD_LINCOM_ENTRY;
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -749,7 +722,7 @@ static gd_entry_t *_GD_ParseLinterp(DIRFILE *restrict D,
   E->flags |= GD_EN_CALC;
   E->EN(linterp,table) = NULL;
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -769,7 +742,7 @@ static gd_entry_t *_GD_ParseLinterp(DIRFILE *restrict D,
 }
 
 /* _GD_ParseYoke: parse a field specified by two input fields only (MULTIPLY,
- * DIVIDE)
+ * DIVIDE, INDIR, SINDIR)
 */
 static gd_entry_t *_GD_ParseYoke(DIRFILE *restrict D, gd_entype_t type,
     const struct parser_state *restrict p,
@@ -808,7 +781,7 @@ static gd_entry_t *_GD_ParseYoke(DIRFILE *restrict D, gd_entype_t type,
   E->e->entry[0] = E->e->entry[1] = NULL;
   E->flags |= GD_EN_CALC;
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -862,7 +835,7 @@ static gd_entry_t *_GD_ParseRecip(DIRFILE *restrict D,
   E->in_fields[0] = NULL;
   E->e->entry[0] = NULL;
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -917,7 +890,7 @@ static gd_entry_t *_GD_ParseWindow(DIRFILE *restrict D,
 
   E->field_type = GD_WINDOW_ENTRY;
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -995,7 +968,7 @@ static gd_entry_t *_GD_ParseMplex(DIRFILE *restrict D,
 
   E->field_type = GD_MPLEX_ENTRY;
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -1063,7 +1036,7 @@ static gd_entry_t *_GD_ParseBit(DIRFILE *restrict D, int is_signed,
   E->e->entry[0] = NULL;
   E->flags |= GD_EN_CALC;
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -1137,7 +1110,7 @@ static gd_entry_t *_GD_ParsePhase(DIRFILE *restrict D,
   E->in_fields[0] = NULL;
   E->e->entry[0] = NULL;
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -1194,7 +1167,7 @@ static gd_entry_t *_GD_ParsePolynom(DIRFILE *restrict D,
   memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_POLYNOM_ENTRY;
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -1254,6 +1227,7 @@ gd_type_t _GD_ConstType(DIRFILE *D, gd_type_t type)
       return GD_COMPLEX128;
     case GD_NULL:
     case GD_UNKNOWN:
+    case GD_STRING:
       _GD_InternalError(D);
   }
 
@@ -1300,7 +1274,7 @@ static gd_entry_t *_GD_ParseConst(DIRFILE *restrict D,
   E->field_type = GD_CONST_ENTRY;
   E->flags |= GD_EN_CALC;
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -1345,7 +1319,7 @@ static gd_entry_t *_GD_ParseConst(DIRFILE *restrict D,
 
 /* _GD_ParseArray: parse [CS]ARRAY entry in formats file.
 */
-static gd_entry_t *_GD_ParseArray(DIRFILE *restrict D,
+static gd_entry_t *_GD_ParseArray(DIRFILE *restrict D, int string,
     const struct parser_state *restrict p, char *in_cols[MAX_IN_COLS],
     int n_cols, const gd_entry_t *restrict parent, int me, char **outstring,
     const char *tok_pos)
@@ -1357,10 +1331,11 @@ static gd_entry_t *_GD_ParseArray(DIRFILE *restrict D,
   void *data = NULL;
   gd_entry_t *E;
 
-  dtrace("%p, %p, %p, %i, %p, %i, %p, %p", D, p, in_cols, n_cols, parent, me,
-      outstring, tok_pos);
+  dtrace("%p, %i, %p, %p, %i, %p, %i, %p, %p", D, string, p, in_cols, n_cols,
+      parent, me, outstring, tok_pos);
 
-  if (n_cols < 4) {
+  /* CARRAYs have a data_type token which SARRAYs lack */
+  if (n_cols < 4 - string) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, p->file, p->line, NULL);
     dreturn("%p", NULL);
     return NULL;
@@ -1382,26 +1357,31 @@ static gd_entry_t *_GD_ParseArray(DIRFILE *restrict D,
   }
   memset(E->e, 0, sizeof(struct gd_private_entry_));
 
-  E->field_type = GD_CARRAY_ENTRY;
+  E->field_type = string ? GD_SARRAY_ENTRY : GD_CARRAY_ENTRY;
   E->flags |= GD_EN_CALC;
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
 
-  E->EN(scalar,const_type) = _GD_RawType(in_cols[2], p->standards,
-      p->pedantic);
-  t = _GD_ConstType(D, E->EN(scalar,const_type));
-  first = 3;
-  s = GD_SIZE(t);
-
-  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, p->file, p->line,
-        in_cols[2]);
-    _GD_FreeE(D, E, 1);
-    dreturn("%p", NULL);
-    return NULL;
+  if (string) {
+    s = sizeof(const char *);
+    first = 2;
+  } else {
+    E->EN(scalar,const_type) = _GD_RawType(in_cols[2], p->standards,
+        p->pedantic);
+    t = _GD_ConstType(D, E->EN(scalar,const_type));
+    first = 3;
+    s = GD_SIZE(t);
+
+    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, p->file, p->line,
+          in_cols[2]);
+      _GD_FreeE(D, E, 1);
+      dreturn("%p", NULL);
+      return NULL;
+    }
   }
 
   /* spool in the data */
@@ -1424,17 +1404,32 @@ static gd_entry_t *_GD_ParseArray(DIRFILE *restrict D,
       if (n == GD_SIZE_T_MAX)
         break;
 
-      ptr = _GD_SetScalar(D, p, in_cols[c], (char *)data + s * n++, t, me,
-          &offset, NULL);
+      if (string) {
+        ((char**)data)[n++] = _GD_Strdup(D, in_cols[c]);
 
-      if (ptr) {
-        free(ptr);
-        free(data);
-        _GD_FreeE(D, E, 1);
-        _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LITERAL, p->file, p->line,
-            in_cols[c]);
-        dreturn("%p", NULL);
-        return NULL;
+        if (D->error) {
+          size_t i;
+
+          for (i = 0; i < n; ++i)
+            free(((char**)data)[i]);
+          free(data);
+          _GD_FreeE(D, E, 1);
+          dreturn("%p", NULL);
+          return NULL;
+        }
+      } else {
+        ptr = _GD_SetScalar(D, p, in_cols[c], (char *)data + s * n++, t, me,
+            &offset, NULL);
+
+        if (ptr) {
+          free(ptr);
+          free(data);
+          _GD_FreeE(D, E, 1);
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LITERAL, p->file, p->line,
+              in_cols[c]);
+          dreturn("%p", NULL);
+          return NULL;
+        }
       }
     }
 
@@ -1506,7 +1501,7 @@ static gd_entry_t *_GD_ParseString(DIRFILE *restrict D,
     return NULL;
   }
 
-  if (_GD_SetField(D, p, E, parent, me, in_cols[0], 0)) {
+  if (_GD_SetField(D, p, E, parent, me, in_cols[0])) {
     dreturn("%p", NULL);
     return NULL;
   }
@@ -1550,27 +1545,37 @@ static int _GD_UTF8Encode(DIRFILE *restrict D, const char *restrict format_file,
 /* _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.
+ * parser, but called from _GD_Add.  In this case, it never sets D->error.
  */
 gd_entry_t *_GD_CheckParent(DIRFILE *restrict D,
-    const struct parser_state *p, char **restrict name, int me)
+    const struct parser_state *p, char **restrict name, size_t *len, int me)
 {
+  size_t plen = 0;
   char *cptr, *munged_code;
   gd_entry_t *P = NULL;
 
-  dtrace("%p, %p, \"%s\", %i", D, p, *name, me);
+  dtrace("%p, %p, \"%s\", %p, %i", D, p, *name, len, me);
 
   for (cptr = *name + 1; *cptr != '\0'; ++cptr)
     if (*cptr == '/') {
       *cptr = '\0';
-      if (me == -1)
-        munged_code = strdup(*name);
-      else
-        munged_code = _GD_CodeFromFrag(D, p, NULL, me, *name, NULL, NULL);
+      if (me == -1) {
+        plen = (cptr - *name);
+        munged_code = malloc(plen + 1);
+        if (munged_code)
+          memcpy(munged_code, *name, plen + 1);
+      } else {
+        munged_code = _GD_CodeFromFrag(D, p, NULL, me, *name, NULL);
+        if (munged_code)
+          plen = strlen(munged_code);
+      }
+
       if (munged_code) {
-        P = _GD_FindField(D, munged_code, D->entry, D->n_entries, 0, NULL);
+        P = _GD_FindField(D, munged_code, plen, 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
@@ -1596,11 +1601,12 @@ gd_entry_t *_GD_CheckParent(DIRFILE *restrict D,
       }
 
       /* point name to the metafield name */
+      *len -= (cptr - *name) + 1;
       *name = cptr + 1;
       break;
     }
 
-  dreturn("%p", P);
+  dreturn("%p (\"%s\", %" PRIuSIZE ")", P, *name, *len);
   return P;
 }
 
@@ -1608,24 +1614,21 @@ gd_entry_t *_GD_CheckParent(DIRFILE *restrict D,
  * specification */
 gd_entry_t *_GD_ParseFieldSpec(DIRFILE *restrict D,
     const struct parser_state *restrict p, int n_cols, char **in_cols,
-    const gd_entry_t *restrict P, int me, int creat, int insert,
+    size_t len0, const gd_entry_t *restrict P, int me, int creat, int insert,
     char **outstring, const char *tok_pos)
 {
   gd_entry_t* E = NULL;
   void *ptr;
 
-  dtrace("%p, %p, %i, %p, %p, %i, %i, %i, %p, %p", D, p, n_cols, in_cols, P, me,
-      creat, insert, outstring, tok_pos);
+  dtrace("%p, %p, %i, %p, %" PRIuSIZE ", %p, %i, %i, %i, %p, %p", D, p, n_cols,
+      in_cols, len0, P, me, creat, insert, outstring, tok_pos);
 
   /* Check for barth-style metafield definition */
   if (P == NULL && GD_PVERS_GE(*p, 7)) {
-    P = _GD_CheckParent(D, p, in_cols + 0, me);
+    P = _GD_CheckParent(D, p, in_cols + 0, &len0, me);
     if (P) {
-      if (n_cols < 2)
-        _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, p->file, p->line, NULL);
-      else
-        E = _GD_ParseFieldSpec(D, p, n_cols, in_cols, P, me, creat, insert,
-            outstring, tok_pos);
+      E = _GD_ParseFieldSpec(D, p, n_cols, in_cols, len0, P, me, creat, insert,
+          outstring, tok_pos);
       dreturn("%p", (!insert) ? E : NULL);
       return (!insert) ? E : NULL;
     }
@@ -1638,10 +1641,7 @@ gd_entry_t *_GD_ParseFieldSpec(DIRFILE *restrict D,
   }
   D->entry = (gd_entry_t **)ptr;
 
-  if (n_cols < 2)
-    _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, p->file, p->line,
-        NULL);
-  else if (P == NULL && (strcmp(in_cols[0], "INDEX") == 0 || (p->pedantic &&
+  if (P == NULL && (strcmp(in_cols[0], "INDEX") == 0 || (p->pedantic &&
           p->standards < 6 && strcmp(in_cols[0], "FILEFRAM") == 0)))
     /* reserved field name */
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_RES_NAME, p->file, p->line,
@@ -1656,7 +1656,7 @@ gd_entry_t *_GD_ParseFieldSpec(DIRFILE *restrict D,
         break;
       case 'C':
         if (strcmp(in_cols[1], "CARRAY") == 0 && GD_PVERS_GE(*p, 8))
-          E = _GD_ParseArray(D, p, in_cols, n_cols, P, me, outstring,
+          E = _GD_ParseArray(D, 0, p, in_cols, n_cols, P, me, outstring,
               tok_pos);
         else if (strcmp(in_cols[1], "CONST") == 0 && GD_PVERS_GE(*p, 6))
           E = _GD_ParseConst(D, p, in_cols, n_cols, P, me);
@@ -1669,6 +1669,12 @@ gd_entry_t *_GD_ParseFieldSpec(DIRFILE *restrict D,
         else
           goto NO_MATCH;
         break;
+      case 'I':
+        if (strcmp(in_cols[1], "INDIR") == 0 && GD_PVERS_GE(*p, 10))
+          E = _GD_ParseYoke(D, GD_INDIR_ENTRY, p, in_cols, n_cols, P, me);
+        else
+          goto NO_MATCH;
+        break;
       case 'L':
         if (strcmp(in_cols[1], "LINCOM") == 0)
           E = _GD_ParseLincom(D, p, in_cols, n_cols, P, me);
@@ -1703,16 +1709,14 @@ gd_entry_t *_GD_ParseFieldSpec(DIRFILE *restrict D,
             if (D->fragment[me].protection != GD_PROTECT_NONE)
               _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_DATA, NULL, 0,
                   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, GD_E_UNENC_UNDET, NULL, 0,
-                  NULL);
-            else if (D->fragment[me].encoding == GD_ENC_UNSUPPORTED)
-              /* If the encoding scheme is unsupported, can't add the field */
-              _GD_SetError(D, GD_E_UNSUPPORTED, 0, NULL, 0, NULL);
             else
               _GD_InitRawIO(D, E, NULL, -1, NULL, 0,
                   GD_FILE_WRITE | GD_FILE_TOUCH, _GD_FileSwapBytes(D, E));
+
+            if (D->error) {
+              _GD_FreeE(D, E, 1);
+              E = NULL;
+            }
           }
 
           /* Is this the first raw field ever defined? */
@@ -1727,6 +1731,11 @@ gd_entry_t *_GD_ParseFieldSpec(DIRFILE *restrict D,
       case 'S':
         if (strcmp(in_cols[1], "SBIT") == 0 && GD_PVERS_GE(*p, 7))
           E = _GD_ParseBit(D, 1, p, in_cols, n_cols, P, me);
+        else if (strcmp(in_cols[1], "SINDIR") == 0 && GD_PVERS_GE(*p, 2))
+          E = _GD_ParseYoke(D, GD_SINDIR_ENTRY, p, in_cols, n_cols, P, me);
+        else if (strcmp(in_cols[1], "SARRAY") == 0 && GD_PVERS_GE(*p, 10))
+          E = _GD_ParseArray(D, 1, p, in_cols, n_cols, P, me, outstring,
+              tok_pos);
         else if (strcmp(in_cols[1], "STRING") == 0 && GD_PVERS_GE(*p, 6))
           E = _GD_ParseString(D, p, in_cols, n_cols, P, me);
         else
@@ -1751,7 +1760,7 @@ NO_MATCH:
     unsigned int u;
 
     /* Check for duplicate */
-    if (_GD_FindField(D, E->field, D->entry, D->n_entries, 0, &u)) {
+    if (_GD_FindField(D, E->field, E->e->len, D->entry, D->n_entries, 0, &u)) {
       if (~p->flags & GD_IGNORE_DUPS)
         _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_DUPLICATE, p->file, p->line,
             E->field);
@@ -1760,16 +1769,6 @@ NO_MATCH:
       return NULL;
     }
 
-    if (E->flags & GD_EN_DOTTED) {
-      ptr = _GD_Realloc(D, D->dot_list, (D->n_dot + 1) * sizeof(gd_entry_t*));
-      if (ptr == NULL) {
-        _GD_FreeE(D, E, 1);
-        dreturn ("%p", NULL);
-        return NULL;
-      }
-      D->dot_list = (gd_entry_t **)ptr;
-    }
-
     /* Initialse the meta counts */
     if (P != NULL) {
       E->e->n_meta = -1;
@@ -1792,12 +1791,6 @@ NO_MATCH:
     /* the Format file fragment index */
     E->fragment_index = me;
 
-    /* update the dot list if necessary */
-    if (E->flags & GD_EN_DOTTED) {
-      D->dot_list[D->n_dot++] = E;
-      qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), _GD_EntryCmp);
-    }
-
     /* sort */
     _GD_InsertSort(D, E, u);
     D->n_entries++;
@@ -2027,11 +2020,12 @@ int _GD_Tokenise(DIRFILE *restrict D, const struct parser_state *restrict p,
 }
 
 /* _GD_ParseAlias: set up an alias
-*/
+ */
 static void _GD_ParseAlias(DIRFILE *restrict D,
     const struct parser_state *restrict p, char **restrict name,
     const char *restrict target, int me)
 {
+  size_t len = strlen(*name);
   gd_entry_t **new_meta_list = NULL;
   gd_entry_t *E, *P = NULL;
   unsigned int u;
@@ -2039,7 +2033,7 @@ static void _GD_ParseAlias(DIRFILE *restrict D,
 
   dtrace("%p, %p, \"%s\", \"%s\", %i", D, p, *name, target, me);
 
-  P = _GD_CheckParent(D, p, name, me);
+  P = _GD_CheckParent(D, p, name, &len, me);
   if (D->error) {
     dreturnvoid();
     return;
@@ -2078,13 +2072,13 @@ static void _GD_ParseAlias(DIRFILE *restrict D,
     return;
   }
 
-  if (_GD_SetField(D, p, E, P, me, *name, 1)) {
+  if (_GD_SetField(D, p, E, P, me, *name)) {
     dreturnvoid();
     return;
   }
 
   /* Check for duplicate */
-  if (_GD_FindField(D, E->field, D->entry, D->n_entries, 0, &u)) {
+  if (_GD_FindField(D, E->field, E->e->len, D->entry, D->n_entries, 0, &u)) {
     if (!(p->flags & GD_IGNORE_DUPS))
       _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_DUPLICATE, p->file, p->line,
           E->field);
@@ -2122,6 +2116,54 @@ static void _GD_ParseAlias(DIRFILE *restrict D,
   dreturnvoid();
 }
 
+static void _GD_ParseNamespace(DIRFILE *D, struct parser_state *restrict p,
+    const char *ns)
+{
+  char *ptr;
+
+  dtrace("%p, %p, \"%s\"", D, p, ns);
+
+  /* Ignore a leading '.' -- namespaces given in a /NAMESPACE directive are
+   * always relative to the rootspace
+   */
+  if (ns[0] == '.')
+    ns++;
+
+  if (ns[0] == '\0') {
+    /* Revert to rootspace */
+    free(p->ns);
+    p->ns = NULL;
+    p->nsl = 0;
+    dreturnvoid();
+    return;
+  }
+
+  /* check new namespace name */
+  if (_GD_ValidateField(ns, 0, p->standards, p->pedantic, GD_VF_NS)) {
+    _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, p->file, p->line, ns);
+    dreturnvoid();
+    return;
+  }
+
+  ptr = _GD_Strdup(D, ns);
+  if (ptr == NULL) { /* alloc error */
+    dreturnvoid();
+    return;
+  }
+
+  free(p->ns);
+  p->ns = ptr;
+  p->nsl = strlen(ptr);
+
+  /* strip trailing dot */
+  if (p->ns[p->nsl - 1] == '.') {
+    p->ns[p->nsl - 1] = 0;
+    p->nsl--;
+  }
+
+  dreturn("(nil) [\"%s\", %" PRIuSIZE "]", p->ns, p->nsl);
+}
+
 /* _GD_ParseDirective: Actually parse a single format file line.
  *       Returns 1 if a match was made.
  */
@@ -2231,10 +2273,12 @@ static int _GD_ParseDirective(DIRFILE *D, struct parser_state *restrict p,
     case 'H':
       if (strcmp(ptr, "HIDDEN") == 0 && GD_PVERS_GE(*p, 9)) {
         matched = 1;
-        munged_code = _GD_CodeFromFrag(D, p, NULL, me, in_cols[1], NULL, NULL);
-        if (munged_code)
-          E = _GD_FindField(D, munged_code, D->entry, D->n_entries, 0, NULL);
-        free(munged_code);
+        munged_code = _GD_CodeFromFrag(D, p, NULL, me, in_cols[1], NULL);
+        if (munged_code) {
+          E = _GD_FindField(D, munged_code, strlen(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, p->file, p->line,
@@ -2277,9 +2321,10 @@ static int _GD_ParseDirective(DIRFILE *D, struct parser_state *restrict p,
     case 'M':
       if (strcmp(ptr, "META") == 0 && GD_PVERS_GE(*p, 6)) {
         matched = 1;
-        munged_code = _GD_CodeFromFrag(D, p, NULL, me, in_cols[1], NULL, NULL);
+        munged_code = _GD_CodeFromFrag(D, p, NULL, me, in_cols[1], NULL);
         if (munged_code) {
-          E = _GD_FindField(D, munged_code, D->entry, D->n_entries, 0, NULL);
+          E = _GD_FindField(D, munged_code, strlen(munged_code), D->entry,
+              D->n_entries, 0, NULL);
           free(munged_code);
         }
 
@@ -2299,8 +2344,14 @@ static int _GD_ParseDirective(DIRFILE *D, struct parser_state *restrict p,
           _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, p->file, p->line,
               NULL);
         else
-          _GD_ParseFieldSpec(D, p, n_cols - 2, in_cols + 2, E, me, 0, 1,
-              outstring, tok_pos);
+          _GD_ParseFieldSpec(D, p, n_cols - 2, in_cols + 2, strlen(in_cols[2]),
+              E, me, 0, 1, outstring, tok_pos);
+      }
+      break;
+    case 'N':
+      if (strcmp(ptr, "NAMESPACE") == 0 && GD_PVERS_GE(*p, 10)) {
+        matched = 1;
+        _GD_ParseNamespace(D, p, in_cols[1]);
       }
       break;
     case 'P':
@@ -2343,40 +2394,43 @@ static int _GD_ParseDirective(DIRFILE *D, struct parser_state *restrict p,
 }
 
 /* Resolve and record an alias, taking care of loops */
-static gd_entry_t *_GD_ResolveAlias(DIRFILE *restrict D, gd_entry_t *restrict E)
+static gd_entry_t *_GD_ResolveAlias(DIRFILE *restrict D, const gd_entry_t *base,
+    gd_entry_t *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;
-  }
+  dtrace("%p, %p, %p(%s)", D, base, E, E->field);
 
   /* Find the target */
-  T = _GD_FindField(D, E->in_fields[0], D->entry, D->n_entries, 0, NULL);
+  T = _GD_FindField(D, E->in_fields[0], strlen(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;
+  /* Aliases store the ulitmate target in entry[0] and the direct link in
+   * entry[1] */
+  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 if (base == T) /* loop */
+        T = NULL;
       else
-        T = _GD_ResolveAlias(D, T);
+        T = _GD_ResolveAlias(D, base, T);
     }
 
-    E->e->entry[0] = T;
   }
 
-  D->recurse_level--;
-  dreturn("%p", D->error ? NULL : E->e->entry[0]);
-  return D->error ? NULL : E->e->entry[0];
+  E->e->entry[0] = T;
+
+  if (D->error) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  dreturn("%p (\"%s\" > \"%s\" > \"%s\")", E->e->entry[0], E->field,
+      E->e->entry[1] ? E->e->entry[1]->field : "",
+      E->e->entry[0] ? E->e->entry[0]->field : "");
+  return E->e->entry[0];
 }
 
 void _GD_UpdateAliases(DIRFILE *D, int reset)
@@ -2394,7 +2448,7 @@ void _GD_UpdateAliases(DIRFILE *D, int reset)
     if (D->entry[u]->field_type == GD_ALIAS_ENTRY &&
         D->entry[u]->e->entry[1] == NULL)
     {
-      _GD_ResolveAlias(D, D->entry[u]);
+      _GD_ResolveAlias(D, D->entry[u], D->entry[u]);
     }
 
   dreturnvoid();
@@ -2448,8 +2502,8 @@ char *_GD_ParseFragment(FILE *restrict fp, DIRFILE *D, struct parser_state *p,
           &outstring, tok_pos);
 
     if (D->error == GD_E_OK && !match)
-      first_raw = _GD_ParseFieldSpec(D, p, n_cols, in_cols, NULL, me, 0, 1,
-          &outstring, tok_pos);
+      first_raw = _GD_ParseFieldSpec(D, p, n_cols, in_cols, strlen(in_cols[0]),
+          NULL, me, 0, 1, &outstring, tok_pos);
 
     if (D->error == GD_E_FORMAT) {
       /* call the callback for this error */
@@ -2489,10 +2543,25 @@ char *_GD_ParseFragment(FILE *restrict fp, DIRFILE *D, struct parser_state *p,
           _GD_ClearError(D);
           rescan = 1; /* rescan the modified instring */
           if (pdata.line != instring) {
-            /* a new line was malloc'd by the caller, delete our old one. */
+            /* a new line was malloc'd by the caller, delete our old one
+             * then copy it from the caller's heap to libc's to avoid
+             * problems later. */
             free(instring);
-            instring = pdata.line;
-            n = pdata.buflen;
+            if (_GD_CFree != free) {
+              instring = strdup(pdata.line);
+              _GD_CFree(pdata.line);
+              if (instring == NULL) {
+                _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+                break;
+              }
+            } else
+              instring = pdata.line;
+
+            /* The callback isn't required to update pdata.buflen when it
+             * updates pdata.line, so just assume the buffer is as large as
+             * the string it contains
+             */
+            n = strlen(instring) + 1;
           }
           break;
         default:
@@ -2570,13 +2639,7 @@ char *gd_strtok(DIRFILE *D, const char *string) gd_nothrow
 
   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);
+  GD_RETURN_IF_INVALID(D, "%p", NULL);
 
   if (string) {
     free(D->tok_base);
@@ -2600,11 +2663,20 @@ char *gd_strtok(DIRFILE *D, const char *string) gd_nothrow
     free(D->tok_base);
     D->tok_pos = D->tok_base = NULL;
     free(outstring);
-    outstring = NULL;
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  /* move to caller's heap -- in_col and outstring always end up pointing to
+   * the same thing, so if we don't have to do this, there's nothing else we
+   * need to do */
+  if (_GD_CMalloc != malloc) {
+    outstring = _GD_CStrdup(in_col);
+    free(in_col);
+    if (outstring == NULL)
+      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
   }
 
-  /* in_col invariably points to outstring, so just let the caller worry about
-   * cleaning up.  Ha! */
   dreturn("\"%s\"", outstring);
   return outstring;
 }
diff --git a/src/protect.c b/src/protect.c
index 9108434..e411bb7 100644
--- a/src/protect.c
+++ b/src/protect.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2010, 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008, 2010, 2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,10 @@ int gd_protection(DIRFILE* D, int fragment_index) gd_nothrow
 {
   dtrace("%p, %i", D, fragment_index);
 
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (fragment_index < 0 || fragment_index >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (fragment_index < 0 || fragment_index >= D->n_fragment)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
 
   dreturn("%i", D->fragment[fragment_index].protection);
   return D->fragment[fragment_index].protection;
@@ -49,41 +40,33 @@ int gd_alter_protection(DIRFILE *D, int protection_level, int fragment_index)
 
   dtrace("%p, %i, %i", D, protection_level, fragment_index);
 
-  _GD_ClearError(D);
-
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if ((D->flags & GD_ACCMODE) != GD_RDWR) {
-    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if ((D->flags & GD_ACCMODE) != GD_RDWR)
+    GD_SET_RETURN_ERROR(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
 
-  if (fragment_index < GD_ALL_FRAGMENTS || fragment_index >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (fragment_index < GD_ALL_FRAGMENTS || fragment_index >= D->n_fragment)
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
 
   if (protection_level != GD_PROTECT_NONE &&
       protection_level != GD_PROTECT_FORMAT &&
       protection_level != GD_PROTECT_DATA &&
       protection_level != GD_PROTECT_ALL)
   {
-    _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_PROTECTION, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+    GD_SET_RETURN_ERROR(D, GD_E_ARGUMENT, GD_E_ARG_PROTECTION, NULL, 0, NULL);
   }
 
   if (fragment_index == GD_ALL_FRAGMENTS)
-    for (i = 0; i < D->n_fragment; ++i)
-      D->fragment[i].protection = protection_level;
-  else
+    for (i = 0; i < D->n_fragment; ++i) {
+      if (protection_level != D->fragment[i].protection) {
+        D->fragment[i].protection = protection_level;
+        D->fragment[i].modified = 1;
+      }
+    }
+  else if (protection_level != D->fragment[fragment_index].protection) {
     D->fragment[fragment_index].protection = protection_level;
+    D->fragment[fragment_index].modified = 1;
+  }
 
   dreturn("%i", 0);
   return 0;
diff --git a/src/putdata.c b/src/putdata.c
index 2d6fc79..630752e 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-2015 D. V. Wiebe
+ * Copyright (C) 2005-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -82,7 +82,7 @@ static size_t _GD_DoRawOut(DIRFILE *restrict D, gd_entry_t *restrict E,
   }
 
   if (_GD_DoSeek(D, E, _GD_ef + E->e->u.raw.file[0].subenc, s0, GD_FILE_WRITE)
-      == -1)
+      < 0)
   {
     free(databuffer);
     dreturn("%i", 0);
@@ -115,17 +115,18 @@ static size_t _GD_DoLinterpOut(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, data_type, data_in);
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-  
   if (E->e->repr[0] != GD_REPR_NONE) { /* can't write to representaions */
     _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_REPR, NULL, 0, E->in_fields[0]);
     dreturn("%i", 0);
     return 0;
   }
 
+  if (E->e->u.linterp.table_len < 0)
+    if (_GD_ReadLinterpFile(D, E)) {
+      dreturn("%i", 0);
+      return 0;
+    }
+
   /* if the table is complex valued, we can't invert it */
   if (E->e->u.linterp.complex_table) {
     _GD_SetError(D, GD_E_DOMAIN, GD_E_DOMAIN_COMPLEX, NULL, 0, NULL);
@@ -133,14 +134,6 @@ static size_t _GD_DoLinterpOut(DIRFILE *restrict D, gd_entry_t *restrict E,
     return 0;
   }
 
-  if (E->e->u.linterp.table_len < 0) {
-    _GD_ReadLinterpFile(D, E);
-    if (D->error != GD_E_OK) {
-      dreturn("%i", 0);
-      return 0;
-    }
-  }
-
   /* Check whether the LUT is monotonic */
   if (E->e->u.linterp.table_monotonic == -1) {
     E->e->u.linterp.table_monotonic = 1;
@@ -230,11 +223,6 @@ static size_t _GD_DoLincomOut(DIRFILE *restrict D, gd_entry_t *restrict E,
     return 0;
   }
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   if (E->e->repr[0] != GD_REPR_NONE) { /* can't write to representaions */
     _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_REPR, NULL, 0, E->in_fields[0]);
     dreturn("%i", 0);
@@ -306,11 +294,6 @@ static size_t _GD_DoBitOut(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, data_type, data_in);
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   if (E->e->repr[0] != GD_REPR_NONE) { /* can't write to representaions */
     _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_REPR, NULL, 0, E->in_fields[0]);
     dreturn("%i", 0);
@@ -367,11 +350,6 @@ static size_t _GD_DoPhaseOut(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, data_type, data_in);
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   if (E->e->repr[0] != GD_REPR_NONE) { /* can't write to representaions */
     _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_REPR, NULL, 0, E->in_fields[0]);
     dreturn("%i", 0);
@@ -396,11 +374,6 @@ static size_t _GD_DoRecipOut(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, data_type, data_in);
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   if (E->e->repr[0] != GD_REPR_NONE) { /* can't write to representaions */
     _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_REPR, NULL, 0, E->in_fields[0]);
     dreturn("%i", 0);
@@ -456,11 +429,6 @@ static size_t _GD_DoPolynomOut(DIRFILE *restrict D, gd_entry_t *restrict E,
     return 0;
   }
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   if (E->e->repr[0] != GD_REPR_NONE) { /* can't write to representaions */
     _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_REPR, NULL, 0, E->in_fields[0]);
     dreturn("%i", 0);
@@ -562,8 +530,7 @@ static void _GD_MplexOutData(DIRFILE *restrict D, void *restrict A,
     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, 0, NULL, type, NULL);
-                        break;
+    default:       _GD_InternalError(D); break;
   }
 
   dreturnvoid();
@@ -582,22 +549,12 @@ static size_t _GD_DoMplexOut(DIRFILE *restrict D, gd_entry_t *restrict E,
   dtrace("%p, %p, %" PRId64 ", %" PRIuSIZE ", 0x%X, %p", D, E,
       (int64_t)first_samp, num_samp, data_type, data_in);
 
-  if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   if (E->e->repr[0] != GD_REPR_NONE) { /* can't write to representaions */
     _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_REPR, NULL, 0, E->in_fields[0]);
     dreturn("%i", 0);
     return 0;
   }
 
-  if (_GD_BadInput(D, E, 1, GD_NO_ENTRY, 1)) {
-    dreturn("%i", 0);
-    return 0;
-  }
-
   /* read the data to be modified */
   spf1 = _GD_GetSPF(D, E->e->entry[0]);
   spf2 = _GD_GetSPF(D, E->e->entry[1]);
@@ -695,14 +652,15 @@ size_t _GD_DoFieldOut(DIRFILE *restrict D, gd_entry_t *restrict E,
     return 0;
   }
 
-  if (!(E->flags & GD_EN_CALC)) {
+  if (!(E->flags & GD_EN_CALC))
     _GD_CalculateEntry(D, E, 1);
 
-    if (D->error) {
-      D->recurse_level--;
-      dreturn("%i", 0);
-      return 0;
-    }
+  _GD_FindInputs(D, E, 1);
+
+  if (D->error) {
+    D->recurse_level--;
+    dreturn("%i", 0);
+    return 0;
   }
 
   /* Avoid craziness */
@@ -756,10 +714,13 @@ size_t _GD_DoFieldOut(DIRFILE *restrict D, gd_entry_t *restrict E,
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
     case GD_WINDOW_ENTRY:
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
     case GD_INDEX_ENTRY:
       _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_PUT, NULL, 0, E->field);
       break;
     case GD_STRING_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_ALIAS_ENTRY:
     case GD_NO_ENTRY:
       _GD_InternalError(D);
@@ -784,11 +745,7 @@ size_t gd_putdata64(DIRFILE* D, const char *field_code, off64_t first_frame,
       ", 0x%X, %p", D, field_code, (int64_t)first_frame, (int64_t)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);
-    dreturn("%i", 0);
-    return 0;
-  }
+  GD_RETURN_IF_INVALID(D, "%i", 0);
 
   if ((D->flags & GD_ACCMODE) != GD_RDWR) {
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
@@ -796,18 +753,17 @@ size_t gd_putdata64(DIRFILE* D, const char *field_code, off64_t first_frame,
     return 0;
   }
 
-  _GD_ClearError(D);
-
-  entry = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
+  entry = _GD_FindEntry(D, field_code);
 
   if (entry == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
     dreturn("%i", 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 if (_GD_BadType(GD_DIRFILE_STANDARDS_VERSION, data_type))
+    _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, data_type, NULL);
 
   if (D->error) {
     dreturn("%i", 0);
@@ -819,7 +775,7 @@ size_t gd_putdata64(DIRFILE* D, const char *field_code, off64_t first_frame,
     first_frame = 0;
   }
 
-  if (num_frames > 0 || first_frame > 0) {
+  if (num_frames || first_frame) {
     /* get the samples per frame */
     spf = _GD_GetSPF(D, entry);
 
diff --git a/src/sie.c b/src/sie.c
index a21b22a..b45e3fb 100644
--- a/src/sie.c
+++ b/src/sie.c
@@ -162,13 +162,7 @@ int _GD_SampIndOpen(int fd, struct gd_raw_file_ *file,
 {
   dtrace("%i, %p, <unused>, %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));
+  file->edata = malloc(sizeof(struct gd_siedata));
 
   if (file->edata == NULL) {
     dreturn("%i", -1);
diff --git a/src/spf.c b/src/spf.c
index 1229a33..a9e96e8 100644
--- a/src/spf.c
+++ b/src/spf.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2015 D. V. Wiebe
+ * Copyright (C) 2005-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -31,8 +31,14 @@ unsigned int _GD_GetSPF(DIRFILE *D, gd_entry_t *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("%u", 0);
+    return 0;
+  }
+
+  if (_GD_FindInputs(D, E, 1)) {
     D->recurse_level--;
+    dreturn("%u", 0);
     return 0;
   }
 
@@ -54,9 +60,8 @@ unsigned int _GD_GetSPF(DIRFILE *D, gd_entry_t *E)
     case GD_SBIT_ENTRY:
     case GD_WINDOW_ENTRY:
     case GD_MPLEX_ENTRY:
-      if (_GD_BadInput(D, E, 0, GD_NO_ENTRY, 1))
-        break;
-
+    case GD_INDIR_ENTRY:
+    case GD_SINDIR_ENTRY:
       spf = _GD_GetSPF(D, E->e->entry[0]);
       break;
     case GD_INDEX_ENTRY:
@@ -65,6 +70,7 @@ unsigned int _GD_GetSPF(DIRFILE *D, gd_entry_t *E)
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
     case GD_STRING_ENTRY:
+    case GD_SARRAY_ENTRY:
     case GD_ALIAS_ENTRY:
     case GD_NO_ENTRY:
       _GD_InternalError(D);
@@ -84,13 +90,7 @@ unsigned int gd_spf(DIRFILE* D, const char *field_code) gd_nothrow
 
   dtrace("%p, \"%s\"", D, field_code);
 
-  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);
+  GD_RETURN_IF_INVALID(D, "%u", 0);
 
   entry = _GD_FindEntry(D, field_code);
 
diff --git a/src/string.c b/src/string.c
index fead4d2..767887e 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2010-2015 D. V. Wiebe
+/* Copyright (C) 2008, 2010-2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,54 +20,59 @@
  */
 #include "internal.h"
 
-static int gd_get_sarray_slice(DIRFILE *D, const char *field_code,
-    unsigned long start, size_t n, const char **data_out)
-gd_nothrow
+int gd_get_sarray_slice(DIRFILE *D, const char *field_code, unsigned long start,
+    size_t n, const char **data_out) gd_nothrow
 {
   gd_entry_t *E;
 
   dtrace("%p, \"%s\", %lu, %" PRIuSIZE ", %p", D, field_code, start, n,
       data_out);
 
-  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);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  if (E == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
-    dreturn("%i", -1);
-    return -1;
-  }
+  E = _GD_FindEntry(D, field_code);
 
-  if (E->field_type != GD_STRING_ENTRY) {
+  if (E == NULL)
+    ; /* Error already set */
+  else if (E->field_type != GD_STRING_ENTRY && E->field_type != GD_SARRAY_ENTRY)
     _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
-    dreturn("%i", -1);
-    return -1;
-  } else if (start + n > ((E->field_type == GD_STRING_ENTRY) ? 1 :
+  else if (start + n > ((E->field_type == GD_STRING_ENTRY) ? 1 :
         E->EN(scalar,array_len)))
   {
     _GD_SetError(D, GD_E_BOUNDS, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  } else if (n == 0)
+    ; /* nothing to do */
+  else if (E->field_type == GD_STRING_ENTRY)
+    data_out[0] = E->e->u.string;
+  else
+    memcpy(data_out, ((const char **)E->e->u.scalar.d) + start,
+        n * sizeof(const char*));
 
-  /* nothing to do */
-  if (n == 0) {
-    dreturn("%i", 0);
-    return 0;
-  }
+  GD_RETURN_ERROR(D);
+}
+
+int gd_get_sarray(DIRFILE *D, const char *field_code, const char **data_out)
+gd_nothrow
+{
+  gd_entry_t *E;
+
+  dtrace("%p, \"%s\", %p", D, field_code, data_out);
+
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  E = _GD_FindEntry(D, field_code);
+
+  if (E == NULL)
+    GD_RETURN_ERROR(D);
 
   if (E->field_type == GD_STRING_ENTRY)
     data_out[0] = E->e->u.string;
+  else if (E->field_type == GD_SARRAY_ENTRY)
+    memcpy(data_out, E->e->u.scalar.d,
+        E->EN(scalar,array_len) * sizeof(const char*));
   else
-    memcpy(data_out, ((const char **)E->e->u.scalar.d) + start,
-        n * sizeof(const char*));
+    GD_SET_RETURN_ERROR(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0,
+        field_code);
 
   dreturn("%i", 0);
   return 0;
@@ -97,38 +102,36 @@ size_t gd_get_string(DIRFILE *D, const char *field_code, size_t len,
   return n_read;
 }
 
-static size_t _GD_PutSarraySlice(DIRFILE *restrict D, gd_entry_t *restrict E,
+static void _GD_PutSarraySlice(DIRFILE *restrict D, gd_entry_t *restrict E,
     unsigned long first, size_t n, const char **data_in)
 {
-  size_t len;
-
   dtrace("%p, %p, %lu, %" PRIuSIZE ", %p", D, E, first, n, data_in);
 
   if ((D->flags & GD_ACCMODE) != GD_RDWR) {
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", 0);
-    return 0;
+    dreturnvoid();
+    return;
   }
 
   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;
+    dreturnvoid();
+    return;
   }
 
   if (first + n > ((E->field_type == GD_STRING_ENTRY) ? 1 :
         E->EN(scalar,array_len)))
   {
     _GD_SetError(D, GD_E_BOUNDS, 0, NULL, 0, NULL);
-    dreturn("%i", 0);
-    return 0;
+    dreturnvoid();
+    return;
   }
 
   if (n == 0) {
     /* succesfully did nothing. */
-    dreturn("%i", 1);
-    return 1;
+    dreturnvoid();
+    return;
   }
 
   if (E->field_type == GD_STRING_ENTRY) {
@@ -136,8 +139,8 @@ static size_t _GD_PutSarraySlice(DIRFILE *restrict D, gd_entry_t *restrict E,
     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;
+      dreturnvoid();
+      return;
     }
     free(ptr);
   } else {
@@ -145,8 +148,8 @@ static size_t _GD_PutSarraySlice(DIRFILE *restrict D, gd_entry_t *restrict E,
     size_t i;
     char **new_data = _GD_Malloc(D, n * sizeof(char*));
     if (new_data == NULL) {
-      dreturn("%i", 0);
-      return 0;
+      dreturnvoid();
+      return;
     }
 
     memset(new_data, 0, n * sizeof(char*));
@@ -157,8 +160,8 @@ static size_t _GD_PutSarraySlice(DIRFILE *restrict D, gd_entry_t *restrict E,
       for (i = 0; i < n; ++i)
         free(new_data[i]);
       free(new_data);
-      dreturn("%i", 0);
-      return 0;
+      dreturnvoid();
+      return;
     }
 
     /* replace elements */
@@ -171,38 +174,73 @@ static size_t _GD_PutSarraySlice(DIRFILE *restrict D, gd_entry_t *restrict E,
 
   D->fragment[E->fragment_index].modified = 1;
 
-  len = strlen(data_in[0]) + 1;
-  dreturn("%" PRIuSIZE, len);
-  return len;
+  dreturnvoid();
+  return;
+}
+
+int gd_put_sarray_slice(DIRFILE *D, const char *field_code, unsigned long first,
+    size_t n, const char **data_in) gd_nothrow
+{
+  gd_entry_t *E;
+
+  dtrace("%p, \"%s\", %lu, %" PRIuSIZE ", %p", D, field_code, first, n,
+      data_in);
+
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  E = _GD_FindEntry(D, field_code);
+
+  if (E == NULL)
+    ; /* Error already set */
+  else if (E->field_type != GD_SARRAY_ENTRY && E->field_type != GD_STRING_ENTRY)
+    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+  else
+    _GD_PutSarraySlice(D, E, first, n, data_in);
+
+  GD_RETURN_ERROR(D);
 }
 
-size_t gd_put_string(DIRFILE *D, const char *field_code, const char *data_in)
+int gd_put_sarray(DIRFILE *D, const char *field_code, const char **data_in)
   gd_nothrow
 {
-  size_t n_wrote = 0;
   gd_entry_t *E;
 
-  dtrace("%p, \"%s\", \"%s\"", D, field_code, data_in);
+  dtrace("%p, \"%s\", %p", D, field_code, data_in);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", 0);
-    return 0;
-  }
+  GD_RETURN_ERR_IF_INVALID(D);
+
+  E = _GD_FindEntry(D, field_code);
+
+  if (E == NULL) 
+    ; /* Error already set */
+  else if (E->field_type != GD_SARRAY_ENTRY && E->field_type != GD_STRING_ENTRY)
+    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+  else
+   _GD_PutSarraySlice(D, E, 0, (E->field_type == GD_STRING_ENTRY) ? 1 :
+       E->EN(scalar,array_len), data_in);
+
+  GD_RETURN_ERROR(D);
+}
+
+int gd_put_string(DIRFILE *D, const char *field_code, const char *data_in)
+  gd_nothrow
+{
+  gd_entry_t *E;
+
+  dtrace("%p, \"%s\", \"%s\"", D, field_code, data_in);
 
-  _GD_ClearError(D);
+  GD_RETURN_ERR_IF_INVALID(D);
 
-  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
+  E = _GD_FindEntry(D, field_code);
 
   if (E == NULL)
-    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
-  else if (E->field_type != GD_STRING_ENTRY) {
+    ; /* Error already set */
+  else if (E->field_type != GD_STRING_ENTRY && E->field_type != GD_SARRAY_ENTRY)
     _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
-  } else 
-    n_wrote = _GD_PutSarraySlice(D, E, 0, 1, &data_in);
+  else 
+    _GD_PutSarraySlice(D, E, 0, 1, &data_in);
 
-  dreturn("%" PRIuSIZE, n_wrote);
-  return n_wrote;
+  GD_RETURN_ERROR(D);
 }
 /* vim: ts=2 sw=2 et tw=80
 */
diff --git a/src/types.c b/src/types.c
index 0977e71..50e60ce 100644
--- a/src/types.c
+++ b/src/types.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2012, 2014, 2015 D. V. Wiebe
+ * Copyright (C) 2005-2012, 2014, 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -119,7 +119,7 @@ gd_nothrow
           TO_COMPLEX(double,int8_t);
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
@@ -171,7 +171,7 @@ gd_nothrow
           TO_COMPLEX(double,uint8_t);
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
@@ -223,7 +223,7 @@ gd_nothrow
           TO_COMPLEX(double,int16_t);
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
@@ -275,7 +275,7 @@ gd_nothrow
           TO_COMPLEX(double,uint16_t);
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
@@ -327,7 +327,7 @@ gd_nothrow
           TO_COMPLEX(double,int32_t);
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
@@ -430,7 +430,7 @@ gd_nothrow
           TO_COMPLEX(double,int64_t);
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
@@ -482,7 +482,7 @@ gd_nothrow
           TO_COMPLEX(double,uint64_t);
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
@@ -534,7 +534,7 @@ gd_nothrow
           TO_COMPLEX(double,float);
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
@@ -586,7 +586,7 @@ gd_nothrow
           TO_COMPLEX(double,double);
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
@@ -630,7 +630,7 @@ gd_nothrow
             ((double *)data_out)[i] = (double)((float *)data_in)[i];
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
@@ -674,12 +674,12 @@ gd_nothrow
           memcpy(data_out, data_in, 2 * n * sizeof(double));
           return;
         default:
-          _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, out_type, NULL);
+          _GD_InternalError(D);
           break;
       }
       break;
     default:
-      _GD_SetError(D, GD_E_BAD_TYPE, 0, NULL, in_type, NULL);
+      _GD_InternalError(D);
       break;
   }
 }
diff --git a/src/zzip.c b/src/zzip.c
index 8e2c3a2..f0dfb2b 100644
--- a/src/zzip.c
+++ b/src/zzip.c
@@ -77,7 +77,7 @@ static struct gd_zzipdata *_GD_ZzipDoOpen(int dirfd, struct gd_raw_file_* file)
   dtrace("%i, %p", dirfd, file);
 
   /* open the zip file.  */
-  if ((fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY | O_BINARY)) < 0) {
+  if ((fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY | O_BINARY, 0666)) < 0) {
     file->error = -1;
     dreturn("%p", NULL);
     return NULL;
diff --git a/test/Makefile.am b/test/Makefile.am
index f53a676..72d38e4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -23,55 +23,99 @@ AUTOMAKE_OPTIONS = foreign serial-tests
 LDADD=../src/libgetdata.la
 AM_CPPFLAGS=${GD_CC_WALL} $(GD_CC_WEXTRA) -I$(top_srcdir)/src
 
-EXTRA_DIST=test.h
-
-ADD_TESTS=add_add add_affix add_alias add_alias_affix add_alias_meta \
-					add_amb_code7 add_bit add_bit_bitnum add_bit_bitsize add_bit_invalid \
-					add_bit_numbits add_bit_scalars add_carray add_clincom add_code \
-					add_const add_cpolynom add_crecip add_crecip89 add_dangle_dup \
-					add_divide add_divide_invalid add_dot5 add_dot6 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_scalars add_multiply add_multiply_invalid add_phase \
-					add_phase_invalid add_polynom add_polynom_scalar add_protect add_raw \
-					add_raw_include add_raw_invalid add_raw_spf add_raw_spf_scalar \
-					add_raw_sub 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
+# The enc_*.c files aren't directly used as tests.  They're included by
+# corresponding encoding tests.
+EXTRA_DIST=test.h enc_add.c enc_complex64.c enc_complex128.c enc_del.c \
+					 enc_enoent.c enc_float32.c enc_float64.c enc_get_cont.c enc_int8.c \
+					 enc_int16.c enc_int32.c enc_int64.c enc_move_from.c enc_nframes.c \
+					 enc_put_offs.c enc_seek.c enc_uint8.c enc_uint16.c enc_uint32.c \
+					 enc_uint64.c
+
+ADD_TESTS=add_add add_affix add_alias add_alias_affix add_alias_index \
+					add_alias_meta add_alias_name add_alias_ns add_alias_prot \
+					add_alias_rdonly add_amb_code7 add_bit add_bit_bitnum \
+					add_bit_bitsize add_bit_inaff add_bit_invalid add_bit_numbits \
+					add_bit_scalars add_carray add_carray_entry add_carray_type \
+					add_clincom add_clincom_nfields add_code add_const add_const_type \
+					add_cpolynom add_cpolynom_order add_crecip add_crecip89 \
+					add_dangle_dup add_divide add_divide_inaff1 add_divide_inaff2 \
+					add_divide_invalid add_dot5 add_dot6 add_dot10 add_duplicate \
+					add_format add_indir add_invalid add_lincom add_lincom_affix \
+					add_lincom_invalid add_lincom_nfields add_lincom_nfields2 \
+					add_linterp add_linterp_inaff add_linterp_invalid add_meta \
+					add_meta_alias add_meta_parent add_mplex add_mplex_inaff \
+					add_mplex_period add_mplex_scalars add_multiply add_multiply_invalid \
+					add_name_len add_ns add_ns_frag add_ns_frag2 add_phase \
+					add_phase_inaff add_phase_invalid add_polynom add_polynom_inaff \
+					add_polynom_order add_polynom_order2 add_polynom_scalar add_protect \
+					add_raw add_raw_include add_raw_invalid add_raw_prot add_raw_spf \
+					add_raw_spf_scalar add_raw_sub add_raw_type add_rdonly add_recip \
+					add_recip_inaff add_resolv add_sarray add_sarray_dup add_sarray_nil \
+					add_sbit add_scalar add_scalar_carray add_scalar_carray_bad \
+					add_sindir add_sort add_spec add_spec_affix add_spec_directive \
+					add_spec_index \
+					add_spec_invalid add_spec_meta add_spec_nil add_spec_prot \
+					add_spec_raw_autoenc add_spec_raw_prot add_spec_raw_unkenc \
+					add_spec_resolv add_string add_string_affix add_string_dup \
+					add_string_entry add_type add_window add_window_inaff 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_clincom alter_const alter_const_c2r \
-						alter_const_r2c alter_const_r2r alter_cpolynom alter_cpolynom_null \
+ALLOC_TESTS=alloc_affix alloc_callback alloc_clear alloc_entry alloc_tok
+
+ALTER_TESTS=alter_bit_bitnum alter_bit_in alter_bit_numbits alter_bit_scalar \
+						alter_carray_len alter_carray_type alter_clincom alter_clincom_32 \
+						alter_clincom_nfields alter_clincom_nfields_code \
+						alter_clincom_null alter_code alter_const alter_const_c2r \
+						alter_const_r2c alter_const_r2r alter_const_type alter_cpolynom \
+						alter_cpolynom_null alter_cpolynom_ord alter_cpolynom_ord_code \
 						alter_crecip alter_crecip89 alter_crecip89_null alter_crecip_zero \
-						alter_divide alter_entry alter_entry_affix alter_entry_hidden \
-						alter_entry_lincom alter_entry_recode alter_entry_recode_recalc \
-						alter_entry_scalar1 alter_entry_scalar2a alter_entry_scalar2n \
-						alter_entry_scalar3 alter_entry_scalar3c alter_entry_scalar3i \
-						alter_entry_scalar3r alter_entry_scalar4 alter_entry_scalar_amb \
-						alter_index 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_spec_polynom alter_window
-
-ASCII_TESTS=ascii_add ascii_get ascii_get_complex ascii_get_get ascii_get_here \
-						ascii_get_sub ascii_nframes ascii_put ascii_put_here ascii_seek \
-						ascii_seek_far ascii_sync
-
-BOF_TESTS=bof bof_bit bof_index bof_lincom bof_phase bof_phase_neg
-
-BZIP_TESTS=bzip_add bzip_get bzip_get_far bzip_get_get bzip_get_get2 \
-					 bzip_get_put bzip_move_from bzip_move_to bzip_nframes bzip_put \
-					 bzip_put_back bzip_put_endian bzip_put_get bzip_put_pad \
-					 bzip_put_sub bzip_seek bzip_seek_far bzip_sync
+						alter_divide alter_divide_in alter_entry alter_entry_affix \
+						alter_entry_entype alter_entry_hidden alter_entry_lincom \
+						alter_entry_lincom_nfields alter_entry_recode \
+						alter_entry_recode_recalc alter_entry_sarray alter_entry_scalar1 \
+						alter_entry_scalar2a alter_entry_scalar2n alter_entry_scalar3 \
+						alter_entry_scalar3c alter_entry_scalar3i alter_entry_scalar3r \
+						alter_entry_scalar4 alter_entry_scalar_amb alter_index alter_indir \
+						alter_lincom_23 alter_lincom_32 alter_lincom_affix \
+						alter_lincom_input alter_lincom_nfields alter_lincom_nfields_code \
+						alter_lincom_offset alter_lincom_scalar alter_lincom_slope \
+						alter_linterp alter_linterp_in alter_linterp_move alter_mplex \
+						alter_mplex_in alter_mplex_scalar alter_mspec alter_mspec_affix \
+						alter_multiply alter_phase alter_phase_in alter_phase_scalar \
+						alter_polynom_coeff alter_polynom_input alter_polynom_ord \
+						alter_polynom_ord2 alter_polynom_ord_code alter_polynom_scalar \
+						alter_prot alter_raw_prot alter_raw_spf alter_raw_spf_type \
+						alter_raw_type alter_rdonly alter_recip alter_recip_scalar \
+						alter_recip_zero alter_sarray alter_sarray_nop alter_sbit \
+						alter_scalar_affix alter_sindir alter_spec alter_spec_affix \
+						alter_spec_code alter_spec_format alter_spec_meta alter_spec_nil \
+						alter_spec_polynom alter_spec_prot alter_spec_rdonly alter_window \
+						alter_window_in alter_window_op alter_window_scalar
+
+ASCII_TESTS=ascii_add ascii_complex64 ascii_complex128 ascii_get \
+						ascii_get_complex ascii_float32 ascii_float64 ascii_get_get \
+						ascii_get_here ascii_get_sub ascii_int8 ascii_int16 ascii_int32 \
+						ascii_int64 ascii_nframes ascii_put ascii_put_here ascii_seek \
+						ascii_seek_far ascii_sync ascii_uint8 ascii_uint16 ascii_uint32 \
+						ascii_uint64
+
+BOF_TESTS=bof bof_bit bof_bit_code bof_code bof_const bof_index bof_lincom \
+					bof_lincom_code bof_phase bof_phase_code bof_phase_neg bof_recurse
+
+BZIP_TESTS=bzip_add bzip_complex64 bzip_complex128 bzip_del bzip_enoent \
+					 bzip_float32 bzip_float64 bzip_get bzip_get_cont bzip_get_far \
+					 bzip_get_get bzip_get_get2 bzip_get_put bzip_int8 bzip_int16 \
+					 bzip_int32 bzip_int64 bzip_move_from bzip_move_to bzip_nframes \
+					 bzip_put bzip_put_back bzip_put_endian bzip_put_get bzip_put_offs \
+					 bzip_put_pad bzip_put_sub bzip_seek bzip_seek_far bzip_sync \
+					 bzip_uint8 bzip_uint16 bzip_uint32 bzip_uint64
+
+CALIST_TESTS=calist calist0 calist_free calist_hidden calist_long calist_meta \
+						 calist_meta0 calist_meta_free calist_meta_hidden calist_meta_meta \
+						 calist_meta_parent calist_null
 
 CLOSE_TESTS=close_bad close_close close_discard close_null
 
@@ -126,29 +170,30 @@ CONVERT_TESTS=convert_complex128_complex64 convert_complex128_float64 \
 
 CREAT_TESTS=creat creat_excl creat_rdonly creat_rdonly_exists
 
-CVLIST_TESTS=cvlist cvlist_array cvlist_array0 cvlist_array_free \
-						 cvlist_array_hidden cvlist_array_meta cvlist_array_meta0 \
-						 cvlist_array_meta_free cvlist_array_meta_hidden cvlist_array_null \
-						 cvlist_hidden cvlist_invalid cvlist_meta cvlist_meta0 \
-						 cvlist_meta_hidden cvlist_meta_invalid cvlist_null
+CVLIST_TESTS=cvlist cvlist_hidden cvlist_invalid cvlist_long cvlist_meta \
+						 cvlist_meta0 cvlist_meta_code cvlist_meta_hidden \
+						 cvlist_meta_invalid cvlist_meta cvlist_null cvlist_meta_parent
 
-DEL_TESTS=del_alias del_bad_code del_carray del_carray_deref del_const \
-					del_const_deref del_const_force del_data del_data_enoent \
-					del_data_open del_derived del_derived_after del_derived_force \
-					del_del del_meta del_meta_force del_ref
+DEL_TESTS=del_alias del_alias_dangle del_alias_target del_bad_code del_carray \
+					del_carray_deref del_const del_const_deref del_const_force del_data \
+					del_data_enoent del_data_open del_data_prot del_del del_derived \
+					del_derived_after del_derived_force del_divide del_meta \
+					del_meta_force del_prot del_rdonly del_ref
 
 DESYNC_TESTS=desync desync_flush desync_path desync_reopen desync_reopen_inv
 
 DFES_TESTS=dfes_bit dfes_divide dfes_lincom dfes_linterp dfes_multiply \
 					 dfes_null dfes_phase dfes_raw dfes_recip dfes_zero
 
-ELIST_TESTS=elist_alias elist_hidden elist_noalias elist_scalar
+ELIST_TESTS=elist_alias elist_hidden elist_noalias elist_parent elist_parent2 \
+						elist_scalar elist_type
 
 ENCODE_TESTS=encode_alter encode_alter_all encode_alter_open encode_get \
 						 encode_recode encode_recode_open encode_support
 
-ENDIAN_TESTS=endian_alter endian_alter_all endian_alter_sie endian_get \
-						 endian_move
+ENDIAN_TESTS=endian_alter endian_alter_all endian_alter_arg endian_alter_dprot \
+						 endian_alter_fprot endian_alter_index endian_alter_rdonly \
+						 endian_alter_sie endian_get endian_index endian_move
 
 ENTRY_TESTS=entry_bad_code entry_bit entry_bit_scalar entry_divide \
 						entry_invalid entry_lincom entry_lincom_scalar entry_linterp \
@@ -158,85 +203,116 @@ ENTRY_TESTS=entry_bad_code entry_bit entry_bit_scalar entry_divide \
 						entry_scalar_repr entry_recip entry_type entry_type_alias \
 						entry_window entry_window_scalar
 
-EOF_TESTS=eof eof_bit eof_index eof_lincom eof_phase eof_phase_neg
+EOF_TESTS=eof eof_bit eof_bit_code eof_const eof_index eof_lincom \
+					eof_lincom_code eof_phase eof_phase_code eof_phase_neg eof_recurse
 
 ERROR_TESTS=error error_error error_num error_short error_verbose \
 						error_verbose_prefix
 
 FILE_TESTS=file file_code file_type
 
-FLAC_TESTS=flac_add flac_get_big flac_get_far flac_get_get flac_get_get2 \
-					 flac_get_int8 flac_get_int64 flac_get_little flac_get_long \
-					 flac_nframes flac_put_big flac_put_complex128 flac_put_float64 \
-					 flac_put_int32 flac_put_little flac_seek flac_seek_far flac_sync
+FLAC_TESTS=flac_add flac_complex64 flac_complex128 flac_del flac_enoent \
+					 flac_float32 flac_float64 flac_get_big flac_get_cont \
+					 flac_get_far flac_get_get flac_get_get2 flac_get_int8 \
+					 flac_get_int64 flac_get_little flac_get_long flac_int8 \
+					 flac_int16 flac_int32 flac_int64 flac_move_from flac_nframes \
+					 flac_put_big flac_put_complex128 flac_put_float64 \
+					 flac_put_int32 flac_put_little flac_put_offs flac_seek \
+					 flac_seek_far flac_sync flac_uint8 flac_uint16 flac_uint32 \
+					 flac_uint64
 
 FLIST_TESTS=flist flist0 flist2 flist_hidden flist_invalid flist_meta \
 						flist_meta2 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_all flush_amb_code flush_bad_code flush_flush flush_hex \
-						flush_invalid flush_lincom flush_lincom1 flush_meta flush_mult \
-						flush_raw_close flush_ref flush_spec flush_string flush_sync
+FLUSH_TESTS=flush_all flush_bad_code flush_flush flush_invalid flush_lincom \
+						flush_lincom1 flush_mult flush_raw_close flush_recurse flush_sync
 
-FOFFS_TESTS=foffs_alter foffs_alter_all foffs_get foffs_move
+FOFFS_TESTS=foffs_alter foffs_alter_all foffs_alter_dprot foffs_alter_fprot \
+						foffs_alter_index foffs_alter_range foffs_alter_rdonly foffs_get \
+						foffs_index foffs_move
 
 FRAGMENT_TESTS=fragment_affix fragment_affix_alter fragment_affix_alter2 \
-							 fragment_affix_alter_code fragment_affix_alter_nop \
-							 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_c2r get_carray_slice get_char get_clincom get_complex128 \
-					get_complex64 get_const get_const_carray get_const_complex \
-					get_const_repr get_cpolynom get_cpolynom1 get_cpolynom_int get_dim \
-					get_divide get_divide_ccin get_divide_crin get_divide_crinr \
-					get_divide_rcin get_divide_s get_endian8 get_endian16 get_endian32 \
-					get_endian64 get_endian_complex128_arm get_endian_complex128_big \
-					get_endian_complex128_little get_endian_complex64_arm \
-					get_endian_complex64_big get_endian_complex64_little \
-					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_foffs2 get_fs get_here get_here_foffs \
-					get_heres get_index_complex get_int8 get_int16 get_int32 \
-					get_int64 get_invalid get_lincom1 get_lincom2 get_lincom2s \
-					get_lincom3 get_lincom3s get_lincom_mdt get_lincom_noin \
-					get_lincom_non get_lincom_null get_lincom_spf get_linterp \
-					get_linterp1 get_linterp_abs get_linterp_complex get_linterp_empty \
-					get_linterp_nodir get_linterp_noin get_linterp_notab \
-					get_linterp_sort get_mplex get_mplex_bof get_mplex_complex \
-					get_mplex_lb get_mplex_lball get_mplex_nolb get_mplex_s \
-					get_mplex_saved get_multiply get_multiply_ccin get_multiply_crin \
-					get_multiply_crinr get_multiply_noin get_multiply_rcin \
-					get_multiply_s get_neg get_none get_nonexistent get_null get_off64 \
-					get_phase get_phase_affix get_polynom get_polynom_cmpin \
-					get_polynom_noin get_range get_recip get_recip_const get_recurse \
-					get_rofs get_sbit get_sf get_ss get_string get_type get_uint16 \
-					get_uint32 get_uint64 get_window get_window_clr get_window_complex \
-					get_window_ge get_window_gt get_window_le get_window_lt \
-					get_window_ne get_window_s get_window_set get_zero get_zero_complex \
-					get_zero_float
-
-GLOBAL_TESTS=global_flags global_name global_ref global_ref_empty global_ref_set
-
-GZIP_TESTS=gzip_add gzip_del gzip_get gzip_get_far gzip_get_get gzip_get_get2 \
-					 gzip_get_put gzip_move_from gzip_move_to gzip_nframes gzip_put \
-					 gzip_put_back gzip_put_endian gzip_put_get gzip_put_nframes \
-					 gzip_put_off gzip_put_pad gzip_put_sub gzip_seek gzip_seek_far \
-					 gzip_seek_put gzip_sync
+							 fragment_affix_alter_code fragment_affix_alter_dotpx \
+							 fragment_affix_alter_index fragment_affix_alter_nop \
+							 fragment_affix_alter_nons fragment_affix_alter_ns \
+							 fragment_affix_alter_pns fragment_affix_dup \
+							 fragment_affix_index fragment_affix_ns fragment_index \
+							 fragment_index_alias fragment_name fragment_name_oor \
+							 fragment_ndotdots fragment_ndots fragment_ns fragment_ns0 \
+							 fragment_ns_add fragment_ns_add0 fragment_ns_alter \
+							 fragment_ns_alter_nop fragment_ns_alter_pdel \
+							 fragment_ns_del fragment_ns_dot fragment_ns_dotdot \
+							 fragment_ns_dotns fragment_ns_nsdot fragment_num \
+							 fragment_parent fragment_parent_index fragment_parent_root
+
+GET_TESTS=get64 get_affix get_bad_code get_bit get_carray get_carray_bad \
+					get_carray_c2r get_carray_slice get_carray_slice_bounds \
+					get_carray_slice_type get_carray_type get_char get_clincom \
+					get_complex128 get_complex64 get_const get_const_bad \
+					get_const_carray get_const_complex get_const_repr get_const_reprz \
+					get_cpolynom get_cpolynom1 get_cpolynom_int get_dim get_dimin \
+					get_divide get_divide_ccin get_divide_code get_divide_crin \
+					get_divide_crinr get_divide_rcin get_divide_s get_dot get_endian8 \
+					get_endian16 get_endian32 get_endian64 get_endian_complex128_arm \
+					get_endian_complex128_big get_endian_complex128_little \
+					get_endian_complex64_arm get_endian_complex64_big \
+					get_endian_complex64_little 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_foffs2 get_fs get_here get_here_foffs get_heres \
+					get_index_complex get_index_type get_indir get_indir_typein get_int8 \
+					get_int16 get_int32 get_int64 get_invalid get_lincom1 get_lincom2 \
+					get_lincom2s get_lincom3 get_lincom3s get_lincom_mdt get_lincom_noin \
+					get_lincom_non get_lincom_null get_lincom_spf get_lincom_code \
+					get_linterp get_linterp1 get_linterp_abs get_linterp_complex \
+					get_linterp_empty get_linterp_nodir get_linterp_noin \
+					get_linterp_notab get_linterp_sort get_mplex get_mplex_bof \
+					get_mplex_complex get_mplex_lb get_mplex_lball get_mplex_nolb \
+					get_mplex_s get_mplex_saved get_multiply get_multiply_ccin \
+					get_multiply_code get_multiply_crin get_multiply_crinr \
+					get_multiply_noin get_multiply_rcin get_multiply_s get_neg get_none \
+					get_nonexistent get_null get_off64 get_phase get_phase_affix \
+					get_polynom get_polynom_cmpin get_polynom_noin get_range get_recip \
+					get_recip_cmpin get_recip_const get_recurse get_reprz get_rofs \
+					get_sarray get_sarray_bad get_sarray_slice get_sarray_slice_bounds \
+					get_sarray_slice_type get_sarray_type get_sbit get_sf get_sindir \
+					get_sindir_code get_sindir_neg get_sindir_none get_sindir_null \
+					get_sindir_reprz get_sindir_type get_sindir_typein get_ss get_string \
+					get_type get_uint16 get_uint32 get_uint64 get_window get_window_clr \
+					get_window_complex get_window_ge get_window_gt get_window_le \
+					get_window_lt get_window_ne get_window_s get_window_set get_zero \
+					get_zero_complex get_zero_float
+
+GLOBAL_TESTS=global_flags global_name
+
+GZIP_TESTS=gzip_add gzip_complex64 gzip_complex128 gzip_del gzip_enoent \
+					 gzip_float32 gzip_float64 gzip_get gzip_get_cont gzip_get_far \
+					 gzip_get_get gzip_get_get2 gzip_get_put gzip_int8 gzip_int16 \
+					 gzip_int32 gzip_int64 gzip_move_from gzip_move_to gzip_nframes \
+					 gzip_put gzip_put_back gzip_put_endian gzip_put_get \
+					 gzip_put_nframes gzip_put_off gzip_put_offs gzip_put_pad \
+					 gzip_put_sub gzip_seek gzip_seek_far gzip_seek_put gzip_sync \
+					 gzip_uint8 gzip_uint16 gzip_uint32 gzip_uint64
 
 HEADER_TESTS=header_complex header_off64t
 
 HIDE_TESTS=hide hide_bad hide_hidden hide_hidden_bad hide_unhide \
 					 hide_unhide_bad
 
-INCLUDE_TESTS=include_accmode include_affix include_auto include_cb \
-							include_creat include_ignore include_include include_index \
-							include_invalid include_nonexistent include_pc \
-							include_ref include_sub include_syntax
+INCLUDE_TESTS=include_accmode include_affix include_affix_ns include_auto \
+							include_cb include_creat include_format include_ignore \
+							include_include include_index include_invalid \
+							include_nonexistent include_ndotdots include_ndots include_ns \
+							include_ns_dot include_ns_dotdot include_ns_dotns include_ns_nil \
+							include_ns_null include_ns_prefix include_pc include_prot \
+							include_ref include_ref_code include_ref_type include_sub \
+							include_syntax
 
-INDEX_TESTS=index_domain index_index index_range index_s index_subset
+INDEX_TESTS=index_domain index_empty index_index index_one index_range \
+						index_reprz index_s index_scalar index_subset
 
 if INCLUDE_LEGACY_API
 LEGACY_TESTS=legacy_error legacy_estring legacy_format legacy_get \
@@ -244,39 +320,64 @@ LEGACY_TESTS=legacy_error legacy_estring legacy_format legacy_get \
 						 legacy_put legacy_spf
 endif
 
-LZMA_TESTS=lzma_get lzma_nframes lzma_put lzma_xz_add lzma_xz_get \
-					 lzma_xz_get_far lzma_xz_get_get lzma_xz_get_get2 lzma_xz_get_put \
-					 lzma_xz_move_to lzma_xz_nframes lzma_xz_put lzma_xz_put_back \
-					 lzma_xz_put_endian lzma_xz_put_get lzma_xz_put_pad lzma_xz_seek \
-					 lzma_xz_seek_far lzma_xz_sync
-
-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
+LEN_TESTS=len_bad len_carray len_const len_sarray len_string len_type
+
+LZMA_TESTS=lzma_enoent lzma_get lzma_nframes lzma_put lzma_xz_add \
+					 lzma_xz_complex64 lzma_xz_complex128 lzma_xz_del lzma_xz_float32 \
+					 lzma_xz_float64 lzma_xz_get lzma_xz_get_cont lzma_xz_get_far \
+					 lzma_xz_get_get lzma_xz_get_get2 lzma_xz_get_put lzma_xz_int8 \
+					 lzma_xz_int16 lzma_xz_int32 lzma_xz_int64 lzma_xz_move_from \
+					 lzma_xz_move_to lzma_xz_nframes lzma_xz_offs_clear lzma_xz_put \
+					 lzma_xz_put_back lzma_xz_put_endian lzma_xz_put_get \
+					 lzma_xz_put_offs lzma_xz_put_pad lzma_xz_seek lzma_xz_seek_far \
+					 lzma_xz_sync lzma_xz_uint8 lzma_xz_uint16 lzma_xz_uint32 \
+					 lzma_xz_uint64
+
+MADD_TESTS=madd madd_affix madd_alias madd_aliasmeta madd_alias_affix \
+					 madd_alias_alias madd_alias_subsub madd_bit madd_bit_invalid \
+					 madd_carray madd_clincom madd_clincom_nfields madd_const \
+					 madd_cpolynom madd_cpolynom_order madd_crecip madd_crecip89 \
+					 madd_divide madd_index madd_indir madd_lincom madd_lincom_invalid \
+					 madd_lincom_nfields madd_linterp madd_linterp_invalid madd_mplex \
+					 madd_multiply madd_multiply_invalid madd_parent_bad madd_phase \
+					 madd_phase_invalid madd_polynom madd_polynom_order madd_raw \
+					 madd_recip madd_sarray madd_sarray_dup madd_sbit madd_sindir \
+					 madd_spec madd_spec_directive madd_spec_invalid madd_spec_parent \
+					 madd_spec_resolv madd_string madd_string_dup madd_subsub madd_window
+
+MATCH_TESTS=match_fragment match_pcre match_pcre_bad match_pcre_caseless \
+						match_pcre_ext match_pcre_js match_pcre_utf8 match_regex \
+						match_regex_bad match_regex_ext match_regex_icase
+
+MFLUSH_TESTS=mflush mflush_affix mflush_amb_code mflush_carray mflush_hex \
+						 mflush_indir mflush_mplex mflush_ns mflush_pretty mflush_prot \
+						 mflush_ref mflush_repr mflush_repr9 mflush_reprz mflush_sindir \
+						 mflush_spec mflush_string mflush_type mflush_type4 mflush_windop
 
 MOVE_TESTS=move_affix move_affix_dup move_affix_meta move_affix_updb \
-					 move_alias move_data_enc_ar move_data_enc_ra move_data_endian \
-					 move_data_foffs move_data_foffs_neg move_data_nop move_index \
-					 move_meta move_move move_protect move_subdir
-
-NAME_TESTS=name_affix name_affix_bad name_alias name_dangle name_dot5 \
-					 name_dot5r name_dot9 name_dup name_meta name_move name_move_alias \
-					 name_name name_updb name_updb_affix name_updb_alias \
-					 name_updb_carray name_updb_const name_updb_const_alias
-
-NATIVE_TESTS=native_bit native_const native_index native_lincom \
+					 move_alias move_code move_data_enc_ar move_data_enc_ra \
+					 move_data_enc_un move_data_endian move_data_foffs \
+					 move_data_foffs_neg move_data_nop move_data_prot move_entype \
+					 move_index move_meta move_move move_nop move_ns move_nsns \
+					 move_protect move_rdonly move_subdir move_unkenc
+
+NAME_TESTS=name_affix name_affix_bad name_alias name_code name_dangle \
+					 name_dot5 name_dot5r name_dot9 name_dot10 name_dup name_index \
+					 name_meta name_meta2 name_move name_move_alias name_name name_ns \
+					 name_ns2 name_nsdot name_prot name_rdonly name_updb name_updb_affix \
+					 name_updb_alias name_updb_carray name_updb_const \
+					 name_updb_const_alias name_updb_sarray
+
+NATIVE_TESTS=native_bit native_code native_const native_index native_lincom \
 						 native_lincom_cmpin native_lincom_cmpscal native_linterp \
 						 native_linterp_cmp native_mult native_mult1 native_mult2 \
 						 native_polynom native_polynom_cmpin native_polynom_cmpscal \
 						 native_raw native_phase native_recip native_recip_cmpin \
-						 native_recip_cmpscal native_sbit native_string
+						 native_recip_cmpscal native_recurse native_reprz native_sbit \
+						 native_string
 
-NENTRIES_TESTS=nentries_alias nentries_hidden nentries_noalias nentries_scalar
+NENTRIES_TESTS=nentries_alias nentries_entype nentries_hidden nentries_noalias \
+							 nentries_scalar
 
 NFIELDS_TESTS=nfields_hidden nfields_invalid nfields_nfields nfields_type \
 							nfields_type_hidden nfields_type_invalid nfields_vector \
@@ -287,8 +388,8 @@ NFRAMES_TESTS=nframes64 nframes_empty nframes_invalid nframes_nframes \
 
 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
+						nmeta_parent_meta nmeta_vectors nmeta_vectors_del \
+						nmeta_vectors_hidden nmeta_vectors_invalid nmeta_vectors_parent
 
 OPEN_TESTS=open_abs open_cb_abort open_cb_cont open_cb_ignore open_cb_invalid \
 					 open_cb_rescan open_cb_rescan_alloc open_eaccess open_invalid \
@@ -296,23 +397,29 @@ OPEN_TESTS=open_abs open_cb_abort open_cb_cont open_cb_ignore open_cb_invalid \
 					 open_sym_at open_sym_c open_sym_cl open_sym_ct open_sym_d \
 					 open_sym_l 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_hex parse_hidden \
-						parse_hidden_field parse_hidden_meta parse_include \
-						parse_include_absolute parse_include_absrel \
-						parse_include_affix_bad parse_include_affix_ref parse_include_dir \
-						parse_include_loop parse_include_nonexistent parse_include_prefix \
+PARSE_TESTS=parse_alias parse_alias_code parse_alias_dup parse_alias_loop \
+						parse_alias_meta parse_alias_missing parse_alias_ncols \
+						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_carray_ncols \
+						parse_carray_type parse_const parse_const_complex \
+						parse_const_ncols parse_const_type parse_divide parse_double \
+						parse_duplicate parse_duplicate_ignore parse_endian_bad \
+						parse_endian_bad2 parse_endian_big parse_endian_force \
+						parse_endian_little parse_endian_slash parse_eol parse_esc \
+						parse_foffs parse_foffs_include parse_foffs_slash parse_hex \
+						parse_hidden parse_hidden_field parse_hidden_frag \
+						parse_hidden_meta parse_huge parse_include parse_include_absolute \
+						parse_include_absrel parse_include_affix_bad \
+						parse_include_affix_ref parse_include_dir parse_include_loop \
+						parse_include_nodir parse_include_nonexistent parse_include_ns \
+						parse_include_ns2 parse_include_nsabs parse_include_nsinh \
+						parse_include_nspop parse_include_nsrabs parse_include_nsrainh \
+						parse_include_nsrinh parse_include_nsroot 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_indir 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_literal_cmpbad parse_literal_fltcmp \
@@ -322,81 +429,108 @@ PARSE_TESTS=parse_alias parse_alias_code parse_alias_dup parse_alias_meta \
 						parse_meta_alias parse_meta_frag 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_octal_zero \
-						parse_phase parse_phase_ncols parse_phase_scalar parse_polynom \
+						parse_meta_meta parse_meta_ncols parse_meta_parent parse_meta_raw \
+						parse_mplex parse_mplex_ncols parse_mplex_neg parse_mplex_nomax \
+						parse_mplex_scalar parse_multiply parse_multiply_ncols parse_name \
+						parse_name_dot parse_name_ext parse_ncols parse_ns parse_ns_dot \
+						parse_ns_dotdot parse_ns_dotdotns parse_ns_dotns parse_ns_include \
+						parse_ns_include_ns parse_ns_ndotdots parse_ns_ndots \
+						parse_ns_nsdot parse_ns_nsdotdot parse_nsf parse_nsf_abs \
+						parse_nsf_alias parse_nsf_dot parse_nsf_hide parse_nsf_index \
+						parse_nsf_meta parse_nsf_meta2 parse_nsf_ref parse_nsf_refabs \
+						parse_nsf_root parse_nsf_sub parse_octal_zero 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_char_bad \
 						parse_raw_ncols parse_raw_scalar parse_raw_spf parse_raw_type \
-						parse_recip parse_ref parse_ref_nonexistent parse_sbit \
-						parse_scalar1 parse_scalar2 parse_scalar_repr parse_sort \
-						parse_string parse_string_ncols parse_string_null parse_utf8 \
-						parse_utf8_invalid parse_utf8_zero 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_alter_all protect_get
-
-PUT_TESTS=put64 put_bad_code put_bit put_bof put_carray put_carray_client \
-					put_carray_slice put_char put_clincom1 put_complex128 put_complex64 \
-					put_const put_const_protect put_cpolynom put_crecip put_divide \
-					put_endian8 put_endian16 put_endian32 put_endian64 \
-					put_endian_complex128_arm put_endian_complex128_big \
-					put_endian_complex128_little put_endian_complex64_arm \
-					put_endian_complex64_big put_endian_complex64_little \
-					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_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_mplex_complex \
-					put_multiply put_nofile put_null put_off64 put_phase put_phase_noin \
-					put_polynom1 put_polynom2 put_polynom_noin put_protect put_range \
-					put_rdonly put_recip put_recurse put_repr put_rofs put_sbit put_sf \
-					put_ss put_string put_string_protect put_sub put_type put_uint16 \
-					put_uint32 put_uint64 put_window put_zero
-
-REF_TESTS=ref ref_none ref_two
+						parse_recip parse_recip_ncols parse_ref parse_ref_nonexistent \
+						parse_ref_type parse_sarray parse_sarray_long parse_sarray_ncols \
+						parse_sbit parse_scalar1 parse_scalar2 parse_scalar_repr \
+						parse_sindir parse_sort parse_string parse_string_ncols \
+						parse_string_null parse_utf8 parse_utf8_invalid parse_utf8_zero \
+						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_alter_all protect_alter_arg \
+							protect_alter_index protect_alter_rdonly protect_get \
+							protect_index
+
+PUT_TESTS=put64 put_bad_code put_bit put_bit_repr put_bof put_carray \
+					put_carray_client put_carray_bad put_carray_bounds put_carray_rdonly \
+					put_carray_slice put_carray_type put_char put_clincom1 \
+					put_complex128 put_complex64 put_const put_const_protect \
+					put_cpolynom put_crecip put_divide put_endian8 put_endian16 \
+					put_endian32 put_endian64 put_endian_complex128_arm \
+					put_endian_complex128_big put_endian_complex128_little \
+					put_endian_complex64_arm put_endian_complex64_big \
+					put_endian_complex64_little 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_here put_heres put_indir put_int8 put_int16 put_int32 \
+					put_int64 put_invalid put_lincom1 put_lincom2 put_lincom_noin \
+					put_lincom_repr put_linterp put_linterp_cmp put_linterp_noin \
+					put_linterp_nomono put_linterp_notab put_linterp_repr \
+					put_linterp_reverse put_mplex put_mplex_complex put_mplex_repr \
+					put_multiply put_neg put_nofile put_null put_off64 put_phase \
+					put_phase_noin put_phase_repr put_polynom1 put_polynom2 \
+					put_polynom_noin put_polynom_repr put_protect put_range put_rdonly \
+					put_recip put_recip_repr put_recurse put_repr put_rofs put_sarray \
+					put_sarray_bad put_sarray_bounds put_sarray_rdonly put_sarray_slice \
+					put_sarray_type put_sbit put_scalar put_sf put_sindir put_ss \
+					put_string put_string_protect put_string_type put_sub put_type \
+					put_uint16 put_uint32 put_uint64 put_window put_zero
+
+REF_TESTS=ref ref_empty ref_get ref_none ref_set ref_set_code ref_set_prot \
+					ref_set_rdonly ref_set_type ref_two
 
 REPR_TESTS=repr_a repr_bad repr_float32 repr_float64 repr_i repr_int16 \
 					 repr_int32 repr_int64 repr_int8 repr_m repr_r repr_real_a \
 					 repr_real_i repr_real_m repr_real_r repr_uint16 repr_uint32 \
 					 repr_uint64 repr_uint8
 
-SEEK_TESTS=seek64 seek_cur seek_end seek_far seek_foffs seek_foffs2 seek_index \
-					 seek_lincom seek_mult seek_neg seek_phase seek_range seek_range2 \
-					 seek_set seek_sub
+SALIST_TESTS=salist salist0 salist_hidden salist_long salist_meta salist_meta0 \
+						 salist_meta_free salist_meta_hidden salist_meta_meta \
+						 salist_meta_parent
 
-SIE_TESTS=sie_get_big sie_get_header sie_get_little sie_move_from sie_move_to \
-					sie_nframes_big sie_nframes_little sie_put_append sie_put_append2 \
-					sie_put_back sie_put_big sie_put_header sie_put_little sie_put_many \
-					sie_put_newo sie_put_newo0 sie_put_pad sie_put_pad0 sie_put_trunc \
-					sie_put_trunc2 sie_put_trunc_nf sie_seek sie_seek_far sie_sync
+SEEK_TESTS=seek64 seek_arg seek_code seek_cur seek_dim seek_end seek_far \
+					 seek_foffs seek_foffs2 seek_index seek_index_end seek_lincom \
+					 seek_mplex seek_mult seek_neg seek_phase seek_range seek_range2 \
+					 seek_range_end seek_recurse seek_set seek_sub
+
+SIE_TESTS=sie_err_open sie_get_big sie_get_header sie_get_little sie_move_from \
+					sie_move_to sie_nframes_big sie_nframes_little sie_put_append \
+					sie_put_append2 sie_put_back sie_put_big sie_put_header \
+					sie_put_little sie_put_many sie_put_newo sie_put_newo0 sie_put_pad \
+					sie_put_pad0 sie_put_trunc sie_put_trunc2 sie_put_trunc_nf sie_seek \
+					sie_seek_far sie_sync
 
 SLIM_TESTS=slim_get slim_nframes slim_seek slim_seek_far
 
-SVLIST_TESTS=svlist svlist0 svlist2 svlist_hidden svlist_invalid svlist_meta \
-						 svlist_meta0 svlist_meta_hidden svlist_meta_invalid
+SVLIST_TESTS=svlist svlist0 svlist2 svlist_hidden svlist_invalid svlist_long \
+						 svlist_meta svlist_meta0 svlist_meta_hidden svlist_meta_invalid \
+						 svlist_meta_meta svlist_meta_parent
 
-SPF_TESTS=spf_alias spf_alias_missing spf_alias_meta spf_divide spf_lincom \
-					spf_multiply spf_polynom spf_raw spf_recip spf_recurse
+SPF_TESTS=spf_alias spf_alias_missing spf_alias_meta spf_const spf_divide \
+					spf_lincom spf_multiply spf_polynom spf_raw spf_recip spf_recurse
 
 TABLE_TESTS=table table_code table_type
 
-TELL_TESTS=tell tell64 tell_multidiv tell_sub
+TELL_TESTS=tell tell64 tell_code tell_dim tell_multi_div tell_multi_lincom \
+					 tell_recurse tell_sub
 
 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 unclude_open
+VALID_TESTS=valid_reprz
+
+UNCLUDE_TESTS=unclude unclude_del unclude_index unclude_keep unclude_move \
+							unclude_open unclude_prot unclude_rdonly
 
 VERSION_TESTS=version_0 version_0_write version_1 version_1_write version_2 \
 							version_2_write version_3 version_3_write version_4 \
@@ -412,22 +546,24 @@ ZZIP_TESTS=zzip_data zzip_get zzip_get_get zzip_nframes zzip_seek zzip_seek_far
 
 ZZSLIM_TESTS=zzslim_get zzslim_nframes zzslim_seek zzslim_seek_far
 
-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)     \
-			$(FLAC_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)     $(NATIVE_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)    \
-			$(ZZIP_TESTS)     $(ZZSLIM_TESTS)
+TESTS=$(ADD_TESTS)      $(ALIAS_TESTS)    $(ALLOC_TESTS)    $(ALTER_TESTS)    \
+			$(ASCII_TESTS)    $(BOF_TESTS)      $(BZIP_TESTS)     $(CALIST_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)     $(FLAC_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)   $(LEN_TESTS)      \
+			$(LZMA_TESTS)     $(MADD_TESTS)     $(MATCH_TESTS)    $(MFLUSH_TESTS)   \
+			$(MOVE_TESTS)     $(NAME_TESTS)     $(NATIVE_TESTS)   $(NENTRIES_TESTS) \
+			$(NFIELDS_TESTS)  $(NFRAMES_TESTS)  $(NMETA_TESTS)    $(OPEN_TESTS)     \
+			$(PARSE_TESTS)    $(PROTECT_TESTS)  $(PUT_TESTS)      $(REF_TESTS)      \
+			$(REPR_TESTS)     $(SALIST_TESTS)   $(SEEK_TESTS)     $(SIE_TESTS)      \
+			$(SLIM_TESTS)     $(SPF_TESTS)      $(SVLIST_TESTS)   $(TABLE_TESTS)    \
+			$(TELL_TESTS)     $(TOK_TESTS)      $(TRUNC_TESTS)    $(UNCLUDE_TESTS)  \
+			$(VALID_TESTS)    $(VERSION_TESTS)  $(VLIST_TESTS)    $(ZZIP_TESTS)     \
+			$(ZZSLIM_TESTS)
 
 check_PROGRAMS=$(TESTS)
 
diff --git a/test/Makefile.in b/test/Makefile.in
index 31c72f4..5fc5597 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -107,8 +107,10 @@ TESTS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 	$(am__EXEEXT_52) $(am__EXEEXT_53) $(am__EXEEXT_54) \
 	$(am__EXEEXT_55) $(am__EXEEXT_56) $(am__EXEEXT_57) \
 	$(am__EXEEXT_58) $(am__EXEEXT_59) $(am__EXEEXT_60) \
-	$(am__EXEEXT_61) $(am__EXEEXT_62)
-check_PROGRAMS = $(am__EXEEXT_63)
+	$(am__EXEEXT_61) $(am__EXEEXT_62) $(am__EXEEXT_63) \
+	$(am__EXEEXT_64) $(am__EXEEXT_65) $(am__EXEEXT_66) \
+	$(am__EXEEXT_67) $(am__EXEEXT_68) $(am__EXEEXT_69)
+check_PROGRAMS = $(am__EXEEXT_70)
 subdir = test
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
@@ -129,89 +131,157 @@ CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 am__EXEEXT_1 = add_add$(EXEEXT) add_affix$(EXEEXT) add_alias$(EXEEXT) \
-	add_alias_affix$(EXEEXT) add_alias_meta$(EXEEXT) \
-	add_amb_code7$(EXEEXT) add_bit$(EXEEXT) \
-	add_bit_bitnum$(EXEEXT) add_bit_bitsize$(EXEEXT) \
+	add_alias_affix$(EXEEXT) add_alias_index$(EXEEXT) \
+	add_alias_meta$(EXEEXT) add_alias_name$(EXEEXT) \
+	add_alias_ns$(EXEEXT) add_alias_prot$(EXEEXT) \
+	add_alias_rdonly$(EXEEXT) add_amb_code7$(EXEEXT) \
+	add_bit$(EXEEXT) add_bit_bitnum$(EXEEXT) \
+	add_bit_bitsize$(EXEEXT) add_bit_inaff$(EXEEXT) \
 	add_bit_invalid$(EXEEXT) add_bit_numbits$(EXEEXT) \
 	add_bit_scalars$(EXEEXT) add_carray$(EXEEXT) \
-	add_clincom$(EXEEXT) add_code$(EXEEXT) add_const$(EXEEXT) \
-	add_cpolynom$(EXEEXT) add_crecip$(EXEEXT) \
-	add_crecip89$(EXEEXT) add_dangle_dup$(EXEEXT) \
-	add_divide$(EXEEXT) add_divide_invalid$(EXEEXT) \
-	add_dot5$(EXEEXT) add_dot6$(EXEEXT) add_duplicate$(EXEEXT) \
-	add_format$(EXEEXT) add_invalid$(EXEEXT) add_lincom$(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_carray_entry$(EXEEXT) add_carray_type$(EXEEXT) \
+	add_clincom$(EXEEXT) add_clincom_nfields$(EXEEXT) \
+	add_code$(EXEEXT) add_const$(EXEEXT) add_const_type$(EXEEXT) \
+	add_cpolynom$(EXEEXT) add_cpolynom_order$(EXEEXT) \
+	add_crecip$(EXEEXT) add_crecip89$(EXEEXT) \
+	add_dangle_dup$(EXEEXT) add_divide$(EXEEXT) \
+	add_divide_inaff1$(EXEEXT) add_divide_inaff2$(EXEEXT) \
+	add_divide_invalid$(EXEEXT) add_dot5$(EXEEXT) \
+	add_dot6$(EXEEXT) add_dot10$(EXEEXT) add_duplicate$(EXEEXT) \
+	add_format$(EXEEXT) add_indir$(EXEEXT) add_invalid$(EXEEXT) \
+	add_lincom$(EXEEXT) add_lincom_affix$(EXEEXT) \
+	add_lincom_invalid$(EXEEXT) add_lincom_nfields$(EXEEXT) \
+	add_lincom_nfields2$(EXEEXT) add_linterp$(EXEEXT) \
+	add_linterp_inaff$(EXEEXT) add_linterp_invalid$(EXEEXT) \
+	add_meta$(EXEEXT) add_meta_alias$(EXEEXT) \
+	add_meta_parent$(EXEEXT) add_mplex$(EXEEXT) \
+	add_mplex_inaff$(EXEEXT) add_mplex_period$(EXEEXT) \
 	add_mplex_scalars$(EXEEXT) add_multiply$(EXEEXT) \
-	add_multiply_invalid$(EXEEXT) add_phase$(EXEEXT) \
+	add_multiply_invalid$(EXEEXT) add_name_len$(EXEEXT) \
+	add_ns$(EXEEXT) add_ns_frag$(EXEEXT) add_ns_frag2$(EXEEXT) \
+	add_phase$(EXEEXT) add_phase_inaff$(EXEEXT) \
 	add_phase_invalid$(EXEEXT) add_polynom$(EXEEXT) \
-	add_polynom_scalar$(EXEEXT) add_protect$(EXEEXT) \
-	add_raw$(EXEEXT) add_raw_include$(EXEEXT) \
-	add_raw_invalid$(EXEEXT) add_raw_spf$(EXEEXT) \
-	add_raw_spf_scalar$(EXEEXT) add_raw_sub$(EXEEXT) \
-	add_raw_type$(EXEEXT) add_rdonly$(EXEEXT) add_recip$(EXEEXT) \
-	add_resolv$(EXEEXT) add_sbit$(EXEEXT) add_scalar$(EXEEXT) \
+	add_polynom_inaff$(EXEEXT) add_polynom_order$(EXEEXT) \
+	add_polynom_order2$(EXEEXT) add_polynom_scalar$(EXEEXT) \
+	add_protect$(EXEEXT) add_raw$(EXEEXT) add_raw_include$(EXEEXT) \
+	add_raw_invalid$(EXEEXT) add_raw_prot$(EXEEXT) \
+	add_raw_spf$(EXEEXT) add_raw_spf_scalar$(EXEEXT) \
+	add_raw_sub$(EXEEXT) add_raw_type$(EXEEXT) add_rdonly$(EXEEXT) \
+	add_recip$(EXEEXT) add_recip_inaff$(EXEEXT) \
+	add_resolv$(EXEEXT) add_sarray$(EXEEXT) \
+	add_sarray_dup$(EXEEXT) add_sarray_nil$(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_spec_resolv$(EXEEXT) \
-	add_string$(EXEEXT) add_string_affix$(EXEEXT) \
-	add_type$(EXEEXT) add_window$(EXEEXT) add_window_op$(EXEEXT)
+	add_sindir$(EXEEXT) add_sort$(EXEEXT) add_spec$(EXEEXT) \
+	add_spec_affix$(EXEEXT) add_spec_directive$(EXEEXT) \
+	add_spec_index$(EXEEXT) add_spec_invalid$(EXEEXT) \
+	add_spec_meta$(EXEEXT) add_spec_nil$(EXEEXT) \
+	add_spec_prot$(EXEEXT) add_spec_raw_autoenc$(EXEEXT) \
+	add_spec_raw_prot$(EXEEXT) add_spec_raw_unkenc$(EXEEXT) \
+	add_spec_resolv$(EXEEXT) add_string$(EXEEXT) \
+	add_string_affix$(EXEEXT) add_string_dup$(EXEEXT) \
+	add_string_entry$(EXEEXT) add_type$(EXEEXT) \
+	add_window$(EXEEXT) add_window_inaff$(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) \
+am__EXEEXT_3 = alloc_affix$(EXEEXT) alloc_callback$(EXEEXT) \
+	alloc_clear$(EXEEXT) alloc_entry$(EXEEXT) alloc_tok$(EXEEXT)
+am__EXEEXT_4 = alter_bit_bitnum$(EXEEXT) alter_bit_in$(EXEEXT) \
+	alter_bit_numbits$(EXEEXT) alter_bit_scalar$(EXEEXT) \
 	alter_carray_len$(EXEEXT) alter_carray_type$(EXEEXT) \
-	alter_clincom$(EXEEXT) alter_const$(EXEEXT) \
-	alter_const_c2r$(EXEEXT) alter_const_r2c$(EXEEXT) \
-	alter_const_r2r$(EXEEXT) alter_cpolynom$(EXEEXT) \
-	alter_cpolynom_null$(EXEEXT) alter_crecip$(EXEEXT) \
+	alter_clincom$(EXEEXT) alter_clincom_32$(EXEEXT) \
+	alter_clincom_nfields$(EXEEXT) \
+	alter_clincom_nfields_code$(EXEEXT) \
+	alter_clincom_null$(EXEEXT) alter_code$(EXEEXT) \
+	alter_const$(EXEEXT) alter_const_c2r$(EXEEXT) \
+	alter_const_r2c$(EXEEXT) alter_const_r2r$(EXEEXT) \
+	alter_const_type$(EXEEXT) alter_cpolynom$(EXEEXT) \
+	alter_cpolynom_null$(EXEEXT) alter_cpolynom_ord$(EXEEXT) \
+	alter_cpolynom_ord_code$(EXEEXT) alter_crecip$(EXEEXT) \
 	alter_crecip89$(EXEEXT) alter_crecip89_null$(EXEEXT) \
 	alter_crecip_zero$(EXEEXT) alter_divide$(EXEEXT) \
-	alter_entry$(EXEEXT) alter_entry_affix$(EXEEXT) \
+	alter_divide_in$(EXEEXT) alter_entry$(EXEEXT) \
+	alter_entry_affix$(EXEEXT) alter_entry_entype$(EXEEXT) \
 	alter_entry_hidden$(EXEEXT) alter_entry_lincom$(EXEEXT) \
+	alter_entry_lincom_nfields$(EXEEXT) \
 	alter_entry_recode$(EXEEXT) alter_entry_recode_recalc$(EXEEXT) \
-	alter_entry_scalar1$(EXEEXT) alter_entry_scalar2a$(EXEEXT) \
-	alter_entry_scalar2n$(EXEEXT) alter_entry_scalar3$(EXEEXT) \
-	alter_entry_scalar3c$(EXEEXT) alter_entry_scalar3i$(EXEEXT) \
-	alter_entry_scalar3r$(EXEEXT) alter_entry_scalar4$(EXEEXT) \
-	alter_entry_scalar_amb$(EXEEXT) alter_index$(EXEEXT) \
+	alter_entry_sarray$(EXEEXT) alter_entry_scalar1$(EXEEXT) \
+	alter_entry_scalar2a$(EXEEXT) alter_entry_scalar2n$(EXEEXT) \
+	alter_entry_scalar3$(EXEEXT) alter_entry_scalar3c$(EXEEXT) \
+	alter_entry_scalar3i$(EXEEXT) alter_entry_scalar3r$(EXEEXT) \
+	alter_entry_scalar4$(EXEEXT) alter_entry_scalar_amb$(EXEEXT) \
+	alter_index$(EXEEXT) alter_indir$(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_mplex$(EXEEXT) alter_mspec$(EXEEXT) \
+	alter_lincom_nfields$(EXEEXT) \
+	alter_lincom_nfields_code$(EXEEXT) \
+	alter_lincom_offset$(EXEEXT) alter_lincom_scalar$(EXEEXT) \
+	alter_lincom_slope$(EXEEXT) alter_linterp$(EXEEXT) \
+	alter_linterp_in$(EXEEXT) alter_linterp_move$(EXEEXT) \
+	alter_mplex$(EXEEXT) alter_mplex_in$(EXEEXT) \
+	alter_mplex_scalar$(EXEEXT) alter_mspec$(EXEEXT) \
 	alter_mspec_affix$(EXEEXT) alter_multiply$(EXEEXT) \
-	alter_phase$(EXEEXT) alter_polynom_coeff$(EXEEXT) \
+	alter_phase$(EXEEXT) alter_phase_in$(EXEEXT) \
+	alter_phase_scalar$(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_scalar_affix$(EXEEXT) alter_spec$(EXEEXT) \
-	alter_spec_affix$(EXEEXT) alter_spec_meta$(EXEEXT) \
-	alter_spec_polynom$(EXEEXT) alter_window$(EXEEXT)
-am__EXEEXT_4 = ascii_add$(EXEEXT) ascii_get$(EXEEXT) \
-	ascii_get_complex$(EXEEXT) ascii_get_get$(EXEEXT) \
+	alter_polynom_ord2$(EXEEXT) alter_polynom_ord_code$(EXEEXT) \
+	alter_polynom_scalar$(EXEEXT) alter_prot$(EXEEXT) \
+	alter_raw_prot$(EXEEXT) alter_raw_spf$(EXEEXT) \
+	alter_raw_spf_type$(EXEEXT) alter_raw_type$(EXEEXT) \
+	alter_rdonly$(EXEEXT) alter_recip$(EXEEXT) \
+	alter_recip_scalar$(EXEEXT) alter_recip_zero$(EXEEXT) \
+	alter_sarray$(EXEEXT) alter_sarray_nop$(EXEEXT) \
+	alter_sbit$(EXEEXT) alter_scalar_affix$(EXEEXT) \
+	alter_sindir$(EXEEXT) alter_spec$(EXEEXT) \
+	alter_spec_affix$(EXEEXT) alter_spec_code$(EXEEXT) \
+	alter_spec_format$(EXEEXT) alter_spec_meta$(EXEEXT) \
+	alter_spec_nil$(EXEEXT) alter_spec_polynom$(EXEEXT) \
+	alter_spec_prot$(EXEEXT) alter_spec_rdonly$(EXEEXT) \
+	alter_window$(EXEEXT) alter_window_in$(EXEEXT) \
+	alter_window_op$(EXEEXT) alter_window_scalar$(EXEEXT)
+am__EXEEXT_5 = ascii_add$(EXEEXT) ascii_complex64$(EXEEXT) \
+	ascii_complex128$(EXEEXT) ascii_get$(EXEEXT) \
+	ascii_get_complex$(EXEEXT) ascii_float32$(EXEEXT) \
+	ascii_float64$(EXEEXT) ascii_get_get$(EXEEXT) \
 	ascii_get_here$(EXEEXT) ascii_get_sub$(EXEEXT) \
-	ascii_nframes$(EXEEXT) ascii_put$(EXEEXT) \
+	ascii_int8$(EXEEXT) ascii_int16$(EXEEXT) ascii_int32$(EXEEXT) \
+	ascii_int64$(EXEEXT) ascii_nframes$(EXEEXT) ascii_put$(EXEEXT) \
 	ascii_put_here$(EXEEXT) ascii_seek$(EXEEXT) \
-	ascii_seek_far$(EXEEXT) ascii_sync$(EXEEXT)
-am__EXEEXT_5 = bof$(EXEEXT) bof_bit$(EXEEXT) bof_index$(EXEEXT) \
-	bof_lincom$(EXEEXT) bof_phase$(EXEEXT) bof_phase_neg$(EXEEXT)
-am__EXEEXT_6 = bzip_add$(EXEEXT) bzip_get$(EXEEXT) \
+	ascii_seek_far$(EXEEXT) ascii_sync$(EXEEXT) \
+	ascii_uint8$(EXEEXT) ascii_uint16$(EXEEXT) \
+	ascii_uint32$(EXEEXT) ascii_uint64$(EXEEXT)
+am__EXEEXT_6 = bof$(EXEEXT) bof_bit$(EXEEXT) bof_bit_code$(EXEEXT) \
+	bof_code$(EXEEXT) bof_const$(EXEEXT) bof_index$(EXEEXT) \
+	bof_lincom$(EXEEXT) bof_lincom_code$(EXEEXT) \
+	bof_phase$(EXEEXT) bof_phase_code$(EXEEXT) \
+	bof_phase_neg$(EXEEXT) bof_recurse$(EXEEXT)
+am__EXEEXT_7 = bzip_add$(EXEEXT) bzip_complex64$(EXEEXT) \
+	bzip_complex128$(EXEEXT) bzip_del$(EXEEXT) \
+	bzip_enoent$(EXEEXT) bzip_float32$(EXEEXT) \
+	bzip_float64$(EXEEXT) bzip_get$(EXEEXT) bzip_get_cont$(EXEEXT) \
 	bzip_get_far$(EXEEXT) bzip_get_get$(EXEEXT) \
 	bzip_get_get2$(EXEEXT) bzip_get_put$(EXEEXT) \
-	bzip_move_from$(EXEEXT) bzip_move_to$(EXEEXT) \
-	bzip_nframes$(EXEEXT) bzip_put$(EXEEXT) bzip_put_back$(EXEEXT) \
-	bzip_put_endian$(EXEEXT) bzip_put_get$(EXEEXT) \
+	bzip_int8$(EXEEXT) bzip_int16$(EXEEXT) bzip_int32$(EXEEXT) \
+	bzip_int64$(EXEEXT) bzip_move_from$(EXEEXT) \
+	bzip_move_to$(EXEEXT) bzip_nframes$(EXEEXT) bzip_put$(EXEEXT) \
+	bzip_put_back$(EXEEXT) bzip_put_endian$(EXEEXT) \
+	bzip_put_get$(EXEEXT) bzip_put_offs$(EXEEXT) \
 	bzip_put_pad$(EXEEXT) bzip_put_sub$(EXEEXT) bzip_seek$(EXEEXT) \
-	bzip_seek_far$(EXEEXT) bzip_sync$(EXEEXT)
-am__EXEEXT_7 = close_bad$(EXEEXT) close_close$(EXEEXT) \
+	bzip_seek_far$(EXEEXT) bzip_sync$(EXEEXT) bzip_uint8$(EXEEXT) \
+	bzip_uint16$(EXEEXT) bzip_uint32$(EXEEXT) bzip_uint64$(EXEEXT)
+am__EXEEXT_8 = calist$(EXEEXT) calist0$(EXEEXT) calist_free$(EXEEXT) \
+	calist_hidden$(EXEEXT) calist_long$(EXEEXT) \
+	calist_meta$(EXEEXT) calist_meta0$(EXEEXT) \
+	calist_meta_free$(EXEEXT) calist_meta_hidden$(EXEEXT) \
+	calist_meta_meta$(EXEEXT) calist_meta_parent$(EXEEXT) \
+	calist_null$(EXEEXT)
+am__EXEEXT_9 = close_bad$(EXEEXT) close_close$(EXEEXT) \
 	close_discard$(EXEEXT) close_null$(EXEEXT)
-am__EXEEXT_8 = convert_complex128_complex64$(EXEEXT) \
+am__EXEEXT_10 = convert_complex128_complex64$(EXEEXT) \
 	convert_complex128_float64$(EXEEXT) \
 	convert_complex128_int64$(EXEEXT) \
 	convert_complex128_uint64$(EXEEXT) \
@@ -287,42 +357,45 @@ am__EXEEXT_8 = 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_9 = creat$(EXEEXT) creat_excl$(EXEEXT) \
+am__EXEEXT_11 = creat$(EXEEXT) creat_excl$(EXEEXT) \
 	creat_rdonly$(EXEEXT) creat_rdonly_exists$(EXEEXT)
-am__EXEEXT_10 = cvlist$(EXEEXT) cvlist_array$(EXEEXT) \
-	cvlist_array0$(EXEEXT) cvlist_array_free$(EXEEXT) \
-	cvlist_array_hidden$(EXEEXT) cvlist_array_meta$(EXEEXT) \
-	cvlist_array_meta0$(EXEEXT) cvlist_array_meta_free$(EXEEXT) \
-	cvlist_array_meta_hidden$(EXEEXT) cvlist_array_null$(EXEEXT) \
-	cvlist_hidden$(EXEEXT) cvlist_invalid$(EXEEXT) \
+am__EXEEXT_12 = cvlist$(EXEEXT) cvlist_hidden$(EXEEXT) \
+	cvlist_invalid$(EXEEXT) cvlist_long$(EXEEXT) \
 	cvlist_meta$(EXEEXT) cvlist_meta0$(EXEEXT) \
-	cvlist_meta_hidden$(EXEEXT) cvlist_meta_invalid$(EXEEXT) \
-	cvlist_null$(EXEEXT)
-am__EXEEXT_11 = del_alias$(EXEEXT) del_bad_code$(EXEEXT) \
+	cvlist_meta_code$(EXEEXT) cvlist_meta_hidden$(EXEEXT) \
+	cvlist_meta_invalid$(EXEEXT) cvlist_meta$(EXEEXT) \
+	cvlist_null$(EXEEXT) cvlist_meta_parent$(EXEEXT)
+am__EXEEXT_13 = del_alias$(EXEEXT) del_alias_dangle$(EXEEXT) \
+	del_alias_target$(EXEEXT) del_bad_code$(EXEEXT) \
 	del_carray$(EXEEXT) del_carray_deref$(EXEEXT) \
 	del_const$(EXEEXT) del_const_deref$(EXEEXT) \
 	del_const_force$(EXEEXT) del_data$(EXEEXT) \
 	del_data_enoent$(EXEEXT) del_data_open$(EXEEXT) \
-	del_derived$(EXEEXT) del_derived_after$(EXEEXT) \
-	del_derived_force$(EXEEXT) del_del$(EXEEXT) del_meta$(EXEEXT) \
-	del_meta_force$(EXEEXT) del_ref$(EXEEXT)
-am__EXEEXT_12 = dfes_bit$(EXEEXT) dfes_divide$(EXEEXT) \
+	del_data_prot$(EXEEXT) del_del$(EXEEXT) del_derived$(EXEEXT) \
+	del_derived_after$(EXEEXT) del_derived_force$(EXEEXT) \
+	del_divide$(EXEEXT) del_meta$(EXEEXT) del_meta_force$(EXEEXT) \
+	del_prot$(EXEEXT) del_rdonly$(EXEEXT) del_ref$(EXEEXT)
+am__EXEEXT_14 = 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_13 = desync$(EXEEXT) desync_flush$(EXEEXT) \
+am__EXEEXT_15 = desync$(EXEEXT) desync_flush$(EXEEXT) \
 	desync_path$(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_alter_all$(EXEEXT) \
+am__EXEEXT_16 = elist_alias$(EXEEXT) elist_hidden$(EXEEXT) \
+	elist_noalias$(EXEEXT) elist_parent$(EXEEXT) \
+	elist_parent2$(EXEEXT) elist_scalar$(EXEEXT) \
+	elist_type$(EXEEXT)
+am__EXEEXT_17 = encode_alter$(EXEEXT) encode_alter_all$(EXEEXT) \
 	encode_alter_open$(EXEEXT) encode_get$(EXEEXT) \
 	encode_recode$(EXEEXT) encode_recode_open$(EXEEXT) \
 	encode_support$(EXEEXT)
-am__EXEEXT_16 = endian_alter$(EXEEXT) endian_alter_all$(EXEEXT) \
-	endian_alter_sie$(EXEEXT) endian_get$(EXEEXT) \
-	endian_move$(EXEEXT)
-am__EXEEXT_17 = entry_bad_code$(EXEEXT) entry_bit$(EXEEXT) \
+am__EXEEXT_18 = endian_alter$(EXEEXT) endian_alter_all$(EXEEXT) \
+	endian_alter_arg$(EXEEXT) endian_alter_dprot$(EXEEXT) \
+	endian_alter_fprot$(EXEEXT) endian_alter_index$(EXEEXT) \
+	endian_alter_rdonly$(EXEEXT) endian_alter_sie$(EXEEXT) \
+	endian_get$(EXEEXT) endian_index$(EXEEXT) endian_move$(EXEEXT)
+am__EXEEXT_19 = 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) \
@@ -335,22 +408,32 @@ am__EXEEXT_17 = entry_bad_code$(EXEEXT) entry_bit$(EXEEXT) \
 	entry_recip$(EXEEXT) entry_type$(EXEEXT) \
 	entry_type_alias$(EXEEXT) entry_window$(EXEEXT) \
 	entry_window_scalar$(EXEEXT)
-am__EXEEXT_18 = eof$(EXEEXT) eof_bit$(EXEEXT) eof_index$(EXEEXT) \
-	eof_lincom$(EXEEXT) eof_phase$(EXEEXT) eof_phase_neg$(EXEEXT)
-am__EXEEXT_19 = error$(EXEEXT) error_error$(EXEEXT) error_num$(EXEEXT) \
+am__EXEEXT_20 = eof$(EXEEXT) eof_bit$(EXEEXT) eof_bit_code$(EXEEXT) \
+	eof_const$(EXEEXT) eof_index$(EXEEXT) eof_lincom$(EXEEXT) \
+	eof_lincom_code$(EXEEXT) eof_phase$(EXEEXT) \
+	eof_phase_code$(EXEEXT) eof_phase_neg$(EXEEXT) \
+	eof_recurse$(EXEEXT)
+am__EXEEXT_21 = 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 = flac_add$(EXEEXT) flac_get_big$(EXEEXT) \
-	flac_get_far$(EXEEXT) flac_get_get$(EXEEXT) \
-	flac_get_get2$(EXEEXT) flac_get_int8$(EXEEXT) \
-	flac_get_int64$(EXEEXT) flac_get_little$(EXEEXT) \
-	flac_get_long$(EXEEXT) flac_nframes$(EXEEXT) \
-	flac_put_big$(EXEEXT) flac_put_complex128$(EXEEXT) \
-	flac_put_float64$(EXEEXT) flac_put_int32$(EXEEXT) \
-	flac_put_little$(EXEEXT) flac_seek$(EXEEXT) \
-	flac_seek_far$(EXEEXT) flac_sync$(EXEEXT)
-am__EXEEXT_22 = flist$(EXEEXT) flist0$(EXEEXT) flist2$(EXEEXT) \
+am__EXEEXT_22 = file$(EXEEXT) file_code$(EXEEXT) file_type$(EXEEXT)
+am__EXEEXT_23 = flac_add$(EXEEXT) flac_complex64$(EXEEXT) \
+	flac_complex128$(EXEEXT) flac_del$(EXEEXT) \
+	flac_enoent$(EXEEXT) flac_float32$(EXEEXT) \
+	flac_float64$(EXEEXT) flac_get_big$(EXEEXT) \
+	flac_get_cont$(EXEEXT) flac_get_far$(EXEEXT) \
+	flac_get_get$(EXEEXT) flac_get_get2$(EXEEXT) \
+	flac_get_int8$(EXEEXT) flac_get_int64$(EXEEXT) \
+	flac_get_little$(EXEEXT) flac_get_long$(EXEEXT) \
+	flac_int8$(EXEEXT) flac_int16$(EXEEXT) flac_int32$(EXEEXT) \
+	flac_int64$(EXEEXT) flac_move_from$(EXEEXT) \
+	flac_nframes$(EXEEXT) flac_put_big$(EXEEXT) \
+	flac_put_complex128$(EXEEXT) flac_put_float64$(EXEEXT) \
+	flac_put_int32$(EXEEXT) flac_put_little$(EXEEXT) \
+	flac_put_offs$(EXEEXT) flac_seek$(EXEEXT) \
+	flac_seek_far$(EXEEXT) flac_sync$(EXEEXT) flac_uint8$(EXEEXT) \
+	flac_uint16$(EXEEXT) flac_uint32$(EXEEXT) flac_uint64$(EXEEXT)
+am__EXEEXT_24 = flist$(EXEEXT) flist0$(EXEEXT) flist2$(EXEEXT) \
 	flist_hidden$(EXEEXT) flist_invalid$(EXEEXT) \
 	flist_meta$(EXEEXT) flist_meta2$(EXEEXT) \
 	flist_meta_hidden$(EXEEXT) flist_meta_invalid$(EXEEXT) \
@@ -358,35 +441,53 @@ am__EXEEXT_22 = flist$(EXEEXT) flist0$(EXEEXT) flist2$(EXEEXT) \
 	flist_type_invalid$(EXEEXT) flist_type_meta$(EXEEXT) \
 	flist_type_meta_hidden$(EXEEXT) \
 	flist_type_meta_invalid$(EXEEXT)
-am__EXEEXT_23 = flush_all$(EXEEXT) flush_amb_code$(EXEEXT) \
-	flush_bad_code$(EXEEXT) flush_flush$(EXEEXT) \
-	flush_hex$(EXEEXT) flush_invalid$(EXEEXT) \
+am__EXEEXT_25 = flush_all$(EXEEXT) flush_bad_code$(EXEEXT) \
+	flush_flush$(EXEEXT) flush_invalid$(EXEEXT) \
 	flush_lincom$(EXEEXT) flush_lincom1$(EXEEXT) \
-	flush_meta$(EXEEXT) flush_mult$(EXEEXT) \
-	flush_raw_close$(EXEEXT) flush_ref$(EXEEXT) \
-	flush_spec$(EXEEXT) flush_string$(EXEEXT) flush_sync$(EXEEXT)
-am__EXEEXT_24 = foffs_alter$(EXEEXT) foffs_alter_all$(EXEEXT) \
-	foffs_get$(EXEEXT) foffs_move$(EXEEXT)
-am__EXEEXT_25 = fragment_affix$(EXEEXT) fragment_affix_alter$(EXEEXT) \
+	flush_mult$(EXEEXT) flush_raw_close$(EXEEXT) \
+	flush_recurse$(EXEEXT) flush_sync$(EXEEXT)
+am__EXEEXT_26 = foffs_alter$(EXEEXT) foffs_alter_all$(EXEEXT) \
+	foffs_alter_dprot$(EXEEXT) foffs_alter_fprot$(EXEEXT) \
+	foffs_alter_index$(EXEEXT) foffs_alter_range$(EXEEXT) \
+	foffs_alter_rdonly$(EXEEXT) foffs_get$(EXEEXT) \
+	foffs_index$(EXEEXT) foffs_move$(EXEEXT)
+am__EXEEXT_27 = fragment_affix$(EXEEXT) fragment_affix_alter$(EXEEXT) \
 	fragment_affix_alter2$(EXEEXT) \
 	fragment_affix_alter_code$(EXEEXT) \
-	fragment_affix_alter_nop$(EXEEXT) fragment_affix_dup$(EXEEXT) \
+	fragment_affix_alter_dotpx$(EXEEXT) \
+	fragment_affix_alter_index$(EXEEXT) \
+	fragment_affix_alter_nop$(EXEEXT) \
+	fragment_affix_alter_nons$(EXEEXT) \
+	fragment_affix_alter_ns$(EXEEXT) \
+	fragment_affix_alter_pns$(EXEEXT) fragment_affix_dup$(EXEEXT) \
+	fragment_affix_index$(EXEEXT) fragment_affix_ns$(EXEEXT) \
 	fragment_index$(EXEEXT) fragment_index_alias$(EXEEXT) \
 	fragment_name$(EXEEXT) fragment_name_oor$(EXEEXT) \
-	fragment_num$(EXEEXT) fragment_parent$(EXEEXT)
-am__EXEEXT_26 = get64$(EXEEXT) get_affix$(EXEEXT) \
+	fragment_ndotdots$(EXEEXT) fragment_ndots$(EXEEXT) \
+	fragment_ns$(EXEEXT) fragment_ns0$(EXEEXT) \
+	fragment_ns_add$(EXEEXT) fragment_ns_add0$(EXEEXT) \
+	fragment_ns_alter$(EXEEXT) fragment_ns_alter_nop$(EXEEXT) \
+	fragment_ns_alter_pdel$(EXEEXT) fragment_ns_del$(EXEEXT) \
+	fragment_ns_dot$(EXEEXT) fragment_ns_dotdot$(EXEEXT) \
+	fragment_ns_dotns$(EXEEXT) fragment_ns_nsdot$(EXEEXT) \
+	fragment_num$(EXEEXT) fragment_parent$(EXEEXT) \
+	fragment_parent_index$(EXEEXT) fragment_parent_root$(EXEEXT)
+am__EXEEXT_28 = get64$(EXEEXT) get_affix$(EXEEXT) \
 	get_bad_code$(EXEEXT) get_bit$(EXEEXT) get_carray$(EXEEXT) \
-	get_carray_len$(EXEEXT) get_carray_c2r$(EXEEXT) \
-	get_carray_slice$(EXEEXT) get_char$(EXEEXT) \
-	get_clincom$(EXEEXT) get_complex128$(EXEEXT) \
+	get_carray_bad$(EXEEXT) get_carray_c2r$(EXEEXT) \
+	get_carray_slice$(EXEEXT) get_carray_slice_bounds$(EXEEXT) \
+	get_carray_slice_type$(EXEEXT) get_carray_type$(EXEEXT) \
+	get_char$(EXEEXT) get_clincom$(EXEEXT) get_complex128$(EXEEXT) \
 	get_complex64$(EXEEXT) get_const$(EXEEXT) \
-	get_const_carray$(EXEEXT) get_const_complex$(EXEEXT) \
-	get_const_repr$(EXEEXT) get_cpolynom$(EXEEXT) \
+	get_const_bad$(EXEEXT) get_const_carray$(EXEEXT) \
+	get_const_complex$(EXEEXT) get_const_repr$(EXEEXT) \
+	get_const_reprz$(EXEEXT) get_cpolynom$(EXEEXT) \
 	get_cpolynom1$(EXEEXT) get_cpolynom_int$(EXEEXT) \
-	get_dim$(EXEEXT) get_divide$(EXEEXT) get_divide_ccin$(EXEEXT) \
+	get_dim$(EXEEXT) get_dimin$(EXEEXT) get_divide$(EXEEXT) \
+	get_divide_ccin$(EXEEXT) get_divide_code$(EXEEXT) \
 	get_divide_crin$(EXEEXT) get_divide_crinr$(EXEEXT) \
 	get_divide_rcin$(EXEEXT) get_divide_s$(EXEEXT) \
-	get_endian8$(EXEEXT) get_endian16$(EXEEXT) \
+	get_dot$(EXEEXT) get_endian8$(EXEEXT) get_endian16$(EXEEXT) \
 	get_endian32$(EXEEXT) get_endian64$(EXEEXT) \
 	get_endian_complex128_arm$(EXEEXT) \
 	get_endian_complex128_big$(EXEEXT) \
@@ -403,32 +504,42 @@ am__EXEEXT_26 = get64$(EXEEXT) get_affix$(EXEEXT) \
 	get_float32$(EXEEXT) get_float64$(EXEEXT) get_foffs$(EXEEXT) \
 	get_foffs2$(EXEEXT) get_fs$(EXEEXT) get_here$(EXEEXT) \
 	get_here_foffs$(EXEEXT) get_heres$(EXEEXT) \
-	get_index_complex$(EXEEXT) get_int8$(EXEEXT) \
+	get_index_complex$(EXEEXT) get_index_type$(EXEEXT) \
+	get_indir$(EXEEXT) get_indir_typein$(EXEEXT) get_int8$(EXEEXT) \
 	get_int16$(EXEEXT) get_int32$(EXEEXT) get_int64$(EXEEXT) \
 	get_invalid$(EXEEXT) get_lincom1$(EXEEXT) get_lincom2$(EXEEXT) \
 	get_lincom2s$(EXEEXT) get_lincom3$(EXEEXT) \
 	get_lincom3s$(EXEEXT) get_lincom_mdt$(EXEEXT) \
 	get_lincom_noin$(EXEEXT) get_lincom_non$(EXEEXT) \
 	get_lincom_null$(EXEEXT) get_lincom_spf$(EXEEXT) \
-	get_linterp$(EXEEXT) get_linterp1$(EXEEXT) \
-	get_linterp_abs$(EXEEXT) get_linterp_complex$(EXEEXT) \
-	get_linterp_empty$(EXEEXT) get_linterp_nodir$(EXEEXT) \
-	get_linterp_noin$(EXEEXT) get_linterp_notab$(EXEEXT) \
-	get_linterp_sort$(EXEEXT) get_mplex$(EXEEXT) \
-	get_mplex_bof$(EXEEXT) get_mplex_complex$(EXEEXT) \
-	get_mplex_lb$(EXEEXT) get_mplex_lball$(EXEEXT) \
-	get_mplex_nolb$(EXEEXT) get_mplex_s$(EXEEXT) \
-	get_mplex_saved$(EXEEXT) get_multiply$(EXEEXT) \
-	get_multiply_ccin$(EXEEXT) get_multiply_crin$(EXEEXT) \
+	get_lincom_code$(EXEEXT) get_linterp$(EXEEXT) \
+	get_linterp1$(EXEEXT) get_linterp_abs$(EXEEXT) \
+	get_linterp_complex$(EXEEXT) get_linterp_empty$(EXEEXT) \
+	get_linterp_nodir$(EXEEXT) get_linterp_noin$(EXEEXT) \
+	get_linterp_notab$(EXEEXT) get_linterp_sort$(EXEEXT) \
+	get_mplex$(EXEEXT) get_mplex_bof$(EXEEXT) \
+	get_mplex_complex$(EXEEXT) get_mplex_lb$(EXEEXT) \
+	get_mplex_lball$(EXEEXT) get_mplex_nolb$(EXEEXT) \
+	get_mplex_s$(EXEEXT) get_mplex_saved$(EXEEXT) \
+	get_multiply$(EXEEXT) get_multiply_ccin$(EXEEXT) \
+	get_multiply_code$(EXEEXT) get_multiply_crin$(EXEEXT) \
 	get_multiply_crinr$(EXEEXT) get_multiply_noin$(EXEEXT) \
 	get_multiply_rcin$(EXEEXT) get_multiply_s$(EXEEXT) \
 	get_neg$(EXEEXT) get_none$(EXEEXT) get_nonexistent$(EXEEXT) \
 	get_null$(EXEEXT) get_off64$(EXEEXT) get_phase$(EXEEXT) \
 	get_phase_affix$(EXEEXT) get_polynom$(EXEEXT) \
 	get_polynom_cmpin$(EXEEXT) get_polynom_noin$(EXEEXT) \
-	get_range$(EXEEXT) get_recip$(EXEEXT) get_recip_const$(EXEEXT) \
-	get_recurse$(EXEEXT) get_rofs$(EXEEXT) get_sbit$(EXEEXT) \
-	get_sf$(EXEEXT) get_ss$(EXEEXT) get_string$(EXEEXT) \
+	get_range$(EXEEXT) get_recip$(EXEEXT) get_recip_cmpin$(EXEEXT) \
+	get_recip_const$(EXEEXT) get_recurse$(EXEEXT) \
+	get_reprz$(EXEEXT) get_rofs$(EXEEXT) get_sarray$(EXEEXT) \
+	get_sarray_bad$(EXEEXT) get_sarray_slice$(EXEEXT) \
+	get_sarray_slice_bounds$(EXEEXT) \
+	get_sarray_slice_type$(EXEEXT) get_sarray_type$(EXEEXT) \
+	get_sbit$(EXEEXT) get_sf$(EXEEXT) get_sindir$(EXEEXT) \
+	get_sindir_code$(EXEEXT) get_sindir_neg$(EXEEXT) \
+	get_sindir_none$(EXEEXT) get_sindir_null$(EXEEXT) \
+	get_sindir_reprz$(EXEEXT) get_sindir_type$(EXEEXT) \
+	get_sindir_typein$(EXEEXT) get_ss$(EXEEXT) get_string$(EXEEXT) \
 	get_type$(EXEEXT) get_uint16$(EXEEXT) get_uint32$(EXEEXT) \
 	get_uint64$(EXEEXT) get_window$(EXEEXT) \
 	get_window_clr$(EXEEXT) get_window_complex$(EXEEXT) \
@@ -437,33 +548,46 @@ am__EXEEXT_26 = get64$(EXEEXT) get_affix$(EXEEXT) \
 	get_window_ne$(EXEEXT) get_window_s$(EXEEXT) \
 	get_window_set$(EXEEXT) get_zero$(EXEEXT) \
 	get_zero_complex$(EXEEXT) get_zero_float$(EXEEXT)
-am__EXEEXT_27 = global_flags$(EXEEXT) global_name$(EXEEXT) \
-	global_ref$(EXEEXT) global_ref_empty$(EXEEXT) \
-	global_ref_set$(EXEEXT)
-am__EXEEXT_28 = gzip_add$(EXEEXT) gzip_del$(EXEEXT) gzip_get$(EXEEXT) \
+am__EXEEXT_29 = global_flags$(EXEEXT) global_name$(EXEEXT)
+am__EXEEXT_30 = gzip_add$(EXEEXT) gzip_complex64$(EXEEXT) \
+	gzip_complex128$(EXEEXT) gzip_del$(EXEEXT) \
+	gzip_enoent$(EXEEXT) gzip_float32$(EXEEXT) \
+	gzip_float64$(EXEEXT) gzip_get$(EXEEXT) gzip_get_cont$(EXEEXT) \
 	gzip_get_far$(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_back$(EXEEXT) \
-	gzip_put_endian$(EXEEXT) gzip_put_get$(EXEEXT) \
-	gzip_put_nframes$(EXEEXT) gzip_put_off$(EXEEXT) \
+	gzip_int8$(EXEEXT) gzip_int16$(EXEEXT) gzip_int32$(EXEEXT) \
+	gzip_int64$(EXEEXT) gzip_move_from$(EXEEXT) \
+	gzip_move_to$(EXEEXT) gzip_nframes$(EXEEXT) gzip_put$(EXEEXT) \
+	gzip_put_back$(EXEEXT) gzip_put_endian$(EXEEXT) \
+	gzip_put_get$(EXEEXT) gzip_put_nframes$(EXEEXT) \
+	gzip_put_off$(EXEEXT) gzip_put_offs$(EXEEXT) \
 	gzip_put_pad$(EXEEXT) gzip_put_sub$(EXEEXT) gzip_seek$(EXEEXT) \
 	gzip_seek_far$(EXEEXT) gzip_seek_put$(EXEEXT) \
-	gzip_sync$(EXEEXT)
-am__EXEEXT_29 = header_complex$(EXEEXT) header_off64t$(EXEEXT)
-am__EXEEXT_30 = hide$(EXEEXT) hide_bad$(EXEEXT) hide_hidden$(EXEEXT) \
+	gzip_sync$(EXEEXT) gzip_uint8$(EXEEXT) gzip_uint16$(EXEEXT) \
+	gzip_uint32$(EXEEXT) gzip_uint64$(EXEEXT)
+am__EXEEXT_31 = header_complex$(EXEEXT) header_off64t$(EXEEXT)
+am__EXEEXT_32 = hide$(EXEEXT) hide_bad$(EXEEXT) hide_hidden$(EXEEXT) \
 	hide_hidden_bad$(EXEEXT) hide_unhide$(EXEEXT) \
 	hide_unhide_bad$(EXEEXT)
-am__EXEEXT_31 = include_accmode$(EXEEXT) include_affix$(EXEEXT) \
-	include_auto$(EXEEXT) include_cb$(EXEEXT) \
-	include_creat$(EXEEXT) include_ignore$(EXEEXT) \
+am__EXEEXT_33 = include_accmode$(EXEEXT) include_affix$(EXEEXT) \
+	include_affix_ns$(EXEEXT) include_auto$(EXEEXT) \
+	include_cb$(EXEEXT) include_creat$(EXEEXT) \
+	include_format$(EXEEXT) include_ignore$(EXEEXT) \
 	include_include$(EXEEXT) include_index$(EXEEXT) \
 	include_invalid$(EXEEXT) include_nonexistent$(EXEEXT) \
-	include_pc$(EXEEXT) include_ref$(EXEEXT) include_sub$(EXEEXT) \
-	include_syntax$(EXEEXT)
-am__EXEEXT_32 = index_domain$(EXEEXT) index_index$(EXEEXT) \
-	index_range$(EXEEXT) index_s$(EXEEXT) index_subset$(EXEEXT)
- at INCLUDE_LEGACY_API_TRUE@am__EXEEXT_33 = legacy_error$(EXEEXT) \
+	include_ndotdots$(EXEEXT) include_ndots$(EXEEXT) \
+	include_ns$(EXEEXT) include_ns_dot$(EXEEXT) \
+	include_ns_dotdot$(EXEEXT) include_ns_dotns$(EXEEXT) \
+	include_ns_nil$(EXEEXT) include_ns_null$(EXEEXT) \
+	include_ns_prefix$(EXEEXT) include_pc$(EXEEXT) \
+	include_prot$(EXEEXT) include_ref$(EXEEXT) \
+	include_ref_code$(EXEEXT) include_ref_type$(EXEEXT) \
+	include_sub$(EXEEXT) include_syntax$(EXEEXT)
+am__EXEEXT_34 = index_domain$(EXEEXT) index_empty$(EXEEXT) \
+	index_index$(EXEEXT) index_one$(EXEEXT) index_range$(EXEEXT) \
+	index_reprz$(EXEEXT) index_s$(EXEEXT) index_scalar$(EXEEXT) \
+	index_subset$(EXEEXT)
+ at INCLUDE_LEGACY_API_TRUE@am__EXEEXT_35 = legacy_error$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_estring$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_format$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_get$(EXEEXT) \
@@ -473,73 +597,119 @@ am__EXEEXT_32 = index_domain$(EXEEXT) index_index$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_nonexistent$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_put$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_spf$(EXEEXT)
-am__EXEEXT_34 = lzma_get$(EXEEXT) lzma_nframes$(EXEEXT) \
-	lzma_put$(EXEEXT) lzma_xz_add$(EXEEXT) lzma_xz_get$(EXEEXT) \
-	lzma_xz_get_far$(EXEEXT) lzma_xz_get_get$(EXEEXT) \
-	lzma_xz_get_get2$(EXEEXT) lzma_xz_get_put$(EXEEXT) \
+am__EXEEXT_36 = len_bad$(EXEEXT) len_carray$(EXEEXT) \
+	len_const$(EXEEXT) len_sarray$(EXEEXT) len_string$(EXEEXT) \
+	len_type$(EXEEXT)
+am__EXEEXT_37 = lzma_enoent$(EXEEXT) lzma_get$(EXEEXT) \
+	lzma_nframes$(EXEEXT) lzma_put$(EXEEXT) lzma_xz_add$(EXEEXT) \
+	lzma_xz_complex64$(EXEEXT) lzma_xz_complex128$(EXEEXT) \
+	lzma_xz_del$(EXEEXT) lzma_xz_float32$(EXEEXT) \
+	lzma_xz_float64$(EXEEXT) lzma_xz_get$(EXEEXT) \
+	lzma_xz_get_cont$(EXEEXT) lzma_xz_get_far$(EXEEXT) \
+	lzma_xz_get_get$(EXEEXT) lzma_xz_get_get2$(EXEEXT) \
+	lzma_xz_get_put$(EXEEXT) lzma_xz_int8$(EXEEXT) \
+	lzma_xz_int16$(EXEEXT) lzma_xz_int32$(EXEEXT) \
+	lzma_xz_int64$(EXEEXT) lzma_xz_move_from$(EXEEXT) \
 	lzma_xz_move_to$(EXEEXT) lzma_xz_nframes$(EXEEXT) \
-	lzma_xz_put$(EXEEXT) lzma_xz_put_back$(EXEEXT) \
-	lzma_xz_put_endian$(EXEEXT) lzma_xz_put_get$(EXEEXT) \
+	lzma_xz_offs_clear$(EXEEXT) lzma_xz_put$(EXEEXT) \
+	lzma_xz_put_back$(EXEEXT) lzma_xz_put_endian$(EXEEXT) \
+	lzma_xz_put_get$(EXEEXT) lzma_xz_put_offs$(EXEEXT) \
 	lzma_xz_put_pad$(EXEEXT) lzma_xz_seek$(EXEEXT) \
-	lzma_xz_seek_far$(EXEEXT) lzma_xz_sync$(EXEEXT)
-am__EXEEXT_35 = 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_index$(EXEEXT) madd_lincom$(EXEEXT) \
-	madd_lincom_invalid$(EXEEXT) madd_linterp$(EXEEXT) \
+	lzma_xz_seek_far$(EXEEXT) lzma_xz_sync$(EXEEXT) \
+	lzma_xz_uint8$(EXEEXT) lzma_xz_uint16$(EXEEXT) \
+	lzma_xz_uint32$(EXEEXT) lzma_xz_uint64$(EXEEXT)
+am__EXEEXT_38 = madd$(EXEEXT) madd_affix$(EXEEXT) madd_alias$(EXEEXT) \
+	madd_aliasmeta$(EXEEXT) madd_alias_affix$(EXEEXT) \
+	madd_alias_alias$(EXEEXT) madd_alias_subsub$(EXEEXT) \
+	madd_bit$(EXEEXT) madd_bit_invalid$(EXEEXT) \
+	madd_carray$(EXEEXT) madd_clincom$(EXEEXT) \
+	madd_clincom_nfields$(EXEEXT) madd_const$(EXEEXT) \
+	madd_cpolynom$(EXEEXT) madd_cpolynom_order$(EXEEXT) \
+	madd_crecip$(EXEEXT) madd_crecip89$(EXEEXT) \
+	madd_divide$(EXEEXT) madd_index$(EXEEXT) madd_indir$(EXEEXT) \
+	madd_lincom$(EXEEXT) madd_lincom_invalid$(EXEEXT) \
+	madd_lincom_nfields$(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_spec_resolv$(EXEEXT) \
-	madd_string$(EXEEXT) madd_window$(EXEEXT)
-am__EXEEXT_36 = move_affix$(EXEEXT) move_affix_dup$(EXEEXT) \
+	madd_parent_bad$(EXEEXT) madd_phase$(EXEEXT) \
+	madd_phase_invalid$(EXEEXT) madd_polynom$(EXEEXT) \
+	madd_polynom_order$(EXEEXT) madd_raw$(EXEEXT) \
+	madd_recip$(EXEEXT) madd_sarray$(EXEEXT) \
+	madd_sarray_dup$(EXEEXT) madd_sbit$(EXEEXT) \
+	madd_sindir$(EXEEXT) madd_spec$(EXEEXT) \
+	madd_spec_directive$(EXEEXT) madd_spec_invalid$(EXEEXT) \
+	madd_spec_parent$(EXEEXT) madd_spec_resolv$(EXEEXT) \
+	madd_string$(EXEEXT) madd_string_dup$(EXEEXT) \
+	madd_subsub$(EXEEXT) madd_window$(EXEEXT)
+am__EXEEXT_39 = match_fragment$(EXEEXT) match_pcre$(EXEEXT) \
+	match_pcre_bad$(EXEEXT) match_pcre_caseless$(EXEEXT) \
+	match_pcre_ext$(EXEEXT) match_pcre_js$(EXEEXT) \
+	match_pcre_utf8$(EXEEXT) match_regex$(EXEEXT) \
+	match_regex_bad$(EXEEXT) match_regex_ext$(EXEEXT) \
+	match_regex_icase$(EXEEXT)
+am__EXEEXT_40 = mflush$(EXEEXT) mflush_affix$(EXEEXT) \
+	mflush_amb_code$(EXEEXT) mflush_carray$(EXEEXT) \
+	mflush_hex$(EXEEXT) mflush_indir$(EXEEXT) \
+	mflush_mplex$(EXEEXT) mflush_ns$(EXEEXT) \
+	mflush_pretty$(EXEEXT) mflush_prot$(EXEEXT) \
+	mflush_ref$(EXEEXT) mflush_repr$(EXEEXT) mflush_repr9$(EXEEXT) \
+	mflush_reprz$(EXEEXT) mflush_sindir$(EXEEXT) \
+	mflush_spec$(EXEEXT) mflush_string$(EXEEXT) \
+	mflush_type$(EXEEXT) mflush_type4$(EXEEXT) \
+	mflush_windop$(EXEEXT)
+am__EXEEXT_41 = move_affix$(EXEEXT) move_affix_dup$(EXEEXT) \
 	move_affix_meta$(EXEEXT) move_affix_updb$(EXEEXT) \
-	move_alias$(EXEEXT) move_data_enc_ar$(EXEEXT) \
-	move_data_enc_ra$(EXEEXT) move_data_endian$(EXEEXT) \
+	move_alias$(EXEEXT) move_code$(EXEEXT) \
+	move_data_enc_ar$(EXEEXT) move_data_enc_ra$(EXEEXT) \
+	move_data_enc_un$(EXEEXT) move_data_endian$(EXEEXT) \
 	move_data_foffs$(EXEEXT) move_data_foffs_neg$(EXEEXT) \
-	move_data_nop$(EXEEXT) move_index$(EXEEXT) move_meta$(EXEEXT) \
-	move_move$(EXEEXT) move_protect$(EXEEXT) move_subdir$(EXEEXT)
-am__EXEEXT_37 = name_affix$(EXEEXT) name_affix_bad$(EXEEXT) \
-	name_alias$(EXEEXT) name_dangle$(EXEEXT) name_dot5$(EXEEXT) \
-	name_dot5r$(EXEEXT) name_dot9$(EXEEXT) name_dup$(EXEEXT) \
-	name_meta$(EXEEXT) name_move$(EXEEXT) name_move_alias$(EXEEXT) \
-	name_name$(EXEEXT) name_updb$(EXEEXT) name_updb_affix$(EXEEXT) \
-	name_updb_alias$(EXEEXT) name_updb_carray$(EXEEXT) \
-	name_updb_const$(EXEEXT) name_updb_const_alias$(EXEEXT)
-am__EXEEXT_38 = native_bit$(EXEEXT) native_const$(EXEEXT) \
-	native_index$(EXEEXT) native_lincom$(EXEEXT) \
-	native_lincom_cmpin$(EXEEXT) native_lincom_cmpscal$(EXEEXT) \
-	native_linterp$(EXEEXT) native_linterp_cmp$(EXEEXT) \
-	native_mult$(EXEEXT) native_mult1$(EXEEXT) \
-	native_mult2$(EXEEXT) native_polynom$(EXEEXT) \
-	native_polynom_cmpin$(EXEEXT) native_polynom_cmpscal$(EXEEXT) \
-	native_raw$(EXEEXT) native_phase$(EXEEXT) \
-	native_recip$(EXEEXT) native_recip_cmpin$(EXEEXT) \
-	native_recip_cmpscal$(EXEEXT) native_sbit$(EXEEXT) \
-	native_string$(EXEEXT)
-am__EXEEXT_39 = nentries_alias$(EXEEXT) nentries_hidden$(EXEEXT) \
-	nentries_noalias$(EXEEXT) nentries_scalar$(EXEEXT)
-am__EXEEXT_40 = nfields_hidden$(EXEEXT) nfields_invalid$(EXEEXT) \
+	move_data_nop$(EXEEXT) move_data_prot$(EXEEXT) \
+	move_entype$(EXEEXT) move_index$(EXEEXT) move_meta$(EXEEXT) \
+	move_move$(EXEEXT) move_nop$(EXEEXT) move_ns$(EXEEXT) \
+	move_nsns$(EXEEXT) move_protect$(EXEEXT) move_rdonly$(EXEEXT) \
+	move_subdir$(EXEEXT) move_unkenc$(EXEEXT)
+am__EXEEXT_42 = name_affix$(EXEEXT) name_affix_bad$(EXEEXT) \
+	name_alias$(EXEEXT) name_code$(EXEEXT) name_dangle$(EXEEXT) \
+	name_dot5$(EXEEXT) name_dot5r$(EXEEXT) name_dot9$(EXEEXT) \
+	name_dot10$(EXEEXT) name_dup$(EXEEXT) name_index$(EXEEXT) \
+	name_meta$(EXEEXT) name_meta2$(EXEEXT) name_move$(EXEEXT) \
+	name_move_alias$(EXEEXT) name_name$(EXEEXT) name_ns$(EXEEXT) \
+	name_ns2$(EXEEXT) name_nsdot$(EXEEXT) name_prot$(EXEEXT) \
+	name_rdonly$(EXEEXT) name_updb$(EXEEXT) \
+	name_updb_affix$(EXEEXT) name_updb_alias$(EXEEXT) \
+	name_updb_carray$(EXEEXT) name_updb_const$(EXEEXT) \
+	name_updb_const_alias$(EXEEXT) name_updb_sarray$(EXEEXT)
+am__EXEEXT_43 = native_bit$(EXEEXT) native_code$(EXEEXT) \
+	native_const$(EXEEXT) native_index$(EXEEXT) \
+	native_lincom$(EXEEXT) native_lincom_cmpin$(EXEEXT) \
+	native_lincom_cmpscal$(EXEEXT) native_linterp$(EXEEXT) \
+	native_linterp_cmp$(EXEEXT) native_mult$(EXEEXT) \
+	native_mult1$(EXEEXT) native_mult2$(EXEEXT) \
+	native_polynom$(EXEEXT) native_polynom_cmpin$(EXEEXT) \
+	native_polynom_cmpscal$(EXEEXT) native_raw$(EXEEXT) \
+	native_phase$(EXEEXT) native_recip$(EXEEXT) \
+	native_recip_cmpin$(EXEEXT) native_recip_cmpscal$(EXEEXT) \
+	native_recurse$(EXEEXT) native_reprz$(EXEEXT) \
+	native_sbit$(EXEEXT) native_string$(EXEEXT)
+am__EXEEXT_44 = nentries_alias$(EXEEXT) nentries_entype$(EXEEXT) \
+	nentries_hidden$(EXEEXT) nentries_noalias$(EXEEXT) \
+	nentries_scalar$(EXEEXT)
+am__EXEEXT_45 = nfields_hidden$(EXEEXT) nfields_invalid$(EXEEXT) \
 	nfields_nfields$(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_41 = nframes64$(EXEEXT) nframes_empty$(EXEEXT) \
+am__EXEEXT_46 = nframes64$(EXEEXT) nframes_empty$(EXEEXT) \
 	nframes_invalid$(EXEEXT) nframes_nframes$(EXEEXT) \
 	nframes_off64$(EXEEXT) nframes_spf$(EXEEXT)
-am__EXEEXT_42 = nmeta$(EXEEXT) nmeta_hidden$(EXEEXT) \
+am__EXEEXT_47 = 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_hidden$(EXEEXT) nmeta_vectors_invalid$(EXEEXT) \
-	nmeta_vectors_parent$(EXEEXT)
-am__EXEEXT_43 = open_abs$(EXEEXT) open_cb_abort$(EXEEXT) \
+	nmeta_parent_meta$(EXEEXT) nmeta_vectors$(EXEEXT) \
+	nmeta_vectors_del$(EXEEXT) nmeta_vectors_hidden$(EXEEXT) \
+	nmeta_vectors_invalid$(EXEEXT) nmeta_vectors_parent$(EXEEXT)
+am__EXEEXT_48 = open_abs$(EXEEXT) open_cb_abort$(EXEEXT) \
 	open_cb_cont$(EXEEXT) open_cb_ignore$(EXEEXT) \
 	open_cb_invalid$(EXEEXT) open_cb_rescan$(EXEEXT) \
 	open_cb_rescan_alloc$(EXEEXT) open_eaccess$(EXEEXT) \
@@ -549,87 +719,115 @@ am__EXEEXT_43 = open_abs$(EXEEXT) open_cb_abort$(EXEEXT) \
 	open_sym_cl$(EXEEXT) open_sym_ct$(EXEEXT) open_sym_d$(EXEEXT) \
 	open_sym_l$(EXEEXT) open_sym_p$(EXEEXT) open_sym_pl$(EXEEXT) \
 	open_sym_pt$(EXEEXT)
-am__EXEEXT_44 = parse_alias$(EXEEXT) parse_alias_code$(EXEEXT) \
-	parse_alias_dup$(EXEEXT) parse_alias_meta$(EXEEXT) \
-	parse_alias_missing$(EXEEXT) parse_badline$(EXEEXT) \
+am__EXEEXT_49 = parse_alias$(EXEEXT) parse_alias_code$(EXEEXT) \
+	parse_alias_dup$(EXEEXT) parse_alias_loop$(EXEEXT) \
+	parse_alias_meta$(EXEEXT) parse_alias_missing$(EXEEXT) \
+	parse_alias_ncols$(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_carray_long$(EXEEXT) parse_carray_ncols$(EXEEXT) \
+	parse_carray_type$(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_const_type$(EXEEXT) parse_divide$(EXEEXT) \
+	parse_double$(EXEEXT) parse_duplicate$(EXEEXT) \
+	parse_duplicate_ignore$(EXEEXT) parse_endian_bad$(EXEEXT) \
+	parse_endian_bad2$(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_hex$(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_affix_bad$(EXEEXT) \
+	parse_esc$(EXEEXT) parse_foffs$(EXEEXT) \
+	parse_foffs_include$(EXEEXT) parse_foffs_slash$(EXEEXT) \
+	parse_hex$(EXEEXT) parse_hidden$(EXEEXT) \
+	parse_hidden_field$(EXEEXT) parse_hidden_frag$(EXEEXT) \
+	parse_hidden_meta$(EXEEXT) parse_huge$(EXEEXT) \
+	parse_include$(EXEEXT) parse_include_absolute$(EXEEXT) \
+	parse_include_absrel$(EXEEXT) parse_include_affix_bad$(EXEEXT) \
 	parse_include_affix_ref$(EXEEXT) parse_include_dir$(EXEEXT) \
-	parse_include_loop$(EXEEXT) parse_include_nonexistent$(EXEEXT) \
+	parse_include_loop$(EXEEXT) parse_include_nodir$(EXEEXT) \
+	parse_include_nonexistent$(EXEEXT) parse_include_ns$(EXEEXT) \
+	parse_include_ns2$(EXEEXT) parse_include_nsabs$(EXEEXT) \
+	parse_include_nsinh$(EXEEXT) parse_include_nspop$(EXEEXT) \
+	parse_include_nsrabs$(EXEEXT) parse_include_nsrainh$(EXEEXT) \
+	parse_include_nsrinh$(EXEEXT) parse_include_nsroot$(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_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_literal_cmpbad$(EXEEXT) parse_literal_fltcmp$(EXEEXT) \
-	parse_literal_fltcmp0$(EXEEXT) parse_literal_intcmp$(EXEEXT) \
-	parse_literal_intcmp0$(EXEEXT) parse_literal_uintcmp$(EXEEXT) \
-	parse_literal_uintcmp0$(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_frag$(EXEEXT) \
-	parse_meta_implicit$(EXEEXT) parse_meta_implicit2$(EXEEXT) \
+	parse_indir$(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_literal_cmpbad$(EXEEXT) \
+	parse_literal_fltcmp$(EXEEXT) parse_literal_fltcmp0$(EXEEXT) \
+	parse_literal_intcmp$(EXEEXT) parse_literal_intcmp0$(EXEEXT) \
+	parse_literal_uintcmp$(EXEEXT) parse_literal_uintcmp0$(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_frag$(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_meta_ncols$(EXEEXT) parse_meta_parent$(EXEEXT) \
+	parse_meta_raw$(EXEEXT) parse_mplex$(EXEEXT) \
+	parse_mplex_ncols$(EXEEXT) parse_mplex_neg$(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_octal_zero$(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_char_bad$(EXEEXT) parse_raw_ncols$(EXEEXT) \
-	parse_raw_scalar$(EXEEXT) parse_raw_spf$(EXEEXT) \
-	parse_raw_type$(EXEEXT) parse_recip$(EXEEXT) \
+	parse_name_ext$(EXEEXT) parse_ncols$(EXEEXT) parse_ns$(EXEEXT) \
+	parse_ns_dot$(EXEEXT) parse_ns_dotdot$(EXEEXT) \
+	parse_ns_dotdotns$(EXEEXT) parse_ns_dotns$(EXEEXT) \
+	parse_ns_include$(EXEEXT) parse_ns_include_ns$(EXEEXT) \
+	parse_ns_ndotdots$(EXEEXT) parse_ns_ndots$(EXEEXT) \
+	parse_ns_nsdot$(EXEEXT) parse_ns_nsdotdot$(EXEEXT) \
+	parse_nsf$(EXEEXT) parse_nsf_abs$(EXEEXT) \
+	parse_nsf_alias$(EXEEXT) parse_nsf_dot$(EXEEXT) \
+	parse_nsf_hide$(EXEEXT) parse_nsf_index$(EXEEXT) \
+	parse_nsf_meta$(EXEEXT) parse_nsf_meta2$(EXEEXT) \
+	parse_nsf_ref$(EXEEXT) parse_nsf_refabs$(EXEEXT) \
+	parse_nsf_root$(EXEEXT) parse_nsf_sub$(EXEEXT) \
+	parse_octal_zero$(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_char_bad$(EXEEXT) \
+	parse_raw_ncols$(EXEEXT) parse_raw_scalar$(EXEEXT) \
+	parse_raw_spf$(EXEEXT) parse_raw_type$(EXEEXT) \
+	parse_recip$(EXEEXT) parse_recip_ncols$(EXEEXT) \
 	parse_ref$(EXEEXT) parse_ref_nonexistent$(EXEEXT) \
+	parse_ref_type$(EXEEXT) parse_sarray$(EXEEXT) \
+	parse_sarray_long$(EXEEXT) parse_sarray_ncols$(EXEEXT) \
 	parse_sbit$(EXEEXT) parse_scalar1$(EXEEXT) \
 	parse_scalar2$(EXEEXT) parse_scalar_repr$(EXEEXT) \
-	parse_sort$(EXEEXT) parse_string$(EXEEXT) \
-	parse_string_ncols$(EXEEXT) parse_string_null$(EXEEXT) \
-	parse_utf8$(EXEEXT) parse_utf8_invalid$(EXEEXT) \
-	parse_utf8_zero$(EXEEXT) parse_version$(EXEEXT) \
-	parse_version_89$(EXEEXT) parse_version_98$(EXEEXT) \
-	parse_version_include$(EXEEXT) \
+	parse_sindir$(EXEEXT) parse_sort$(EXEEXT) \
+	parse_string$(EXEEXT) parse_string_ncols$(EXEEXT) \
+	parse_string_null$(EXEEXT) parse_utf8$(EXEEXT) \
+	parse_utf8_invalid$(EXEEXT) parse_utf8_zero$(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_45 = protect_alter$(EXEEXT) protect_alter_all$(EXEEXT) \
-	protect_get$(EXEEXT)
-am__EXEEXT_46 = put64$(EXEEXT) put_bad_code$(EXEEXT) put_bit$(EXEEXT) \
-	put_bof$(EXEEXT) put_carray$(EXEEXT) \
-	put_carray_client$(EXEEXT) put_carray_slice$(EXEEXT) \
+am__EXEEXT_50 = protect_alter$(EXEEXT) protect_alter_all$(EXEEXT) \
+	protect_alter_arg$(EXEEXT) protect_alter_index$(EXEEXT) \
+	protect_alter_rdonly$(EXEEXT) protect_get$(EXEEXT) \
+	protect_index$(EXEEXT)
+am__EXEEXT_51 = put64$(EXEEXT) put_bad_code$(EXEEXT) put_bit$(EXEEXT) \
+	put_bit_repr$(EXEEXT) put_bof$(EXEEXT) put_carray$(EXEEXT) \
+	put_carray_client$(EXEEXT) put_carray_bad$(EXEEXT) \
+	put_carray_bounds$(EXEEXT) put_carray_rdonly$(EXEEXT) \
+	put_carray_slice$(EXEEXT) put_carray_type$(EXEEXT) \
 	put_char$(EXEEXT) put_clincom1$(EXEEXT) \
 	put_complex128$(EXEEXT) put_complex64$(EXEEXT) \
 	put_const$(EXEEXT) put_const_protect$(EXEEXT) \
@@ -650,70 +848,96 @@ am__EXEEXT_46 = put64$(EXEEXT) put_bad_code$(EXEEXT) put_bit$(EXEEXT) \
 	put_endian_float64_little$(EXEEXT) put_ff$(EXEEXT) \
 	put_float32$(EXEEXT) put_float64$(EXEEXT) put_foffs$(EXEEXT) \
 	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_indir$(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_lincom_repr$(EXEEXT) \
+	put_linterp$(EXEEXT) put_linterp_cmp$(EXEEXT) \
+	put_linterp_noin$(EXEEXT) put_linterp_nomono$(EXEEXT) \
+	put_linterp_notab$(EXEEXT) put_linterp_repr$(EXEEXT) \
 	put_linterp_reverse$(EXEEXT) put_mplex$(EXEEXT) \
-	put_mplex_complex$(EXEEXT) put_multiply$(EXEEXT) \
-	put_nofile$(EXEEXT) put_null$(EXEEXT) put_off64$(EXEEXT) \
-	put_phase$(EXEEXT) put_phase_noin$(EXEEXT) \
+	put_mplex_complex$(EXEEXT) put_mplex_repr$(EXEEXT) \
+	put_multiply$(EXEEXT) put_neg$(EXEEXT) put_nofile$(EXEEXT) \
+	put_null$(EXEEXT) put_off64$(EXEEXT) put_phase$(EXEEXT) \
+	put_phase_noin$(EXEEXT) put_phase_repr$(EXEEXT) \
 	put_polynom1$(EXEEXT) put_polynom2$(EXEEXT) \
-	put_polynom_noin$(EXEEXT) put_protect$(EXEEXT) \
-	put_range$(EXEEXT) put_rdonly$(EXEEXT) put_recip$(EXEEXT) \
+	put_polynom_noin$(EXEEXT) put_polynom_repr$(EXEEXT) \
+	put_protect$(EXEEXT) put_range$(EXEEXT) put_rdonly$(EXEEXT) \
+	put_recip$(EXEEXT) put_recip_repr$(EXEEXT) \
 	put_recurse$(EXEEXT) put_repr$(EXEEXT) put_rofs$(EXEEXT) \
-	put_sbit$(EXEEXT) put_sf$(EXEEXT) put_ss$(EXEEXT) \
-	put_string$(EXEEXT) put_string_protect$(EXEEXT) \
+	put_sarray$(EXEEXT) put_sarray_bad$(EXEEXT) \
+	put_sarray_bounds$(EXEEXT) put_sarray_rdonly$(EXEEXT) \
+	put_sarray_slice$(EXEEXT) put_sarray_type$(EXEEXT) \
+	put_sbit$(EXEEXT) put_scalar$(EXEEXT) put_sf$(EXEEXT) \
+	put_sindir$(EXEEXT) put_ss$(EXEEXT) put_string$(EXEEXT) \
+	put_string_protect$(EXEEXT) put_string_type$(EXEEXT) \
 	put_sub$(EXEEXT) put_type$(EXEEXT) put_uint16$(EXEEXT) \
 	put_uint32$(EXEEXT) put_uint64$(EXEEXT) put_window$(EXEEXT) \
 	put_zero$(EXEEXT)
-am__EXEEXT_47 = ref$(EXEEXT) ref_none$(EXEEXT) ref_two$(EXEEXT)
-am__EXEEXT_48 = repr_a$(EXEEXT) repr_bad$(EXEEXT) \
+am__EXEEXT_52 = ref$(EXEEXT) ref_empty$(EXEEXT) ref_get$(EXEEXT) \
+	ref_none$(EXEEXT) ref_set$(EXEEXT) ref_set_code$(EXEEXT) \
+	ref_set_prot$(EXEEXT) ref_set_rdonly$(EXEEXT) \
+	ref_set_type$(EXEEXT) ref_two$(EXEEXT)
+am__EXEEXT_53 = repr_a$(EXEEXT) repr_bad$(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_49 = seek64$(EXEEXT) seek_cur$(EXEEXT) seek_end$(EXEEXT) \
+am__EXEEXT_54 = salist$(EXEEXT) salist0$(EXEEXT) \
+	salist_hidden$(EXEEXT) salist_long$(EXEEXT) \
+	salist_meta$(EXEEXT) salist_meta0$(EXEEXT) \
+	salist_meta_free$(EXEEXT) salist_meta_hidden$(EXEEXT) \
+	salist_meta_meta$(EXEEXT) salist_meta_parent$(EXEEXT)
+am__EXEEXT_55 = seek64$(EXEEXT) seek_arg$(EXEEXT) seek_code$(EXEEXT) \
+	seek_cur$(EXEEXT) seek_dim$(EXEEXT) seek_end$(EXEEXT) \
 	seek_far$(EXEEXT) seek_foffs$(EXEEXT) seek_foffs2$(EXEEXT) \
-	seek_index$(EXEEXT) seek_lincom$(EXEEXT) seek_mult$(EXEEXT) \
+	seek_index$(EXEEXT) seek_index_end$(EXEEXT) \
+	seek_lincom$(EXEEXT) seek_mplex$(EXEEXT) seek_mult$(EXEEXT) \
 	seek_neg$(EXEEXT) seek_phase$(EXEEXT) seek_range$(EXEEXT) \
-	seek_range2$(EXEEXT) seek_set$(EXEEXT) seek_sub$(EXEEXT)
-am__EXEEXT_50 = sie_get_big$(EXEEXT) sie_get_header$(EXEEXT) \
-	sie_get_little$(EXEEXT) sie_move_from$(EXEEXT) \
-	sie_move_to$(EXEEXT) sie_nframes_big$(EXEEXT) \
-	sie_nframes_little$(EXEEXT) sie_put_append$(EXEEXT) \
-	sie_put_append2$(EXEEXT) sie_put_back$(EXEEXT) \
-	sie_put_big$(EXEEXT) sie_put_header$(EXEEXT) \
-	sie_put_little$(EXEEXT) sie_put_many$(EXEEXT) \
-	sie_put_newo$(EXEEXT) sie_put_newo0$(EXEEXT) \
-	sie_put_pad$(EXEEXT) sie_put_pad0$(EXEEXT) \
-	sie_put_trunc$(EXEEXT) sie_put_trunc2$(EXEEXT) \
-	sie_put_trunc_nf$(EXEEXT) sie_seek$(EXEEXT) \
-	sie_seek_far$(EXEEXT) sie_sync$(EXEEXT)
-am__EXEEXT_51 = slim_get$(EXEEXT) slim_nframes$(EXEEXT) \
+	seek_range2$(EXEEXT) seek_range_end$(EXEEXT) \
+	seek_recurse$(EXEEXT) seek_set$(EXEEXT) seek_sub$(EXEEXT)
+am__EXEEXT_56 = sie_err_open$(EXEEXT) sie_get_big$(EXEEXT) \
+	sie_get_header$(EXEEXT) sie_get_little$(EXEEXT) \
+	sie_move_from$(EXEEXT) sie_move_to$(EXEEXT) \
+	sie_nframes_big$(EXEEXT) sie_nframes_little$(EXEEXT) \
+	sie_put_append$(EXEEXT) sie_put_append2$(EXEEXT) \
+	sie_put_back$(EXEEXT) sie_put_big$(EXEEXT) \
+	sie_put_header$(EXEEXT) sie_put_little$(EXEEXT) \
+	sie_put_many$(EXEEXT) sie_put_newo$(EXEEXT) \
+	sie_put_newo0$(EXEEXT) sie_put_pad$(EXEEXT) \
+	sie_put_pad0$(EXEEXT) sie_put_trunc$(EXEEXT) \
+	sie_put_trunc2$(EXEEXT) sie_put_trunc_nf$(EXEEXT) \
+	sie_seek$(EXEEXT) sie_seek_far$(EXEEXT) sie_sync$(EXEEXT)
+am__EXEEXT_57 = slim_get$(EXEEXT) slim_nframes$(EXEEXT) \
 	slim_seek$(EXEEXT) slim_seek_far$(EXEEXT)
-am__EXEEXT_52 = spf_alias$(EXEEXT) spf_alias_missing$(EXEEXT) \
-	spf_alias_meta$(EXEEXT) spf_divide$(EXEEXT) \
+am__EXEEXT_58 = spf_alias$(EXEEXT) spf_alias_missing$(EXEEXT) \
+	spf_alias_meta$(EXEEXT) spf_const$(EXEEXT) spf_divide$(EXEEXT) \
 	spf_lincom$(EXEEXT) spf_multiply$(EXEEXT) spf_polynom$(EXEEXT) \
 	spf_raw$(EXEEXT) spf_recip$(EXEEXT) spf_recurse$(EXEEXT)
-am__EXEEXT_53 = svlist$(EXEEXT) svlist0$(EXEEXT) svlist2$(EXEEXT) \
+am__EXEEXT_59 = svlist$(EXEEXT) svlist0$(EXEEXT) svlist2$(EXEEXT) \
 	svlist_hidden$(EXEEXT) svlist_invalid$(EXEEXT) \
-	svlist_meta$(EXEEXT) svlist_meta0$(EXEEXT) \
-	svlist_meta_hidden$(EXEEXT) svlist_meta_invalid$(EXEEXT)
-am__EXEEXT_54 = table$(EXEEXT) table_code$(EXEEXT) table_type$(EXEEXT)
-am__EXEEXT_55 = tell$(EXEEXT) tell64$(EXEEXT) tell_multidiv$(EXEEXT) \
+	svlist_long$(EXEEXT) svlist_meta$(EXEEXT) \
+	svlist_meta0$(EXEEXT) svlist_meta_hidden$(EXEEXT) \
+	svlist_meta_invalid$(EXEEXT) svlist_meta_meta$(EXEEXT) \
+	svlist_meta_parent$(EXEEXT)
+am__EXEEXT_60 = table$(EXEEXT) table_code$(EXEEXT) table_type$(EXEEXT)
+am__EXEEXT_61 = tell$(EXEEXT) tell64$(EXEEXT) tell_code$(EXEEXT) \
+	tell_dim$(EXEEXT) tell_multi_div$(EXEEXT) \
+	tell_multi_lincom$(EXEEXT) tell_recurse$(EXEEXT) \
 	tell_sub$(EXEEXT)
-am__EXEEXT_56 = tok_arg$(EXEEXT) tok_escape$(EXEEXT) \
+am__EXEEXT_62 = tok_arg$(EXEEXT) tok_escape$(EXEEXT) \
 	tok_quote$(EXEEXT)
-am__EXEEXT_57 = trunc$(EXEEXT) trunc_dir$(EXEEXT) \
+am__EXEEXT_63 = trunc$(EXEEXT) trunc_dir$(EXEEXT) \
 	trunc_rdonly$(EXEEXT) trunc_rofs$(EXEEXT) \
 	trunc_truncsub$(EXEEXT)
-am__EXEEXT_58 = unclude$(EXEEXT) unclude_del$(EXEEXT) \
-	unclude_move$(EXEEXT) unclude_open$(EXEEXT)
-am__EXEEXT_59 = version_0$(EXEEXT) version_0_write$(EXEEXT) \
+am__EXEEXT_64 = unclude$(EXEEXT) unclude_del$(EXEEXT) \
+	unclude_index$(EXEEXT) unclude_keep$(EXEEXT) \
+	unclude_move$(EXEEXT) unclude_open$(EXEEXT) \
+	unclude_prot$(EXEEXT) unclude_rdonly$(EXEEXT)
+am__EXEEXT_65 = valid_reprz$(EXEEXT)
+am__EXEEXT_66 = 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) \
@@ -725,16 +949,16 @@ am__EXEEXT_59 = version_0$(EXEEXT) version_0_write$(EXEEXT) \
 	version_8$(EXEEXT) version_8_strict$(EXEEXT) \
 	version_8_write$(EXEEXT) version_9$(EXEEXT) \
 	version_9_strict$(EXEEXT) version_9_write$(EXEEXT)
-am__EXEEXT_60 = vlist$(EXEEXT) vlist_alias$(EXEEXT) \
+am__EXEEXT_67 = vlist$(EXEEXT) vlist_alias$(EXEEXT) \
 	vlist_hidden$(EXEEXT) vlist_invalid$(EXEEXT) \
 	vlist_meta$(EXEEXT) vlist_meta_hidden$(EXEEXT) \
 	vlist_meta_invalid$(EXEEXT)
-am__EXEEXT_61 = zzip_data$(EXEEXT) zzip_get$(EXEEXT) \
+am__EXEEXT_68 = zzip_data$(EXEEXT) zzip_get$(EXEEXT) \
 	zzip_get_get$(EXEEXT) zzip_nframes$(EXEEXT) zzip_seek$(EXEEXT) \
 	zzip_seek_far$(EXEEXT)
-am__EXEEXT_62 = zzslim_get$(EXEEXT) zzslim_nframes$(EXEEXT) \
+am__EXEEXT_69 = zzslim_get$(EXEEXT) zzslim_nframes$(EXEEXT) \
 	zzslim_seek$(EXEEXT) zzslim_seek_far$(EXEEXT)
-am__EXEEXT_63 = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+am__EXEEXT_70 = $(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) \
@@ -754,7 +978,9 @@ am__EXEEXT_63 = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 	$(am__EXEEXT_52) $(am__EXEEXT_53) $(am__EXEEXT_54) \
 	$(am__EXEEXT_55) $(am__EXEEXT_56) $(am__EXEEXT_57) \
 	$(am__EXEEXT_58) $(am__EXEEXT_59) $(am__EXEEXT_60) \
-	$(am__EXEEXT_61) $(am__EXEEXT_62)
+	$(am__EXEEXT_61) $(am__EXEEXT_62) $(am__EXEEXT_63) \
+	$(am__EXEEXT_64) $(am__EXEEXT_65) $(am__EXEEXT_66) \
+	$(am__EXEEXT_67) $(am__EXEEXT_68) $(am__EXEEXT_69)
 add_add_SOURCES = add_add.c
 add_add_OBJECTS = add_add.$(OBJEXT)
 add_add_LDADD = $(LDADD)
@@ -775,10 +1001,30 @@ 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_index_SOURCES = add_alias_index.c
+add_alias_index_OBJECTS = add_alias_index.$(OBJEXT)
+add_alias_index_LDADD = $(LDADD)
+add_alias_index_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_alias_name_SOURCES = add_alias_name.c
+add_alias_name_OBJECTS = add_alias_name.$(OBJEXT)
+add_alias_name_LDADD = $(LDADD)
+add_alias_name_DEPENDENCIES = ../src/libgetdata.la
+add_alias_ns_SOURCES = add_alias_ns.c
+add_alias_ns_OBJECTS = add_alias_ns.$(OBJEXT)
+add_alias_ns_LDADD = $(LDADD)
+add_alias_ns_DEPENDENCIES = ../src/libgetdata.la
+add_alias_prot_SOURCES = add_alias_prot.c
+add_alias_prot_OBJECTS = add_alias_prot.$(OBJEXT)
+add_alias_prot_LDADD = $(LDADD)
+add_alias_prot_DEPENDENCIES = ../src/libgetdata.la
+add_alias_rdonly_SOURCES = add_alias_rdonly.c
+add_alias_rdonly_OBJECTS = add_alias_rdonly.$(OBJEXT)
+add_alias_rdonly_LDADD = $(LDADD)
+add_alias_rdonly_DEPENDENCIES = ../src/libgetdata.la
 add_amb_code7_SOURCES = add_amb_code7.c
 add_amb_code7_OBJECTS = add_amb_code7.$(OBJEXT)
 add_amb_code7_LDADD = $(LDADD)
@@ -795,6 +1041,10 @@ add_bit_bitsize_SOURCES = add_bit_bitsize.c
 add_bit_bitsize_OBJECTS = add_bit_bitsize.$(OBJEXT)
 add_bit_bitsize_LDADD = $(LDADD)
 add_bit_bitsize_DEPENDENCIES = ../src/libgetdata.la
+add_bit_inaff_SOURCES = add_bit_inaff.c
+add_bit_inaff_OBJECTS = add_bit_inaff.$(OBJEXT)
+add_bit_inaff_LDADD = $(LDADD)
+add_bit_inaff_DEPENDENCIES = ../src/libgetdata.la
 add_bit_invalid_SOURCES = add_bit_invalid.c
 add_bit_invalid_OBJECTS = add_bit_invalid.$(OBJEXT)
 add_bit_invalid_LDADD = $(LDADD)
@@ -811,10 +1061,22 @@ add_carray_SOURCES = add_carray.c
 add_carray_OBJECTS = add_carray.$(OBJEXT)
 add_carray_LDADD = $(LDADD)
 add_carray_DEPENDENCIES = ../src/libgetdata.la
+add_carray_entry_SOURCES = add_carray_entry.c
+add_carray_entry_OBJECTS = add_carray_entry.$(OBJEXT)
+add_carray_entry_LDADD = $(LDADD)
+add_carray_entry_DEPENDENCIES = ../src/libgetdata.la
+add_carray_type_SOURCES = add_carray_type.c
+add_carray_type_OBJECTS = add_carray_type.$(OBJEXT)
+add_carray_type_LDADD = $(LDADD)
+add_carray_type_DEPENDENCIES = ../src/libgetdata.la
 add_clincom_SOURCES = add_clincom.c
 add_clincom_OBJECTS = add_clincom.$(OBJEXT)
 add_clincom_LDADD = $(LDADD)
 add_clincom_DEPENDENCIES = ../src/libgetdata.la
+add_clincom_nfields_SOURCES = add_clincom_nfields.c
+add_clincom_nfields_OBJECTS = add_clincom_nfields.$(OBJEXT)
+add_clincom_nfields_LDADD = $(LDADD)
+add_clincom_nfields_DEPENDENCIES = ../src/libgetdata.la
 add_code_SOURCES = add_code.c
 add_code_OBJECTS = add_code.$(OBJEXT)
 add_code_LDADD = $(LDADD)
@@ -823,10 +1085,18 @@ add_const_SOURCES = add_const.c
 add_const_OBJECTS = add_const.$(OBJEXT)
 add_const_LDADD = $(LDADD)
 add_const_DEPENDENCIES = ../src/libgetdata.la
+add_const_type_SOURCES = add_const_type.c
+add_const_type_OBJECTS = add_const_type.$(OBJEXT)
+add_const_type_LDADD = $(LDADD)
+add_const_type_DEPENDENCIES = ../src/libgetdata.la
 add_cpolynom_SOURCES = add_cpolynom.c
 add_cpolynom_OBJECTS = add_cpolynom.$(OBJEXT)
 add_cpolynom_LDADD = $(LDADD)
 add_cpolynom_DEPENDENCIES = ../src/libgetdata.la
+add_cpolynom_order_SOURCES = add_cpolynom_order.c
+add_cpolynom_order_OBJECTS = add_cpolynom_order.$(OBJEXT)
+add_cpolynom_order_LDADD = $(LDADD)
+add_cpolynom_order_DEPENDENCIES = ../src/libgetdata.la
 add_crecip_SOURCES = add_crecip.c
 add_crecip_OBJECTS = add_crecip.$(OBJEXT)
 add_crecip_LDADD = $(LDADD)
@@ -843,10 +1113,22 @@ add_divide_SOURCES = add_divide.c
 add_divide_OBJECTS = add_divide.$(OBJEXT)
 add_divide_LDADD = $(LDADD)
 add_divide_DEPENDENCIES = ../src/libgetdata.la
+add_divide_inaff1_SOURCES = add_divide_inaff1.c
+add_divide_inaff1_OBJECTS = add_divide_inaff1.$(OBJEXT)
+add_divide_inaff1_LDADD = $(LDADD)
+add_divide_inaff1_DEPENDENCIES = ../src/libgetdata.la
+add_divide_inaff2_SOURCES = add_divide_inaff2.c
+add_divide_inaff2_OBJECTS = add_divide_inaff2.$(OBJEXT)
+add_divide_inaff2_LDADD = $(LDADD)
+add_divide_inaff2_DEPENDENCIES = ../src/libgetdata.la
 add_divide_invalid_SOURCES = add_divide_invalid.c
 add_divide_invalid_OBJECTS = add_divide_invalid.$(OBJEXT)
 add_divide_invalid_LDADD = $(LDADD)
 add_divide_invalid_DEPENDENCIES = ../src/libgetdata.la
+add_dot10_SOURCES = add_dot10.c
+add_dot10_OBJECTS = add_dot10.$(OBJEXT)
+add_dot10_LDADD = $(LDADD)
+add_dot10_DEPENDENCIES = ../src/libgetdata.la
 add_dot5_SOURCES = add_dot5.c
 add_dot5_OBJECTS = add_dot5.$(OBJEXT)
 add_dot5_LDADD = $(LDADD)
@@ -863,6 +1145,10 @@ add_format_SOURCES = add_format.c
 add_format_OBJECTS = add_format.$(OBJEXT)
 add_format_LDADD = $(LDADD)
 add_format_DEPENDENCIES = ../src/libgetdata.la
+add_indir_SOURCES = add_indir.c
+add_indir_OBJECTS = add_indir.$(OBJEXT)
+add_indir_LDADD = $(LDADD)
+add_indir_DEPENDENCIES = ../src/libgetdata.la
 add_invalid_SOURCES = add_invalid.c
 add_invalid_OBJECTS = add_invalid.$(OBJEXT)
 add_invalid_LDADD = $(LDADD)
@@ -883,10 +1169,18 @@ add_lincom_nfields_SOURCES = add_lincom_nfields.c
 add_lincom_nfields_OBJECTS = add_lincom_nfields.$(OBJEXT)
 add_lincom_nfields_LDADD = $(LDADD)
 add_lincom_nfields_DEPENDENCIES = ../src/libgetdata.la
+add_lincom_nfields2_SOURCES = add_lincom_nfields2.c
+add_lincom_nfields2_OBJECTS = add_lincom_nfields2.$(OBJEXT)
+add_lincom_nfields2_LDADD = $(LDADD)
+add_lincom_nfields2_DEPENDENCIES = ../src/libgetdata.la
 add_linterp_SOURCES = add_linterp.c
 add_linterp_OBJECTS = add_linterp.$(OBJEXT)
 add_linterp_LDADD = $(LDADD)
 add_linterp_DEPENDENCIES = ../src/libgetdata.la
+add_linterp_inaff_SOURCES = add_linterp_inaff.c
+add_linterp_inaff_OBJECTS = add_linterp_inaff.$(OBJEXT)
+add_linterp_inaff_LDADD = $(LDADD)
+add_linterp_inaff_DEPENDENCIES = ../src/libgetdata.la
 add_linterp_invalid_SOURCES = add_linterp_invalid.c
 add_linterp_invalid_OBJECTS = add_linterp_invalid.$(OBJEXT)
 add_linterp_invalid_LDADD = $(LDADD)
@@ -899,10 +1193,22 @@ 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_meta_parent_SOURCES = add_meta_parent.c
+add_meta_parent_OBJECTS = add_meta_parent.$(OBJEXT)
+add_meta_parent_LDADD = $(LDADD)
+add_meta_parent_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_inaff_SOURCES = add_mplex_inaff.c
+add_mplex_inaff_OBJECTS = add_mplex_inaff.$(OBJEXT)
+add_mplex_inaff_LDADD = $(LDADD)
+add_mplex_inaff_DEPENDENCIES = ../src/libgetdata.la
+add_mplex_period_SOURCES = add_mplex_period.c
+add_mplex_period_OBJECTS = add_mplex_period.$(OBJEXT)
+add_mplex_period_LDADD = $(LDADD)
+add_mplex_period_DEPENDENCIES = ../src/libgetdata.la
 add_mplex_scalars_SOURCES = add_mplex_scalars.c
 add_mplex_scalars_OBJECTS = add_mplex_scalars.$(OBJEXT)
 add_mplex_scalars_LDADD = $(LDADD)
@@ -915,10 +1221,30 @@ add_multiply_invalid_SOURCES = add_multiply_invalid.c
 add_multiply_invalid_OBJECTS = add_multiply_invalid.$(OBJEXT)
 add_multiply_invalid_LDADD = $(LDADD)
 add_multiply_invalid_DEPENDENCIES = ../src/libgetdata.la
+add_name_len_SOURCES = add_name_len.c
+add_name_len_OBJECTS = add_name_len.$(OBJEXT)
+add_name_len_LDADD = $(LDADD)
+add_name_len_DEPENDENCIES = ../src/libgetdata.la
+add_ns_SOURCES = add_ns.c
+add_ns_OBJECTS = add_ns.$(OBJEXT)
+add_ns_LDADD = $(LDADD)
+add_ns_DEPENDENCIES = ../src/libgetdata.la
+add_ns_frag_SOURCES = add_ns_frag.c
+add_ns_frag_OBJECTS = add_ns_frag.$(OBJEXT)
+add_ns_frag_LDADD = $(LDADD)
+add_ns_frag_DEPENDENCIES = ../src/libgetdata.la
+add_ns_frag2_SOURCES = add_ns_frag2.c
+add_ns_frag2_OBJECTS = add_ns_frag2.$(OBJEXT)
+add_ns_frag2_LDADD = $(LDADD)
+add_ns_frag2_DEPENDENCIES = ../src/libgetdata.la
 add_phase_SOURCES = add_phase.c
 add_phase_OBJECTS = add_phase.$(OBJEXT)
 add_phase_LDADD = $(LDADD)
 add_phase_DEPENDENCIES = ../src/libgetdata.la
+add_phase_inaff_SOURCES = add_phase_inaff.c
+add_phase_inaff_OBJECTS = add_phase_inaff.$(OBJEXT)
+add_phase_inaff_LDADD = $(LDADD)
+add_phase_inaff_DEPENDENCIES = ../src/libgetdata.la
 add_phase_invalid_SOURCES = add_phase_invalid.c
 add_phase_invalid_OBJECTS = add_phase_invalid.$(OBJEXT)
 add_phase_invalid_LDADD = $(LDADD)
@@ -927,6 +1253,18 @@ add_polynom_SOURCES = add_polynom.c
 add_polynom_OBJECTS = add_polynom.$(OBJEXT)
 add_polynom_LDADD = $(LDADD)
 add_polynom_DEPENDENCIES = ../src/libgetdata.la
+add_polynom_inaff_SOURCES = add_polynom_inaff.c
+add_polynom_inaff_OBJECTS = add_polynom_inaff.$(OBJEXT)
+add_polynom_inaff_LDADD = $(LDADD)
+add_polynom_inaff_DEPENDENCIES = ../src/libgetdata.la
+add_polynom_order_SOURCES = add_polynom_order.c
+add_polynom_order_OBJECTS = add_polynom_order.$(OBJEXT)
+add_polynom_order_LDADD = $(LDADD)
+add_polynom_order_DEPENDENCIES = ../src/libgetdata.la
+add_polynom_order2_SOURCES = add_polynom_order2.c
+add_polynom_order2_OBJECTS = add_polynom_order2.$(OBJEXT)
+add_polynom_order2_LDADD = $(LDADD)
+add_polynom_order2_DEPENDENCIES = ../src/libgetdata.la
 add_polynom_scalar_SOURCES = add_polynom_scalar.c
 add_polynom_scalar_OBJECTS = add_polynom_scalar.$(OBJEXT)
 add_polynom_scalar_LDADD = $(LDADD)
@@ -947,6 +1285,10 @@ add_raw_invalid_SOURCES = add_raw_invalid.c
 add_raw_invalid_OBJECTS = add_raw_invalid.$(OBJEXT)
 add_raw_invalid_LDADD = $(LDADD)
 add_raw_invalid_DEPENDENCIES = ../src/libgetdata.la
+add_raw_prot_SOURCES = add_raw_prot.c
+add_raw_prot_OBJECTS = add_raw_prot.$(OBJEXT)
+add_raw_prot_LDADD = $(LDADD)
+add_raw_prot_DEPENDENCIES = ../src/libgetdata.la
 add_raw_spf_SOURCES = add_raw_spf.c
 add_raw_spf_OBJECTS = add_raw_spf.$(OBJEXT)
 add_raw_spf_LDADD = $(LDADD)
@@ -971,10 +1313,26 @@ add_recip_SOURCES = add_recip.c
 add_recip_OBJECTS = add_recip.$(OBJEXT)
 add_recip_LDADD = $(LDADD)
 add_recip_DEPENDENCIES = ../src/libgetdata.la
+add_recip_inaff_SOURCES = add_recip_inaff.c
+add_recip_inaff_OBJECTS = add_recip_inaff.$(OBJEXT)
+add_recip_inaff_LDADD = $(LDADD)
+add_recip_inaff_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_sarray_SOURCES = add_sarray.c
+add_sarray_OBJECTS = add_sarray.$(OBJEXT)
+add_sarray_LDADD = $(LDADD)
+add_sarray_DEPENDENCIES = ../src/libgetdata.la
+add_sarray_dup_SOURCES = add_sarray_dup.c
+add_sarray_dup_OBJECTS = add_sarray_dup.$(OBJEXT)
+add_sarray_dup_LDADD = $(LDADD)
+add_sarray_dup_DEPENDENCIES = ../src/libgetdata.la
+add_sarray_nil_SOURCES = add_sarray_nil.c
+add_sarray_nil_OBJECTS = add_sarray_nil.$(OBJEXT)
+add_sarray_nil_LDADD = $(LDADD)
+add_sarray_nil_DEPENDENCIES = ../src/libgetdata.la
 add_sbit_SOURCES = add_sbit.c
 add_sbit_OBJECTS = add_sbit.$(OBJEXT)
 add_sbit_LDADD = $(LDADD)
@@ -991,6 +1349,10 @@ 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_sindir_SOURCES = add_sindir.c
+add_sindir_OBJECTS = add_sindir.$(OBJEXT)
+add_sindir_LDADD = $(LDADD)
+add_sindir_DEPENDENCIES = ../src/libgetdata.la
 add_sort_SOURCES = add_sort.c
 add_sort_OBJECTS = add_sort.$(OBJEXT)
 add_sort_LDADD = $(LDADD)
@@ -999,10 +1361,18 @@ add_spec_SOURCES = add_spec.c
 add_spec_OBJECTS = add_spec.$(OBJEXT)
 add_spec_LDADD = $(LDADD)
 add_spec_DEPENDENCIES = ../src/libgetdata.la
+add_spec_affix_SOURCES = add_spec_affix.c
+add_spec_affix_OBJECTS = add_spec_affix.$(OBJEXT)
+add_spec_affix_LDADD = $(LDADD)
+add_spec_affix_DEPENDENCIES = ../src/libgetdata.la
 add_spec_directive_SOURCES = add_spec_directive.c
 add_spec_directive_OBJECTS = add_spec_directive.$(OBJEXT)
 add_spec_directive_LDADD = $(LDADD)
 add_spec_directive_DEPENDENCIES = ../src/libgetdata.la
+add_spec_index_SOURCES = add_spec_index.c
+add_spec_index_OBJECTS = add_spec_index.$(OBJEXT)
+add_spec_index_LDADD = $(LDADD)
+add_spec_index_DEPENDENCIES = ../src/libgetdata.la
 add_spec_invalid_SOURCES = add_spec_invalid.c
 add_spec_invalid_OBJECTS = add_spec_invalid.$(OBJEXT)
 add_spec_invalid_LDADD = $(LDADD)
@@ -1011,6 +1381,26 @@ 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_nil_SOURCES = add_spec_nil.c
+add_spec_nil_OBJECTS = add_spec_nil.$(OBJEXT)
+add_spec_nil_LDADD = $(LDADD)
+add_spec_nil_DEPENDENCIES = ../src/libgetdata.la
+add_spec_prot_SOURCES = add_spec_prot.c
+add_spec_prot_OBJECTS = add_spec_prot.$(OBJEXT)
+add_spec_prot_LDADD = $(LDADD)
+add_spec_prot_DEPENDENCIES = ../src/libgetdata.la
+add_spec_raw_autoenc_SOURCES = add_spec_raw_autoenc.c
+add_spec_raw_autoenc_OBJECTS = add_spec_raw_autoenc.$(OBJEXT)
+add_spec_raw_autoenc_LDADD = $(LDADD)
+add_spec_raw_autoenc_DEPENDENCIES = ../src/libgetdata.la
+add_spec_raw_prot_SOURCES = add_spec_raw_prot.c
+add_spec_raw_prot_OBJECTS = add_spec_raw_prot.$(OBJEXT)
+add_spec_raw_prot_LDADD = $(LDADD)
+add_spec_raw_prot_DEPENDENCIES = ../src/libgetdata.la
+add_spec_raw_unkenc_SOURCES = add_spec_raw_unkenc.c
+add_spec_raw_unkenc_OBJECTS = add_spec_raw_unkenc.$(OBJEXT)
+add_spec_raw_unkenc_LDADD = $(LDADD)
+add_spec_raw_unkenc_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)
@@ -1023,6 +1413,14 @@ 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_string_dup_SOURCES = add_string_dup.c
+add_string_dup_OBJECTS = add_string_dup.$(OBJEXT)
+add_string_dup_LDADD = $(LDADD)
+add_string_dup_DEPENDENCIES = ../src/libgetdata.la
+add_string_entry_SOURCES = add_string_entry.c
+add_string_entry_OBJECTS = add_string_entry.$(OBJEXT)
+add_string_entry_LDADD = $(LDADD)
+add_string_entry_DEPENDENCIES = ../src/libgetdata.la
 add_type_SOURCES = add_type.c
 add_type_OBJECTS = add_type.$(OBJEXT)
 add_type_LDADD = $(LDADD)
@@ -1031,6 +1429,10 @@ add_window_SOURCES = add_window.c
 add_window_OBJECTS = add_window.$(OBJEXT)
 add_window_LDADD = $(LDADD)
 add_window_DEPENDENCIES = ../src/libgetdata.la
+add_window_inaff_SOURCES = add_window_inaff.c
+add_window_inaff_OBJECTS = add_window_inaff.$(OBJEXT)
+add_window_inaff_LDADD = $(LDADD)
+add_window_inaff_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)
@@ -1071,14 +1473,42 @@ 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
+alloc_affix_SOURCES = alloc_affix.c
+alloc_affix_OBJECTS = alloc_affix.$(OBJEXT)
+alloc_affix_LDADD = $(LDADD)
+alloc_affix_DEPENDENCIES = ../src/libgetdata.la
+alloc_callback_SOURCES = alloc_callback.c
+alloc_callback_OBJECTS = alloc_callback.$(OBJEXT)
+alloc_callback_LDADD = $(LDADD)
+alloc_callback_DEPENDENCIES = ../src/libgetdata.la
+alloc_clear_SOURCES = alloc_clear.c
+alloc_clear_OBJECTS = alloc_clear.$(OBJEXT)
+alloc_clear_LDADD = $(LDADD)
+alloc_clear_DEPENDENCIES = ../src/libgetdata.la
+alloc_entry_SOURCES = alloc_entry.c
+alloc_entry_OBJECTS = alloc_entry.$(OBJEXT)
+alloc_entry_LDADD = $(LDADD)
+alloc_entry_DEPENDENCIES = ../src/libgetdata.la
+alloc_tok_SOURCES = alloc_tok.c
+alloc_tok_OBJECTS = alloc_tok.$(OBJEXT)
+alloc_tok_LDADD = $(LDADD)
+alloc_tok_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)
 alter_bit_bitnum_DEPENDENCIES = ../src/libgetdata.la
+alter_bit_in_SOURCES = alter_bit_in.c
+alter_bit_in_OBJECTS = alter_bit_in.$(OBJEXT)
+alter_bit_in_LDADD = $(LDADD)
+alter_bit_in_DEPENDENCIES = ../src/libgetdata.la
 alter_bit_numbits_SOURCES = alter_bit_numbits.c
 alter_bit_numbits_OBJECTS = alter_bit_numbits.$(OBJEXT)
 alter_bit_numbits_LDADD = $(LDADD)
 alter_bit_numbits_DEPENDENCIES = ../src/libgetdata.la
+alter_bit_scalar_SOURCES = alter_bit_scalar.c
+alter_bit_scalar_OBJECTS = alter_bit_scalar.$(OBJEXT)
+alter_bit_scalar_LDADD = $(LDADD)
+alter_bit_scalar_DEPENDENCIES = ../src/libgetdata.la
 alter_carray_len_SOURCES = alter_carray_len.c
 alter_carray_len_OBJECTS = alter_carray_len.$(OBJEXT)
 alter_carray_len_LDADD = $(LDADD)
@@ -1091,6 +1521,27 @@ alter_clincom_SOURCES = alter_clincom.c
 alter_clincom_OBJECTS = alter_clincom.$(OBJEXT)
 alter_clincom_LDADD = $(LDADD)
 alter_clincom_DEPENDENCIES = ../src/libgetdata.la
+alter_clincom_32_SOURCES = alter_clincom_32.c
+alter_clincom_32_OBJECTS = alter_clincom_32.$(OBJEXT)
+alter_clincom_32_LDADD = $(LDADD)
+alter_clincom_32_DEPENDENCIES = ../src/libgetdata.la
+alter_clincom_nfields_SOURCES = alter_clincom_nfields.c
+alter_clincom_nfields_OBJECTS = alter_clincom_nfields.$(OBJEXT)
+alter_clincom_nfields_LDADD = $(LDADD)
+alter_clincom_nfields_DEPENDENCIES = ../src/libgetdata.la
+alter_clincom_nfields_code_SOURCES = alter_clincom_nfields_code.c
+alter_clincom_nfields_code_OBJECTS =  \
+	alter_clincom_nfields_code.$(OBJEXT)
+alter_clincom_nfields_code_LDADD = $(LDADD)
+alter_clincom_nfields_code_DEPENDENCIES = ../src/libgetdata.la
+alter_clincom_null_SOURCES = alter_clincom_null.c
+alter_clincom_null_OBJECTS = alter_clincom_null.$(OBJEXT)
+alter_clincom_null_LDADD = $(LDADD)
+alter_clincom_null_DEPENDENCIES = ../src/libgetdata.la
+alter_code_SOURCES = alter_code.c
+alter_code_OBJECTS = alter_code.$(OBJEXT)
+alter_code_LDADD = $(LDADD)
+alter_code_DEPENDENCIES = ../src/libgetdata.la
 alter_const_SOURCES = alter_const.c
 alter_const_OBJECTS = alter_const.$(OBJEXT)
 alter_const_LDADD = $(LDADD)
@@ -1107,6 +1558,10 @@ alter_const_r2r_SOURCES = alter_const_r2r.c
 alter_const_r2r_OBJECTS = alter_const_r2r.$(OBJEXT)
 alter_const_r2r_LDADD = $(LDADD)
 alter_const_r2r_DEPENDENCIES = ../src/libgetdata.la
+alter_const_type_SOURCES = alter_const_type.c
+alter_const_type_OBJECTS = alter_const_type.$(OBJEXT)
+alter_const_type_LDADD = $(LDADD)
+alter_const_type_DEPENDENCIES = ../src/libgetdata.la
 alter_cpolynom_SOURCES = alter_cpolynom.c
 alter_cpolynom_OBJECTS = alter_cpolynom.$(OBJEXT)
 alter_cpolynom_LDADD = $(LDADD)
@@ -1115,6 +1570,14 @@ alter_cpolynom_null_SOURCES = alter_cpolynom_null.c
 alter_cpolynom_null_OBJECTS = alter_cpolynom_null.$(OBJEXT)
 alter_cpolynom_null_LDADD = $(LDADD)
 alter_cpolynom_null_DEPENDENCIES = ../src/libgetdata.la
+alter_cpolynom_ord_SOURCES = alter_cpolynom_ord.c
+alter_cpolynom_ord_OBJECTS = alter_cpolynom_ord.$(OBJEXT)
+alter_cpolynom_ord_LDADD = $(LDADD)
+alter_cpolynom_ord_DEPENDENCIES = ../src/libgetdata.la
+alter_cpolynom_ord_code_SOURCES = alter_cpolynom_ord_code.c
+alter_cpolynom_ord_code_OBJECTS = alter_cpolynom_ord_code.$(OBJEXT)
+alter_cpolynom_ord_code_LDADD = $(LDADD)
+alter_cpolynom_ord_code_DEPENDENCIES = ../src/libgetdata.la
 alter_crecip_SOURCES = alter_crecip.c
 alter_crecip_OBJECTS = alter_crecip.$(OBJEXT)
 alter_crecip_LDADD = $(LDADD)
@@ -1135,6 +1598,10 @@ alter_divide_SOURCES = alter_divide.c
 alter_divide_OBJECTS = alter_divide.$(OBJEXT)
 alter_divide_LDADD = $(LDADD)
 alter_divide_DEPENDENCIES = ../src/libgetdata.la
+alter_divide_in_SOURCES = alter_divide_in.c
+alter_divide_in_OBJECTS = alter_divide_in.$(OBJEXT)
+alter_divide_in_LDADD = $(LDADD)
+alter_divide_in_DEPENDENCIES = ../src/libgetdata.la
 alter_entry_SOURCES = alter_entry.c
 alter_entry_OBJECTS = alter_entry.$(OBJEXT)
 alter_entry_LDADD = $(LDADD)
@@ -1143,6 +1610,10 @@ 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_entype_SOURCES = alter_entry_entype.c
+alter_entry_entype_OBJECTS = alter_entry_entype.$(OBJEXT)
+alter_entry_entype_LDADD = $(LDADD)
+alter_entry_entype_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)
@@ -1151,6 +1622,11 @@ alter_entry_lincom_SOURCES = alter_entry_lincom.c
 alter_entry_lincom_OBJECTS = alter_entry_lincom.$(OBJEXT)
 alter_entry_lincom_LDADD = $(LDADD)
 alter_entry_lincom_DEPENDENCIES = ../src/libgetdata.la
+alter_entry_lincom_nfields_SOURCES = alter_entry_lincom_nfields.c
+alter_entry_lincom_nfields_OBJECTS =  \
+	alter_entry_lincom_nfields.$(OBJEXT)
+alter_entry_lincom_nfields_LDADD = $(LDADD)
+alter_entry_lincom_nfields_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)
@@ -1160,6 +1636,10 @@ alter_entry_recode_recalc_OBJECTS =  \
 	alter_entry_recode_recalc.$(OBJEXT)
 alter_entry_recode_recalc_LDADD = $(LDADD)
 alter_entry_recode_recalc_DEPENDENCIES = ../src/libgetdata.la
+alter_entry_sarray_SOURCES = alter_entry_sarray.c
+alter_entry_sarray_OBJECTS = alter_entry_sarray.$(OBJEXT)
+alter_entry_sarray_LDADD = $(LDADD)
+alter_entry_sarray_DEPENDENCIES = ../src/libgetdata.la
 alter_entry_scalar1_SOURCES = alter_entry_scalar1.c
 alter_entry_scalar1_OBJECTS = alter_entry_scalar1.$(OBJEXT)
 alter_entry_scalar1_LDADD = $(LDADD)
@@ -1200,6 +1680,10 @@ alter_index_SOURCES = alter_index.c
 alter_index_OBJECTS = alter_index.$(OBJEXT)
 alter_index_LDADD = $(LDADD)
 alter_index_DEPENDENCIES = ../src/libgetdata.la
+alter_indir_SOURCES = alter_indir.c
+alter_indir_OBJECTS = alter_indir.$(OBJEXT)
+alter_indir_LDADD = $(LDADD)
+alter_indir_DEPENDENCIES = ../src/libgetdata.la
 alter_lincom_23_SOURCES = alter_lincom_23.c
 alter_lincom_23_OBJECTS = alter_lincom_23.$(OBJEXT)
 alter_lincom_23_LDADD = $(LDADD)
@@ -1216,10 +1700,23 @@ alter_lincom_input_SOURCES = alter_lincom_input.c
 alter_lincom_input_OBJECTS = alter_lincom_input.$(OBJEXT)
 alter_lincom_input_LDADD = $(LDADD)
 alter_lincom_input_DEPENDENCIES = ../src/libgetdata.la
+alter_lincom_nfields_SOURCES = alter_lincom_nfields.c
+alter_lincom_nfields_OBJECTS = alter_lincom_nfields.$(OBJEXT)
+alter_lincom_nfields_LDADD = $(LDADD)
+alter_lincom_nfields_DEPENDENCIES = ../src/libgetdata.la
+alter_lincom_nfields_code_SOURCES = alter_lincom_nfields_code.c
+alter_lincom_nfields_code_OBJECTS =  \
+	alter_lincom_nfields_code.$(OBJEXT)
+alter_lincom_nfields_code_LDADD = $(LDADD)
+alter_lincom_nfields_code_DEPENDENCIES = ../src/libgetdata.la
 alter_lincom_offset_SOURCES = alter_lincom_offset.c
 alter_lincom_offset_OBJECTS = alter_lincom_offset.$(OBJEXT)
 alter_lincom_offset_LDADD = $(LDADD)
 alter_lincom_offset_DEPENDENCIES = ../src/libgetdata.la
+alter_lincom_scalar_SOURCES = alter_lincom_scalar.c
+alter_lincom_scalar_OBJECTS = alter_lincom_scalar.$(OBJEXT)
+alter_lincom_scalar_LDADD = $(LDADD)
+alter_lincom_scalar_DEPENDENCIES = ../src/libgetdata.la
 alter_lincom_slope_SOURCES = alter_lincom_slope.c
 alter_lincom_slope_OBJECTS = alter_lincom_slope.$(OBJEXT)
 alter_lincom_slope_LDADD = $(LDADD)
@@ -1228,6 +1725,10 @@ alter_linterp_SOURCES = alter_linterp.c
 alter_linterp_OBJECTS = alter_linterp.$(OBJEXT)
 alter_linterp_LDADD = $(LDADD)
 alter_linterp_DEPENDENCIES = ../src/libgetdata.la
+alter_linterp_in_SOURCES = alter_linterp_in.c
+alter_linterp_in_OBJECTS = alter_linterp_in.$(OBJEXT)
+alter_linterp_in_LDADD = $(LDADD)
+alter_linterp_in_DEPENDENCIES = ../src/libgetdata.la
 alter_linterp_move_SOURCES = alter_linterp_move.c
 alter_linterp_move_OBJECTS = alter_linterp_move.$(OBJEXT)
 alter_linterp_move_LDADD = $(LDADD)
@@ -1236,6 +1737,14 @@ alter_mplex_SOURCES = alter_mplex.c
 alter_mplex_OBJECTS = alter_mplex.$(OBJEXT)
 alter_mplex_LDADD = $(LDADD)
 alter_mplex_DEPENDENCIES = ../src/libgetdata.la
+alter_mplex_in_SOURCES = alter_mplex_in.c
+alter_mplex_in_OBJECTS = alter_mplex_in.$(OBJEXT)
+alter_mplex_in_LDADD = $(LDADD)
+alter_mplex_in_DEPENDENCIES = ../src/libgetdata.la
+alter_mplex_scalar_SOURCES = alter_mplex_scalar.c
+alter_mplex_scalar_OBJECTS = alter_mplex_scalar.$(OBJEXT)
+alter_mplex_scalar_LDADD = $(LDADD)
+alter_mplex_scalar_DEPENDENCIES = ../src/libgetdata.la
 alter_mspec_SOURCES = alter_mspec.c
 alter_mspec_OBJECTS = alter_mspec.$(OBJEXT)
 alter_mspec_LDADD = $(LDADD)
@@ -1252,6 +1761,14 @@ alter_phase_SOURCES = alter_phase.c
 alter_phase_OBJECTS = alter_phase.$(OBJEXT)
 alter_phase_LDADD = $(LDADD)
 alter_phase_DEPENDENCIES = ../src/libgetdata.la
+alter_phase_in_SOURCES = alter_phase_in.c
+alter_phase_in_OBJECTS = alter_phase_in.$(OBJEXT)
+alter_phase_in_LDADD = $(LDADD)
+alter_phase_in_DEPENDENCIES = ../src/libgetdata.la
+alter_phase_scalar_SOURCES = alter_phase_scalar.c
+alter_phase_scalar_OBJECTS = alter_phase_scalar.$(OBJEXT)
+alter_phase_scalar_LDADD = $(LDADD)
+alter_phase_scalar_DEPENDENCIES = ../src/libgetdata.la
 alter_polynom_coeff_SOURCES = alter_polynom_coeff.c
 alter_polynom_coeff_OBJECTS = alter_polynom_coeff.$(OBJEXT)
 alter_polynom_coeff_LDADD = $(LDADD)
@@ -1264,26 +1781,74 @@ alter_polynom_ord_SOURCES = alter_polynom_ord.c
 alter_polynom_ord_OBJECTS = alter_polynom_ord.$(OBJEXT)
 alter_polynom_ord_LDADD = $(LDADD)
 alter_polynom_ord_DEPENDENCIES = ../src/libgetdata.la
+alter_polynom_ord2_SOURCES = alter_polynom_ord2.c
+alter_polynom_ord2_OBJECTS = alter_polynom_ord2.$(OBJEXT)
+alter_polynom_ord2_LDADD = $(LDADD)
+alter_polynom_ord2_DEPENDENCIES = ../src/libgetdata.la
+alter_polynom_ord_code_SOURCES = alter_polynom_ord_code.c
+alter_polynom_ord_code_OBJECTS = alter_polynom_ord_code.$(OBJEXT)
+alter_polynom_ord_code_LDADD = $(LDADD)
+alter_polynom_ord_code_DEPENDENCIES = ../src/libgetdata.la
+alter_polynom_scalar_SOURCES = alter_polynom_scalar.c
+alter_polynom_scalar_OBJECTS = alter_polynom_scalar.$(OBJEXT)
+alter_polynom_scalar_LDADD = $(LDADD)
+alter_polynom_scalar_DEPENDENCIES = ../src/libgetdata.la
+alter_prot_SOURCES = alter_prot.c
+alter_prot_OBJECTS = alter_prot.$(OBJEXT)
+alter_prot_LDADD = $(LDADD)
+alter_prot_DEPENDENCIES = ../src/libgetdata.la
+alter_raw_prot_SOURCES = alter_raw_prot.c
+alter_raw_prot_OBJECTS = alter_raw_prot.$(OBJEXT)
+alter_raw_prot_LDADD = $(LDADD)
+alter_raw_prot_DEPENDENCIES = ../src/libgetdata.la
 alter_raw_spf_SOURCES = alter_raw_spf.c
 alter_raw_spf_OBJECTS = alter_raw_spf.$(OBJEXT)
 alter_raw_spf_LDADD = $(LDADD)
 alter_raw_spf_DEPENDENCIES = ../src/libgetdata.la
+alter_raw_spf_type_SOURCES = alter_raw_spf_type.c
+alter_raw_spf_type_OBJECTS = alter_raw_spf_type.$(OBJEXT)
+alter_raw_spf_type_LDADD = $(LDADD)
+alter_raw_spf_type_DEPENDENCIES = ../src/libgetdata.la
 alter_raw_type_SOURCES = alter_raw_type.c
 alter_raw_type_OBJECTS = alter_raw_type.$(OBJEXT)
 alter_raw_type_LDADD = $(LDADD)
 alter_raw_type_DEPENDENCIES = ../src/libgetdata.la
+alter_rdonly_SOURCES = alter_rdonly.c
+alter_rdonly_OBJECTS = alter_rdonly.$(OBJEXT)
+alter_rdonly_LDADD = $(LDADD)
+alter_rdonly_DEPENDENCIES = ../src/libgetdata.la
 alter_recip_SOURCES = alter_recip.c
 alter_recip_OBJECTS = alter_recip.$(OBJEXT)
 alter_recip_LDADD = $(LDADD)
 alter_recip_DEPENDENCIES = ../src/libgetdata.la
+alter_recip_scalar_SOURCES = alter_recip_scalar.c
+alter_recip_scalar_OBJECTS = alter_recip_scalar.$(OBJEXT)
+alter_recip_scalar_LDADD = $(LDADD)
+alter_recip_scalar_DEPENDENCIES = ../src/libgetdata.la
 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_sarray_SOURCES = alter_sarray.c
+alter_sarray_OBJECTS = alter_sarray.$(OBJEXT)
+alter_sarray_LDADD = $(LDADD)
+alter_sarray_DEPENDENCIES = ../src/libgetdata.la
+alter_sarray_nop_SOURCES = alter_sarray_nop.c
+alter_sarray_nop_OBJECTS = alter_sarray_nop.$(OBJEXT)
+alter_sarray_nop_LDADD = $(LDADD)
+alter_sarray_nop_DEPENDENCIES = ../src/libgetdata.la
+alter_sbit_SOURCES = alter_sbit.c
+alter_sbit_OBJECTS = alter_sbit.$(OBJEXT)
+alter_sbit_LDADD = $(LDADD)
+alter_sbit_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_sindir_SOURCES = alter_sindir.c
+alter_sindir_OBJECTS = alter_sindir.$(OBJEXT)
+alter_sindir_LDADD = $(LDADD)
+alter_sindir_DEPENDENCIES = ../src/libgetdata.la
 alter_spec_SOURCES = alter_spec.c
 alter_spec_OBJECTS = alter_spec.$(OBJEXT)
 alter_spec_LDADD = $(LDADD)
@@ -1292,22 +1857,70 @@ 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_code_SOURCES = alter_spec_code.c
+alter_spec_code_OBJECTS = alter_spec_code.$(OBJEXT)
+alter_spec_code_LDADD = $(LDADD)
+alter_spec_code_DEPENDENCIES = ../src/libgetdata.la
+alter_spec_format_SOURCES = alter_spec_format.c
+alter_spec_format_OBJECTS = alter_spec_format.$(OBJEXT)
+alter_spec_format_LDADD = $(LDADD)
+alter_spec_format_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_spec_nil_SOURCES = alter_spec_nil.c
+alter_spec_nil_OBJECTS = alter_spec_nil.$(OBJEXT)
+alter_spec_nil_LDADD = $(LDADD)
+alter_spec_nil_DEPENDENCIES = ../src/libgetdata.la
 alter_spec_polynom_SOURCES = alter_spec_polynom.c
 alter_spec_polynom_OBJECTS = alter_spec_polynom.$(OBJEXT)
 alter_spec_polynom_LDADD = $(LDADD)
 alter_spec_polynom_DEPENDENCIES = ../src/libgetdata.la
+alter_spec_prot_SOURCES = alter_spec_prot.c
+alter_spec_prot_OBJECTS = alter_spec_prot.$(OBJEXT)
+alter_spec_prot_LDADD = $(LDADD)
+alter_spec_prot_DEPENDENCIES = ../src/libgetdata.la
+alter_spec_rdonly_SOURCES = alter_spec_rdonly.c
+alter_spec_rdonly_OBJECTS = alter_spec_rdonly.$(OBJEXT)
+alter_spec_rdonly_LDADD = $(LDADD)
+alter_spec_rdonly_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
+alter_window_in_SOURCES = alter_window_in.c
+alter_window_in_OBJECTS = alter_window_in.$(OBJEXT)
+alter_window_in_LDADD = $(LDADD)
+alter_window_in_DEPENDENCIES = ../src/libgetdata.la
+alter_window_op_SOURCES = alter_window_op.c
+alter_window_op_OBJECTS = alter_window_op.$(OBJEXT)
+alter_window_op_LDADD = $(LDADD)
+alter_window_op_DEPENDENCIES = ../src/libgetdata.la
+alter_window_scalar_SOURCES = alter_window_scalar.c
+alter_window_scalar_OBJECTS = alter_window_scalar.$(OBJEXT)
+alter_window_scalar_LDADD = $(LDADD)
+alter_window_scalar_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_complex128_SOURCES = ascii_complex128.c
+ascii_complex128_OBJECTS = ascii_complex128.$(OBJEXT)
+ascii_complex128_LDADD = $(LDADD)
+ascii_complex128_DEPENDENCIES = ../src/libgetdata.la
+ascii_complex64_SOURCES = ascii_complex64.c
+ascii_complex64_OBJECTS = ascii_complex64.$(OBJEXT)
+ascii_complex64_LDADD = $(LDADD)
+ascii_complex64_DEPENDENCIES = ../src/libgetdata.la
+ascii_float32_SOURCES = ascii_float32.c
+ascii_float32_OBJECTS = ascii_float32.$(OBJEXT)
+ascii_float32_LDADD = $(LDADD)
+ascii_float32_DEPENDENCIES = ../src/libgetdata.la
+ascii_float64_SOURCES = ascii_float64.c
+ascii_float64_OBJECTS = ascii_float64.$(OBJEXT)
+ascii_float64_LDADD = $(LDADD)
+ascii_float64_DEPENDENCIES = ../src/libgetdata.la
 ascii_get_SOURCES = ascii_get.c
 ascii_get_OBJECTS = ascii_get.$(OBJEXT)
 ascii_get_LDADD = $(LDADD)
@@ -1328,6 +1941,22 @@ ascii_get_sub_SOURCES = ascii_get_sub.c
 ascii_get_sub_OBJECTS = ascii_get_sub.$(OBJEXT)
 ascii_get_sub_LDADD = $(LDADD)
 ascii_get_sub_DEPENDENCIES = ../src/libgetdata.la
+ascii_int16_SOURCES = ascii_int16.c
+ascii_int16_OBJECTS = ascii_int16.$(OBJEXT)
+ascii_int16_LDADD = $(LDADD)
+ascii_int16_DEPENDENCIES = ../src/libgetdata.la
+ascii_int32_SOURCES = ascii_int32.c
+ascii_int32_OBJECTS = ascii_int32.$(OBJEXT)
+ascii_int32_LDADD = $(LDADD)
+ascii_int32_DEPENDENCIES = ../src/libgetdata.la
+ascii_int64_SOURCES = ascii_int64.c
+ascii_int64_OBJECTS = ascii_int64.$(OBJEXT)
+ascii_int64_LDADD = $(LDADD)
+ascii_int64_DEPENDENCIES = ../src/libgetdata.la
+ascii_int8_SOURCES = ascii_int8.c
+ascii_int8_OBJECTS = ascii_int8.$(OBJEXT)
+ascii_int8_LDADD = $(LDADD)
+ascii_int8_DEPENDENCIES = ../src/libgetdata.la
 ascii_nframes_SOURCES = ascii_nframes.c
 ascii_nframes_OBJECTS = ascii_nframes.$(OBJEXT)
 ascii_nframes_LDADD = $(LDADD)
@@ -1352,6 +1981,22 @@ ascii_sync_SOURCES = ascii_sync.c
 ascii_sync_OBJECTS = ascii_sync.$(OBJEXT)
 ascii_sync_LDADD = $(LDADD)
 ascii_sync_DEPENDENCIES = ../src/libgetdata.la
+ascii_uint16_SOURCES = ascii_uint16.c
+ascii_uint16_OBJECTS = ascii_uint16.$(OBJEXT)
+ascii_uint16_LDADD = $(LDADD)
+ascii_uint16_DEPENDENCIES = ../src/libgetdata.la
+ascii_uint32_SOURCES = ascii_uint32.c
+ascii_uint32_OBJECTS = ascii_uint32.$(OBJEXT)
+ascii_uint32_LDADD = $(LDADD)
+ascii_uint32_DEPENDENCIES = ../src/libgetdata.la
+ascii_uint64_SOURCES = ascii_uint64.c
+ascii_uint64_OBJECTS = ascii_uint64.$(OBJEXT)
+ascii_uint64_LDADD = $(LDADD)
+ascii_uint64_DEPENDENCIES = ../src/libgetdata.la
+ascii_uint8_SOURCES = ascii_uint8.c
+ascii_uint8_OBJECTS = ascii_uint8.$(OBJEXT)
+ascii_uint8_LDADD = $(LDADD)
+ascii_uint8_DEPENDENCIES = ../src/libgetdata.la
 bof_SOURCES = bof.c
 bof_OBJECTS = bof.$(OBJEXT)
 bof_LDADD = $(LDADD)
@@ -1360,6 +2005,18 @@ bof_bit_SOURCES = bof_bit.c
 bof_bit_OBJECTS = bof_bit.$(OBJEXT)
 bof_bit_LDADD = $(LDADD)
 bof_bit_DEPENDENCIES = ../src/libgetdata.la
+bof_bit_code_SOURCES = bof_bit_code.c
+bof_bit_code_OBJECTS = bof_bit_code.$(OBJEXT)
+bof_bit_code_LDADD = $(LDADD)
+bof_bit_code_DEPENDENCIES = ../src/libgetdata.la
+bof_code_SOURCES = bof_code.c
+bof_code_OBJECTS = bof_code.$(OBJEXT)
+bof_code_LDADD = $(LDADD)
+bof_code_DEPENDENCIES = ../src/libgetdata.la
+bof_const_SOURCES = bof_const.c
+bof_const_OBJECTS = bof_const.$(OBJEXT)
+bof_const_LDADD = $(LDADD)
+bof_const_DEPENDENCIES = ../src/libgetdata.la
 bof_index_SOURCES = bof_index.c
 bof_index_OBJECTS = bof_index.$(OBJEXT)
 bof_index_LDADD = $(LDADD)
@@ -1368,22 +2025,62 @@ bof_lincom_SOURCES = bof_lincom.c
 bof_lincom_OBJECTS = bof_lincom.$(OBJEXT)
 bof_lincom_LDADD = $(LDADD)
 bof_lincom_DEPENDENCIES = ../src/libgetdata.la
+bof_lincom_code_SOURCES = bof_lincom_code.c
+bof_lincom_code_OBJECTS = bof_lincom_code.$(OBJEXT)
+bof_lincom_code_LDADD = $(LDADD)
+bof_lincom_code_DEPENDENCIES = ../src/libgetdata.la
 bof_phase_SOURCES = bof_phase.c
 bof_phase_OBJECTS = bof_phase.$(OBJEXT)
 bof_phase_LDADD = $(LDADD)
 bof_phase_DEPENDENCIES = ../src/libgetdata.la
+bof_phase_code_SOURCES = bof_phase_code.c
+bof_phase_code_OBJECTS = bof_phase_code.$(OBJEXT)
+bof_phase_code_LDADD = $(LDADD)
+bof_phase_code_DEPENDENCIES = ../src/libgetdata.la
 bof_phase_neg_SOURCES = bof_phase_neg.c
 bof_phase_neg_OBJECTS = bof_phase_neg.$(OBJEXT)
 bof_phase_neg_LDADD = $(LDADD)
 bof_phase_neg_DEPENDENCIES = ../src/libgetdata.la
+bof_recurse_SOURCES = bof_recurse.c
+bof_recurse_OBJECTS = bof_recurse.$(OBJEXT)
+bof_recurse_LDADD = $(LDADD)
+bof_recurse_DEPENDENCIES = ../src/libgetdata.la
 bzip_add_SOURCES = bzip_add.c
 bzip_add_OBJECTS = bzip_add.$(OBJEXT)
 bzip_add_LDADD = $(LDADD)
 bzip_add_DEPENDENCIES = ../src/libgetdata.la
+bzip_complex128_SOURCES = bzip_complex128.c
+bzip_complex128_OBJECTS = bzip_complex128.$(OBJEXT)
+bzip_complex128_LDADD = $(LDADD)
+bzip_complex128_DEPENDENCIES = ../src/libgetdata.la
+bzip_complex64_SOURCES = bzip_complex64.c
+bzip_complex64_OBJECTS = bzip_complex64.$(OBJEXT)
+bzip_complex64_LDADD = $(LDADD)
+bzip_complex64_DEPENDENCIES = ../src/libgetdata.la
+bzip_del_SOURCES = bzip_del.c
+bzip_del_OBJECTS = bzip_del.$(OBJEXT)
+bzip_del_LDADD = $(LDADD)
+bzip_del_DEPENDENCIES = ../src/libgetdata.la
+bzip_enoent_SOURCES = bzip_enoent.c
+bzip_enoent_OBJECTS = bzip_enoent.$(OBJEXT)
+bzip_enoent_LDADD = $(LDADD)
+bzip_enoent_DEPENDENCIES = ../src/libgetdata.la
+bzip_float32_SOURCES = bzip_float32.c
+bzip_float32_OBJECTS = bzip_float32.$(OBJEXT)
+bzip_float32_LDADD = $(LDADD)
+bzip_float32_DEPENDENCIES = ../src/libgetdata.la
+bzip_float64_SOURCES = bzip_float64.c
+bzip_float64_OBJECTS = bzip_float64.$(OBJEXT)
+bzip_float64_LDADD = $(LDADD)
+bzip_float64_DEPENDENCIES = ../src/libgetdata.la
 bzip_get_SOURCES = bzip_get.c
 bzip_get_OBJECTS = bzip_get.$(OBJEXT)
 bzip_get_LDADD = $(LDADD)
 bzip_get_DEPENDENCIES = ../src/libgetdata.la
+bzip_get_cont_SOURCES = bzip_get_cont.c
+bzip_get_cont_OBJECTS = bzip_get_cont.$(OBJEXT)
+bzip_get_cont_LDADD = $(LDADD)
+bzip_get_cont_DEPENDENCIES = ../src/libgetdata.la
 bzip_get_far_SOURCES = bzip_get_far.c
 bzip_get_far_OBJECTS = bzip_get_far.$(OBJEXT)
 bzip_get_far_LDADD = $(LDADD)
@@ -1400,6 +2097,22 @@ bzip_get_put_SOURCES = bzip_get_put.c
 bzip_get_put_OBJECTS = bzip_get_put.$(OBJEXT)
 bzip_get_put_LDADD = $(LDADD)
 bzip_get_put_DEPENDENCIES = ../src/libgetdata.la
+bzip_int16_SOURCES = bzip_int16.c
+bzip_int16_OBJECTS = bzip_int16.$(OBJEXT)
+bzip_int16_LDADD = $(LDADD)
+bzip_int16_DEPENDENCIES = ../src/libgetdata.la
+bzip_int32_SOURCES = bzip_int32.c
+bzip_int32_OBJECTS = bzip_int32.$(OBJEXT)
+bzip_int32_LDADD = $(LDADD)
+bzip_int32_DEPENDENCIES = ../src/libgetdata.la
+bzip_int64_SOURCES = bzip_int64.c
+bzip_int64_OBJECTS = bzip_int64.$(OBJEXT)
+bzip_int64_LDADD = $(LDADD)
+bzip_int64_DEPENDENCIES = ../src/libgetdata.la
+bzip_int8_SOURCES = bzip_int8.c
+bzip_int8_OBJECTS = bzip_int8.$(OBJEXT)
+bzip_int8_LDADD = $(LDADD)
+bzip_int8_DEPENDENCIES = ../src/libgetdata.la
 bzip_move_from_SOURCES = bzip_move_from.c
 bzip_move_from_OBJECTS = bzip_move_from.$(OBJEXT)
 bzip_move_from_LDADD = $(LDADD)
@@ -1428,6 +2141,10 @@ bzip_put_get_SOURCES = bzip_put_get.c
 bzip_put_get_OBJECTS = bzip_put_get.$(OBJEXT)
 bzip_put_get_LDADD = $(LDADD)
 bzip_put_get_DEPENDENCIES = ../src/libgetdata.la
+bzip_put_offs_SOURCES = bzip_put_offs.c
+bzip_put_offs_OBJECTS = bzip_put_offs.$(OBJEXT)
+bzip_put_offs_LDADD = $(LDADD)
+bzip_put_offs_DEPENDENCIES = ../src/libgetdata.la
 bzip_put_pad_SOURCES = bzip_put_pad.c
 bzip_put_pad_OBJECTS = bzip_put_pad.$(OBJEXT)
 bzip_put_pad_LDADD = $(LDADD)
@@ -1448,6 +2165,70 @@ bzip_sync_SOURCES = bzip_sync.c
 bzip_sync_OBJECTS = bzip_sync.$(OBJEXT)
 bzip_sync_LDADD = $(LDADD)
 bzip_sync_DEPENDENCIES = ../src/libgetdata.la
+bzip_uint16_SOURCES = bzip_uint16.c
+bzip_uint16_OBJECTS = bzip_uint16.$(OBJEXT)
+bzip_uint16_LDADD = $(LDADD)
+bzip_uint16_DEPENDENCIES = ../src/libgetdata.la
+bzip_uint32_SOURCES = bzip_uint32.c
+bzip_uint32_OBJECTS = bzip_uint32.$(OBJEXT)
+bzip_uint32_LDADD = $(LDADD)
+bzip_uint32_DEPENDENCIES = ../src/libgetdata.la
+bzip_uint64_SOURCES = bzip_uint64.c
+bzip_uint64_OBJECTS = bzip_uint64.$(OBJEXT)
+bzip_uint64_LDADD = $(LDADD)
+bzip_uint64_DEPENDENCIES = ../src/libgetdata.la
+bzip_uint8_SOURCES = bzip_uint8.c
+bzip_uint8_OBJECTS = bzip_uint8.$(OBJEXT)
+bzip_uint8_LDADD = $(LDADD)
+bzip_uint8_DEPENDENCIES = ../src/libgetdata.la
+calist_SOURCES = calist.c
+calist_OBJECTS = calist.$(OBJEXT)
+calist_LDADD = $(LDADD)
+calist_DEPENDENCIES = ../src/libgetdata.la
+calist0_SOURCES = calist0.c
+calist0_OBJECTS = calist0.$(OBJEXT)
+calist0_LDADD = $(LDADD)
+calist0_DEPENDENCIES = ../src/libgetdata.la
+calist_free_SOURCES = calist_free.c
+calist_free_OBJECTS = calist_free.$(OBJEXT)
+calist_free_LDADD = $(LDADD)
+calist_free_DEPENDENCIES = ../src/libgetdata.la
+calist_hidden_SOURCES = calist_hidden.c
+calist_hidden_OBJECTS = calist_hidden.$(OBJEXT)
+calist_hidden_LDADD = $(LDADD)
+calist_hidden_DEPENDENCIES = ../src/libgetdata.la
+calist_long_SOURCES = calist_long.c
+calist_long_OBJECTS = calist_long.$(OBJEXT)
+calist_long_LDADD = $(LDADD)
+calist_long_DEPENDENCIES = ../src/libgetdata.la
+calist_meta_SOURCES = calist_meta.c
+calist_meta_OBJECTS = calist_meta.$(OBJEXT)
+calist_meta_LDADD = $(LDADD)
+calist_meta_DEPENDENCIES = ../src/libgetdata.la
+calist_meta0_SOURCES = calist_meta0.c
+calist_meta0_OBJECTS = calist_meta0.$(OBJEXT)
+calist_meta0_LDADD = $(LDADD)
+calist_meta0_DEPENDENCIES = ../src/libgetdata.la
+calist_meta_free_SOURCES = calist_meta_free.c
+calist_meta_free_OBJECTS = calist_meta_free.$(OBJEXT)
+calist_meta_free_LDADD = $(LDADD)
+calist_meta_free_DEPENDENCIES = ../src/libgetdata.la
+calist_meta_hidden_SOURCES = calist_meta_hidden.c
+calist_meta_hidden_OBJECTS = calist_meta_hidden.$(OBJEXT)
+calist_meta_hidden_LDADD = $(LDADD)
+calist_meta_hidden_DEPENDENCIES = ../src/libgetdata.la
+calist_meta_meta_SOURCES = calist_meta_meta.c
+calist_meta_meta_OBJECTS = calist_meta_meta.$(OBJEXT)
+calist_meta_meta_LDADD = $(LDADD)
+calist_meta_meta_DEPENDENCIES = ../src/libgetdata.la
+calist_meta_parent_SOURCES = calist_meta_parent.c
+calist_meta_parent_OBJECTS = calist_meta_parent.$(OBJEXT)
+calist_meta_parent_LDADD = $(LDADD)
+calist_meta_parent_DEPENDENCIES = ../src/libgetdata.la
+calist_null_SOURCES = calist_null.c
+calist_null_OBJECTS = calist_null.$(OBJEXT)
+calist_null_LDADD = $(LDADD)
+calist_null_DEPENDENCIES = ../src/libgetdata.la
 close_bad_SOURCES = close_bad.c
 close_bad_OBJECTS = close_bad.$(OBJEXT)
 close_bad_LDADD = $(LDADD)
@@ -1968,42 +2749,6 @@ cvlist_SOURCES = cvlist.c
 cvlist_OBJECTS = cvlist.$(OBJEXT)
 cvlist_LDADD = $(LDADD)
 cvlist_DEPENDENCIES = ../src/libgetdata.la
-cvlist_array_SOURCES = cvlist_array.c
-cvlist_array_OBJECTS = cvlist_array.$(OBJEXT)
-cvlist_array_LDADD = $(LDADD)
-cvlist_array_DEPENDENCIES = ../src/libgetdata.la
-cvlist_array0_SOURCES = cvlist_array0.c
-cvlist_array0_OBJECTS = cvlist_array0.$(OBJEXT)
-cvlist_array0_LDADD = $(LDADD)
-cvlist_array0_DEPENDENCIES = ../src/libgetdata.la
-cvlist_array_free_SOURCES = cvlist_array_free.c
-cvlist_array_free_OBJECTS = cvlist_array_free.$(OBJEXT)
-cvlist_array_free_LDADD = $(LDADD)
-cvlist_array_free_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_meta0_SOURCES = cvlist_array_meta0.c
-cvlist_array_meta0_OBJECTS = cvlist_array_meta0.$(OBJEXT)
-cvlist_array_meta0_LDADD = $(LDADD)
-cvlist_array_meta0_DEPENDENCIES = ../src/libgetdata.la
-cvlist_array_meta_free_SOURCES = cvlist_array_meta_free.c
-cvlist_array_meta_free_OBJECTS = cvlist_array_meta_free.$(OBJEXT)
-cvlist_array_meta_free_LDADD = $(LDADD)
-cvlist_array_meta_free_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_array_null_SOURCES = cvlist_array_null.c
-cvlist_array_null_OBJECTS = cvlist_array_null.$(OBJEXT)
-cvlist_array_null_LDADD = $(LDADD)
-cvlist_array_null_DEPENDENCIES = ../src/libgetdata.la
 cvlist_hidden_SOURCES = cvlist_hidden.c
 cvlist_hidden_OBJECTS = cvlist_hidden.$(OBJEXT)
 cvlist_hidden_LDADD = $(LDADD)
@@ -2012,6 +2757,10 @@ cvlist_invalid_SOURCES = cvlist_invalid.c
 cvlist_invalid_OBJECTS = cvlist_invalid.$(OBJEXT)
 cvlist_invalid_LDADD = $(LDADD)
 cvlist_invalid_DEPENDENCIES = ../src/libgetdata.la
+cvlist_long_SOURCES = cvlist_long.c
+cvlist_long_OBJECTS = cvlist_long.$(OBJEXT)
+cvlist_long_LDADD = $(LDADD)
+cvlist_long_DEPENDENCIES = ../src/libgetdata.la
 cvlist_meta_SOURCES = cvlist_meta.c
 cvlist_meta_OBJECTS = cvlist_meta.$(OBJEXT)
 cvlist_meta_LDADD = $(LDADD)
@@ -2020,6 +2769,10 @@ cvlist_meta0_SOURCES = cvlist_meta0.c
 cvlist_meta0_OBJECTS = cvlist_meta0.$(OBJEXT)
 cvlist_meta0_LDADD = $(LDADD)
 cvlist_meta0_DEPENDENCIES = ../src/libgetdata.la
+cvlist_meta_code_SOURCES = cvlist_meta_code.c
+cvlist_meta_code_OBJECTS = cvlist_meta_code.$(OBJEXT)
+cvlist_meta_code_LDADD = $(LDADD)
+cvlist_meta_code_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)
@@ -2028,6 +2781,10 @@ cvlist_meta_invalid_SOURCES = cvlist_meta_invalid.c
 cvlist_meta_invalid_OBJECTS = cvlist_meta_invalid.$(OBJEXT)
 cvlist_meta_invalid_LDADD = $(LDADD)
 cvlist_meta_invalid_DEPENDENCIES = ../src/libgetdata.la
+cvlist_meta_parent_SOURCES = cvlist_meta_parent.c
+cvlist_meta_parent_OBJECTS = cvlist_meta_parent.$(OBJEXT)
+cvlist_meta_parent_LDADD = $(LDADD)
+cvlist_meta_parent_DEPENDENCIES = ../src/libgetdata.la
 cvlist_null_SOURCES = cvlist_null.c
 cvlist_null_OBJECTS = cvlist_null.$(OBJEXT)
 cvlist_null_LDADD = $(LDADD)
@@ -2036,6 +2793,14 @@ del_alias_SOURCES = del_alias.c
 del_alias_OBJECTS = del_alias.$(OBJEXT)
 del_alias_LDADD = $(LDADD)
 del_alias_DEPENDENCIES = ../src/libgetdata.la
+del_alias_dangle_SOURCES = del_alias_dangle.c
+del_alias_dangle_OBJECTS = del_alias_dangle.$(OBJEXT)
+del_alias_dangle_LDADD = $(LDADD)
+del_alias_dangle_DEPENDENCIES = ../src/libgetdata.la
+del_alias_target_SOURCES = del_alias_target.c
+del_alias_target_OBJECTS = del_alias_target.$(OBJEXT)
+del_alias_target_LDADD = $(LDADD)
+del_alias_target_DEPENDENCIES = ../src/libgetdata.la
 del_bad_code_SOURCES = del_bad_code.c
 del_bad_code_OBJECTS = del_bad_code.$(OBJEXT)
 del_bad_code_LDADD = $(LDADD)
@@ -2072,6 +2837,10 @@ del_data_open_SOURCES = del_data_open.c
 del_data_open_OBJECTS = del_data_open.$(OBJEXT)
 del_data_open_LDADD = $(LDADD)
 del_data_open_DEPENDENCIES = ../src/libgetdata.la
+del_data_prot_SOURCES = del_data_prot.c
+del_data_prot_OBJECTS = del_data_prot.$(OBJEXT)
+del_data_prot_LDADD = $(LDADD)
+del_data_prot_DEPENDENCIES = ../src/libgetdata.la
 del_del_SOURCES = del_del.c
 del_del_OBJECTS = del_del.$(OBJEXT)
 del_del_LDADD = $(LDADD)
@@ -2088,6 +2857,10 @@ del_derived_force_SOURCES = del_derived_force.c
 del_derived_force_OBJECTS = del_derived_force.$(OBJEXT)
 del_derived_force_LDADD = $(LDADD)
 del_derived_force_DEPENDENCIES = ../src/libgetdata.la
+del_divide_SOURCES = del_divide.c
+del_divide_OBJECTS = del_divide.$(OBJEXT)
+del_divide_LDADD = $(LDADD)
+del_divide_DEPENDENCIES = ../src/libgetdata.la
 del_meta_SOURCES = del_meta.c
 del_meta_OBJECTS = del_meta.$(OBJEXT)
 del_meta_LDADD = $(LDADD)
@@ -2096,6 +2869,14 @@ 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
+del_prot_SOURCES = del_prot.c
+del_prot_OBJECTS = del_prot.$(OBJEXT)
+del_prot_LDADD = $(LDADD)
+del_prot_DEPENDENCIES = ../src/libgetdata.la
+del_rdonly_SOURCES = del_rdonly.c
+del_rdonly_OBJECTS = del_rdonly.$(OBJEXT)
+del_rdonly_LDADD = $(LDADD)
+del_rdonly_DEPENDENCIES = ../src/libgetdata.la
 del_ref_SOURCES = del_ref.c
 del_ref_OBJECTS = del_ref.$(OBJEXT)
 del_ref_LDADD = $(LDADD)
@@ -2172,10 +2953,22 @@ elist_noalias_SOURCES = elist_noalias.c
 elist_noalias_OBJECTS = elist_noalias.$(OBJEXT)
 elist_noalias_LDADD = $(LDADD)
 elist_noalias_DEPENDENCIES = ../src/libgetdata.la
+elist_parent_SOURCES = elist_parent.c
+elist_parent_OBJECTS = elist_parent.$(OBJEXT)
+elist_parent_LDADD = $(LDADD)
+elist_parent_DEPENDENCIES = ../src/libgetdata.la
+elist_parent2_SOURCES = elist_parent2.c
+elist_parent2_OBJECTS = elist_parent2.$(OBJEXT)
+elist_parent2_LDADD = $(LDADD)
+elist_parent2_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
+elist_type_SOURCES = elist_type.c
+elist_type_OBJECTS = elist_type.$(OBJEXT)
+elist_type_LDADD = $(LDADD)
+elist_type_DEPENDENCIES = ../src/libgetdata.la
 encode_alter_SOURCES = encode_alter.c
 encode_alter_OBJECTS = encode_alter.$(OBJEXT)
 encode_alter_LDADD = $(LDADD)
@@ -2212,6 +3005,26 @@ endian_alter_all_SOURCES = endian_alter_all.c
 endian_alter_all_OBJECTS = endian_alter_all.$(OBJEXT)
 endian_alter_all_LDADD = $(LDADD)
 endian_alter_all_DEPENDENCIES = ../src/libgetdata.la
+endian_alter_arg_SOURCES = endian_alter_arg.c
+endian_alter_arg_OBJECTS = endian_alter_arg.$(OBJEXT)
+endian_alter_arg_LDADD = $(LDADD)
+endian_alter_arg_DEPENDENCIES = ../src/libgetdata.la
+endian_alter_dprot_SOURCES = endian_alter_dprot.c
+endian_alter_dprot_OBJECTS = endian_alter_dprot.$(OBJEXT)
+endian_alter_dprot_LDADD = $(LDADD)
+endian_alter_dprot_DEPENDENCIES = ../src/libgetdata.la
+endian_alter_fprot_SOURCES = endian_alter_fprot.c
+endian_alter_fprot_OBJECTS = endian_alter_fprot.$(OBJEXT)
+endian_alter_fprot_LDADD = $(LDADD)
+endian_alter_fprot_DEPENDENCIES = ../src/libgetdata.la
+endian_alter_index_SOURCES = endian_alter_index.c
+endian_alter_index_OBJECTS = endian_alter_index.$(OBJEXT)
+endian_alter_index_LDADD = $(LDADD)
+endian_alter_index_DEPENDENCIES = ../src/libgetdata.la
+endian_alter_rdonly_SOURCES = endian_alter_rdonly.c
+endian_alter_rdonly_OBJECTS = endian_alter_rdonly.$(OBJEXT)
+endian_alter_rdonly_LDADD = $(LDADD)
+endian_alter_rdonly_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)
@@ -2220,6 +3033,10 @@ endian_get_SOURCES = endian_get.c
 endian_get_OBJECTS = endian_get.$(OBJEXT)
 endian_get_LDADD = $(LDADD)
 endian_get_DEPENDENCIES = ../src/libgetdata.la
+endian_index_SOURCES = endian_index.c
+endian_index_OBJECTS = endian_index.$(OBJEXT)
+endian_index_LDADD = $(LDADD)
+endian_index_DEPENDENCIES = ../src/libgetdata.la
 endian_move_SOURCES = endian_move.c
 endian_move_OBJECTS = endian_move.$(OBJEXT)
 endian_move_LDADD = $(LDADD)
@@ -2332,6 +3149,14 @@ eof_bit_SOURCES = eof_bit.c
 eof_bit_OBJECTS = eof_bit.$(OBJEXT)
 eof_bit_LDADD = $(LDADD)
 eof_bit_DEPENDENCIES = ../src/libgetdata.la
+eof_bit_code_SOURCES = eof_bit_code.c
+eof_bit_code_OBJECTS = eof_bit_code.$(OBJEXT)
+eof_bit_code_LDADD = $(LDADD)
+eof_bit_code_DEPENDENCIES = ../src/libgetdata.la
+eof_const_SOURCES = eof_const.c
+eof_const_OBJECTS = eof_const.$(OBJEXT)
+eof_const_LDADD = $(LDADD)
+eof_const_DEPENDENCIES = ../src/libgetdata.la
 eof_index_SOURCES = eof_index.c
 eof_index_OBJECTS = eof_index.$(OBJEXT)
 eof_index_LDADD = $(LDADD)
@@ -2340,14 +3165,26 @@ eof_lincom_SOURCES = eof_lincom.c
 eof_lincom_OBJECTS = eof_lincom.$(OBJEXT)
 eof_lincom_LDADD = $(LDADD)
 eof_lincom_DEPENDENCIES = ../src/libgetdata.la
+eof_lincom_code_SOURCES = eof_lincom_code.c
+eof_lincom_code_OBJECTS = eof_lincom_code.$(OBJEXT)
+eof_lincom_code_LDADD = $(LDADD)
+eof_lincom_code_DEPENDENCIES = ../src/libgetdata.la
 eof_phase_SOURCES = eof_phase.c
 eof_phase_OBJECTS = eof_phase.$(OBJEXT)
 eof_phase_LDADD = $(LDADD)
 eof_phase_DEPENDENCIES = ../src/libgetdata.la
+eof_phase_code_SOURCES = eof_phase_code.c
+eof_phase_code_OBJECTS = eof_phase_code.$(OBJEXT)
+eof_phase_code_LDADD = $(LDADD)
+eof_phase_code_DEPENDENCIES = ../src/libgetdata.la
 eof_phase_neg_SOURCES = eof_phase_neg.c
 eof_phase_neg_OBJECTS = eof_phase_neg.$(OBJEXT)
 eof_phase_neg_LDADD = $(LDADD)
 eof_phase_neg_DEPENDENCIES = ../src/libgetdata.la
+eof_recurse_SOURCES = eof_recurse.c
+eof_recurse_OBJECTS = eof_recurse.$(OBJEXT)
+eof_recurse_LDADD = $(LDADD)
+eof_recurse_DEPENDENCIES = ../src/libgetdata.la
 error_SOURCES = error.c
 error_OBJECTS = error.$(OBJEXT)
 error_LDADD = $(LDADD)
@@ -2388,10 +3225,38 @@ flac_add_SOURCES = flac_add.c
 flac_add_OBJECTS = flac_add.$(OBJEXT)
 flac_add_LDADD = $(LDADD)
 flac_add_DEPENDENCIES = ../src/libgetdata.la
+flac_complex128_SOURCES = flac_complex128.c
+flac_complex128_OBJECTS = flac_complex128.$(OBJEXT)
+flac_complex128_LDADD = $(LDADD)
+flac_complex128_DEPENDENCIES = ../src/libgetdata.la
+flac_complex64_SOURCES = flac_complex64.c
+flac_complex64_OBJECTS = flac_complex64.$(OBJEXT)
+flac_complex64_LDADD = $(LDADD)
+flac_complex64_DEPENDENCIES = ../src/libgetdata.la
+flac_del_SOURCES = flac_del.c
+flac_del_OBJECTS = flac_del.$(OBJEXT)
+flac_del_LDADD = $(LDADD)
+flac_del_DEPENDENCIES = ../src/libgetdata.la
+flac_enoent_SOURCES = flac_enoent.c
+flac_enoent_OBJECTS = flac_enoent.$(OBJEXT)
+flac_enoent_LDADD = $(LDADD)
+flac_enoent_DEPENDENCIES = ../src/libgetdata.la
+flac_float32_SOURCES = flac_float32.c
+flac_float32_OBJECTS = flac_float32.$(OBJEXT)
+flac_float32_LDADD = $(LDADD)
+flac_float32_DEPENDENCIES = ../src/libgetdata.la
+flac_float64_SOURCES = flac_float64.c
+flac_float64_OBJECTS = flac_float64.$(OBJEXT)
+flac_float64_LDADD = $(LDADD)
+flac_float64_DEPENDENCIES = ../src/libgetdata.la
 flac_get_big_SOURCES = flac_get_big.c
 flac_get_big_OBJECTS = flac_get_big.$(OBJEXT)
 flac_get_big_LDADD = $(LDADD)
 flac_get_big_DEPENDENCIES = ../src/libgetdata.la
+flac_get_cont_SOURCES = flac_get_cont.c
+flac_get_cont_OBJECTS = flac_get_cont.$(OBJEXT)
+flac_get_cont_LDADD = $(LDADD)
+flac_get_cont_DEPENDENCIES = ../src/libgetdata.la
 flac_get_far_SOURCES = flac_get_far.c
 flac_get_far_OBJECTS = flac_get_far.$(OBJEXT)
 flac_get_far_LDADD = $(LDADD)
@@ -2420,6 +3285,26 @@ flac_get_long_SOURCES = flac_get_long.c
 flac_get_long_OBJECTS = flac_get_long.$(OBJEXT)
 flac_get_long_LDADD = $(LDADD)
 flac_get_long_DEPENDENCIES = ../src/libgetdata.la
+flac_int16_SOURCES = flac_int16.c
+flac_int16_OBJECTS = flac_int16.$(OBJEXT)
+flac_int16_LDADD = $(LDADD)
+flac_int16_DEPENDENCIES = ../src/libgetdata.la
+flac_int32_SOURCES = flac_int32.c
+flac_int32_OBJECTS = flac_int32.$(OBJEXT)
+flac_int32_LDADD = $(LDADD)
+flac_int32_DEPENDENCIES = ../src/libgetdata.la
+flac_int64_SOURCES = flac_int64.c
+flac_int64_OBJECTS = flac_int64.$(OBJEXT)
+flac_int64_LDADD = $(LDADD)
+flac_int64_DEPENDENCIES = ../src/libgetdata.la
+flac_int8_SOURCES = flac_int8.c
+flac_int8_OBJECTS = flac_int8.$(OBJEXT)
+flac_int8_LDADD = $(LDADD)
+flac_int8_DEPENDENCIES = ../src/libgetdata.la
+flac_move_from_SOURCES = flac_move_from.c
+flac_move_from_OBJECTS = flac_move_from.$(OBJEXT)
+flac_move_from_LDADD = $(LDADD)
+flac_move_from_DEPENDENCIES = ../src/libgetdata.la
 flac_nframes_SOURCES = flac_nframes.c
 flac_nframes_OBJECTS = flac_nframes.$(OBJEXT)
 flac_nframes_LDADD = $(LDADD)
@@ -2444,6 +3329,10 @@ flac_put_little_SOURCES = flac_put_little.c
 flac_put_little_OBJECTS = flac_put_little.$(OBJEXT)
 flac_put_little_LDADD = $(LDADD)
 flac_put_little_DEPENDENCIES = ../src/libgetdata.la
+flac_put_offs_SOURCES = flac_put_offs.c
+flac_put_offs_OBJECTS = flac_put_offs.$(OBJEXT)
+flac_put_offs_LDADD = $(LDADD)
+flac_put_offs_DEPENDENCIES = ../src/libgetdata.la
 flac_seek_SOURCES = flac_seek.c
 flac_seek_OBJECTS = flac_seek.$(OBJEXT)
 flac_seek_LDADD = $(LDADD)
@@ -2456,6 +3345,22 @@ flac_sync_SOURCES = flac_sync.c
 flac_sync_OBJECTS = flac_sync.$(OBJEXT)
 flac_sync_LDADD = $(LDADD)
 flac_sync_DEPENDENCIES = ../src/libgetdata.la
+flac_uint16_SOURCES = flac_uint16.c
+flac_uint16_OBJECTS = flac_uint16.$(OBJEXT)
+flac_uint16_LDADD = $(LDADD)
+flac_uint16_DEPENDENCIES = ../src/libgetdata.la
+flac_uint32_SOURCES = flac_uint32.c
+flac_uint32_OBJECTS = flac_uint32.$(OBJEXT)
+flac_uint32_LDADD = $(LDADD)
+flac_uint32_DEPENDENCIES = ../src/libgetdata.la
+flac_uint64_SOURCES = flac_uint64.c
+flac_uint64_OBJECTS = flac_uint64.$(OBJEXT)
+flac_uint64_LDADD = $(LDADD)
+flac_uint64_DEPENDENCIES = ../src/libgetdata.la
+flac_uint8_SOURCES = flac_uint8.c
+flac_uint8_OBJECTS = flac_uint8.$(OBJEXT)
+flac_uint8_LDADD = $(LDADD)
+flac_uint8_DEPENDENCIES = ../src/libgetdata.la
 flist_SOURCES = flist.c
 flist_OBJECTS = flist.$(OBJEXT)
 flist_LDADD = $(LDADD)
@@ -2520,10 +3425,6 @@ flush_all_SOURCES = flush_all.c
 flush_all_OBJECTS = flush_all.$(OBJEXT)
 flush_all_LDADD = $(LDADD)
 flush_all_DEPENDENCIES = ../src/libgetdata.la
-flush_amb_code_SOURCES = flush_amb_code.c
-flush_amb_code_OBJECTS = flush_amb_code.$(OBJEXT)
-flush_amb_code_LDADD = $(LDADD)
-flush_amb_code_DEPENDENCIES = ../src/libgetdata.la
 flush_bad_code_SOURCES = flush_bad_code.c
 flush_bad_code_OBJECTS = flush_bad_code.$(OBJEXT)
 flush_bad_code_LDADD = $(LDADD)
@@ -2532,10 +3433,6 @@ flush_flush_SOURCES = flush_flush.c
 flush_flush_OBJECTS = flush_flush.$(OBJEXT)
 flush_flush_LDADD = $(LDADD)
 flush_flush_DEPENDENCIES = ../src/libgetdata.la
-flush_hex_SOURCES = flush_hex.c
-flush_hex_OBJECTS = flush_hex.$(OBJEXT)
-flush_hex_LDADD = $(LDADD)
-flush_hex_DEPENDENCIES = ../src/libgetdata.la
 flush_invalid_SOURCES = flush_invalid.c
 flush_invalid_OBJECTS = flush_invalid.$(OBJEXT)
 flush_invalid_LDADD = $(LDADD)
@@ -2548,10 +3445,6 @@ flush_lincom1_SOURCES = flush_lincom1.c
 flush_lincom1_OBJECTS = flush_lincom1.$(OBJEXT)
 flush_lincom1_LDADD = $(LDADD)
 flush_lincom1_DEPENDENCIES = ../src/libgetdata.la
-flush_meta_SOURCES = flush_meta.c
-flush_meta_OBJECTS = flush_meta.$(OBJEXT)
-flush_meta_LDADD = $(LDADD)
-flush_meta_DEPENDENCIES = ../src/libgetdata.la
 flush_mult_SOURCES = flush_mult.c
 flush_mult_OBJECTS = flush_mult.$(OBJEXT)
 flush_mult_LDADD = $(LDADD)
@@ -2560,18 +3453,10 @@ flush_raw_close_SOURCES = flush_raw_close.c
 flush_raw_close_OBJECTS = flush_raw_close.$(OBJEXT)
 flush_raw_close_LDADD = $(LDADD)
 flush_raw_close_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)
-flush_spec_DEPENDENCIES = ../src/libgetdata.la
-flush_string_SOURCES = flush_string.c
-flush_string_OBJECTS = flush_string.$(OBJEXT)
-flush_string_LDADD = $(LDADD)
-flush_string_DEPENDENCIES = ../src/libgetdata.la
+flush_recurse_SOURCES = flush_recurse.c
+flush_recurse_OBJECTS = flush_recurse.$(OBJEXT)
+flush_recurse_LDADD = $(LDADD)
+flush_recurse_DEPENDENCIES = ../src/libgetdata.la
 flush_sync_SOURCES = flush_sync.c
 flush_sync_OBJECTS = flush_sync.$(OBJEXT)
 flush_sync_LDADD = $(LDADD)
@@ -2584,10 +3469,34 @@ foffs_alter_all_SOURCES = foffs_alter_all.c
 foffs_alter_all_OBJECTS = foffs_alter_all.$(OBJEXT)
 foffs_alter_all_LDADD = $(LDADD)
 foffs_alter_all_DEPENDENCIES = ../src/libgetdata.la
+foffs_alter_dprot_SOURCES = foffs_alter_dprot.c
+foffs_alter_dprot_OBJECTS = foffs_alter_dprot.$(OBJEXT)
+foffs_alter_dprot_LDADD = $(LDADD)
+foffs_alter_dprot_DEPENDENCIES = ../src/libgetdata.la
+foffs_alter_fprot_SOURCES = foffs_alter_fprot.c
+foffs_alter_fprot_OBJECTS = foffs_alter_fprot.$(OBJEXT)
+foffs_alter_fprot_LDADD = $(LDADD)
+foffs_alter_fprot_DEPENDENCIES = ../src/libgetdata.la
+foffs_alter_index_SOURCES = foffs_alter_index.c
+foffs_alter_index_OBJECTS = foffs_alter_index.$(OBJEXT)
+foffs_alter_index_LDADD = $(LDADD)
+foffs_alter_index_DEPENDENCIES = ../src/libgetdata.la
+foffs_alter_range_SOURCES = foffs_alter_range.c
+foffs_alter_range_OBJECTS = foffs_alter_range.$(OBJEXT)
+foffs_alter_range_LDADD = $(LDADD)
+foffs_alter_range_DEPENDENCIES = ../src/libgetdata.la
+foffs_alter_rdonly_SOURCES = foffs_alter_rdonly.c
+foffs_alter_rdonly_OBJECTS = foffs_alter_rdonly.$(OBJEXT)
+foffs_alter_rdonly_LDADD = $(LDADD)
+foffs_alter_rdonly_DEPENDENCIES = ../src/libgetdata.la
 foffs_get_SOURCES = foffs_get.c
 foffs_get_OBJECTS = foffs_get.$(OBJEXT)
 foffs_get_LDADD = $(LDADD)
 foffs_get_DEPENDENCIES = ../src/libgetdata.la
+foffs_index_SOURCES = foffs_index.c
+foffs_index_OBJECTS = foffs_index.$(OBJEXT)
+foffs_index_LDADD = $(LDADD)
+foffs_index_DEPENDENCIES = ../src/libgetdata.la
 foffs_move_SOURCES = foffs_move.c
 foffs_move_OBJECTS = foffs_move.$(OBJEXT)
 foffs_move_LDADD = $(LDADD)
@@ -2609,14 +3518,45 @@ fragment_affix_alter_code_OBJECTS =  \
 	fragment_affix_alter_code.$(OBJEXT)
 fragment_affix_alter_code_LDADD = $(LDADD)
 fragment_affix_alter_code_DEPENDENCIES = ../src/libgetdata.la
+fragment_affix_alter_dotpx_SOURCES = fragment_affix_alter_dotpx.c
+fragment_affix_alter_dotpx_OBJECTS =  \
+	fragment_affix_alter_dotpx.$(OBJEXT)
+fragment_affix_alter_dotpx_LDADD = $(LDADD)
+fragment_affix_alter_dotpx_DEPENDENCIES = ../src/libgetdata.la
+fragment_affix_alter_index_SOURCES = fragment_affix_alter_index.c
+fragment_affix_alter_index_OBJECTS =  \
+	fragment_affix_alter_index.$(OBJEXT)
+fragment_affix_alter_index_LDADD = $(LDADD)
+fragment_affix_alter_index_DEPENDENCIES = ../src/libgetdata.la
+fragment_affix_alter_nons_SOURCES = fragment_affix_alter_nons.c
+fragment_affix_alter_nons_OBJECTS =  \
+	fragment_affix_alter_nons.$(OBJEXT)
+fragment_affix_alter_nons_LDADD = $(LDADD)
+fragment_affix_alter_nons_DEPENDENCIES = ../src/libgetdata.la
 fragment_affix_alter_nop_SOURCES = fragment_affix_alter_nop.c
 fragment_affix_alter_nop_OBJECTS = fragment_affix_alter_nop.$(OBJEXT)
 fragment_affix_alter_nop_LDADD = $(LDADD)
 fragment_affix_alter_nop_DEPENDENCIES = ../src/libgetdata.la
+fragment_affix_alter_ns_SOURCES = fragment_affix_alter_ns.c
+fragment_affix_alter_ns_OBJECTS = fragment_affix_alter_ns.$(OBJEXT)
+fragment_affix_alter_ns_LDADD = $(LDADD)
+fragment_affix_alter_ns_DEPENDENCIES = ../src/libgetdata.la
+fragment_affix_alter_pns_SOURCES = fragment_affix_alter_pns.c
+fragment_affix_alter_pns_OBJECTS = fragment_affix_alter_pns.$(OBJEXT)
+fragment_affix_alter_pns_LDADD = $(LDADD)
+fragment_affix_alter_pns_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_affix_index_SOURCES = fragment_affix_index.c
+fragment_affix_index_OBJECTS = fragment_affix_index.$(OBJEXT)
+fragment_affix_index_LDADD = $(LDADD)
+fragment_affix_index_DEPENDENCIES = ../src/libgetdata.la
+fragment_affix_ns_SOURCES = fragment_affix_ns.c
+fragment_affix_ns_OBJECTS = fragment_affix_ns.$(OBJEXT)
+fragment_affix_ns_LDADD = $(LDADD)
+fragment_affix_ns_DEPENDENCIES = ../src/libgetdata.la
 fragment_index_SOURCES = fragment_index.c
 fragment_index_OBJECTS = fragment_index.$(OBJEXT)
 fragment_index_LDADD = $(LDADD)
@@ -2633,6 +3573,62 @@ 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_ndotdots_SOURCES = fragment_ndotdots.c
+fragment_ndotdots_OBJECTS = fragment_ndotdots.$(OBJEXT)
+fragment_ndotdots_LDADD = $(LDADD)
+fragment_ndotdots_DEPENDENCIES = ../src/libgetdata.la
+fragment_ndots_SOURCES = fragment_ndots.c
+fragment_ndots_OBJECTS = fragment_ndots.$(OBJEXT)
+fragment_ndots_LDADD = $(LDADD)
+fragment_ndots_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_SOURCES = fragment_ns.c
+fragment_ns_OBJECTS = fragment_ns.$(OBJEXT)
+fragment_ns_LDADD = $(LDADD)
+fragment_ns_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns0_SOURCES = fragment_ns0.c
+fragment_ns0_OBJECTS = fragment_ns0.$(OBJEXT)
+fragment_ns0_LDADD = $(LDADD)
+fragment_ns0_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_add_SOURCES = fragment_ns_add.c
+fragment_ns_add_OBJECTS = fragment_ns_add.$(OBJEXT)
+fragment_ns_add_LDADD = $(LDADD)
+fragment_ns_add_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_add0_SOURCES = fragment_ns_add0.c
+fragment_ns_add0_OBJECTS = fragment_ns_add0.$(OBJEXT)
+fragment_ns_add0_LDADD = $(LDADD)
+fragment_ns_add0_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_alter_SOURCES = fragment_ns_alter.c
+fragment_ns_alter_OBJECTS = fragment_ns_alter.$(OBJEXT)
+fragment_ns_alter_LDADD = $(LDADD)
+fragment_ns_alter_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_alter_nop_SOURCES = fragment_ns_alter_nop.c
+fragment_ns_alter_nop_OBJECTS = fragment_ns_alter_nop.$(OBJEXT)
+fragment_ns_alter_nop_LDADD = $(LDADD)
+fragment_ns_alter_nop_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_alter_pdel_SOURCES = fragment_ns_alter_pdel.c
+fragment_ns_alter_pdel_OBJECTS = fragment_ns_alter_pdel.$(OBJEXT)
+fragment_ns_alter_pdel_LDADD = $(LDADD)
+fragment_ns_alter_pdel_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_del_SOURCES = fragment_ns_del.c
+fragment_ns_del_OBJECTS = fragment_ns_del.$(OBJEXT)
+fragment_ns_del_LDADD = $(LDADD)
+fragment_ns_del_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_dot_SOURCES = fragment_ns_dot.c
+fragment_ns_dot_OBJECTS = fragment_ns_dot.$(OBJEXT)
+fragment_ns_dot_LDADD = $(LDADD)
+fragment_ns_dot_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_dotdot_SOURCES = fragment_ns_dotdot.c
+fragment_ns_dotdot_OBJECTS = fragment_ns_dotdot.$(OBJEXT)
+fragment_ns_dotdot_LDADD = $(LDADD)
+fragment_ns_dotdot_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_dotns_SOURCES = fragment_ns_dotns.c
+fragment_ns_dotns_OBJECTS = fragment_ns_dotns.$(OBJEXT)
+fragment_ns_dotns_LDADD = $(LDADD)
+fragment_ns_dotns_DEPENDENCIES = ../src/libgetdata.la
+fragment_ns_nsdot_SOURCES = fragment_ns_nsdot.c
+fragment_ns_nsdot_OBJECTS = fragment_ns_nsdot.$(OBJEXT)
+fragment_ns_nsdot_LDADD = $(LDADD)
+fragment_ns_nsdot_DEPENDENCIES = ../src/libgetdata.la
 fragment_num_SOURCES = fragment_num.c
 fragment_num_OBJECTS = fragment_num.$(OBJEXT)
 fragment_num_LDADD = $(LDADD)
@@ -2641,6 +3637,14 @@ fragment_parent_SOURCES = fragment_parent.c
 fragment_parent_OBJECTS = fragment_parent.$(OBJEXT)
 fragment_parent_LDADD = $(LDADD)
 fragment_parent_DEPENDENCIES = ../src/libgetdata.la
+fragment_parent_index_SOURCES = fragment_parent_index.c
+fragment_parent_index_OBJECTS = fragment_parent_index.$(OBJEXT)
+fragment_parent_index_LDADD = $(LDADD)
+fragment_parent_index_DEPENDENCIES = ../src/libgetdata.la
+fragment_parent_root_SOURCES = fragment_parent_root.c
+fragment_parent_root_OBJECTS = fragment_parent_root.$(OBJEXT)
+fragment_parent_root_LDADD = $(LDADD)
+fragment_parent_root_DEPENDENCIES = ../src/libgetdata.la
 get64_SOURCES = get64.c
 get64_OBJECTS = get64.$(OBJEXT)
 get64_LDADD = $(LDADD)
@@ -2661,18 +3665,30 @@ get_carray_SOURCES = get_carray.c
 get_carray_OBJECTS = get_carray.$(OBJEXT)
 get_carray_LDADD = $(LDADD)
 get_carray_DEPENDENCIES = ../src/libgetdata.la
+get_carray_bad_SOURCES = get_carray_bad.c
+get_carray_bad_OBJECTS = get_carray_bad.$(OBJEXT)
+get_carray_bad_LDADD = $(LDADD)
+get_carray_bad_DEPENDENCIES = ../src/libgetdata.la
 get_carray_c2r_SOURCES = get_carray_c2r.c
 get_carray_c2r_OBJECTS = get_carray_c2r.$(OBJEXT)
 get_carray_c2r_LDADD = $(LDADD)
 get_carray_c2r_DEPENDENCIES = ../src/libgetdata.la
-get_carray_len_SOURCES = get_carray_len.c
-get_carray_len_OBJECTS = get_carray_len.$(OBJEXT)
-get_carray_len_LDADD = $(LDADD)
-get_carray_len_DEPENDENCIES = ../src/libgetdata.la
 get_carray_slice_SOURCES = get_carray_slice.c
 get_carray_slice_OBJECTS = get_carray_slice.$(OBJEXT)
 get_carray_slice_LDADD = $(LDADD)
 get_carray_slice_DEPENDENCIES = ../src/libgetdata.la
+get_carray_slice_bounds_SOURCES = get_carray_slice_bounds.c
+get_carray_slice_bounds_OBJECTS = get_carray_slice_bounds.$(OBJEXT)
+get_carray_slice_bounds_LDADD = $(LDADD)
+get_carray_slice_bounds_DEPENDENCIES = ../src/libgetdata.la
+get_carray_slice_type_SOURCES = get_carray_slice_type.c
+get_carray_slice_type_OBJECTS = get_carray_slice_type.$(OBJEXT)
+get_carray_slice_type_LDADD = $(LDADD)
+get_carray_slice_type_DEPENDENCIES = ../src/libgetdata.la
+get_carray_type_SOURCES = get_carray_type.c
+get_carray_type_OBJECTS = get_carray_type.$(OBJEXT)
+get_carray_type_LDADD = $(LDADD)
+get_carray_type_DEPENDENCIES = ../src/libgetdata.la
 get_char_SOURCES = get_char.c
 get_char_OBJECTS = get_char.$(OBJEXT)
 get_char_LDADD = $(LDADD)
@@ -2693,6 +3709,10 @@ get_const_SOURCES = get_const.c
 get_const_OBJECTS = get_const.$(OBJEXT)
 get_const_LDADD = $(LDADD)
 get_const_DEPENDENCIES = ../src/libgetdata.la
+get_const_bad_SOURCES = get_const_bad.c
+get_const_bad_OBJECTS = get_const_bad.$(OBJEXT)
+get_const_bad_LDADD = $(LDADD)
+get_const_bad_DEPENDENCIES = ../src/libgetdata.la
 get_const_carray_SOURCES = get_const_carray.c
 get_const_carray_OBJECTS = get_const_carray.$(OBJEXT)
 get_const_carray_LDADD = $(LDADD)
@@ -2705,6 +3725,10 @@ get_const_repr_SOURCES = get_const_repr.c
 get_const_repr_OBJECTS = get_const_repr.$(OBJEXT)
 get_const_repr_LDADD = $(LDADD)
 get_const_repr_DEPENDENCIES = ../src/libgetdata.la
+get_const_reprz_SOURCES = get_const_reprz.c
+get_const_reprz_OBJECTS = get_const_reprz.$(OBJEXT)
+get_const_reprz_LDADD = $(LDADD)
+get_const_reprz_DEPENDENCIES = ../src/libgetdata.la
 get_cpolynom_SOURCES = get_cpolynom.c
 get_cpolynom_OBJECTS = get_cpolynom.$(OBJEXT)
 get_cpolynom_LDADD = $(LDADD)
@@ -2721,6 +3745,10 @@ get_dim_SOURCES = get_dim.c
 get_dim_OBJECTS = get_dim.$(OBJEXT)
 get_dim_LDADD = $(LDADD)
 get_dim_DEPENDENCIES = ../src/libgetdata.la
+get_dimin_SOURCES = get_dimin.c
+get_dimin_OBJECTS = get_dimin.$(OBJEXT)
+get_dimin_LDADD = $(LDADD)
+get_dimin_DEPENDENCIES = ../src/libgetdata.la
 get_divide_SOURCES = get_divide.c
 get_divide_OBJECTS = get_divide.$(OBJEXT)
 get_divide_LDADD = $(LDADD)
@@ -2729,6 +3757,10 @@ get_divide_ccin_SOURCES = get_divide_ccin.c
 get_divide_ccin_OBJECTS = get_divide_ccin.$(OBJEXT)
 get_divide_ccin_LDADD = $(LDADD)
 get_divide_ccin_DEPENDENCIES = ../src/libgetdata.la
+get_divide_code_SOURCES = get_divide_code.c
+get_divide_code_OBJECTS = get_divide_code.$(OBJEXT)
+get_divide_code_LDADD = $(LDADD)
+get_divide_code_DEPENDENCIES = ../src/libgetdata.la
 get_divide_crin_SOURCES = get_divide_crin.c
 get_divide_crin_OBJECTS = get_divide_crin.$(OBJEXT)
 get_divide_crin_LDADD = $(LDADD)
@@ -2745,6 +3777,10 @@ get_divide_s_SOURCES = get_divide_s.c
 get_divide_s_OBJECTS = get_divide_s.$(OBJEXT)
 get_divide_s_LDADD = $(LDADD)
 get_divide_s_DEPENDENCIES = ../src/libgetdata.la
+get_dot_SOURCES = get_dot.c
+get_dot_OBJECTS = get_dot.$(OBJEXT)
+get_dot_LDADD = $(LDADD)
+get_dot_DEPENDENCIES = ../src/libgetdata.la
 get_endian16_SOURCES = get_endian16.c
 get_endian16_OBJECTS = get_endian16.$(OBJEXT)
 get_endian16_LDADD = $(LDADD)
@@ -2855,6 +3891,18 @@ get_index_complex_SOURCES = get_index_complex.c
 get_index_complex_OBJECTS = get_index_complex.$(OBJEXT)
 get_index_complex_LDADD = $(LDADD)
 get_index_complex_DEPENDENCIES = ../src/libgetdata.la
+get_index_type_SOURCES = get_index_type.c
+get_index_type_OBJECTS = get_index_type.$(OBJEXT)
+get_index_type_LDADD = $(LDADD)
+get_index_type_DEPENDENCIES = ../src/libgetdata.la
+get_indir_SOURCES = get_indir.c
+get_indir_OBJECTS = get_indir.$(OBJEXT)
+get_indir_LDADD = $(LDADD)
+get_indir_DEPENDENCIES = ../src/libgetdata.la
+get_indir_typein_SOURCES = get_indir_typein.c
+get_indir_typein_OBJECTS = get_indir_typein.$(OBJEXT)
+get_indir_typein_LDADD = $(LDADD)
+get_indir_typein_DEPENDENCIES = ../src/libgetdata.la
 get_int16_SOURCES = get_int16.c
 get_int16_OBJECTS = get_int16.$(OBJEXT)
 get_int16_LDADD = $(LDADD)
@@ -2895,6 +3943,10 @@ get_lincom3s_SOURCES = get_lincom3s.c
 get_lincom3s_OBJECTS = get_lincom3s.$(OBJEXT)
 get_lincom3s_LDADD = $(LDADD)
 get_lincom3s_DEPENDENCIES = ../src/libgetdata.la
+get_lincom_code_SOURCES = get_lincom_code.c
+get_lincom_code_OBJECTS = get_lincom_code.$(OBJEXT)
+get_lincom_code_LDADD = $(LDADD)
+get_lincom_code_DEPENDENCIES = ../src/libgetdata.la
 get_lincom_mdt_SOURCES = get_lincom_mdt.c
 get_lincom_mdt_OBJECTS = get_lincom_mdt.$(OBJEXT)
 get_lincom_mdt_LDADD = $(LDADD)
@@ -2991,6 +4043,10 @@ get_multiply_ccin_SOURCES = get_multiply_ccin.c
 get_multiply_ccin_OBJECTS = get_multiply_ccin.$(OBJEXT)
 get_multiply_ccin_LDADD = $(LDADD)
 get_multiply_ccin_DEPENDENCIES = ../src/libgetdata.la
+get_multiply_code_SOURCES = get_multiply_code.c
+get_multiply_code_OBJECTS = get_multiply_code.$(OBJEXT)
+get_multiply_code_LDADD = $(LDADD)
+get_multiply_code_DEPENDENCIES = ../src/libgetdata.la
 get_multiply_crin_SOURCES = get_multiply_crin.c
 get_multiply_crin_OBJECTS = get_multiply_crin.$(OBJEXT)
 get_multiply_crin_LDADD = $(LDADD)
@@ -3059,6 +4115,10 @@ get_recip_SOURCES = get_recip.c
 get_recip_OBJECTS = get_recip.$(OBJEXT)
 get_recip_LDADD = $(LDADD)
 get_recip_DEPENDENCIES = ../src/libgetdata.la
+get_recip_cmpin_SOURCES = get_recip_cmpin.c
+get_recip_cmpin_OBJECTS = get_recip_cmpin.$(OBJEXT)
+get_recip_cmpin_LDADD = $(LDADD)
+get_recip_cmpin_DEPENDENCIES = ../src/libgetdata.la
 get_recip_const_SOURCES = get_recip_const.c
 get_recip_const_OBJECTS = get_recip_const.$(OBJEXT)
 get_recip_const_LDADD = $(LDADD)
@@ -3067,10 +4127,38 @@ get_recurse_SOURCES = get_recurse.c
 get_recurse_OBJECTS = get_recurse.$(OBJEXT)
 get_recurse_LDADD = $(LDADD)
 get_recurse_DEPENDENCIES = ../src/libgetdata.la
+get_reprz_SOURCES = get_reprz.c
+get_reprz_OBJECTS = get_reprz.$(OBJEXT)
+get_reprz_LDADD = $(LDADD)
+get_reprz_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_sarray_SOURCES = get_sarray.c
+get_sarray_OBJECTS = get_sarray.$(OBJEXT)
+get_sarray_LDADD = $(LDADD)
+get_sarray_DEPENDENCIES = ../src/libgetdata.la
+get_sarray_bad_SOURCES = get_sarray_bad.c
+get_sarray_bad_OBJECTS = get_sarray_bad.$(OBJEXT)
+get_sarray_bad_LDADD = $(LDADD)
+get_sarray_bad_DEPENDENCIES = ../src/libgetdata.la
+get_sarray_slice_SOURCES = get_sarray_slice.c
+get_sarray_slice_OBJECTS = get_sarray_slice.$(OBJEXT)
+get_sarray_slice_LDADD = $(LDADD)
+get_sarray_slice_DEPENDENCIES = ../src/libgetdata.la
+get_sarray_slice_bounds_SOURCES = get_sarray_slice_bounds.c
+get_sarray_slice_bounds_OBJECTS = get_sarray_slice_bounds.$(OBJEXT)
+get_sarray_slice_bounds_LDADD = $(LDADD)
+get_sarray_slice_bounds_DEPENDENCIES = ../src/libgetdata.la
+get_sarray_slice_type_SOURCES = get_sarray_slice_type.c
+get_sarray_slice_type_OBJECTS = get_sarray_slice_type.$(OBJEXT)
+get_sarray_slice_type_LDADD = $(LDADD)
+get_sarray_slice_type_DEPENDENCIES = ../src/libgetdata.la
+get_sarray_type_SOURCES = get_sarray_type.c
+get_sarray_type_OBJECTS = get_sarray_type.$(OBJEXT)
+get_sarray_type_LDADD = $(LDADD)
+get_sarray_type_DEPENDENCIES = ../src/libgetdata.la
 get_sbit_SOURCES = get_sbit.c
 get_sbit_OBJECTS = get_sbit.$(OBJEXT)
 get_sbit_LDADD = $(LDADD)
@@ -3079,6 +4167,38 @@ get_sf_SOURCES = get_sf.c
 get_sf_OBJECTS = get_sf.$(OBJEXT)
 get_sf_LDADD = $(LDADD)
 get_sf_DEPENDENCIES = ../src/libgetdata.la
+get_sindir_SOURCES = get_sindir.c
+get_sindir_OBJECTS = get_sindir.$(OBJEXT)
+get_sindir_LDADD = $(LDADD)
+get_sindir_DEPENDENCIES = ../src/libgetdata.la
+get_sindir_code_SOURCES = get_sindir_code.c
+get_sindir_code_OBJECTS = get_sindir_code.$(OBJEXT)
+get_sindir_code_LDADD = $(LDADD)
+get_sindir_code_DEPENDENCIES = ../src/libgetdata.la
+get_sindir_neg_SOURCES = get_sindir_neg.c
+get_sindir_neg_OBJECTS = get_sindir_neg.$(OBJEXT)
+get_sindir_neg_LDADD = $(LDADD)
+get_sindir_neg_DEPENDENCIES = ../src/libgetdata.la
+get_sindir_none_SOURCES = get_sindir_none.c
+get_sindir_none_OBJECTS = get_sindir_none.$(OBJEXT)
+get_sindir_none_LDADD = $(LDADD)
+get_sindir_none_DEPENDENCIES = ../src/libgetdata.la
+get_sindir_null_SOURCES = get_sindir_null.c
+get_sindir_null_OBJECTS = get_sindir_null.$(OBJEXT)
+get_sindir_null_LDADD = $(LDADD)
+get_sindir_null_DEPENDENCIES = ../src/libgetdata.la
+get_sindir_reprz_SOURCES = get_sindir_reprz.c
+get_sindir_reprz_OBJECTS = get_sindir_reprz.$(OBJEXT)
+get_sindir_reprz_LDADD = $(LDADD)
+get_sindir_reprz_DEPENDENCIES = ../src/libgetdata.la
+get_sindir_type_SOURCES = get_sindir_type.c
+get_sindir_type_OBJECTS = get_sindir_type.$(OBJEXT)
+get_sindir_type_LDADD = $(LDADD)
+get_sindir_type_DEPENDENCIES = ../src/libgetdata.la
+get_sindir_typein_SOURCES = get_sindir_typein.c
+get_sindir_typein_OBJECTS = get_sindir_typein.$(OBJEXT)
+get_sindir_typein_LDADD = $(LDADD)
+get_sindir_typein_DEPENDENCIES = ../src/libgetdata.la
 get_ss_SOURCES = get_ss.c
 get_ss_OBJECTS = get_ss.$(OBJEXT)
 get_ss_LDADD = $(LDADD)
@@ -3163,30 +4283,42 @@ global_name_SOURCES = global_name.c
 global_name_OBJECTS = global_name.$(OBJEXT)
 global_name_LDADD = $(LDADD)
 global_name_DEPENDENCIES = ../src/libgetdata.la
-global_ref_SOURCES = global_ref.c
-global_ref_OBJECTS = global_ref.$(OBJEXT)
-global_ref_LDADD = $(LDADD)
-global_ref_DEPENDENCIES = ../src/libgetdata.la
-global_ref_empty_SOURCES = global_ref_empty.c
-global_ref_empty_OBJECTS = global_ref_empty.$(OBJEXT)
-global_ref_empty_LDADD = $(LDADD)
-global_ref_empty_DEPENDENCIES = ../src/libgetdata.la
-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_complex128_SOURCES = gzip_complex128.c
+gzip_complex128_OBJECTS = gzip_complex128.$(OBJEXT)
+gzip_complex128_LDADD = $(LDADD)
+gzip_complex128_DEPENDENCIES = ../src/libgetdata.la
+gzip_complex64_SOURCES = gzip_complex64.c
+gzip_complex64_OBJECTS = gzip_complex64.$(OBJEXT)
+gzip_complex64_LDADD = $(LDADD)
+gzip_complex64_DEPENDENCIES = ../src/libgetdata.la
 gzip_del_SOURCES = gzip_del.c
 gzip_del_OBJECTS = gzip_del.$(OBJEXT)
 gzip_del_LDADD = $(LDADD)
 gzip_del_DEPENDENCIES = ../src/libgetdata.la
+gzip_enoent_SOURCES = gzip_enoent.c
+gzip_enoent_OBJECTS = gzip_enoent.$(OBJEXT)
+gzip_enoent_LDADD = $(LDADD)
+gzip_enoent_DEPENDENCIES = ../src/libgetdata.la
+gzip_float32_SOURCES = gzip_float32.c
+gzip_float32_OBJECTS = gzip_float32.$(OBJEXT)
+gzip_float32_LDADD = $(LDADD)
+gzip_float32_DEPENDENCIES = ../src/libgetdata.la
+gzip_float64_SOURCES = gzip_float64.c
+gzip_float64_OBJECTS = gzip_float64.$(OBJEXT)
+gzip_float64_LDADD = $(LDADD)
+gzip_float64_DEPENDENCIES = ../src/libgetdata.la
 gzip_get_SOURCES = gzip_get.c
 gzip_get_OBJECTS = gzip_get.$(OBJEXT)
 gzip_get_LDADD = $(LDADD)
 gzip_get_DEPENDENCIES = ../src/libgetdata.la
+gzip_get_cont_SOURCES = gzip_get_cont.c
+gzip_get_cont_OBJECTS = gzip_get_cont.$(OBJEXT)
+gzip_get_cont_LDADD = $(LDADD)
+gzip_get_cont_DEPENDENCIES = ../src/libgetdata.la
 gzip_get_far_SOURCES = gzip_get_far.c
 gzip_get_far_OBJECTS = gzip_get_far.$(OBJEXT)
 gzip_get_far_LDADD = $(LDADD)
@@ -3203,6 +4335,22 @@ 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_int16_SOURCES = gzip_int16.c
+gzip_int16_OBJECTS = gzip_int16.$(OBJEXT)
+gzip_int16_LDADD = $(LDADD)
+gzip_int16_DEPENDENCIES = ../src/libgetdata.la
+gzip_int32_SOURCES = gzip_int32.c
+gzip_int32_OBJECTS = gzip_int32.$(OBJEXT)
+gzip_int32_LDADD = $(LDADD)
+gzip_int32_DEPENDENCIES = ../src/libgetdata.la
+gzip_int64_SOURCES = gzip_int64.c
+gzip_int64_OBJECTS = gzip_int64.$(OBJEXT)
+gzip_int64_LDADD = $(LDADD)
+gzip_int64_DEPENDENCIES = ../src/libgetdata.la
+gzip_int8_SOURCES = gzip_int8.c
+gzip_int8_OBJECTS = gzip_int8.$(OBJEXT)
+gzip_int8_LDADD = $(LDADD)
+gzip_int8_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)
@@ -3239,6 +4387,10 @@ gzip_put_off_SOURCES = gzip_put_off.c
 gzip_put_off_OBJECTS = gzip_put_off.$(OBJEXT)
 gzip_put_off_LDADD = $(LDADD)
 gzip_put_off_DEPENDENCIES = ../src/libgetdata.la
+gzip_put_offs_SOURCES = gzip_put_offs.c
+gzip_put_offs_OBJECTS = gzip_put_offs.$(OBJEXT)
+gzip_put_offs_LDADD = $(LDADD)
+gzip_put_offs_DEPENDENCIES = ../src/libgetdata.la
 gzip_put_pad_SOURCES = gzip_put_pad.c
 gzip_put_pad_OBJECTS = gzip_put_pad.$(OBJEXT)
 gzip_put_pad_LDADD = $(LDADD)
@@ -3263,6 +4415,22 @@ gzip_sync_SOURCES = gzip_sync.c
 gzip_sync_OBJECTS = gzip_sync.$(OBJEXT)
 gzip_sync_LDADD = $(LDADD)
 gzip_sync_DEPENDENCIES = ../src/libgetdata.la
+gzip_uint16_SOURCES = gzip_uint16.c
+gzip_uint16_OBJECTS = gzip_uint16.$(OBJEXT)
+gzip_uint16_LDADD = $(LDADD)
+gzip_uint16_DEPENDENCIES = ../src/libgetdata.la
+gzip_uint32_SOURCES = gzip_uint32.c
+gzip_uint32_OBJECTS = gzip_uint32.$(OBJEXT)
+gzip_uint32_LDADD = $(LDADD)
+gzip_uint32_DEPENDENCIES = ../src/libgetdata.la
+gzip_uint64_SOURCES = gzip_uint64.c
+gzip_uint64_OBJECTS = gzip_uint64.$(OBJEXT)
+gzip_uint64_LDADD = $(LDADD)
+gzip_uint64_DEPENDENCIES = ../src/libgetdata.la
+gzip_uint8_SOURCES = gzip_uint8.c
+gzip_uint8_OBJECTS = gzip_uint8.$(OBJEXT)
+gzip_uint8_LDADD = $(LDADD)
+gzip_uint8_DEPENDENCIES = ../src/libgetdata.la
 header_complex_SOURCES = header_complex.c
 header_complex_OBJECTS = header_complex.$(OBJEXT)
 header_complex_LDADD = $(LDADD)
@@ -3303,6 +4471,10 @@ include_affix_SOURCES = include_affix.c
 include_affix_OBJECTS = include_affix.$(OBJEXT)
 include_affix_LDADD = $(LDADD)
 include_affix_DEPENDENCIES = ../src/libgetdata.la
+include_affix_ns_SOURCES = include_affix_ns.c
+include_affix_ns_OBJECTS = include_affix_ns.$(OBJEXT)
+include_affix_ns_LDADD = $(LDADD)
+include_affix_ns_DEPENDENCIES = ../src/libgetdata.la
 include_auto_SOURCES = include_auto.c
 include_auto_OBJECTS = include_auto.$(OBJEXT)
 include_auto_LDADD = $(LDADD)
@@ -3315,6 +4487,10 @@ include_creat_SOURCES = include_creat.c
 include_creat_OBJECTS = include_creat.$(OBJEXT)
 include_creat_LDADD = $(LDADD)
 include_creat_DEPENDENCIES = ../src/libgetdata.la
+include_format_SOURCES = include_format.c
+include_format_OBJECTS = include_format.$(OBJEXT)
+include_format_LDADD = $(LDADD)
+include_format_DEPENDENCIES = ../src/libgetdata.la
 include_ignore_SOURCES = include_ignore.c
 include_ignore_OBJECTS = include_ignore.$(OBJEXT)
 include_ignore_LDADD = $(LDADD)
@@ -3331,18 +4507,66 @@ include_invalid_SOURCES = include_invalid.c
 include_invalid_OBJECTS = include_invalid.$(OBJEXT)
 include_invalid_LDADD = $(LDADD)
 include_invalid_DEPENDENCIES = ../src/libgetdata.la
+include_ndotdots_SOURCES = include_ndotdots.c
+include_ndotdots_OBJECTS = include_ndotdots.$(OBJEXT)
+include_ndotdots_LDADD = $(LDADD)
+include_ndotdots_DEPENDENCIES = ../src/libgetdata.la
+include_ndots_SOURCES = include_ndots.c
+include_ndots_OBJECTS = include_ndots.$(OBJEXT)
+include_ndots_LDADD = $(LDADD)
+include_ndots_DEPENDENCIES = ../src/libgetdata.la
 include_nonexistent_SOURCES = include_nonexistent.c
 include_nonexistent_OBJECTS = include_nonexistent.$(OBJEXT)
 include_nonexistent_LDADD = $(LDADD)
 include_nonexistent_DEPENDENCIES = ../src/libgetdata.la
+include_ns_SOURCES = include_ns.c
+include_ns_OBJECTS = include_ns.$(OBJEXT)
+include_ns_LDADD = $(LDADD)
+include_ns_DEPENDENCIES = ../src/libgetdata.la
+include_ns_dot_SOURCES = include_ns_dot.c
+include_ns_dot_OBJECTS = include_ns_dot.$(OBJEXT)
+include_ns_dot_LDADD = $(LDADD)
+include_ns_dot_DEPENDENCIES = ../src/libgetdata.la
+include_ns_dotdot_SOURCES = include_ns_dotdot.c
+include_ns_dotdot_OBJECTS = include_ns_dotdot.$(OBJEXT)
+include_ns_dotdot_LDADD = $(LDADD)
+include_ns_dotdot_DEPENDENCIES = ../src/libgetdata.la
+include_ns_dotns_SOURCES = include_ns_dotns.c
+include_ns_dotns_OBJECTS = include_ns_dotns.$(OBJEXT)
+include_ns_dotns_LDADD = $(LDADD)
+include_ns_dotns_DEPENDENCIES = ../src/libgetdata.la
+include_ns_nil_SOURCES = include_ns_nil.c
+include_ns_nil_OBJECTS = include_ns_nil.$(OBJEXT)
+include_ns_nil_LDADD = $(LDADD)
+include_ns_nil_DEPENDENCIES = ../src/libgetdata.la
+include_ns_null_SOURCES = include_ns_null.c
+include_ns_null_OBJECTS = include_ns_null.$(OBJEXT)
+include_ns_null_LDADD = $(LDADD)
+include_ns_null_DEPENDENCIES = ../src/libgetdata.la
+include_ns_prefix_SOURCES = include_ns_prefix.c
+include_ns_prefix_OBJECTS = include_ns_prefix.$(OBJEXT)
+include_ns_prefix_LDADD = $(LDADD)
+include_ns_prefix_DEPENDENCIES = ../src/libgetdata.la
 include_pc_SOURCES = include_pc.c
 include_pc_OBJECTS = include_pc.$(OBJEXT)
 include_pc_LDADD = $(LDADD)
 include_pc_DEPENDENCIES = ../src/libgetdata.la
+include_prot_SOURCES = include_prot.c
+include_prot_OBJECTS = include_prot.$(OBJEXT)
+include_prot_LDADD = $(LDADD)
+include_prot_DEPENDENCIES = ../src/libgetdata.la
 include_ref_SOURCES = include_ref.c
 include_ref_OBJECTS = include_ref.$(OBJEXT)
 include_ref_LDADD = $(LDADD)
 include_ref_DEPENDENCIES = ../src/libgetdata.la
+include_ref_code_SOURCES = include_ref_code.c
+include_ref_code_OBJECTS = include_ref_code.$(OBJEXT)
+include_ref_code_LDADD = $(LDADD)
+include_ref_code_DEPENDENCIES = ../src/libgetdata.la
+include_ref_type_SOURCES = include_ref_type.c
+include_ref_type_OBJECTS = include_ref_type.$(OBJEXT)
+include_ref_type_LDADD = $(LDADD)
+include_ref_type_DEPENDENCIES = ../src/libgetdata.la
 include_sub_SOURCES = include_sub.c
 include_sub_OBJECTS = include_sub.$(OBJEXT)
 include_sub_LDADD = $(LDADD)
@@ -3355,18 +4579,34 @@ index_domain_SOURCES = index_domain.c
 index_domain_OBJECTS = index_domain.$(OBJEXT)
 index_domain_LDADD = $(LDADD)
 index_domain_DEPENDENCIES = ../src/libgetdata.la
+index_empty_SOURCES = index_empty.c
+index_empty_OBJECTS = index_empty.$(OBJEXT)
+index_empty_LDADD = $(LDADD)
+index_empty_DEPENDENCIES = ../src/libgetdata.la
 index_index_SOURCES = index_index.c
 index_index_OBJECTS = index_index.$(OBJEXT)
 index_index_LDADD = $(LDADD)
 index_index_DEPENDENCIES = ../src/libgetdata.la
+index_one_SOURCES = index_one.c
+index_one_OBJECTS = index_one.$(OBJEXT)
+index_one_LDADD = $(LDADD)
+index_one_DEPENDENCIES = ../src/libgetdata.la
 index_range_SOURCES = index_range.c
 index_range_OBJECTS = index_range.$(OBJEXT)
 index_range_LDADD = $(LDADD)
 index_range_DEPENDENCIES = ../src/libgetdata.la
+index_reprz_SOURCES = index_reprz.c
+index_reprz_OBJECTS = index_reprz.$(OBJEXT)
+index_reprz_LDADD = $(LDADD)
+index_reprz_DEPENDENCIES = ../src/libgetdata.la
 index_s_SOURCES = index_s.c
 index_s_OBJECTS = index_s.$(OBJEXT)
 index_s_LDADD = $(LDADD)
 index_s_DEPENDENCIES = ../src/libgetdata.la
+index_scalar_SOURCES = index_scalar.c
+index_scalar_OBJECTS = index_scalar.$(OBJEXT)
+index_scalar_LDADD = $(LDADD)
+index_scalar_DEPENDENCIES = ../src/libgetdata.la
 index_subset_SOURCES = index_subset.c
 index_subset_OBJECTS = index_subset.$(OBJEXT)
 index_subset_LDADD = $(LDADD)
@@ -3411,6 +4651,34 @@ legacy_spf_SOURCES = legacy_spf.c
 legacy_spf_OBJECTS = legacy_spf.$(OBJEXT)
 legacy_spf_LDADD = $(LDADD)
 legacy_spf_DEPENDENCIES = ../src/libgetdata.la
+len_bad_SOURCES = len_bad.c
+len_bad_OBJECTS = len_bad.$(OBJEXT)
+len_bad_LDADD = $(LDADD)
+len_bad_DEPENDENCIES = ../src/libgetdata.la
+len_carray_SOURCES = len_carray.c
+len_carray_OBJECTS = len_carray.$(OBJEXT)
+len_carray_LDADD = $(LDADD)
+len_carray_DEPENDENCIES = ../src/libgetdata.la
+len_const_SOURCES = len_const.c
+len_const_OBJECTS = len_const.$(OBJEXT)
+len_const_LDADD = $(LDADD)
+len_const_DEPENDENCIES = ../src/libgetdata.la
+len_sarray_SOURCES = len_sarray.c
+len_sarray_OBJECTS = len_sarray.$(OBJEXT)
+len_sarray_LDADD = $(LDADD)
+len_sarray_DEPENDENCIES = ../src/libgetdata.la
+len_string_SOURCES = len_string.c
+len_string_OBJECTS = len_string.$(OBJEXT)
+len_string_LDADD = $(LDADD)
+len_string_DEPENDENCIES = ../src/libgetdata.la
+len_type_SOURCES = len_type.c
+len_type_OBJECTS = len_type.$(OBJEXT)
+len_type_LDADD = $(LDADD)
+len_type_DEPENDENCIES = ../src/libgetdata.la
+lzma_enoent_SOURCES = lzma_enoent.c
+lzma_enoent_OBJECTS = lzma_enoent.$(OBJEXT)
+lzma_enoent_LDADD = $(LDADD)
+lzma_enoent_DEPENDENCIES = ../src/libgetdata.la
 lzma_get_SOURCES = lzma_get.c
 lzma_get_OBJECTS = lzma_get.$(OBJEXT)
 lzma_get_LDADD = $(LDADD)
@@ -3427,10 +4695,34 @@ lzma_xz_add_SOURCES = lzma_xz_add.c
 lzma_xz_add_OBJECTS = lzma_xz_add.$(OBJEXT)
 lzma_xz_add_LDADD = $(LDADD)
 lzma_xz_add_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_complex128_SOURCES = lzma_xz_complex128.c
+lzma_xz_complex128_OBJECTS = lzma_xz_complex128.$(OBJEXT)
+lzma_xz_complex128_LDADD = $(LDADD)
+lzma_xz_complex128_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_complex64_SOURCES = lzma_xz_complex64.c
+lzma_xz_complex64_OBJECTS = lzma_xz_complex64.$(OBJEXT)
+lzma_xz_complex64_LDADD = $(LDADD)
+lzma_xz_complex64_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_del_SOURCES = lzma_xz_del.c
+lzma_xz_del_OBJECTS = lzma_xz_del.$(OBJEXT)
+lzma_xz_del_LDADD = $(LDADD)
+lzma_xz_del_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_float32_SOURCES = lzma_xz_float32.c
+lzma_xz_float32_OBJECTS = lzma_xz_float32.$(OBJEXT)
+lzma_xz_float32_LDADD = $(LDADD)
+lzma_xz_float32_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_float64_SOURCES = lzma_xz_float64.c
+lzma_xz_float64_OBJECTS = lzma_xz_float64.$(OBJEXT)
+lzma_xz_float64_LDADD = $(LDADD)
+lzma_xz_float64_DEPENDENCIES = ../src/libgetdata.la
 lzma_xz_get_SOURCES = lzma_xz_get.c
 lzma_xz_get_OBJECTS = lzma_xz_get.$(OBJEXT)
 lzma_xz_get_LDADD = $(LDADD)
 lzma_xz_get_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_get_cont_SOURCES = lzma_xz_get_cont.c
+lzma_xz_get_cont_OBJECTS = lzma_xz_get_cont.$(OBJEXT)
+lzma_xz_get_cont_LDADD = $(LDADD)
+lzma_xz_get_cont_DEPENDENCIES = ../src/libgetdata.la
 lzma_xz_get_far_SOURCES = lzma_xz_get_far.c
 lzma_xz_get_far_OBJECTS = lzma_xz_get_far.$(OBJEXT)
 lzma_xz_get_far_LDADD = $(LDADD)
@@ -3447,6 +4739,26 @@ lzma_xz_get_put_SOURCES = lzma_xz_get_put.c
 lzma_xz_get_put_OBJECTS = lzma_xz_get_put.$(OBJEXT)
 lzma_xz_get_put_LDADD = $(LDADD)
 lzma_xz_get_put_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_int16_SOURCES = lzma_xz_int16.c
+lzma_xz_int16_OBJECTS = lzma_xz_int16.$(OBJEXT)
+lzma_xz_int16_LDADD = $(LDADD)
+lzma_xz_int16_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_int32_SOURCES = lzma_xz_int32.c
+lzma_xz_int32_OBJECTS = lzma_xz_int32.$(OBJEXT)
+lzma_xz_int32_LDADD = $(LDADD)
+lzma_xz_int32_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_int64_SOURCES = lzma_xz_int64.c
+lzma_xz_int64_OBJECTS = lzma_xz_int64.$(OBJEXT)
+lzma_xz_int64_LDADD = $(LDADD)
+lzma_xz_int64_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_int8_SOURCES = lzma_xz_int8.c
+lzma_xz_int8_OBJECTS = lzma_xz_int8.$(OBJEXT)
+lzma_xz_int8_LDADD = $(LDADD)
+lzma_xz_int8_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_move_from_SOURCES = lzma_xz_move_from.c
+lzma_xz_move_from_OBJECTS = lzma_xz_move_from.$(OBJEXT)
+lzma_xz_move_from_LDADD = $(LDADD)
+lzma_xz_move_from_DEPENDENCIES = ../src/libgetdata.la
 lzma_xz_move_to_SOURCES = lzma_xz_move_to.c
 lzma_xz_move_to_OBJECTS = lzma_xz_move_to.$(OBJEXT)
 lzma_xz_move_to_LDADD = $(LDADD)
@@ -3455,6 +4767,10 @@ lzma_xz_nframes_SOURCES = lzma_xz_nframes.c
 lzma_xz_nframes_OBJECTS = lzma_xz_nframes.$(OBJEXT)
 lzma_xz_nframes_LDADD = $(LDADD)
 lzma_xz_nframes_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_offs_clear_SOURCES = lzma_xz_offs_clear.c
+lzma_xz_offs_clear_OBJECTS = lzma_xz_offs_clear.$(OBJEXT)
+lzma_xz_offs_clear_LDADD = $(LDADD)
+lzma_xz_offs_clear_DEPENDENCIES = ../src/libgetdata.la
 lzma_xz_put_SOURCES = lzma_xz_put.c
 lzma_xz_put_OBJECTS = lzma_xz_put.$(OBJEXT)
 lzma_xz_put_LDADD = $(LDADD)
@@ -3471,6 +4787,10 @@ lzma_xz_put_get_SOURCES = lzma_xz_put_get.c
 lzma_xz_put_get_OBJECTS = lzma_xz_put_get.$(OBJEXT)
 lzma_xz_put_get_LDADD = $(LDADD)
 lzma_xz_put_get_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_put_offs_SOURCES = lzma_xz_put_offs.c
+lzma_xz_put_offs_OBJECTS = lzma_xz_put_offs.$(OBJEXT)
+lzma_xz_put_offs_LDADD = $(LDADD)
+lzma_xz_put_offs_DEPENDENCIES = ../src/libgetdata.la
 lzma_xz_put_pad_SOURCES = lzma_xz_put_pad.c
 lzma_xz_put_pad_OBJECTS = lzma_xz_put_pad.$(OBJEXT)
 lzma_xz_put_pad_LDADD = $(LDADD)
@@ -3487,6 +4807,22 @@ lzma_xz_sync_SOURCES = lzma_xz_sync.c
 lzma_xz_sync_OBJECTS = lzma_xz_sync.$(OBJEXT)
 lzma_xz_sync_LDADD = $(LDADD)
 lzma_xz_sync_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_uint16_SOURCES = lzma_xz_uint16.c
+lzma_xz_uint16_OBJECTS = lzma_xz_uint16.$(OBJEXT)
+lzma_xz_uint16_LDADD = $(LDADD)
+lzma_xz_uint16_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_uint32_SOURCES = lzma_xz_uint32.c
+lzma_xz_uint32_OBJECTS = lzma_xz_uint32.$(OBJEXT)
+lzma_xz_uint32_LDADD = $(LDADD)
+lzma_xz_uint32_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_uint64_SOURCES = lzma_xz_uint64.c
+lzma_xz_uint64_OBJECTS = lzma_xz_uint64.$(OBJEXT)
+lzma_xz_uint64_LDADD = $(LDADD)
+lzma_xz_uint64_DEPENDENCIES = ../src/libgetdata.la
+lzma_xz_uint8_SOURCES = lzma_xz_uint8.c
+lzma_xz_uint8_OBJECTS = lzma_xz_uint8.$(OBJEXT)
+lzma_xz_uint8_LDADD = $(LDADD)
+lzma_xz_uint8_DEPENDENCIES = ../src/libgetdata.la
 madd_SOURCES = madd.c
 madd_OBJECTS = madd.$(OBJEXT)
 madd_LDADD = $(LDADD)
@@ -3503,6 +4839,18 @@ 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_alias_alias_SOURCES = madd_alias_alias.c
+madd_alias_alias_OBJECTS = madd_alias_alias.$(OBJEXT)
+madd_alias_alias_LDADD = $(LDADD)
+madd_alias_alias_DEPENDENCIES = ../src/libgetdata.la
+madd_alias_subsub_SOURCES = madd_alias_subsub.c
+madd_alias_subsub_OBJECTS = madd_alias_subsub.$(OBJEXT)
+madd_alias_subsub_LDADD = $(LDADD)
+madd_alias_subsub_DEPENDENCIES = ../src/libgetdata.la
+madd_aliasmeta_SOURCES = madd_aliasmeta.c
+madd_aliasmeta_OBJECTS = madd_aliasmeta.$(OBJEXT)
+madd_aliasmeta_LDADD = $(LDADD)
+madd_aliasmeta_DEPENDENCIES = ../src/libgetdata.la
 madd_bit_SOURCES = madd_bit.c
 madd_bit_OBJECTS = madd_bit.$(OBJEXT)
 madd_bit_LDADD = $(LDADD)
@@ -3519,6 +4867,10 @@ madd_clincom_SOURCES = madd_clincom.c
 madd_clincom_OBJECTS = madd_clincom.$(OBJEXT)
 madd_clincom_LDADD = $(LDADD)
 madd_clincom_DEPENDENCIES = ../src/libgetdata.la
+madd_clincom_nfields_SOURCES = madd_clincom_nfields.c
+madd_clincom_nfields_OBJECTS = madd_clincom_nfields.$(OBJEXT)
+madd_clincom_nfields_LDADD = $(LDADD)
+madd_clincom_nfields_DEPENDENCIES = ../src/libgetdata.la
 madd_const_SOURCES = madd_const.c
 madd_const_OBJECTS = madd_const.$(OBJEXT)
 madd_const_LDADD = $(LDADD)
@@ -3527,6 +4879,10 @@ madd_cpolynom_SOURCES = madd_cpolynom.c
 madd_cpolynom_OBJECTS = madd_cpolynom.$(OBJEXT)
 madd_cpolynom_LDADD = $(LDADD)
 madd_cpolynom_DEPENDENCIES = ../src/libgetdata.la
+madd_cpolynom_order_SOURCES = madd_cpolynom_order.c
+madd_cpolynom_order_OBJECTS = madd_cpolynom_order.$(OBJEXT)
+madd_cpolynom_order_LDADD = $(LDADD)
+madd_cpolynom_order_DEPENDENCIES = ../src/libgetdata.la
 madd_crecip_SOURCES = madd_crecip.c
 madd_crecip_OBJECTS = madd_crecip.$(OBJEXT)
 madd_crecip_LDADD = $(LDADD)
@@ -3543,6 +4899,10 @@ madd_index_SOURCES = madd_index.c
 madd_index_OBJECTS = madd_index.$(OBJEXT)
 madd_index_LDADD = $(LDADD)
 madd_index_DEPENDENCIES = ../src/libgetdata.la
+madd_indir_SOURCES = madd_indir.c
+madd_indir_OBJECTS = madd_indir.$(OBJEXT)
+madd_indir_LDADD = $(LDADD)
+madd_indir_DEPENDENCIES = ../src/libgetdata.la
 madd_lincom_SOURCES = madd_lincom.c
 madd_lincom_OBJECTS = madd_lincom.$(OBJEXT)
 madd_lincom_LDADD = $(LDADD)
@@ -3551,6 +4911,10 @@ madd_lincom_invalid_SOURCES = madd_lincom_invalid.c
 madd_lincom_invalid_OBJECTS = madd_lincom_invalid.$(OBJEXT)
 madd_lincom_invalid_LDADD = $(LDADD)
 madd_lincom_invalid_DEPENDENCIES = ../src/libgetdata.la
+madd_lincom_nfields_SOURCES = madd_lincom_nfields.c
+madd_lincom_nfields_OBJECTS = madd_lincom_nfields.$(OBJEXT)
+madd_lincom_nfields_LDADD = $(LDADD)
+madd_lincom_nfields_DEPENDENCIES = ../src/libgetdata.la
 madd_linterp_SOURCES = madd_linterp.c
 madd_linterp_OBJECTS = madd_linterp.$(OBJEXT)
 madd_linterp_LDADD = $(LDADD)
@@ -3571,6 +4935,10 @@ madd_multiply_invalid_SOURCES = madd_multiply_invalid.c
 madd_multiply_invalid_OBJECTS = madd_multiply_invalid.$(OBJEXT)
 madd_multiply_invalid_LDADD = $(LDADD)
 madd_multiply_invalid_DEPENDENCIES = ../src/libgetdata.la
+madd_parent_bad_SOURCES = madd_parent_bad.c
+madd_parent_bad_OBJECTS = madd_parent_bad.$(OBJEXT)
+madd_parent_bad_LDADD = $(LDADD)
+madd_parent_bad_DEPENDENCIES = ../src/libgetdata.la
 madd_phase_SOURCES = madd_phase.c
 madd_phase_OBJECTS = madd_phase.$(OBJEXT)
 madd_phase_LDADD = $(LDADD)
@@ -3583,14 +4951,34 @@ madd_polynom_SOURCES = madd_polynom.c
 madd_polynom_OBJECTS = madd_polynom.$(OBJEXT)
 madd_polynom_LDADD = $(LDADD)
 madd_polynom_DEPENDENCIES = ../src/libgetdata.la
+madd_polynom_order_SOURCES = madd_polynom_order.c
+madd_polynom_order_OBJECTS = madd_polynom_order.$(OBJEXT)
+madd_polynom_order_LDADD = $(LDADD)
+madd_polynom_order_DEPENDENCIES = ../src/libgetdata.la
+madd_raw_SOURCES = madd_raw.c
+madd_raw_OBJECTS = madd_raw.$(OBJEXT)
+madd_raw_LDADD = $(LDADD)
+madd_raw_DEPENDENCIES = ../src/libgetdata.la
 madd_recip_SOURCES = madd_recip.c
 madd_recip_OBJECTS = madd_recip.$(OBJEXT)
 madd_recip_LDADD = $(LDADD)
 madd_recip_DEPENDENCIES = ../src/libgetdata.la
+madd_sarray_SOURCES = madd_sarray.c
+madd_sarray_OBJECTS = madd_sarray.$(OBJEXT)
+madd_sarray_LDADD = $(LDADD)
+madd_sarray_DEPENDENCIES = ../src/libgetdata.la
+madd_sarray_dup_SOURCES = madd_sarray_dup.c
+madd_sarray_dup_OBJECTS = madd_sarray_dup.$(OBJEXT)
+madd_sarray_dup_LDADD = $(LDADD)
+madd_sarray_dup_DEPENDENCIES = ../src/libgetdata.la
 madd_sbit_SOURCES = madd_sbit.c
 madd_sbit_OBJECTS = madd_sbit.$(OBJEXT)
 madd_sbit_LDADD = $(LDADD)
 madd_sbit_DEPENDENCIES = ../src/libgetdata.la
+madd_sindir_SOURCES = madd_sindir.c
+madd_sindir_OBJECTS = madd_sindir.$(OBJEXT)
+madd_sindir_LDADD = $(LDADD)
+madd_sindir_DEPENDENCIES = ../src/libgetdata.la
 madd_spec_SOURCES = madd_spec.c
 madd_spec_OBJECTS = madd_spec.$(OBJEXT)
 madd_spec_LDADD = $(LDADD)
@@ -3603,6 +4991,10 @@ 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_parent_SOURCES = madd_spec_parent.c
+madd_spec_parent_OBJECTS = madd_spec_parent.$(OBJEXT)
+madd_spec_parent_LDADD = $(LDADD)
+madd_spec_parent_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)
@@ -3611,10 +5003,142 @@ madd_string_SOURCES = madd_string.c
 madd_string_OBJECTS = madd_string.$(OBJEXT)
 madd_string_LDADD = $(LDADD)
 madd_string_DEPENDENCIES = ../src/libgetdata.la
+madd_string_dup_SOURCES = madd_string_dup.c
+madd_string_dup_OBJECTS = madd_string_dup.$(OBJEXT)
+madd_string_dup_LDADD = $(LDADD)
+madd_string_dup_DEPENDENCIES = ../src/libgetdata.la
+madd_subsub_SOURCES = madd_subsub.c
+madd_subsub_OBJECTS = madd_subsub.$(OBJEXT)
+madd_subsub_LDADD = $(LDADD)
+madd_subsub_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
+match_fragment_SOURCES = match_fragment.c
+match_fragment_OBJECTS = match_fragment.$(OBJEXT)
+match_fragment_LDADD = $(LDADD)
+match_fragment_DEPENDENCIES = ../src/libgetdata.la
+match_pcre_SOURCES = match_pcre.c
+match_pcre_OBJECTS = match_pcre.$(OBJEXT)
+match_pcre_LDADD = $(LDADD)
+match_pcre_DEPENDENCIES = ../src/libgetdata.la
+match_pcre_bad_SOURCES = match_pcre_bad.c
+match_pcre_bad_OBJECTS = match_pcre_bad.$(OBJEXT)
+match_pcre_bad_LDADD = $(LDADD)
+match_pcre_bad_DEPENDENCIES = ../src/libgetdata.la
+match_pcre_caseless_SOURCES = match_pcre_caseless.c
+match_pcre_caseless_OBJECTS = match_pcre_caseless.$(OBJEXT)
+match_pcre_caseless_LDADD = $(LDADD)
+match_pcre_caseless_DEPENDENCIES = ../src/libgetdata.la
+match_pcre_ext_SOURCES = match_pcre_ext.c
+match_pcre_ext_OBJECTS = match_pcre_ext.$(OBJEXT)
+match_pcre_ext_LDADD = $(LDADD)
+match_pcre_ext_DEPENDENCIES = ../src/libgetdata.la
+match_pcre_js_SOURCES = match_pcre_js.c
+match_pcre_js_OBJECTS = match_pcre_js.$(OBJEXT)
+match_pcre_js_LDADD = $(LDADD)
+match_pcre_js_DEPENDENCIES = ../src/libgetdata.la
+match_pcre_utf8_SOURCES = match_pcre_utf8.c
+match_pcre_utf8_OBJECTS = match_pcre_utf8.$(OBJEXT)
+match_pcre_utf8_LDADD = $(LDADD)
+match_pcre_utf8_DEPENDENCIES = ../src/libgetdata.la
+match_regex_SOURCES = match_regex.c
+match_regex_OBJECTS = match_regex.$(OBJEXT)
+match_regex_LDADD = $(LDADD)
+match_regex_DEPENDENCIES = ../src/libgetdata.la
+match_regex_bad_SOURCES = match_regex_bad.c
+match_regex_bad_OBJECTS = match_regex_bad.$(OBJEXT)
+match_regex_bad_LDADD = $(LDADD)
+match_regex_bad_DEPENDENCIES = ../src/libgetdata.la
+match_regex_ext_SOURCES = match_regex_ext.c
+match_regex_ext_OBJECTS = match_regex_ext.$(OBJEXT)
+match_regex_ext_LDADD = $(LDADD)
+match_regex_ext_DEPENDENCIES = ../src/libgetdata.la
+match_regex_icase_SOURCES = match_regex_icase.c
+match_regex_icase_OBJECTS = match_regex_icase.$(OBJEXT)
+match_regex_icase_LDADD = $(LDADD)
+match_regex_icase_DEPENDENCIES = ../src/libgetdata.la
+mflush_SOURCES = mflush.c
+mflush_OBJECTS = mflush.$(OBJEXT)
+mflush_LDADD = $(LDADD)
+mflush_DEPENDENCIES = ../src/libgetdata.la
+mflush_affix_SOURCES = mflush_affix.c
+mflush_affix_OBJECTS = mflush_affix.$(OBJEXT)
+mflush_affix_LDADD = $(LDADD)
+mflush_affix_DEPENDENCIES = ../src/libgetdata.la
+mflush_amb_code_SOURCES = mflush_amb_code.c
+mflush_amb_code_OBJECTS = mflush_amb_code.$(OBJEXT)
+mflush_amb_code_LDADD = $(LDADD)
+mflush_amb_code_DEPENDENCIES = ../src/libgetdata.la
+mflush_carray_SOURCES = mflush_carray.c
+mflush_carray_OBJECTS = mflush_carray.$(OBJEXT)
+mflush_carray_LDADD = $(LDADD)
+mflush_carray_DEPENDENCIES = ../src/libgetdata.la
+mflush_hex_SOURCES = mflush_hex.c
+mflush_hex_OBJECTS = mflush_hex.$(OBJEXT)
+mflush_hex_LDADD = $(LDADD)
+mflush_hex_DEPENDENCIES = ../src/libgetdata.la
+mflush_indir_SOURCES = mflush_indir.c
+mflush_indir_OBJECTS = mflush_indir.$(OBJEXT)
+mflush_indir_LDADD = $(LDADD)
+mflush_indir_DEPENDENCIES = ../src/libgetdata.la
+mflush_mplex_SOURCES = mflush_mplex.c
+mflush_mplex_OBJECTS = mflush_mplex.$(OBJEXT)
+mflush_mplex_LDADD = $(LDADD)
+mflush_mplex_DEPENDENCIES = ../src/libgetdata.la
+mflush_ns_SOURCES = mflush_ns.c
+mflush_ns_OBJECTS = mflush_ns.$(OBJEXT)
+mflush_ns_LDADD = $(LDADD)
+mflush_ns_DEPENDENCIES = ../src/libgetdata.la
+mflush_pretty_SOURCES = mflush_pretty.c
+mflush_pretty_OBJECTS = mflush_pretty.$(OBJEXT)
+mflush_pretty_LDADD = $(LDADD)
+mflush_pretty_DEPENDENCIES = ../src/libgetdata.la
+mflush_prot_SOURCES = mflush_prot.c
+mflush_prot_OBJECTS = mflush_prot.$(OBJEXT)
+mflush_prot_LDADD = $(LDADD)
+mflush_prot_DEPENDENCIES = ../src/libgetdata.la
+mflush_ref_SOURCES = mflush_ref.c
+mflush_ref_OBJECTS = mflush_ref.$(OBJEXT)
+mflush_ref_LDADD = $(LDADD)
+mflush_ref_DEPENDENCIES = ../src/libgetdata.la
+mflush_repr_SOURCES = mflush_repr.c
+mflush_repr_OBJECTS = mflush_repr.$(OBJEXT)
+mflush_repr_LDADD = $(LDADD)
+mflush_repr_DEPENDENCIES = ../src/libgetdata.la
+mflush_repr9_SOURCES = mflush_repr9.c
+mflush_repr9_OBJECTS = mflush_repr9.$(OBJEXT)
+mflush_repr9_LDADD = $(LDADD)
+mflush_repr9_DEPENDENCIES = ../src/libgetdata.la
+mflush_reprz_SOURCES = mflush_reprz.c
+mflush_reprz_OBJECTS = mflush_reprz.$(OBJEXT)
+mflush_reprz_LDADD = $(LDADD)
+mflush_reprz_DEPENDENCIES = ../src/libgetdata.la
+mflush_sindir_SOURCES = mflush_sindir.c
+mflush_sindir_OBJECTS = mflush_sindir.$(OBJEXT)
+mflush_sindir_LDADD = $(LDADD)
+mflush_sindir_DEPENDENCIES = ../src/libgetdata.la
+mflush_spec_SOURCES = mflush_spec.c
+mflush_spec_OBJECTS = mflush_spec.$(OBJEXT)
+mflush_spec_LDADD = $(LDADD)
+mflush_spec_DEPENDENCIES = ../src/libgetdata.la
+mflush_string_SOURCES = mflush_string.c
+mflush_string_OBJECTS = mflush_string.$(OBJEXT)
+mflush_string_LDADD = $(LDADD)
+mflush_string_DEPENDENCIES = ../src/libgetdata.la
+mflush_type_SOURCES = mflush_type.c
+mflush_type_OBJECTS = mflush_type.$(OBJEXT)
+mflush_type_LDADD = $(LDADD)
+mflush_type_DEPENDENCIES = ../src/libgetdata.la
+mflush_type4_SOURCES = mflush_type4.c
+mflush_type4_OBJECTS = mflush_type4.$(OBJEXT)
+mflush_type4_LDADD = $(LDADD)
+mflush_type4_DEPENDENCIES = ../src/libgetdata.la
+mflush_windop_SOURCES = mflush_windop.c
+mflush_windop_OBJECTS = mflush_windop.$(OBJEXT)
+mflush_windop_LDADD = $(LDADD)
+mflush_windop_DEPENDENCIES = ../src/libgetdata.la
 move_affix_SOURCES = move_affix.c
 move_affix_OBJECTS = move_affix.$(OBJEXT)
 move_affix_LDADD = $(LDADD)
@@ -3635,6 +5159,10 @@ move_alias_SOURCES = move_alias.c
 move_alias_OBJECTS = move_alias.$(OBJEXT)
 move_alias_LDADD = $(LDADD)
 move_alias_DEPENDENCIES = ../src/libgetdata.la
+move_code_SOURCES = move_code.c
+move_code_OBJECTS = move_code.$(OBJEXT)
+move_code_LDADD = $(LDADD)
+move_code_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)
@@ -3643,6 +5171,10 @@ move_data_enc_ra_SOURCES = move_data_enc_ra.c
 move_data_enc_ra_OBJECTS = move_data_enc_ra.$(OBJEXT)
 move_data_enc_ra_LDADD = $(LDADD)
 move_data_enc_ra_DEPENDENCIES = ../src/libgetdata.la
+move_data_enc_un_SOURCES = move_data_enc_un.c
+move_data_enc_un_OBJECTS = move_data_enc_un.$(OBJEXT)
+move_data_enc_un_LDADD = $(LDADD)
+move_data_enc_un_DEPENDENCIES = ../src/libgetdata.la
 move_data_endian_SOURCES = move_data_endian.c
 move_data_endian_OBJECTS = move_data_endian.$(OBJEXT)
 move_data_endian_LDADD = $(LDADD)
@@ -3659,6 +5191,14 @@ move_data_nop_SOURCES = move_data_nop.c
 move_data_nop_OBJECTS = move_data_nop.$(OBJEXT)
 move_data_nop_LDADD = $(LDADD)
 move_data_nop_DEPENDENCIES = ../src/libgetdata.la
+move_data_prot_SOURCES = move_data_prot.c
+move_data_prot_OBJECTS = move_data_prot.$(OBJEXT)
+move_data_prot_LDADD = $(LDADD)
+move_data_prot_DEPENDENCIES = ../src/libgetdata.la
+move_entype_SOURCES = move_entype.c
+move_entype_OBJECTS = move_entype.$(OBJEXT)
+move_entype_LDADD = $(LDADD)
+move_entype_DEPENDENCIES = ../src/libgetdata.la
 move_index_SOURCES = move_index.c
 move_index_OBJECTS = move_index.$(OBJEXT)
 move_index_LDADD = $(LDADD)
@@ -3671,14 +5211,34 @@ move_move_SOURCES = move_move.c
 move_move_OBJECTS = move_move.$(OBJEXT)
 move_move_LDADD = $(LDADD)
 move_move_DEPENDENCIES = ../src/libgetdata.la
+move_nop_SOURCES = move_nop.c
+move_nop_OBJECTS = move_nop.$(OBJEXT)
+move_nop_LDADD = $(LDADD)
+move_nop_DEPENDENCIES = ../src/libgetdata.la
+move_ns_SOURCES = move_ns.c
+move_ns_OBJECTS = move_ns.$(OBJEXT)
+move_ns_LDADD = $(LDADD)
+move_ns_DEPENDENCIES = ../src/libgetdata.la
+move_nsns_SOURCES = move_nsns.c
+move_nsns_OBJECTS = move_nsns.$(OBJEXT)
+move_nsns_LDADD = $(LDADD)
+move_nsns_DEPENDENCIES = ../src/libgetdata.la
 move_protect_SOURCES = move_protect.c
 move_protect_OBJECTS = move_protect.$(OBJEXT)
 move_protect_LDADD = $(LDADD)
 move_protect_DEPENDENCIES = ../src/libgetdata.la
+move_rdonly_SOURCES = move_rdonly.c
+move_rdonly_OBJECTS = move_rdonly.$(OBJEXT)
+move_rdonly_LDADD = $(LDADD)
+move_rdonly_DEPENDENCIES = ../src/libgetdata.la
 move_subdir_SOURCES = move_subdir.c
 move_subdir_OBJECTS = move_subdir.$(OBJEXT)
 move_subdir_LDADD = $(LDADD)
 move_subdir_DEPENDENCIES = ../src/libgetdata.la
+move_unkenc_SOURCES = move_unkenc.c
+move_unkenc_OBJECTS = move_unkenc.$(OBJEXT)
+move_unkenc_LDADD = $(LDADD)
+move_unkenc_DEPENDENCIES = ../src/libgetdata.la
 name_affix_SOURCES = name_affix.c
 name_affix_OBJECTS = name_affix.$(OBJEXT)
 name_affix_LDADD = $(LDADD)
@@ -3691,10 +5251,18 @@ name_alias_SOURCES = name_alias.c
 name_alias_OBJECTS = name_alias.$(OBJEXT)
 name_alias_LDADD = $(LDADD)
 name_alias_DEPENDENCIES = ../src/libgetdata.la
+name_code_SOURCES = name_code.c
+name_code_OBJECTS = name_code.$(OBJEXT)
+name_code_LDADD = $(LDADD)
+name_code_DEPENDENCIES = ../src/libgetdata.la
 name_dangle_SOURCES = name_dangle.c
 name_dangle_OBJECTS = name_dangle.$(OBJEXT)
 name_dangle_LDADD = $(LDADD)
 name_dangle_DEPENDENCIES = ../src/libgetdata.la
+name_dot10_SOURCES = name_dot10.c
+name_dot10_OBJECTS = name_dot10.$(OBJEXT)
+name_dot10_LDADD = $(LDADD)
+name_dot10_DEPENDENCIES = ../src/libgetdata.la
 name_dot5_SOURCES = name_dot5.c
 name_dot5_OBJECTS = name_dot5.$(OBJEXT)
 name_dot5_LDADD = $(LDADD)
@@ -3711,10 +5279,18 @@ name_dup_SOURCES = name_dup.c
 name_dup_OBJECTS = name_dup.$(OBJEXT)
 name_dup_LDADD = $(LDADD)
 name_dup_DEPENDENCIES = ../src/libgetdata.la
+name_index_SOURCES = name_index.c
+name_index_OBJECTS = name_index.$(OBJEXT)
+name_index_LDADD = $(LDADD)
+name_index_DEPENDENCIES = ../src/libgetdata.la
 name_meta_SOURCES = name_meta.c
 name_meta_OBJECTS = name_meta.$(OBJEXT)
 name_meta_LDADD = $(LDADD)
 name_meta_DEPENDENCIES = ../src/libgetdata.la
+name_meta2_SOURCES = name_meta2.c
+name_meta2_OBJECTS = name_meta2.$(OBJEXT)
+name_meta2_LDADD = $(LDADD)
+name_meta2_DEPENDENCIES = ../src/libgetdata.la
 name_move_SOURCES = name_move.c
 name_move_OBJECTS = name_move.$(OBJEXT)
 name_move_LDADD = $(LDADD)
@@ -3727,6 +5303,26 @@ name_name_SOURCES = name_name.c
 name_name_OBJECTS = name_name.$(OBJEXT)
 name_name_LDADD = $(LDADD)
 name_name_DEPENDENCIES = ../src/libgetdata.la
+name_ns_SOURCES = name_ns.c
+name_ns_OBJECTS = name_ns.$(OBJEXT)
+name_ns_LDADD = $(LDADD)
+name_ns_DEPENDENCIES = ../src/libgetdata.la
+name_ns2_SOURCES = name_ns2.c
+name_ns2_OBJECTS = name_ns2.$(OBJEXT)
+name_ns2_LDADD = $(LDADD)
+name_ns2_DEPENDENCIES = ../src/libgetdata.la
+name_nsdot_SOURCES = name_nsdot.c
+name_nsdot_OBJECTS = name_nsdot.$(OBJEXT)
+name_nsdot_LDADD = $(LDADD)
+name_nsdot_DEPENDENCIES = ../src/libgetdata.la
+name_prot_SOURCES = name_prot.c
+name_prot_OBJECTS = name_prot.$(OBJEXT)
+name_prot_LDADD = $(LDADD)
+name_prot_DEPENDENCIES = ../src/libgetdata.la
+name_rdonly_SOURCES = name_rdonly.c
+name_rdonly_OBJECTS = name_rdonly.$(OBJEXT)
+name_rdonly_LDADD = $(LDADD)
+name_rdonly_DEPENDENCIES = ../src/libgetdata.la
 name_updb_SOURCES = name_updb.c
 name_updb_OBJECTS = name_updb.$(OBJEXT)
 name_updb_LDADD = $(LDADD)
@@ -3751,10 +5347,18 @@ 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
+name_updb_sarray_SOURCES = name_updb_sarray.c
+name_updb_sarray_OBJECTS = name_updb_sarray.$(OBJEXT)
+name_updb_sarray_LDADD = $(LDADD)
+name_updb_sarray_DEPENDENCIES = ../src/libgetdata.la
 native_bit_SOURCES = native_bit.c
 native_bit_OBJECTS = native_bit.$(OBJEXT)
 native_bit_LDADD = $(LDADD)
 native_bit_DEPENDENCIES = ../src/libgetdata.la
+native_code_SOURCES = native_code.c
+native_code_OBJECTS = native_code.$(OBJEXT)
+native_code_LDADD = $(LDADD)
+native_code_DEPENDENCIES = ../src/libgetdata.la
 native_const_SOURCES = native_const.c
 native_const_OBJECTS = native_const.$(OBJEXT)
 native_const_LDADD = $(LDADD)
@@ -3827,6 +5431,14 @@ native_recip_cmpscal_SOURCES = native_recip_cmpscal.c
 native_recip_cmpscal_OBJECTS = native_recip_cmpscal.$(OBJEXT)
 native_recip_cmpscal_LDADD = $(LDADD)
 native_recip_cmpscal_DEPENDENCIES = ../src/libgetdata.la
+native_recurse_SOURCES = native_recurse.c
+native_recurse_OBJECTS = native_recurse.$(OBJEXT)
+native_recurse_LDADD = $(LDADD)
+native_recurse_DEPENDENCIES = ../src/libgetdata.la
+native_reprz_SOURCES = native_reprz.c
+native_reprz_OBJECTS = native_reprz.$(OBJEXT)
+native_reprz_LDADD = $(LDADD)
+native_reprz_DEPENDENCIES = ../src/libgetdata.la
 native_sbit_SOURCES = native_sbit.c
 native_sbit_OBJECTS = native_sbit.$(OBJEXT)
 native_sbit_LDADD = $(LDADD)
@@ -3839,6 +5451,10 @@ nentries_alias_SOURCES = nentries_alias.c
 nentries_alias_OBJECTS = nentries_alias.$(OBJEXT)
 nentries_alias_LDADD = $(LDADD)
 nentries_alias_DEPENDENCIES = ../src/libgetdata.la
+nentries_entype_SOURCES = nentries_entype.c
+nentries_entype_OBJECTS = nentries_entype.$(OBJEXT)
+nentries_entype_LDADD = $(LDADD)
+nentries_entype_DEPENDENCIES = ../src/libgetdata.la
 nentries_hidden_SOURCES = nentries_hidden.c
 nentries_hidden_OBJECTS = nentries_hidden.$(OBJEXT)
 nentries_hidden_LDADD = $(LDADD)
@@ -3927,6 +5543,10 @@ nmeta_parent_SOURCES = nmeta_parent.c
 nmeta_parent_OBJECTS = nmeta_parent.$(OBJEXT)
 nmeta_parent_LDADD = $(LDADD)
 nmeta_parent_DEPENDENCIES = ../src/libgetdata.la
+nmeta_parent_meta_SOURCES = nmeta_parent_meta.c
+nmeta_parent_meta_OBJECTS = nmeta_parent_meta.$(OBJEXT)
+nmeta_parent_meta_LDADD = $(LDADD)
+nmeta_parent_meta_DEPENDENCIES = ../src/libgetdata.la
 nmeta_type_SOURCES = nmeta_type.c
 nmeta_type_OBJECTS = nmeta_type.$(OBJEXT)
 nmeta_type_LDADD = $(LDADD)
@@ -4067,6 +5687,10 @@ 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_loop_SOURCES = parse_alias_loop.c
+parse_alias_loop_OBJECTS = parse_alias_loop.$(OBJEXT)
+parse_alias_loop_LDADD = $(LDADD)
+parse_alias_loop_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)
@@ -4075,6 +5699,10 @@ 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_alias_ncols_SOURCES = parse_alias_ncols.c
+parse_alias_ncols_OBJECTS = parse_alias_ncols.$(OBJEXT)
+parse_alias_ncols_LDADD = $(LDADD)
+parse_alias_ncols_DEPENDENCIES = ../src/libgetdata.la
 parse_badline_SOURCES = parse_badline.c
 parse_badline_OBJECTS = parse_badline.$(OBJEXT)
 parse_badline_LDADD = $(LDADD)
@@ -4115,6 +5743,14 @@ parse_carray_long_SOURCES = parse_carray_long.c
 parse_carray_long_OBJECTS = parse_carray_long.$(OBJEXT)
 parse_carray_long_LDADD = $(LDADD)
 parse_carray_long_DEPENDENCIES = ../src/libgetdata.la
+parse_carray_ncols_SOURCES = parse_carray_ncols.c
+parse_carray_ncols_OBJECTS = parse_carray_ncols.$(OBJEXT)
+parse_carray_ncols_LDADD = $(LDADD)
+parse_carray_ncols_DEPENDENCIES = ../src/libgetdata.la
+parse_carray_type_SOURCES = parse_carray_type.c
+parse_carray_type_OBJECTS = parse_carray_type.$(OBJEXT)
+parse_carray_type_LDADD = $(LDADD)
+parse_carray_type_DEPENDENCIES = ../src/libgetdata.la
 parse_const_SOURCES = parse_const.c
 parse_const_OBJECTS = parse_const.$(OBJEXT)
 parse_const_LDADD = $(LDADD)
@@ -4127,6 +5763,10 @@ parse_const_ncols_SOURCES = parse_const_ncols.c
 parse_const_ncols_OBJECTS = parse_const_ncols.$(OBJEXT)
 parse_const_ncols_LDADD = $(LDADD)
 parse_const_ncols_DEPENDENCIES = ../src/libgetdata.la
+parse_const_type_SOURCES = parse_const_type.c
+parse_const_type_OBJECTS = parse_const_type.$(OBJEXT)
+parse_const_type_LDADD = $(LDADD)
+parse_const_type_DEPENDENCIES = ../src/libgetdata.la
 parse_divide_SOURCES = parse_divide.c
 parse_divide_OBJECTS = parse_divide.$(OBJEXT)
 parse_divide_LDADD = $(LDADD)
@@ -4147,6 +5787,10 @@ parse_endian_bad_SOURCES = parse_endian_bad.c
 parse_endian_bad_OBJECTS = parse_endian_bad.$(OBJEXT)
 parse_endian_bad_LDADD = $(LDADD)
 parse_endian_bad_DEPENDENCIES = ../src/libgetdata.la
+parse_endian_bad2_SOURCES = parse_endian_bad2.c
+parse_endian_bad2_OBJECTS = parse_endian_bad2.$(OBJEXT)
+parse_endian_bad2_LDADD = $(LDADD)
+parse_endian_bad2_DEPENDENCIES = ../src/libgetdata.la
 parse_endian_big_SOURCES = parse_endian_big.c
 parse_endian_big_OBJECTS = parse_endian_big.$(OBJEXT)
 parse_endian_big_LDADD = $(LDADD)
@@ -4167,6 +5811,10 @@ parse_eol_SOURCES = parse_eol.c
 parse_eol_OBJECTS = parse_eol.$(OBJEXT)
 parse_eol_LDADD = $(LDADD)
 parse_eol_DEPENDENCIES = ../src/libgetdata.la
+parse_esc_SOURCES = parse_esc.c
+parse_esc_OBJECTS = parse_esc.$(OBJEXT)
+parse_esc_LDADD = $(LDADD)
+parse_esc_DEPENDENCIES = ../src/libgetdata.la
 parse_foffs_SOURCES = parse_foffs.c
 parse_foffs_OBJECTS = parse_foffs.$(OBJEXT)
 parse_foffs_LDADD = $(LDADD)
@@ -4191,10 +5839,18 @@ 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_frag_SOURCES = parse_hidden_frag.c
+parse_hidden_frag_OBJECTS = parse_hidden_frag.$(OBJEXT)
+parse_hidden_frag_LDADD = $(LDADD)
+parse_hidden_frag_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_huge_SOURCES = parse_huge.c
+parse_huge_OBJECTS = parse_huge.$(OBJEXT)
+parse_huge_LDADD = $(LDADD)
+parse_huge_DEPENDENCIES = ../src/libgetdata.la
 parse_include_SOURCES = parse_include.c
 parse_include_OBJECTS = parse_include.$(OBJEXT)
 parse_include_LDADD = $(LDADD)
@@ -4223,11 +5879,51 @@ 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_nodir_SOURCES = parse_include_nodir.c
+parse_include_nodir_OBJECTS = parse_include_nodir.$(OBJEXT)
+parse_include_nodir_LDADD = $(LDADD)
+parse_include_nodir_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_ns_SOURCES = parse_include_ns.c
+parse_include_ns_OBJECTS = parse_include_ns.$(OBJEXT)
+parse_include_ns_LDADD = $(LDADD)
+parse_include_ns_DEPENDENCIES = ../src/libgetdata.la
+parse_include_ns2_SOURCES = parse_include_ns2.c
+parse_include_ns2_OBJECTS = parse_include_ns2.$(OBJEXT)
+parse_include_ns2_LDADD = $(LDADD)
+parse_include_ns2_DEPENDENCIES = ../src/libgetdata.la
+parse_include_nsabs_SOURCES = parse_include_nsabs.c
+parse_include_nsabs_OBJECTS = parse_include_nsabs.$(OBJEXT)
+parse_include_nsabs_LDADD = $(LDADD)
+parse_include_nsabs_DEPENDENCIES = ../src/libgetdata.la
+parse_include_nsinh_SOURCES = parse_include_nsinh.c
+parse_include_nsinh_OBJECTS = parse_include_nsinh.$(OBJEXT)
+parse_include_nsinh_LDADD = $(LDADD)
+parse_include_nsinh_DEPENDENCIES = ../src/libgetdata.la
+parse_include_nspop_SOURCES = parse_include_nspop.c
+parse_include_nspop_OBJECTS = parse_include_nspop.$(OBJEXT)
+parse_include_nspop_LDADD = $(LDADD)
+parse_include_nspop_DEPENDENCIES = ../src/libgetdata.la
+parse_include_nsrabs_SOURCES = parse_include_nsrabs.c
+parse_include_nsrabs_OBJECTS = parse_include_nsrabs.$(OBJEXT)
+parse_include_nsrabs_LDADD = $(LDADD)
+parse_include_nsrabs_DEPENDENCIES = ../src/libgetdata.la
+parse_include_nsrainh_SOURCES = parse_include_nsrainh.c
+parse_include_nsrainh_OBJECTS = parse_include_nsrainh.$(OBJEXT)
+parse_include_nsrainh_LDADD = $(LDADD)
+parse_include_nsrainh_DEPENDENCIES = ../src/libgetdata.la
+parse_include_nsrinh_SOURCES = parse_include_nsrinh.c
+parse_include_nsrinh_OBJECTS = parse_include_nsrinh.$(OBJEXT)
+parse_include_nsrinh_LDADD = $(LDADD)
+parse_include_nsrinh_DEPENDENCIES = ../src/libgetdata.la
+parse_include_nsroot_SOURCES = parse_include_nsroot.c
+parse_include_nsroot_OBJECTS = parse_include_nsroot.$(OBJEXT)
+parse_include_nsroot_LDADD = $(LDADD)
+parse_include_nsroot_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)
@@ -4268,6 +5964,10 @@ parse_index_SOURCES = parse_index.c
 parse_index_OBJECTS = parse_index.$(OBJEXT)
 parse_index_LDADD = $(LDADD)
 parse_index_DEPENDENCIES = ../src/libgetdata.la
+parse_indir_SOURCES = parse_indir.c
+parse_indir_OBJECTS = parse_indir.$(OBJEXT)
+parse_indir_LDADD = $(LDADD)
+parse_indir_DEPENDENCIES = ../src/libgetdata.la
 parse_lincom_SOURCES = parse_lincom.c
 parse_lincom_OBJECTS = parse_lincom.$(OBJEXT)
 parse_lincom_LDADD = $(LDADD)
@@ -4397,6 +6097,10 @@ 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_ncols_SOURCES = parse_meta_ncols.c
+parse_meta_ncols_OBJECTS = parse_meta_ncols.$(OBJEXT)
+parse_meta_ncols_LDADD = $(LDADD)
+parse_meta_ncols_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)
@@ -4413,6 +6117,10 @@ 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_neg_SOURCES = parse_mplex_neg.c
+parse_mplex_neg_OBJECTS = parse_mplex_neg.$(OBJEXT)
+parse_mplex_neg_LDADD = $(LDADD)
+parse_mplex_neg_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)
@@ -4441,14 +6149,102 @@ parse_name_ext_SOURCES = parse_name_ext.c
 parse_name_ext_OBJECTS = parse_name_ext.$(OBJEXT)
 parse_name_ext_LDADD = $(LDADD)
 parse_name_ext_DEPENDENCIES = ../src/libgetdata.la
-parse_name_pedantic_SOURCES = parse_name_pedantic.c
-parse_name_pedantic_OBJECTS = parse_name_pedantic.$(OBJEXT)
-parse_name_pedantic_LDADD = $(LDADD)
-parse_name_pedantic_DEPENDENCIES = ../src/libgetdata.la
 parse_ncols_SOURCES = parse_ncols.c
 parse_ncols_OBJECTS = parse_ncols.$(OBJEXT)
 parse_ncols_LDADD = $(LDADD)
 parse_ncols_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_SOURCES = parse_ns.c
+parse_ns_OBJECTS = parse_ns.$(OBJEXT)
+parse_ns_LDADD = $(LDADD)
+parse_ns_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_dot_SOURCES = parse_ns_dot.c
+parse_ns_dot_OBJECTS = parse_ns_dot.$(OBJEXT)
+parse_ns_dot_LDADD = $(LDADD)
+parse_ns_dot_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_dotdot_SOURCES = parse_ns_dotdot.c
+parse_ns_dotdot_OBJECTS = parse_ns_dotdot.$(OBJEXT)
+parse_ns_dotdot_LDADD = $(LDADD)
+parse_ns_dotdot_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_dotdotns_SOURCES = parse_ns_dotdotns.c
+parse_ns_dotdotns_OBJECTS = parse_ns_dotdotns.$(OBJEXT)
+parse_ns_dotdotns_LDADD = $(LDADD)
+parse_ns_dotdotns_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_dotns_SOURCES = parse_ns_dotns.c
+parse_ns_dotns_OBJECTS = parse_ns_dotns.$(OBJEXT)
+parse_ns_dotns_LDADD = $(LDADD)
+parse_ns_dotns_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_include_SOURCES = parse_ns_include.c
+parse_ns_include_OBJECTS = parse_ns_include.$(OBJEXT)
+parse_ns_include_LDADD = $(LDADD)
+parse_ns_include_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_include_ns_SOURCES = parse_ns_include_ns.c
+parse_ns_include_ns_OBJECTS = parse_ns_include_ns.$(OBJEXT)
+parse_ns_include_ns_LDADD = $(LDADD)
+parse_ns_include_ns_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_ndotdots_SOURCES = parse_ns_ndotdots.c
+parse_ns_ndotdots_OBJECTS = parse_ns_ndotdots.$(OBJEXT)
+parse_ns_ndotdots_LDADD = $(LDADD)
+parse_ns_ndotdots_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_ndots_SOURCES = parse_ns_ndots.c
+parse_ns_ndots_OBJECTS = parse_ns_ndots.$(OBJEXT)
+parse_ns_ndots_LDADD = $(LDADD)
+parse_ns_ndots_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_nsdot_SOURCES = parse_ns_nsdot.c
+parse_ns_nsdot_OBJECTS = parse_ns_nsdot.$(OBJEXT)
+parse_ns_nsdot_LDADD = $(LDADD)
+parse_ns_nsdot_DEPENDENCIES = ../src/libgetdata.la
+parse_ns_nsdotdot_SOURCES = parse_ns_nsdotdot.c
+parse_ns_nsdotdot_OBJECTS = parse_ns_nsdotdot.$(OBJEXT)
+parse_ns_nsdotdot_LDADD = $(LDADD)
+parse_ns_nsdotdot_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_SOURCES = parse_nsf.c
+parse_nsf_OBJECTS = parse_nsf.$(OBJEXT)
+parse_nsf_LDADD = $(LDADD)
+parse_nsf_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_abs_SOURCES = parse_nsf_abs.c
+parse_nsf_abs_OBJECTS = parse_nsf_abs.$(OBJEXT)
+parse_nsf_abs_LDADD = $(LDADD)
+parse_nsf_abs_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_alias_SOURCES = parse_nsf_alias.c
+parse_nsf_alias_OBJECTS = parse_nsf_alias.$(OBJEXT)
+parse_nsf_alias_LDADD = $(LDADD)
+parse_nsf_alias_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_dot_SOURCES = parse_nsf_dot.c
+parse_nsf_dot_OBJECTS = parse_nsf_dot.$(OBJEXT)
+parse_nsf_dot_LDADD = $(LDADD)
+parse_nsf_dot_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_hide_SOURCES = parse_nsf_hide.c
+parse_nsf_hide_OBJECTS = parse_nsf_hide.$(OBJEXT)
+parse_nsf_hide_LDADD = $(LDADD)
+parse_nsf_hide_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_index_SOURCES = parse_nsf_index.c
+parse_nsf_index_OBJECTS = parse_nsf_index.$(OBJEXT)
+parse_nsf_index_LDADD = $(LDADD)
+parse_nsf_index_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_meta_SOURCES = parse_nsf_meta.c
+parse_nsf_meta_OBJECTS = parse_nsf_meta.$(OBJEXT)
+parse_nsf_meta_LDADD = $(LDADD)
+parse_nsf_meta_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_meta2_SOURCES = parse_nsf_meta2.c
+parse_nsf_meta2_OBJECTS = parse_nsf_meta2.$(OBJEXT)
+parse_nsf_meta2_LDADD = $(LDADD)
+parse_nsf_meta2_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_ref_SOURCES = parse_nsf_ref.c
+parse_nsf_ref_OBJECTS = parse_nsf_ref.$(OBJEXT)
+parse_nsf_ref_LDADD = $(LDADD)
+parse_nsf_ref_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_refabs_SOURCES = parse_nsf_refabs.c
+parse_nsf_refabs_OBJECTS = parse_nsf_refabs.$(OBJEXT)
+parse_nsf_refabs_LDADD = $(LDADD)
+parse_nsf_refabs_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_root_SOURCES = parse_nsf_root.c
+parse_nsf_root_OBJECTS = parse_nsf_root.$(OBJEXT)
+parse_nsf_root_LDADD = $(LDADD)
+parse_nsf_root_DEPENDENCIES = ../src/libgetdata.la
+parse_nsf_sub_SOURCES = parse_nsf_sub.c
+parse_nsf_sub_OBJECTS = parse_nsf_sub.$(OBJEXT)
+parse_nsf_sub_LDADD = $(LDADD)
+parse_nsf_sub_DEPENDENCIES = ../src/libgetdata.la
 parse_octal_zero_SOURCES = parse_octal_zero.c
 parse_octal_zero_OBJECTS = parse_octal_zero.$(OBJEXT)
 parse_octal_zero_LDADD = $(LDADD)
@@ -4541,6 +6337,10 @@ parse_recip_SOURCES = parse_recip.c
 parse_recip_OBJECTS = parse_recip.$(OBJEXT)
 parse_recip_LDADD = $(LDADD)
 parse_recip_DEPENDENCIES = ../src/libgetdata.la
+parse_recip_ncols_SOURCES = parse_recip_ncols.c
+parse_recip_ncols_OBJECTS = parse_recip_ncols.$(OBJEXT)
+parse_recip_ncols_LDADD = $(LDADD)
+parse_recip_ncols_DEPENDENCIES = ../src/libgetdata.la
 parse_ref_SOURCES = parse_ref.c
 parse_ref_OBJECTS = parse_ref.$(OBJEXT)
 parse_ref_LDADD = $(LDADD)
@@ -4549,6 +6349,22 @@ parse_ref_nonexistent_SOURCES = parse_ref_nonexistent.c
 parse_ref_nonexistent_OBJECTS = parse_ref_nonexistent.$(OBJEXT)
 parse_ref_nonexistent_LDADD = $(LDADD)
 parse_ref_nonexistent_DEPENDENCIES = ../src/libgetdata.la
+parse_ref_type_SOURCES = parse_ref_type.c
+parse_ref_type_OBJECTS = parse_ref_type.$(OBJEXT)
+parse_ref_type_LDADD = $(LDADD)
+parse_ref_type_DEPENDENCIES = ../src/libgetdata.la
+parse_sarray_SOURCES = parse_sarray.c
+parse_sarray_OBJECTS = parse_sarray.$(OBJEXT)
+parse_sarray_LDADD = $(LDADD)
+parse_sarray_DEPENDENCIES = ../src/libgetdata.la
+parse_sarray_long_SOURCES = parse_sarray_long.c
+parse_sarray_long_OBJECTS = parse_sarray_long.$(OBJEXT)
+parse_sarray_long_LDADD = $(LDADD)
+parse_sarray_long_DEPENDENCIES = ../src/libgetdata.la
+parse_sarray_ncols_SOURCES = parse_sarray_ncols.c
+parse_sarray_ncols_OBJECTS = parse_sarray_ncols.$(OBJEXT)
+parse_sarray_ncols_LDADD = $(LDADD)
+parse_sarray_ncols_DEPENDENCIES = ../src/libgetdata.la
 parse_sbit_SOURCES = parse_sbit.c
 parse_sbit_OBJECTS = parse_sbit.$(OBJEXT)
 parse_sbit_LDADD = $(LDADD)
@@ -4565,6 +6381,10 @@ parse_scalar_repr_SOURCES = parse_scalar_repr.c
 parse_scalar_repr_OBJECTS = parse_scalar_repr.$(OBJEXT)
 parse_scalar_repr_LDADD = $(LDADD)
 parse_scalar_repr_DEPENDENCIES = ../src/libgetdata.la
+parse_sindir_SOURCES = parse_sindir.c
+parse_sindir_OBJECTS = parse_sindir.$(OBJEXT)
+parse_sindir_LDADD = $(LDADD)
+parse_sindir_DEPENDENCIES = ../src/libgetdata.la
 parse_sort_SOURCES = parse_sort.c
 parse_sort_OBJECTS = parse_sort.$(OBJEXT)
 parse_sort_LDADD = $(LDADD)
@@ -4653,10 +6473,26 @@ protect_alter_all_SOURCES = protect_alter_all.c
 protect_alter_all_OBJECTS = protect_alter_all.$(OBJEXT)
 protect_alter_all_LDADD = $(LDADD)
 protect_alter_all_DEPENDENCIES = ../src/libgetdata.la
+protect_alter_arg_SOURCES = protect_alter_arg.c
+protect_alter_arg_OBJECTS = protect_alter_arg.$(OBJEXT)
+protect_alter_arg_LDADD = $(LDADD)
+protect_alter_arg_DEPENDENCIES = ../src/libgetdata.la
+protect_alter_index_SOURCES = protect_alter_index.c
+protect_alter_index_OBJECTS = protect_alter_index.$(OBJEXT)
+protect_alter_index_LDADD = $(LDADD)
+protect_alter_index_DEPENDENCIES = ../src/libgetdata.la
+protect_alter_rdonly_SOURCES = protect_alter_rdonly.c
+protect_alter_rdonly_OBJECTS = protect_alter_rdonly.$(OBJEXT)
+protect_alter_rdonly_LDADD = $(LDADD)
+protect_alter_rdonly_DEPENDENCIES = ../src/libgetdata.la
 protect_get_SOURCES = protect_get.c
 protect_get_OBJECTS = protect_get.$(OBJEXT)
 protect_get_LDADD = $(LDADD)
 protect_get_DEPENDENCIES = ../src/libgetdata.la
+protect_index_SOURCES = protect_index.c
+protect_index_OBJECTS = protect_index.$(OBJEXT)
+protect_index_LDADD = $(LDADD)
+protect_index_DEPENDENCIES = ../src/libgetdata.la
 put64_SOURCES = put64.c
 put64_OBJECTS = put64.$(OBJEXT)
 put64_LDADD = $(LDADD)
@@ -4669,6 +6505,10 @@ put_bit_SOURCES = put_bit.c
 put_bit_OBJECTS = put_bit.$(OBJEXT)
 put_bit_LDADD = $(LDADD)
 put_bit_DEPENDENCIES = ../src/libgetdata.la
+put_bit_repr_SOURCES = put_bit_repr.c
+put_bit_repr_OBJECTS = put_bit_repr.$(OBJEXT)
+put_bit_repr_LDADD = $(LDADD)
+put_bit_repr_DEPENDENCIES = ../src/libgetdata.la
 put_bof_SOURCES = put_bof.c
 put_bof_OBJECTS = put_bof.$(OBJEXT)
 put_bof_LDADD = $(LDADD)
@@ -4677,14 +6517,30 @@ put_carray_SOURCES = put_carray.c
 put_carray_OBJECTS = put_carray.$(OBJEXT)
 put_carray_LDADD = $(LDADD)
 put_carray_DEPENDENCIES = ../src/libgetdata.la
+put_carray_bad_SOURCES = put_carray_bad.c
+put_carray_bad_OBJECTS = put_carray_bad.$(OBJEXT)
+put_carray_bad_LDADD = $(LDADD)
+put_carray_bad_DEPENDENCIES = ../src/libgetdata.la
+put_carray_bounds_SOURCES = put_carray_bounds.c
+put_carray_bounds_OBJECTS = put_carray_bounds.$(OBJEXT)
+put_carray_bounds_LDADD = $(LDADD)
+put_carray_bounds_DEPENDENCIES = ../src/libgetdata.la
 put_carray_client_SOURCES = put_carray_client.c
 put_carray_client_OBJECTS = put_carray_client.$(OBJEXT)
 put_carray_client_LDADD = $(LDADD)
 put_carray_client_DEPENDENCIES = ../src/libgetdata.la
+put_carray_rdonly_SOURCES = put_carray_rdonly.c
+put_carray_rdonly_OBJECTS = put_carray_rdonly.$(OBJEXT)
+put_carray_rdonly_LDADD = $(LDADD)
+put_carray_rdonly_DEPENDENCIES = ../src/libgetdata.la
 put_carray_slice_SOURCES = put_carray_slice.c
 put_carray_slice_OBJECTS = put_carray_slice.$(OBJEXT)
 put_carray_slice_LDADD = $(LDADD)
 put_carray_slice_DEPENDENCIES = ../src/libgetdata.la
+put_carray_type_SOURCES = put_carray_type.c
+put_carray_type_OBJECTS = put_carray_type.$(OBJEXT)
+put_carray_type_LDADD = $(LDADD)
+put_carray_type_DEPENDENCIES = ../src/libgetdata.la
 put_char_SOURCES = put_char.c
 put_char_OBJECTS = put_char.$(OBJEXT)
 put_char_LDADD = $(LDADD)
@@ -4819,6 +6675,10 @@ put_heres_SOURCES = put_heres.c
 put_heres_OBJECTS = put_heres.$(OBJEXT)
 put_heres_LDADD = $(LDADD)
 put_heres_DEPENDENCIES = ../src/libgetdata.la
+put_indir_SOURCES = put_indir.c
+put_indir_OBJECTS = put_indir.$(OBJEXT)
+put_indir_LDADD = $(LDADD)
+put_indir_DEPENDENCIES = ../src/libgetdata.la
 put_int16_SOURCES = put_int16.c
 put_int16_OBJECTS = put_int16.$(OBJEXT)
 put_int16_LDADD = $(LDADD)
@@ -4851,10 +6711,18 @@ put_lincom_noin_SOURCES = put_lincom_noin.c
 put_lincom_noin_OBJECTS = put_lincom_noin.$(OBJEXT)
 put_lincom_noin_LDADD = $(LDADD)
 put_lincom_noin_DEPENDENCIES = ../src/libgetdata.la
+put_lincom_repr_SOURCES = put_lincom_repr.c
+put_lincom_repr_OBJECTS = put_lincom_repr.$(OBJEXT)
+put_lincom_repr_LDADD = $(LDADD)
+put_lincom_repr_DEPENDENCIES = ../src/libgetdata.la
 put_linterp_SOURCES = put_linterp.c
 put_linterp_OBJECTS = put_linterp.$(OBJEXT)
 put_linterp_LDADD = $(LDADD)
 put_linterp_DEPENDENCIES = ../src/libgetdata.la
+put_linterp_cmp_SOURCES = put_linterp_cmp.c
+put_linterp_cmp_OBJECTS = put_linterp_cmp.$(OBJEXT)
+put_linterp_cmp_LDADD = $(LDADD)
+put_linterp_cmp_DEPENDENCIES = ../src/libgetdata.la
 put_linterp_noin_SOURCES = put_linterp_noin.c
 put_linterp_noin_OBJECTS = put_linterp_noin.$(OBJEXT)
 put_linterp_noin_LDADD = $(LDADD)
@@ -4867,6 +6735,10 @@ put_linterp_notab_SOURCES = put_linterp_notab.c
 put_linterp_notab_OBJECTS = put_linterp_notab.$(OBJEXT)
 put_linterp_notab_LDADD = $(LDADD)
 put_linterp_notab_DEPENDENCIES = ../src/libgetdata.la
+put_linterp_repr_SOURCES = put_linterp_repr.c
+put_linterp_repr_OBJECTS = put_linterp_repr.$(OBJEXT)
+put_linterp_repr_LDADD = $(LDADD)
+put_linterp_repr_DEPENDENCIES = ../src/libgetdata.la
 put_linterp_reverse_SOURCES = put_linterp_reverse.c
 put_linterp_reverse_OBJECTS = put_linterp_reverse.$(OBJEXT)
 put_linterp_reverse_LDADD = $(LDADD)
@@ -4879,10 +6751,18 @@ put_mplex_complex_SOURCES = put_mplex_complex.c
 put_mplex_complex_OBJECTS = put_mplex_complex.$(OBJEXT)
 put_mplex_complex_LDADD = $(LDADD)
 put_mplex_complex_DEPENDENCIES = ../src/libgetdata.la
+put_mplex_repr_SOURCES = put_mplex_repr.c
+put_mplex_repr_OBJECTS = put_mplex_repr.$(OBJEXT)
+put_mplex_repr_LDADD = $(LDADD)
+put_mplex_repr_DEPENDENCIES = ../src/libgetdata.la
 put_multiply_SOURCES = put_multiply.c
 put_multiply_OBJECTS = put_multiply.$(OBJEXT)
 put_multiply_LDADD = $(LDADD)
 put_multiply_DEPENDENCIES = ../src/libgetdata.la
+put_neg_SOURCES = put_neg.c
+put_neg_OBJECTS = put_neg.$(OBJEXT)
+put_neg_LDADD = $(LDADD)
+put_neg_DEPENDENCIES = ../src/libgetdata.la
 put_nofile_SOURCES = put_nofile.c
 put_nofile_OBJECTS = put_nofile.$(OBJEXT)
 put_nofile_LDADD = $(LDADD)
@@ -4903,6 +6783,10 @@ put_phase_noin_SOURCES = put_phase_noin.c
 put_phase_noin_OBJECTS = put_phase_noin.$(OBJEXT)
 put_phase_noin_LDADD = $(LDADD)
 put_phase_noin_DEPENDENCIES = ../src/libgetdata.la
+put_phase_repr_SOURCES = put_phase_repr.c
+put_phase_repr_OBJECTS = put_phase_repr.$(OBJEXT)
+put_phase_repr_LDADD = $(LDADD)
+put_phase_repr_DEPENDENCIES = ../src/libgetdata.la
 put_polynom1_SOURCES = put_polynom1.c
 put_polynom1_OBJECTS = put_polynom1.$(OBJEXT)
 put_polynom1_LDADD = $(LDADD)
@@ -4915,6 +6799,10 @@ put_polynom_noin_SOURCES = put_polynom_noin.c
 put_polynom_noin_OBJECTS = put_polynom_noin.$(OBJEXT)
 put_polynom_noin_LDADD = $(LDADD)
 put_polynom_noin_DEPENDENCIES = ../src/libgetdata.la
+put_polynom_repr_SOURCES = put_polynom_repr.c
+put_polynom_repr_OBJECTS = put_polynom_repr.$(OBJEXT)
+put_polynom_repr_LDADD = $(LDADD)
+put_polynom_repr_DEPENDENCIES = ../src/libgetdata.la
 put_protect_SOURCES = put_protect.c
 put_protect_OBJECTS = put_protect.$(OBJEXT)
 put_protect_LDADD = $(LDADD)
@@ -4931,6 +6819,10 @@ put_recip_SOURCES = put_recip.c
 put_recip_OBJECTS = put_recip.$(OBJEXT)
 put_recip_LDADD = $(LDADD)
 put_recip_DEPENDENCIES = ../src/libgetdata.la
+put_recip_repr_SOURCES = put_recip_repr.c
+put_recip_repr_OBJECTS = put_recip_repr.$(OBJEXT)
+put_recip_repr_LDADD = $(LDADD)
+put_recip_repr_DEPENDENCIES = ../src/libgetdata.la
 put_recurse_SOURCES = put_recurse.c
 put_recurse_OBJECTS = put_recurse.$(OBJEXT)
 put_recurse_LDADD = $(LDADD)
@@ -4943,14 +6835,46 @@ put_rofs_SOURCES = put_rofs.c
 put_rofs_OBJECTS = put_rofs.$(OBJEXT)
 put_rofs_LDADD = $(LDADD)
 put_rofs_DEPENDENCIES = ../src/libgetdata.la
+put_sarray_SOURCES = put_sarray.c
+put_sarray_OBJECTS = put_sarray.$(OBJEXT)
+put_sarray_LDADD = $(LDADD)
+put_sarray_DEPENDENCIES = ../src/libgetdata.la
+put_sarray_bad_SOURCES = put_sarray_bad.c
+put_sarray_bad_OBJECTS = put_sarray_bad.$(OBJEXT)
+put_sarray_bad_LDADD = $(LDADD)
+put_sarray_bad_DEPENDENCIES = ../src/libgetdata.la
+put_sarray_bounds_SOURCES = put_sarray_bounds.c
+put_sarray_bounds_OBJECTS = put_sarray_bounds.$(OBJEXT)
+put_sarray_bounds_LDADD = $(LDADD)
+put_sarray_bounds_DEPENDENCIES = ../src/libgetdata.la
+put_sarray_rdonly_SOURCES = put_sarray_rdonly.c
+put_sarray_rdonly_OBJECTS = put_sarray_rdonly.$(OBJEXT)
+put_sarray_rdonly_LDADD = $(LDADD)
+put_sarray_rdonly_DEPENDENCIES = ../src/libgetdata.la
+put_sarray_slice_SOURCES = put_sarray_slice.c
+put_sarray_slice_OBJECTS = put_sarray_slice.$(OBJEXT)
+put_sarray_slice_LDADD = $(LDADD)
+put_sarray_slice_DEPENDENCIES = ../src/libgetdata.la
+put_sarray_type_SOURCES = put_sarray_type.c
+put_sarray_type_OBJECTS = put_sarray_type.$(OBJEXT)
+put_sarray_type_LDADD = $(LDADD)
+put_sarray_type_DEPENDENCIES = ../src/libgetdata.la
 put_sbit_SOURCES = put_sbit.c
 put_sbit_OBJECTS = put_sbit.$(OBJEXT)
 put_sbit_LDADD = $(LDADD)
 put_sbit_DEPENDENCIES = ../src/libgetdata.la
+put_scalar_SOURCES = put_scalar.c
+put_scalar_OBJECTS = put_scalar.$(OBJEXT)
+put_scalar_LDADD = $(LDADD)
+put_scalar_DEPENDENCIES = ../src/libgetdata.la
 put_sf_SOURCES = put_sf.c
 put_sf_OBJECTS = put_sf.$(OBJEXT)
 put_sf_LDADD = $(LDADD)
 put_sf_DEPENDENCIES = ../src/libgetdata.la
+put_sindir_SOURCES = put_sindir.c
+put_sindir_OBJECTS = put_sindir.$(OBJEXT)
+put_sindir_LDADD = $(LDADD)
+put_sindir_DEPENDENCIES = ../src/libgetdata.la
 put_ss_SOURCES = put_ss.c
 put_ss_OBJECTS = put_ss.$(OBJEXT)
 put_ss_LDADD = $(LDADD)
@@ -4963,6 +6887,10 @@ put_string_protect_SOURCES = put_string_protect.c
 put_string_protect_OBJECTS = put_string_protect.$(OBJEXT)
 put_string_protect_LDADD = $(LDADD)
 put_string_protect_DEPENDENCIES = ../src/libgetdata.la
+put_string_type_SOURCES = put_string_type.c
+put_string_type_OBJECTS = put_string_type.$(OBJEXT)
+put_string_type_LDADD = $(LDADD)
+put_string_type_DEPENDENCIES = ../src/libgetdata.la
 put_sub_SOURCES = put_sub.c
 put_sub_OBJECTS = put_sub.$(OBJEXT)
 put_sub_LDADD = $(LDADD)
@@ -4995,10 +6923,38 @@ ref_SOURCES = ref.c
 ref_OBJECTS = ref.$(OBJEXT)
 ref_LDADD = $(LDADD)
 ref_DEPENDENCIES = ../src/libgetdata.la
+ref_empty_SOURCES = ref_empty.c
+ref_empty_OBJECTS = ref_empty.$(OBJEXT)
+ref_empty_LDADD = $(LDADD)
+ref_empty_DEPENDENCIES = ../src/libgetdata.la
+ref_get_SOURCES = ref_get.c
+ref_get_OBJECTS = ref_get.$(OBJEXT)
+ref_get_LDADD = $(LDADD)
+ref_get_DEPENDENCIES = ../src/libgetdata.la
 ref_none_SOURCES = ref_none.c
 ref_none_OBJECTS = ref_none.$(OBJEXT)
 ref_none_LDADD = $(LDADD)
 ref_none_DEPENDENCIES = ../src/libgetdata.la
+ref_set_SOURCES = ref_set.c
+ref_set_OBJECTS = ref_set.$(OBJEXT)
+ref_set_LDADD = $(LDADD)
+ref_set_DEPENDENCIES = ../src/libgetdata.la
+ref_set_code_SOURCES = ref_set_code.c
+ref_set_code_OBJECTS = ref_set_code.$(OBJEXT)
+ref_set_code_LDADD = $(LDADD)
+ref_set_code_DEPENDENCIES = ../src/libgetdata.la
+ref_set_prot_SOURCES = ref_set_prot.c
+ref_set_prot_OBJECTS = ref_set_prot.$(OBJEXT)
+ref_set_prot_LDADD = $(LDADD)
+ref_set_prot_DEPENDENCIES = ../src/libgetdata.la
+ref_set_rdonly_SOURCES = ref_set_rdonly.c
+ref_set_rdonly_OBJECTS = ref_set_rdonly.$(OBJEXT)
+ref_set_rdonly_LDADD = $(LDADD)
+ref_set_rdonly_DEPENDENCIES = ../src/libgetdata.la
+ref_set_type_SOURCES = ref_set_type.c
+ref_set_type_OBJECTS = ref_set_type.$(OBJEXT)
+ref_set_type_LDADD = $(LDADD)
+ref_set_type_DEPENDENCIES = ../src/libgetdata.la
 ref_two_SOURCES = ref_two.c
 ref_two_OBJECTS = ref_two.$(OBJEXT)
 ref_two_LDADD = $(LDADD)
@@ -5079,14 +7035,66 @@ repr_uint8_SOURCES = repr_uint8.c
 repr_uint8_OBJECTS = repr_uint8.$(OBJEXT)
 repr_uint8_LDADD = $(LDADD)
 repr_uint8_DEPENDENCIES = ../src/libgetdata.la
+salist_SOURCES = salist.c
+salist_OBJECTS = salist.$(OBJEXT)
+salist_LDADD = $(LDADD)
+salist_DEPENDENCIES = ../src/libgetdata.la
+salist0_SOURCES = salist0.c
+salist0_OBJECTS = salist0.$(OBJEXT)
+salist0_LDADD = $(LDADD)
+salist0_DEPENDENCIES = ../src/libgetdata.la
+salist_hidden_SOURCES = salist_hidden.c
+salist_hidden_OBJECTS = salist_hidden.$(OBJEXT)
+salist_hidden_LDADD = $(LDADD)
+salist_hidden_DEPENDENCIES = ../src/libgetdata.la
+salist_long_SOURCES = salist_long.c
+salist_long_OBJECTS = salist_long.$(OBJEXT)
+salist_long_LDADD = $(LDADD)
+salist_long_DEPENDENCIES = ../src/libgetdata.la
+salist_meta_SOURCES = salist_meta.c
+salist_meta_OBJECTS = salist_meta.$(OBJEXT)
+salist_meta_LDADD = $(LDADD)
+salist_meta_DEPENDENCIES = ../src/libgetdata.la
+salist_meta0_SOURCES = salist_meta0.c
+salist_meta0_OBJECTS = salist_meta0.$(OBJEXT)
+salist_meta0_LDADD = $(LDADD)
+salist_meta0_DEPENDENCIES = ../src/libgetdata.la
+salist_meta_free_SOURCES = salist_meta_free.c
+salist_meta_free_OBJECTS = salist_meta_free.$(OBJEXT)
+salist_meta_free_LDADD = $(LDADD)
+salist_meta_free_DEPENDENCIES = ../src/libgetdata.la
+salist_meta_hidden_SOURCES = salist_meta_hidden.c
+salist_meta_hidden_OBJECTS = salist_meta_hidden.$(OBJEXT)
+salist_meta_hidden_LDADD = $(LDADD)
+salist_meta_hidden_DEPENDENCIES = ../src/libgetdata.la
+salist_meta_meta_SOURCES = salist_meta_meta.c
+salist_meta_meta_OBJECTS = salist_meta_meta.$(OBJEXT)
+salist_meta_meta_LDADD = $(LDADD)
+salist_meta_meta_DEPENDENCIES = ../src/libgetdata.la
+salist_meta_parent_SOURCES = salist_meta_parent.c
+salist_meta_parent_OBJECTS = salist_meta_parent.$(OBJEXT)
+salist_meta_parent_LDADD = $(LDADD)
+salist_meta_parent_DEPENDENCIES = ../src/libgetdata.la
 seek64_SOURCES = seek64.c
 seek64_OBJECTS = seek64.$(OBJEXT)
 seek64_LDADD = $(LDADD)
 seek64_DEPENDENCIES = ../src/libgetdata.la
+seek_arg_SOURCES = seek_arg.c
+seek_arg_OBJECTS = seek_arg.$(OBJEXT)
+seek_arg_LDADD = $(LDADD)
+seek_arg_DEPENDENCIES = ../src/libgetdata.la
+seek_code_SOURCES = seek_code.c
+seek_code_OBJECTS = seek_code.$(OBJEXT)
+seek_code_LDADD = $(LDADD)
+seek_code_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_dim_SOURCES = seek_dim.c
+seek_dim_OBJECTS = seek_dim.$(OBJEXT)
+seek_dim_LDADD = $(LDADD)
+seek_dim_DEPENDENCIES = ../src/libgetdata.la
 seek_end_SOURCES = seek_end.c
 seek_end_OBJECTS = seek_end.$(OBJEXT)
 seek_end_LDADD = $(LDADD)
@@ -5107,10 +7115,18 @@ seek_index_SOURCES = seek_index.c
 seek_index_OBJECTS = seek_index.$(OBJEXT)
 seek_index_LDADD = $(LDADD)
 seek_index_DEPENDENCIES = ../src/libgetdata.la
+seek_index_end_SOURCES = seek_index_end.c
+seek_index_end_OBJECTS = seek_index_end.$(OBJEXT)
+seek_index_end_LDADD = $(LDADD)
+seek_index_end_DEPENDENCIES = ../src/libgetdata.la
 seek_lincom_SOURCES = seek_lincom.c
 seek_lincom_OBJECTS = seek_lincom.$(OBJEXT)
 seek_lincom_LDADD = $(LDADD)
 seek_lincom_DEPENDENCIES = ../src/libgetdata.la
+seek_mplex_SOURCES = seek_mplex.c
+seek_mplex_OBJECTS = seek_mplex.$(OBJEXT)
+seek_mplex_LDADD = $(LDADD)
+seek_mplex_DEPENDENCIES = ../src/libgetdata.la
 seek_mult_SOURCES = seek_mult.c
 seek_mult_OBJECTS = seek_mult.$(OBJEXT)
 seek_mult_LDADD = $(LDADD)
@@ -5131,6 +7147,14 @@ seek_range2_SOURCES = seek_range2.c
 seek_range2_OBJECTS = seek_range2.$(OBJEXT)
 seek_range2_LDADD = $(LDADD)
 seek_range2_DEPENDENCIES = ../src/libgetdata.la
+seek_range_end_SOURCES = seek_range_end.c
+seek_range_end_OBJECTS = seek_range_end.$(OBJEXT)
+seek_range_end_LDADD = $(LDADD)
+seek_range_end_DEPENDENCIES = ../src/libgetdata.la
+seek_recurse_SOURCES = seek_recurse.c
+seek_recurse_OBJECTS = seek_recurse.$(OBJEXT)
+seek_recurse_LDADD = $(LDADD)
+seek_recurse_DEPENDENCIES = ../src/libgetdata.la
 seek_set_SOURCES = seek_set.c
 seek_set_OBJECTS = seek_set.$(OBJEXT)
 seek_set_LDADD = $(LDADD)
@@ -5139,6 +7163,10 @@ seek_sub_SOURCES = seek_sub.c
 seek_sub_OBJECTS = seek_sub.$(OBJEXT)
 seek_sub_LDADD = $(LDADD)
 seek_sub_DEPENDENCIES = ../src/libgetdata.la
+sie_err_open_SOURCES = sie_err_open.c
+sie_err_open_OBJECTS = sie_err_open.$(OBJEXT)
+sie_err_open_LDADD = $(LDADD)
+sie_err_open_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)
@@ -5263,6 +7291,10 @@ 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_const_SOURCES = spf_const.c
+spf_const_OBJECTS = spf_const.$(OBJEXT)
+spf_const_LDADD = $(LDADD)
+spf_const_DEPENDENCIES = ../src/libgetdata.la
 spf_divide_SOURCES = spf_divide.c
 spf_divide_OBJECTS = spf_divide.$(OBJEXT)
 spf_divide_LDADD = $(LDADD)
@@ -5311,6 +7343,10 @@ svlist_invalid_SOURCES = svlist_invalid.c
 svlist_invalid_OBJECTS = svlist_invalid.$(OBJEXT)
 svlist_invalid_LDADD = $(LDADD)
 svlist_invalid_DEPENDENCIES = ../src/libgetdata.la
+svlist_long_SOURCES = svlist_long.c
+svlist_long_OBJECTS = svlist_long.$(OBJEXT)
+svlist_long_LDADD = $(LDADD)
+svlist_long_DEPENDENCIES = ../src/libgetdata.la
 svlist_meta_SOURCES = svlist_meta.c
 svlist_meta_OBJECTS = svlist_meta.$(OBJEXT)
 svlist_meta_LDADD = $(LDADD)
@@ -5327,6 +7363,14 @@ 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
+svlist_meta_meta_SOURCES = svlist_meta_meta.c
+svlist_meta_meta_OBJECTS = svlist_meta_meta.$(OBJEXT)
+svlist_meta_meta_LDADD = $(LDADD)
+svlist_meta_meta_DEPENDENCIES = ../src/libgetdata.la
+svlist_meta_parent_SOURCES = svlist_meta_parent.c
+svlist_meta_parent_OBJECTS = svlist_meta_parent.$(OBJEXT)
+svlist_meta_parent_LDADD = $(LDADD)
+svlist_meta_parent_DEPENDENCIES = ../src/libgetdata.la
 table_SOURCES = table.c
 table_OBJECTS = table.$(OBJEXT)
 table_LDADD = $(LDADD)
@@ -5347,10 +7391,26 @@ 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
+tell_code_SOURCES = tell_code.c
+tell_code_OBJECTS = tell_code.$(OBJEXT)
+tell_code_LDADD = $(LDADD)
+tell_code_DEPENDENCIES = ../src/libgetdata.la
+tell_dim_SOURCES = tell_dim.c
+tell_dim_OBJECTS = tell_dim.$(OBJEXT)
+tell_dim_LDADD = $(LDADD)
+tell_dim_DEPENDENCIES = ../src/libgetdata.la
+tell_multi_div_SOURCES = tell_multi_div.c
+tell_multi_div_OBJECTS = tell_multi_div.$(OBJEXT)
+tell_multi_div_LDADD = $(LDADD)
+tell_multi_div_DEPENDENCIES = ../src/libgetdata.la
+tell_multi_lincom_SOURCES = tell_multi_lincom.c
+tell_multi_lincom_OBJECTS = tell_multi_lincom.$(OBJEXT)
+tell_multi_lincom_LDADD = $(LDADD)
+tell_multi_lincom_DEPENDENCIES = ../src/libgetdata.la
+tell_recurse_SOURCES = tell_recurse.c
+tell_recurse_OBJECTS = tell_recurse.$(OBJEXT)
+tell_recurse_LDADD = $(LDADD)
+tell_recurse_DEPENDENCIES = ../src/libgetdata.la
 tell_sub_SOURCES = tell_sub.c
 tell_sub_OBJECTS = tell_sub.$(OBJEXT)
 tell_sub_LDADD = $(LDADD)
@@ -5395,6 +7455,14 @@ unclude_del_SOURCES = unclude_del.c
 unclude_del_OBJECTS = unclude_del.$(OBJEXT)
 unclude_del_LDADD = $(LDADD)
 unclude_del_DEPENDENCIES = ../src/libgetdata.la
+unclude_index_SOURCES = unclude_index.c
+unclude_index_OBJECTS = unclude_index.$(OBJEXT)
+unclude_index_LDADD = $(LDADD)
+unclude_index_DEPENDENCIES = ../src/libgetdata.la
+unclude_keep_SOURCES = unclude_keep.c
+unclude_keep_OBJECTS = unclude_keep.$(OBJEXT)
+unclude_keep_LDADD = $(LDADD)
+unclude_keep_DEPENDENCIES = ../src/libgetdata.la
 unclude_move_SOURCES = unclude_move.c
 unclude_move_OBJECTS = unclude_move.$(OBJEXT)
 unclude_move_LDADD = $(LDADD)
@@ -5403,6 +7471,18 @@ unclude_open_SOURCES = unclude_open.c
 unclude_open_OBJECTS = unclude_open.$(OBJEXT)
 unclude_open_LDADD = $(LDADD)
 unclude_open_DEPENDENCIES = ../src/libgetdata.la
+unclude_prot_SOURCES = unclude_prot.c
+unclude_prot_OBJECTS = unclude_prot.$(OBJEXT)
+unclude_prot_LDADD = $(LDADD)
+unclude_prot_DEPENDENCIES = ../src/libgetdata.la
+unclude_rdonly_SOURCES = unclude_rdonly.c
+unclude_rdonly_OBJECTS = unclude_rdonly.$(OBJEXT)
+unclude_rdonly_LDADD = $(LDADD)
+unclude_rdonly_DEPENDENCIES = ../src/libgetdata.la
+valid_reprz_SOURCES = valid_reprz.c
+valid_reprz_OBJECTS = valid_reprz.$(OBJEXT)
+valid_reprz_LDADD = $(LDADD)
+valid_reprz_DEPENDENCIES = ../src/libgetdata.la
 version_0_SOURCES = version_0.c
 version_0_OBJECTS = version_0.$(OBJEXT)
 version_0_LDADD = $(LDADD)
@@ -5606,58 +7686,102 @@ am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
 SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.c \
-	add_alias_meta.c add_amb_code7.c add_bit.c add_bit_bitnum.c \
-	add_bit_bitsize.c add_bit_invalid.c add_bit_numbits.c \
-	add_bit_scalars.c add_carray.c add_clincom.c add_code.c \
-	add_const.c add_cpolynom.c add_crecip.c add_crecip89.c \
-	add_dangle_dup.c add_divide.c add_divide_invalid.c add_dot5.c \
-	add_dot6.c add_duplicate.c add_format.c add_invalid.c \
-	add_lincom.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_scalars.c \
-	add_multiply.c add_multiply_invalid.c add_phase.c \
-	add_phase_invalid.c add_polynom.c add_polynom_scalar.c \
+	add_alias_index.c add_alias_meta.c add_alias_name.c \
+	add_alias_ns.c add_alias_prot.c add_alias_rdonly.c \
+	add_amb_code7.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
+	add_bit_inaff.c add_bit_invalid.c add_bit_numbits.c \
+	add_bit_scalars.c add_carray.c add_carray_entry.c \
+	add_carray_type.c add_clincom.c add_clincom_nfields.c \
+	add_code.c add_const.c add_const_type.c add_cpolynom.c \
+	add_cpolynom_order.c add_crecip.c add_crecip89.c \
+	add_dangle_dup.c add_divide.c add_divide_inaff1.c \
+	add_divide_inaff2.c add_divide_invalid.c add_dot10.c \
+	add_dot5.c add_dot6.c add_duplicate.c add_format.c add_indir.c \
+	add_invalid.c add_lincom.c add_lincom_affix.c \
+	add_lincom_invalid.c add_lincom_nfields.c \
+	add_lincom_nfields2.c add_linterp.c add_linterp_inaff.c \
+	add_linterp_invalid.c add_meta.c add_meta_alias.c \
+	add_meta_parent.c add_mplex.c add_mplex_inaff.c \
+	add_mplex_period.c add_mplex_scalars.c add_multiply.c \
+	add_multiply_invalid.c add_name_len.c add_ns.c add_ns_frag.c \
+	add_ns_frag2.c add_phase.c add_phase_inaff.c \
+	add_phase_invalid.c add_polynom.c add_polynom_inaff.c \
+	add_polynom_order.c add_polynom_order2.c add_polynom_scalar.c \
 	add_protect.c add_raw.c add_raw_include.c add_raw_invalid.c \
-	add_raw_spf.c add_raw_spf_scalar.c add_raw_sub.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_clincom.c \
-	alter_const.c alter_const_c2r.c alter_const_r2c.c \
-	alter_const_r2r.c alter_cpolynom.c alter_cpolynom_null.c \
-	alter_crecip.c alter_crecip89.c alter_crecip89_null.c \
-	alter_crecip_zero.c alter_divide.c alter_entry.c \
-	alter_entry_affix.c alter_entry_hidden.c alter_entry_lincom.c \
+	add_raw_prot.c add_raw_spf.c add_raw_spf_scalar.c \
+	add_raw_sub.c add_raw_type.c add_rdonly.c add_recip.c \
+	add_recip_inaff.c add_resolv.c add_sarray.c add_sarray_dup.c \
+	add_sarray_nil.c add_sbit.c add_scalar.c add_scalar_carray.c \
+	add_scalar_carray_bad.c add_sindir.c add_sort.c add_spec.c \
+	add_spec_affix.c add_spec_directive.c add_spec_index.c \
+	add_spec_invalid.c add_spec_meta.c add_spec_nil.c \
+	add_spec_prot.c add_spec_raw_autoenc.c add_spec_raw_prot.c \
+	add_spec_raw_unkenc.c add_spec_resolv.c add_string.c \
+	add_string_affix.c add_string_dup.c add_string_entry.c \
+	add_type.c add_window.c add_window_inaff.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 \
+	alloc_affix.c alloc_callback.c alloc_clear.c alloc_entry.c \
+	alloc_tok.c alter_bit_bitnum.c alter_bit_in.c \
+	alter_bit_numbits.c alter_bit_scalar.c alter_carray_len.c \
+	alter_carray_type.c alter_clincom.c alter_clincom_32.c \
+	alter_clincom_nfields.c alter_clincom_nfields_code.c \
+	alter_clincom_null.c alter_code.c alter_const.c \
+	alter_const_c2r.c alter_const_r2c.c alter_const_r2r.c \
+	alter_const_type.c alter_cpolynom.c alter_cpolynom_null.c \
+	alter_cpolynom_ord.c alter_cpolynom_ord_code.c alter_crecip.c \
+	alter_crecip89.c alter_crecip89_null.c alter_crecip_zero.c \
+	alter_divide.c alter_divide_in.c alter_entry.c \
+	alter_entry_affix.c alter_entry_entype.c alter_entry_hidden.c \
+	alter_entry_lincom.c alter_entry_lincom_nfields.c \
 	alter_entry_recode.c alter_entry_recode_recalc.c \
-	alter_entry_scalar1.c alter_entry_scalar2a.c \
-	alter_entry_scalar2n.c alter_entry_scalar3.c \
-	alter_entry_scalar3c.c alter_entry_scalar3i.c \
-	alter_entry_scalar3r.c alter_entry_scalar4.c \
-	alter_entry_scalar_amb.c alter_index.c alter_lincom_23.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_scalar_affix.c \
-	alter_spec.c alter_spec_affix.c alter_spec_meta.c \
-	alter_spec_polynom.c alter_window.c ascii_add.c ascii_get.c \
-	ascii_get_complex.c ascii_get_get.c ascii_get_here.c \
-	ascii_get_sub.c ascii_nframes.c ascii_put.c ascii_put_here.c \
-	ascii_seek.c ascii_seek_far.c ascii_sync.c bof.c bof_bit.c \
-	bof_index.c bof_lincom.c bof_phase.c bof_phase_neg.c \
-	bzip_add.c bzip_get.c bzip_get_far.c bzip_get_get.c \
-	bzip_get_get2.c bzip_get_put.c bzip_move_from.c bzip_move_to.c \
-	bzip_nframes.c bzip_put.c bzip_put_back.c bzip_put_endian.c \
-	bzip_put_get.c bzip_put_pad.c bzip_put_sub.c bzip_seek.c \
-	bzip_seek_far.c bzip_sync.c close_bad.c close_close.c \
+	alter_entry_sarray.c alter_entry_scalar1.c \
+	alter_entry_scalar2a.c alter_entry_scalar2n.c \
+	alter_entry_scalar3.c alter_entry_scalar3c.c \
+	alter_entry_scalar3i.c alter_entry_scalar3r.c \
+	alter_entry_scalar4.c alter_entry_scalar_amb.c alter_index.c \
+	alter_indir.c alter_lincom_23.c alter_lincom_32.c \
+	alter_lincom_affix.c alter_lincom_input.c \
+	alter_lincom_nfields.c alter_lincom_nfields_code.c \
+	alter_lincom_offset.c alter_lincom_scalar.c \
+	alter_lincom_slope.c alter_linterp.c alter_linterp_in.c \
+	alter_linterp_move.c alter_mplex.c alter_mplex_in.c \
+	alter_mplex_scalar.c alter_mspec.c alter_mspec_affix.c \
+	alter_multiply.c alter_phase.c alter_phase_in.c \
+	alter_phase_scalar.c alter_polynom_coeff.c \
+	alter_polynom_input.c alter_polynom_ord.c alter_polynom_ord2.c \
+	alter_polynom_ord_code.c alter_polynom_scalar.c alter_prot.c \
+	alter_raw_prot.c alter_raw_spf.c alter_raw_spf_type.c \
+	alter_raw_type.c alter_rdonly.c alter_recip.c \
+	alter_recip_scalar.c alter_recip_zero.c alter_sarray.c \
+	alter_sarray_nop.c alter_sbit.c alter_scalar_affix.c \
+	alter_sindir.c alter_spec.c alter_spec_affix.c \
+	alter_spec_code.c alter_spec_format.c alter_spec_meta.c \
+	alter_spec_nil.c alter_spec_polynom.c alter_spec_prot.c \
+	alter_spec_rdonly.c alter_window.c alter_window_in.c \
+	alter_window_op.c alter_window_scalar.c ascii_add.c \
+	ascii_complex128.c ascii_complex64.c ascii_float32.c \
+	ascii_float64.c ascii_get.c ascii_get_complex.c \
+	ascii_get_get.c ascii_get_here.c ascii_get_sub.c ascii_int16.c \
+	ascii_int32.c ascii_int64.c ascii_int8.c ascii_nframes.c \
+	ascii_put.c ascii_put_here.c ascii_seek.c ascii_seek_far.c \
+	ascii_sync.c ascii_uint16.c ascii_uint32.c ascii_uint64.c \
+	ascii_uint8.c bof.c bof_bit.c bof_bit_code.c bof_code.c \
+	bof_const.c bof_index.c bof_lincom.c bof_lincom_code.c \
+	bof_phase.c bof_phase_code.c bof_phase_neg.c bof_recurse.c \
+	bzip_add.c bzip_complex128.c bzip_complex64.c bzip_del.c \
+	bzip_enoent.c bzip_float32.c bzip_float64.c bzip_get.c \
+	bzip_get_cont.c bzip_get_far.c bzip_get_get.c bzip_get_get2.c \
+	bzip_get_put.c bzip_int16.c bzip_int32.c bzip_int64.c \
+	bzip_int8.c bzip_move_from.c bzip_move_to.c bzip_nframes.c \
+	bzip_put.c bzip_put_back.c bzip_put_endian.c bzip_put_get.c \
+	bzip_put_offs.c bzip_put_pad.c bzip_put_sub.c bzip_seek.c \
+	bzip_seek_far.c bzip_sync.c bzip_uint16.c bzip_uint32.c \
+	bzip_uint64.c bzip_uint8.c calist.c calist0.c calist_free.c \
+	calist_hidden.c calist_long.c calist_meta.c calist_meta0.c \
+	calist_meta_free.c calist_meta_hidden.c calist_meta_meta.c \
+	calist_meta_parent.c calist_null.c close_bad.c close_close.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 \
@@ -5718,25 +7842,27 @@ SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.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 creat_rdonly_exists.c cvlist.c \
-	cvlist_array.c cvlist_array0.c cvlist_array_free.c \
-	cvlist_array_hidden.c cvlist_array_meta.c cvlist_array_meta0.c \
-	cvlist_array_meta_free.c cvlist_array_meta_hidden.c \
-	cvlist_array_null.c cvlist_hidden.c cvlist_invalid.c \
-	cvlist_meta.c cvlist_meta0.c cvlist_meta_hidden.c \
-	cvlist_meta_invalid.c cvlist_null.c del_alias.c del_bad_code.c \
-	del_carray.c del_carray_deref.c del_const.c del_const_deref.c \
-	del_const_force.c del_data.c del_data_enoent.c del_data_open.c \
-	del_del.c del_derived.c del_derived_after.c \
-	del_derived_force.c del_meta.c del_meta_force.c del_ref.c \
-	desync.c desync_flush.c desync_path.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_alter_all.c encode_alter_open.c encode_get.c \
-	encode_recode.c encode_recode_open.c encode_support.c \
-	endian_alter.c endian_alter_all.c endian_alter_sie.c \
-	endian_get.c endian_move.c entry_bad_code.c entry_bit.c \
+	cvlist_hidden.c cvlist_invalid.c cvlist_long.c cvlist_meta.c \
+	cvlist_meta0.c cvlist_meta_code.c cvlist_meta_hidden.c \
+	cvlist_meta_invalid.c cvlist_meta_parent.c cvlist_null.c \
+	del_alias.c del_alias_dangle.c del_alias_target.c \
+	del_bad_code.c del_carray.c del_carray_deref.c del_const.c \
+	del_const_deref.c del_const_force.c del_data.c \
+	del_data_enoent.c del_data_open.c del_data_prot.c del_del.c \
+	del_derived.c del_derived_after.c del_derived_force.c \
+	del_divide.c del_meta.c del_meta_force.c del_prot.c \
+	del_rdonly.c del_ref.c desync.c desync_flush.c desync_path.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_parent.c elist_parent2.c \
+	elist_scalar.c elist_type.c encode_alter.c encode_alter_all.c \
+	encode_alter_open.c encode_get.c encode_recode.c \
+	encode_recode_open.c encode_support.c endian_alter.c \
+	endian_alter_all.c endian_alter_arg.c endian_alter_dprot.c \
+	endian_alter_fprot.c endian_alter_index.c \
+	endian_alter_rdonly.c endian_alter_sie.c endian_get.c \
+	endian_index.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 \
@@ -5745,36 +7871,54 @@ SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.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_bit.c \
-	eof_index.c eof_lincom.c eof_phase.c eof_phase_neg.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 \
-	flac_add.c flac_get_big.c flac_get_far.c flac_get_get.c \
+	eof_bit_code.c eof_const.c eof_index.c eof_lincom.c \
+	eof_lincom_code.c eof_phase.c eof_phase_code.c eof_phase_neg.c \
+	eof_recurse.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 flac_add.c flac_complex128.c flac_complex64.c \
+	flac_del.c flac_enoent.c flac_float32.c flac_float64.c \
+	flac_get_big.c flac_get_cont.c flac_get_far.c flac_get_get.c \
 	flac_get_get2.c flac_get_int64.c flac_get_int8.c \
-	flac_get_little.c flac_get_long.c flac_nframes.c \
+	flac_get_little.c flac_get_long.c flac_int16.c flac_int32.c \
+	flac_int64.c flac_int8.c flac_move_from.c flac_nframes.c \
 	flac_put_big.c flac_put_complex128.c flac_put_float64.c \
-	flac_put_int32.c flac_put_little.c flac_seek.c flac_seek_far.c \
-	flac_sync.c flist.c flist0.c flist2.c flist_hidden.c \
-	flist_invalid.c flist_meta.c flist_meta2.c flist_meta_hidden.c \
-	flist_meta_invalid.c flist_type.c flist_type_hidden.c \
-	flist_type_invalid.c flist_type_meta.c \
+	flac_put_int32.c flac_put_little.c flac_put_offs.c flac_seek.c \
+	flac_seek_far.c flac_sync.c flac_uint16.c flac_uint32.c \
+	flac_uint64.c flac_uint8.c flist.c flist0.c flist2.c \
+	flist_hidden.c flist_invalid.c flist_meta.c flist_meta2.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_all.c \
-	flush_amb_code.c flush_bad_code.c flush_flush.c flush_hex.c \
-	flush_invalid.c flush_lincom.c flush_lincom1.c flush_meta.c \
-	flush_mult.c flush_raw_close.c flush_ref.c flush_spec.c \
-	flush_string.c flush_sync.c foffs_alter.c foffs_alter_all.c \
-	foffs_get.c foffs_move.c fragment_affix.c \
+	flush_bad_code.c flush_flush.c flush_invalid.c flush_lincom.c \
+	flush_lincom1.c flush_mult.c flush_raw_close.c flush_recurse.c \
+	flush_sync.c foffs_alter.c foffs_alter_all.c \
+	foffs_alter_dprot.c foffs_alter_fprot.c foffs_alter_index.c \
+	foffs_alter_range.c foffs_alter_rdonly.c foffs_get.c \
+	foffs_index.c foffs_move.c fragment_affix.c \
 	fragment_affix_alter.c fragment_affix_alter2.c \
-	fragment_affix_alter_code.c fragment_affix_alter_nop.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_c2r.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_carray.c \
-	get_const_complex.c get_const_repr.c get_cpolynom.c \
-	get_cpolynom1.c get_cpolynom_int.c get_dim.c get_divide.c \
-	get_divide_ccin.c get_divide_crin.c get_divide_crinr.c \
-	get_divide_rcin.c get_divide_s.c get_endian16.c get_endian32.c \
+	fragment_affix_alter_code.c fragment_affix_alter_dotpx.c \
+	fragment_affix_alter_index.c fragment_affix_alter_nons.c \
+	fragment_affix_alter_nop.c fragment_affix_alter_ns.c \
+	fragment_affix_alter_pns.c fragment_affix_dup.c \
+	fragment_affix_index.c fragment_affix_ns.c fragment_index.c \
+	fragment_index_alias.c fragment_name.c fragment_name_oor.c \
+	fragment_ndotdots.c fragment_ndots.c fragment_ns.c \
+	fragment_ns0.c fragment_ns_add.c fragment_ns_add0.c \
+	fragment_ns_alter.c fragment_ns_alter_nop.c \
+	fragment_ns_alter_pdel.c fragment_ns_del.c fragment_ns_dot.c \
+	fragment_ns_dotdot.c fragment_ns_dotns.c fragment_ns_nsdot.c \
+	fragment_num.c fragment_parent.c fragment_parent_index.c \
+	fragment_parent_root.c get64.c get_affix.c get_bad_code.c \
+	get_bit.c get_carray.c get_carray_bad.c get_carray_c2r.c \
+	get_carray_slice.c get_carray_slice_bounds.c \
+	get_carray_slice_type.c get_carray_type.c get_char.c \
+	get_clincom.c get_complex128.c get_complex64.c get_const.c \
+	get_const_bad.c get_const_carray.c get_const_complex.c \
+	get_const_repr.c get_const_reprz.c get_cpolynom.c \
+	get_cpolynom1.c get_cpolynom_int.c get_dim.c get_dimin.c \
+	get_divide.c get_divide_ccin.c get_divide_code.c \
+	get_divide_crin.c get_divide_crinr.c get_divide_rcin.c \
+	get_divide_s.c get_dot.c get_endian16.c get_endian32.c \
 	get_endian64.c get_endian8.c get_endian_complex128_arm.c \
 	get_endian_complex128_big.c get_endian_complex128_little.c \
 	get_endian_complex64_arm.c get_endian_complex64_big.c \
@@ -5783,115 +7927,165 @@ SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.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_foffs2.c get_fs.c get_here.c \
-	get_here_foffs.c get_heres.c get_index_complex.c get_int16.c \
+	get_here_foffs.c get_heres.c get_index_complex.c \
+	get_index_type.c get_indir.c get_indir_typein.c get_int16.c \
 	get_int32.c get_int64.c get_int8.c get_invalid.c get_lincom1.c \
 	get_lincom2.c get_lincom2s.c get_lincom3.c get_lincom3s.c \
-	get_lincom_mdt.c get_lincom_noin.c get_lincom_non.c \
-	get_lincom_null.c get_lincom_spf.c get_linterp.c \
-	get_linterp1.c get_linterp_abs.c get_linterp_complex.c \
-	get_linterp_empty.c get_linterp_nodir.c get_linterp_noin.c \
-	get_linterp_notab.c get_linterp_sort.c get_mplex.c \
-	get_mplex_bof.c get_mplex_complex.c get_mplex_lb.c \
+	get_lincom_code.c get_lincom_mdt.c get_lincom_noin.c \
+	get_lincom_non.c get_lincom_null.c get_lincom_spf.c \
+	get_linterp.c get_linterp1.c get_linterp_abs.c \
+	get_linterp_complex.c get_linterp_empty.c get_linterp_nodir.c \
+	get_linterp_noin.c get_linterp_notab.c get_linterp_sort.c \
+	get_mplex.c get_mplex_bof.c get_mplex_complex.c get_mplex_lb.c \
 	get_mplex_lball.c get_mplex_nolb.c get_mplex_s.c \
 	get_mplex_saved.c get_multiply.c get_multiply_ccin.c \
-	get_multiply_crin.c get_multiply_crinr.c get_multiply_noin.c \
-	get_multiply_rcin.c get_multiply_s.c get_neg.c get_none.c \
-	get_nonexistent.c get_null.c get_off64.c get_phase.c \
-	get_phase_affix.c get_polynom.c get_polynom_cmpin.c \
-	get_polynom_noin.c get_range.c get_recip.c get_recip_const.c \
-	get_recurse.c get_rofs.c get_sbit.c get_sf.c get_ss.c \
-	get_string.c get_type.c get_uint16.c get_uint32.c get_uint64.c \
-	get_window.c get_window_clr.c get_window_complex.c \
-	get_window_ge.c get_window_gt.c get_window_le.c \
-	get_window_lt.c get_window_ne.c get_window_s.c \
-	get_window_set.c get_zero.c get_zero_complex.c \
-	get_zero_float.c global_flags.c global_name.c global_ref.c \
-	global_ref_empty.c global_ref_set.c gzip_add.c gzip_del.c \
-	gzip_get.c gzip_get_far.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_back.c gzip_put_endian.c gzip_put_get.c \
-	gzip_put_nframes.c gzip_put_off.c gzip_put_pad.c \
-	gzip_put_sub.c gzip_seek.c gzip_seek_far.c gzip_seek_put.c \
-	gzip_sync.c header_complex.c header_off64t.c hide.c hide_bad.c \
-	hide_hidden.c hide_hidden_bad.c hide_unhide.c \
-	hide_unhide_bad.c include_accmode.c include_affix.c \
-	include_auto.c include_cb.c include_creat.c include_ignore.c \
-	include_include.c include_index.c include_invalid.c \
-	include_nonexistent.c include_pc.c include_ref.c include_sub.c \
-	include_syntax.c index_domain.c index_index.c index_range.c \
-	index_s.c index_subset.c legacy_error.c legacy_estring.c \
-	legacy_format.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 lzma_put.c \
-	lzma_xz_add.c lzma_xz_get.c lzma_xz_get_far.c \
-	lzma_xz_get_get.c lzma_xz_get_get2.c lzma_xz_get_put.c \
-	lzma_xz_move_to.c lzma_xz_nframes.c lzma_xz_put.c \
-	lzma_xz_put_back.c lzma_xz_put_endian.c lzma_xz_put_get.c \
-	lzma_xz_put_pad.c lzma_xz_seek.c lzma_xz_seek_far.c \
-	lzma_xz_sync.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_spec_resolv.c madd_string.c \
-	madd_window.c move_affix.c move_affix_dup.c move_affix_meta.c \
-	move_affix_updb.c move_alias.c move_data_enc_ar.c \
-	move_data_enc_ra.c move_data_endian.c move_data_foffs.c \
-	move_data_foffs_neg.c move_data_nop.c move_index.c move_meta.c \
-	move_move.c move_protect.c move_subdir.c name_affix.c \
-	name_affix_bad.c name_alias.c name_dangle.c name_dot5.c \
-	name_dot5r.c name_dot9.c name_dup.c name_meta.c name_move.c \
-	name_move_alias.c name_name.c name_updb.c name_updb_affix.c \
-	name_updb_alias.c name_updb_carray.c name_updb_const.c \
-	name_updb_const_alias.c native_bit.c native_const.c \
-	native_index.c native_lincom.c native_lincom_cmpin.c \
-	native_lincom_cmpscal.c native_linterp.c native_linterp_cmp.c \
-	native_mult.c native_mult1.c native_mult2.c native_phase.c \
-	native_polynom.c native_polynom_cmpin.c \
-	native_polynom_cmpscal.c native_raw.c native_recip.c \
-	native_recip_cmpin.c native_recip_cmpscal.c native_sbit.c \
-	native_string.c nentries_alias.c nentries_hidden.c \
+	get_multiply_code.c get_multiply_crin.c get_multiply_crinr.c \
+	get_multiply_noin.c get_multiply_rcin.c get_multiply_s.c \
+	get_neg.c get_none.c get_nonexistent.c get_null.c get_off64.c \
+	get_phase.c get_phase_affix.c get_polynom.c \
+	get_polynom_cmpin.c get_polynom_noin.c get_range.c get_recip.c \
+	get_recip_cmpin.c get_recip_const.c get_recurse.c get_reprz.c \
+	get_rofs.c get_sarray.c get_sarray_bad.c get_sarray_slice.c \
+	get_sarray_slice_bounds.c get_sarray_slice_type.c \
+	get_sarray_type.c get_sbit.c get_sf.c get_sindir.c \
+	get_sindir_code.c get_sindir_neg.c get_sindir_none.c \
+	get_sindir_null.c get_sindir_reprz.c get_sindir_type.c \
+	get_sindir_typein.c get_ss.c get_string.c get_type.c \
+	get_uint16.c get_uint32.c get_uint64.c get_window.c \
+	get_window_clr.c get_window_complex.c get_window_ge.c \
+	get_window_gt.c get_window_le.c get_window_lt.c \
+	get_window_ne.c get_window_s.c get_window_set.c get_zero.c \
+	get_zero_complex.c get_zero_float.c global_flags.c \
+	global_name.c gzip_add.c gzip_complex128.c gzip_complex64.c \
+	gzip_del.c gzip_enoent.c gzip_float32.c gzip_float64.c \
+	gzip_get.c gzip_get_cont.c gzip_get_far.c gzip_get_get.c \
+	gzip_get_get2.c gzip_get_put.c gzip_int16.c gzip_int32.c \
+	gzip_int64.c gzip_int8.c gzip_move_from.c gzip_move_to.c \
+	gzip_nframes.c gzip_put.c gzip_put_back.c gzip_put_endian.c \
+	gzip_put_get.c gzip_put_nframes.c gzip_put_off.c \
+	gzip_put_offs.c gzip_put_pad.c gzip_put_sub.c gzip_seek.c \
+	gzip_seek_far.c gzip_seek_put.c gzip_sync.c gzip_uint16.c \
+	gzip_uint32.c gzip_uint64.c gzip_uint8.c header_complex.c \
+	header_off64t.c hide.c hide_bad.c hide_hidden.c \
+	hide_hidden_bad.c hide_unhide.c hide_unhide_bad.c \
+	include_accmode.c include_affix.c include_affix_ns.c \
+	include_auto.c include_cb.c include_creat.c include_format.c \
+	include_ignore.c include_include.c include_index.c \
+	include_invalid.c include_ndotdots.c include_ndots.c \
+	include_nonexistent.c include_ns.c include_ns_dot.c \
+	include_ns_dotdot.c include_ns_dotns.c include_ns_nil.c \
+	include_ns_null.c include_ns_prefix.c include_pc.c \
+	include_prot.c include_ref.c include_ref_code.c \
+	include_ref_type.c include_sub.c include_syntax.c \
+	index_domain.c index_empty.c index_index.c index_one.c \
+	index_range.c index_reprz.c index_s.c index_scalar.c \
+	index_subset.c legacy_error.c legacy_estring.c legacy_format.c \
+	legacy_get.c legacy_get_put.c legacy_get_rofs.c \
+	legacy_nframes.c legacy_nonexistent.c legacy_put.c \
+	legacy_spf.c len_bad.c len_carray.c len_const.c len_sarray.c \
+	len_string.c len_type.c lzma_enoent.c lzma_get.c \
+	lzma_nframes.c lzma_put.c lzma_xz_add.c lzma_xz_complex128.c \
+	lzma_xz_complex64.c lzma_xz_del.c lzma_xz_float32.c \
+	lzma_xz_float64.c lzma_xz_get.c lzma_xz_get_cont.c \
+	lzma_xz_get_far.c lzma_xz_get_get.c lzma_xz_get_get2.c \
+	lzma_xz_get_put.c lzma_xz_int16.c lzma_xz_int32.c \
+	lzma_xz_int64.c lzma_xz_int8.c lzma_xz_move_from.c \
+	lzma_xz_move_to.c lzma_xz_nframes.c lzma_xz_offs_clear.c \
+	lzma_xz_put.c lzma_xz_put_back.c lzma_xz_put_endian.c \
+	lzma_xz_put_get.c lzma_xz_put_offs.c lzma_xz_put_pad.c \
+	lzma_xz_seek.c lzma_xz_seek_far.c lzma_xz_sync.c \
+	lzma_xz_uint16.c lzma_xz_uint32.c lzma_xz_uint64.c \
+	lzma_xz_uint8.c madd.c madd_affix.c madd_alias.c \
+	madd_alias_affix.c madd_alias_alias.c madd_alias_subsub.c \
+	madd_aliasmeta.c madd_bit.c madd_bit_invalid.c madd_carray.c \
+	madd_clincom.c madd_clincom_nfields.c madd_const.c \
+	madd_cpolynom.c madd_cpolynom_order.c madd_crecip.c \
+	madd_crecip89.c madd_divide.c madd_index.c madd_indir.c \
+	madd_lincom.c madd_lincom_invalid.c madd_lincom_nfields.c \
+	madd_linterp.c madd_linterp_invalid.c madd_mplex.c \
+	madd_multiply.c madd_multiply_invalid.c madd_parent_bad.c \
+	madd_phase.c madd_phase_invalid.c madd_polynom.c \
+	madd_polynom_order.c madd_raw.c madd_recip.c madd_sarray.c \
+	madd_sarray_dup.c madd_sbit.c madd_sindir.c madd_spec.c \
+	madd_spec_directive.c madd_spec_invalid.c madd_spec_parent.c \
+	madd_spec_resolv.c madd_string.c madd_string_dup.c \
+	madd_subsub.c madd_window.c match_fragment.c match_pcre.c \
+	match_pcre_bad.c match_pcre_caseless.c match_pcre_ext.c \
+	match_pcre_js.c match_pcre_utf8.c match_regex.c \
+	match_regex_bad.c match_regex_ext.c match_regex_icase.c \
+	mflush.c mflush_affix.c mflush_amb_code.c mflush_carray.c \
+	mflush_hex.c mflush_indir.c mflush_mplex.c mflush_ns.c \
+	mflush_pretty.c mflush_prot.c mflush_ref.c mflush_repr.c \
+	mflush_repr9.c mflush_reprz.c mflush_sindir.c mflush_spec.c \
+	mflush_string.c mflush_type.c mflush_type4.c mflush_windop.c \
+	move_affix.c move_affix_dup.c move_affix_meta.c \
+	move_affix_updb.c move_alias.c move_code.c move_data_enc_ar.c \
+	move_data_enc_ra.c move_data_enc_un.c move_data_endian.c \
+	move_data_foffs.c move_data_foffs_neg.c move_data_nop.c \
+	move_data_prot.c move_entype.c move_index.c move_meta.c \
+	move_move.c move_nop.c move_ns.c move_nsns.c move_protect.c \
+	move_rdonly.c move_subdir.c move_unkenc.c name_affix.c \
+	name_affix_bad.c name_alias.c name_code.c name_dangle.c \
+	name_dot10.c name_dot5.c name_dot5r.c name_dot9.c name_dup.c \
+	name_index.c name_meta.c name_meta2.c name_move.c \
+	name_move_alias.c name_name.c name_ns.c name_ns2.c \
+	name_nsdot.c name_prot.c name_rdonly.c name_updb.c \
+	name_updb_affix.c name_updb_alias.c name_updb_carray.c \
+	name_updb_const.c name_updb_const_alias.c name_updb_sarray.c \
+	native_bit.c native_code.c native_const.c native_index.c \
+	native_lincom.c native_lincom_cmpin.c native_lincom_cmpscal.c \
+	native_linterp.c native_linterp_cmp.c native_mult.c \
+	native_mult1.c native_mult2.c native_phase.c native_polynom.c \
+	native_polynom_cmpin.c native_polynom_cmpscal.c native_raw.c \
+	native_recip.c native_recip_cmpin.c native_recip_cmpscal.c \
+	native_recurse.c native_reprz.c native_sbit.c native_string.c \
+	nentries_alias.c nentries_entype.c nentries_hidden.c \
 	nentries_noalias.c nentries_scalar.c nfields_hidden.c \
 	nfields_invalid.c nfields_nfields.c nfields_type.c \
 	nfields_type_hidden.c nfields_type_invalid.c nfields_vector.c \
 	nfields_vector_hidden.c nfields_vector_invalid.c nframes64.c \
 	nframes_empty.c nframes_invalid.c nframes_nframes.c \
 	nframes_off64.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_abs.c \
-	open_cb_abort.c open_cb_cont.c open_cb_ignore.c \
-	open_cb_invalid.c open_cb_rescan.c open_cb_rescan_alloc.c \
-	open_eaccess.c open_invalid.c open_nonexistent.c \
-	open_notdirfile.c open_open.c open_rofs.c open_sym_al.c \
-	open_sym_at.c open_sym_c.c open_sym_cl.c open_sym_ct.c \
-	open_sym_d.c open_sym_l.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 \
+	nmeta_invalid.c nmeta_parent.c nmeta_parent_meta.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_abs.c open_cb_abort.c \
+	open_cb_cont.c open_cb_ignore.c open_cb_invalid.c \
+	open_cb_rescan.c open_cb_rescan_alloc.c open_eaccess.c \
+	open_invalid.c open_nonexistent.c open_notdirfile.c \
+	open_open.c open_rofs.c open_sym_al.c open_sym_at.c \
+	open_sym_c.c open_sym_cl.c open_sym_ct.c open_sym_d.c \
+	open_sym_l.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_loop.c parse_alias_meta.c parse_alias_missing.c \
+	parse_alias_ncols.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_carray_ncols.c parse_carray_type.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_hex.c \
-	parse_hidden.c parse_hidden_field.c parse_hidden_meta.c \
-	parse_include.c parse_include_absolute.c \
+	parse_const_type.c parse_divide.c parse_double.c \
+	parse_duplicate.c parse_duplicate_ignore.c parse_endian_bad.c \
+	parse_endian_bad2.c parse_endian_big.c parse_endian_force.c \
+	parse_endian_little.c parse_endian_slash.c parse_eol.c \
+	parse_esc.c parse_foffs.c parse_foffs_include.c \
+	parse_foffs_slash.c parse_hex.c parse_hidden.c \
+	parse_hidden_field.c parse_hidden_frag.c parse_hidden_meta.c \
+	parse_huge.c parse_include.c parse_include_absolute.c \
 	parse_include_absrel.c parse_include_affix_bad.c \
 	parse_include_affix_ref.c parse_include_dir.c \
-	parse_include_loop.c parse_include_nonexistent.c \
+	parse_include_loop.c parse_include_nodir.c \
+	parse_include_nonexistent.c parse_include_ns.c \
+	parse_include_ns2.c parse_include_nsabs.c \
+	parse_include_nsinh.c parse_include_nspop.c \
+	parse_include_nsrabs.c parse_include_nsrainh.c \
+	parse_include_nsrinh.c parse_include_nsroot.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_include_sufsuffix.c parse_index.c parse_indir.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 \
@@ -5903,34 +8097,47 @@ SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.c \
 	parse_meta_alias.c parse_meta_frag.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_octal_zero.c parse_phase.c parse_phase_ncols.c \
-	parse_phase_scalar.c parse_polynom.c parse_polynom_ncols1.c \
-	parse_polynom_ncols2.c parse_polynom_scalar.c \
-	parse_protect_all.c parse_protect_bad.c parse_protect_data.c \
-	parse_protect_format.c parse_protect_none.c parse_quote.c \
-	parse_quote_mismatch.c parse_raw.c parse_raw_char.c \
-	parse_raw_char_bad.c parse_raw_ncols.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_scalar1.c \
-	parse_scalar2.c parse_scalar_repr.c parse_sort.c \
-	parse_string.c parse_string_ncols.c parse_string_null.c \
-	parse_utf8.c parse_utf8_invalid.c parse_utf8_zero.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_meta_malias.c parse_meta_meta.c parse_meta_ncols.c \
+	parse_meta_parent.c parse_meta_raw.c parse_mplex.c \
+	parse_mplex_ncols.c parse_mplex_neg.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_ncols.c \
+	parse_ns.c parse_ns_dot.c parse_ns_dotdot.c \
+	parse_ns_dotdotns.c parse_ns_dotns.c parse_ns_include.c \
+	parse_ns_include_ns.c parse_ns_ndotdots.c parse_ns_ndots.c \
+	parse_ns_nsdot.c parse_ns_nsdotdot.c parse_nsf.c \
+	parse_nsf_abs.c parse_nsf_alias.c parse_nsf_dot.c \
+	parse_nsf_hide.c parse_nsf_index.c parse_nsf_meta.c \
+	parse_nsf_meta2.c parse_nsf_ref.c parse_nsf_refabs.c \
+	parse_nsf_root.c parse_nsf_sub.c parse_octal_zero.c \
+	parse_phase.c parse_phase_ncols.c parse_phase_scalar.c \
+	parse_polynom.c parse_polynom_ncols1.c parse_polynom_ncols2.c \
+	parse_polynom_scalar.c parse_protect_all.c parse_protect_bad.c \
+	parse_protect_data.c parse_protect_format.c \
+	parse_protect_none.c parse_quote.c parse_quote_mismatch.c \
+	parse_raw.c parse_raw_char.c parse_raw_char_bad.c \
+	parse_raw_ncols.c parse_raw_scalar.c parse_raw_spf.c \
+	parse_raw_type.c parse_recip.c parse_recip_ncols.c parse_ref.c \
+	parse_ref_nonexistent.c parse_ref_type.c parse_sarray.c \
+	parse_sarray_long.c parse_sarray_ncols.c parse_sbit.c \
+	parse_scalar1.c parse_scalar2.c parse_scalar_repr.c \
+	parse_sindir.c parse_sort.c parse_string.c \
+	parse_string_ncols.c parse_string_null.c parse_utf8.c \
+	parse_utf8_invalid.c parse_utf8_zero.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_alter_all.c protect_get.c put64.c put_bad_code.c \
-	put_bit.c put_bof.c put_carray.c put_carray_client.c \
-	put_carray_slice.c put_char.c put_clincom1.c put_complex128.c \
-	put_complex64.c put_const.c put_const_protect.c put_cpolynom.c \
-	put_crecip.c put_divide.c put_endian16.c put_endian32.c \
-	put_endian64.c put_endian8.c put_endian_complex128_arm.c \
+	protect_alter_all.c protect_alter_arg.c protect_alter_index.c \
+	protect_alter_rdonly.c protect_get.c protect_index.c put64.c \
+	put_bad_code.c put_bit.c put_bit_repr.c put_bof.c put_carray.c \
+	put_carray_bad.c put_carray_bounds.c put_carray_client.c \
+	put_carray_rdonly.c put_carray_slice.c put_carray_type.c \
+	put_char.c put_clincom1.c put_complex128.c put_complex64.c \
+	put_const.c put_const_protect.c put_cpolynom.c put_crecip.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 \
@@ -5938,25 +8145,37 @@ SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.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_indir.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_lincom_repr.c put_linterp.c put_linterp_cmp.c \
 	put_linterp_noin.c put_linterp_nomono.c put_linterp_notab.c \
-	put_linterp_reverse.c put_mplex.c put_mplex_complex.c \
-	put_multiply.c put_nofile.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_range.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_sub.c \
+	put_linterp_repr.c put_linterp_reverse.c put_mplex.c \
+	put_mplex_complex.c put_mplex_repr.c put_multiply.c put_neg.c \
+	put_nofile.c put_null.c put_off64.c put_phase.c \
+	put_phase_noin.c put_phase_repr.c put_polynom1.c \
+	put_polynom2.c put_polynom_noin.c put_polynom_repr.c \
+	put_protect.c put_range.c put_rdonly.c put_recip.c \
+	put_recip_repr.c put_recurse.c put_repr.c put_rofs.c \
+	put_sarray.c put_sarray_bad.c put_sarray_bounds.c \
+	put_sarray_rdonly.c put_sarray_slice.c put_sarray_type.c \
+	put_sbit.c put_scalar.c put_sf.c put_sindir.c put_ss.c \
+	put_string.c put_string_protect.c put_string_type.c put_sub.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_bad.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_far.c seek_foffs.c \
-	seek_foffs2.c seek_index.c seek_lincom.c seek_mult.c \
-	seek_neg.c seek_phase.c seek_range.c seek_range2.c seek_set.c \
-	seek_sub.c sie_get_big.c sie_get_header.c sie_get_little.c \
+	put_zero.c ref.c ref_empty.c ref_get.c ref_none.c ref_set.c \
+	ref_set_code.c ref_set_prot.c ref_set_rdonly.c ref_set_type.c \
+	ref_two.c repr_a.c repr_bad.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 salist.c salist0.c salist_hidden.c salist_long.c \
+	salist_meta.c salist_meta0.c salist_meta_free.c \
+	salist_meta_hidden.c salist_meta_meta.c salist_meta_parent.c \
+	seek64.c seek_arg.c seek_code.c seek_cur.c seek_dim.c \
+	seek_end.c seek_far.c seek_foffs.c seek_foffs2.c seek_index.c \
+	seek_index_end.c seek_lincom.c seek_mplex.c seek_mult.c \
+	seek_neg.c seek_phase.c seek_range.c seek_range2.c \
+	seek_range_end.c seek_recurse.c seek_set.c seek_sub.c \
+	sie_err_open.c sie_get_big.c sie_get_header.c sie_get_little.c \
 	sie_move_from.c sie_move_to.c sie_nframes_big.c \
 	sie_nframes_little.c sie_put_append.c sie_put_append2.c \
 	sie_put_back.c sie_put_big.c sie_put_header.c sie_put_little.c \
@@ -5964,80 +8183,128 @@ SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.c \
 	sie_put_pad0.c sie_put_trunc.c sie_put_trunc2.c \
 	sie_put_trunc_nf.c sie_seek.c sie_seek_far.c sie_sync.c \
 	slim_get.c slim_nframes.c slim_seek.c slim_seek_far.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_raw.c \
-	spf_recip.c spf_recurse.c svlist.c svlist0.c svlist2.c \
-	svlist_hidden.c svlist_invalid.c svlist_meta.c svlist_meta0.c \
-	svlist_meta_hidden.c svlist_meta_invalid.c table.c \
-	table_code.c table_type.c tell.c tell64.c tell_multidiv.c \
+	spf_alias.c spf_alias_meta.c spf_alias_missing.c spf_const.c \
+	spf_divide.c spf_lincom.c spf_multiply.c spf_polynom.c \
+	spf_raw.c spf_recip.c spf_recurse.c svlist.c svlist0.c \
+	svlist2.c svlist_hidden.c svlist_invalid.c svlist_long.c \
+	svlist_meta.c svlist_meta0.c svlist_meta_hidden.c \
+	svlist_meta_invalid.c svlist_meta_meta.c svlist_meta_parent.c \
+	table.c table_code.c table_type.c tell.c tell64.c tell_code.c \
+	tell_dim.c tell_multi_div.c tell_multi_lincom.c tell_recurse.c \
 	tell_sub.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 unclude_open.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 zzip_data.c zzip_get.c zzip_get_get.c \
-	zzip_nframes.c zzip_seek.c zzip_seek_far.c zzslim_get.c \
-	zzslim_nframes.c zzslim_seek.c zzslim_seek_far.c
+	unclude.c unclude_del.c unclude_index.c unclude_keep.c \
+	unclude_move.c unclude_open.c unclude_prot.c unclude_rdonly.c \
+	valid_reprz.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 zzip_data.c \
+	zzip_get.c zzip_get_get.c zzip_nframes.c zzip_seek.c \
+	zzip_seek_far.c zzslim_get.c zzslim_nframes.c zzslim_seek.c \
+	zzslim_seek_far.c
 DIST_SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.c \
-	add_alias_meta.c add_amb_code7.c add_bit.c add_bit_bitnum.c \
-	add_bit_bitsize.c add_bit_invalid.c add_bit_numbits.c \
-	add_bit_scalars.c add_carray.c add_clincom.c add_code.c \
-	add_const.c add_cpolynom.c add_crecip.c add_crecip89.c \
-	add_dangle_dup.c add_divide.c add_divide_invalid.c add_dot5.c \
-	add_dot6.c add_duplicate.c add_format.c add_invalid.c \
-	add_lincom.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_scalars.c \
-	add_multiply.c add_multiply_invalid.c add_phase.c \
-	add_phase_invalid.c add_polynom.c add_polynom_scalar.c \
+	add_alias_index.c add_alias_meta.c add_alias_name.c \
+	add_alias_ns.c add_alias_prot.c add_alias_rdonly.c \
+	add_amb_code7.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
+	add_bit_inaff.c add_bit_invalid.c add_bit_numbits.c \
+	add_bit_scalars.c add_carray.c add_carray_entry.c \
+	add_carray_type.c add_clincom.c add_clincom_nfields.c \
+	add_code.c add_const.c add_const_type.c add_cpolynom.c \
+	add_cpolynom_order.c add_crecip.c add_crecip89.c \
+	add_dangle_dup.c add_divide.c add_divide_inaff1.c \
+	add_divide_inaff2.c add_divide_invalid.c add_dot10.c \
+	add_dot5.c add_dot6.c add_duplicate.c add_format.c add_indir.c \
+	add_invalid.c add_lincom.c add_lincom_affix.c \
+	add_lincom_invalid.c add_lincom_nfields.c \
+	add_lincom_nfields2.c add_linterp.c add_linterp_inaff.c \
+	add_linterp_invalid.c add_meta.c add_meta_alias.c \
+	add_meta_parent.c add_mplex.c add_mplex_inaff.c \
+	add_mplex_period.c add_mplex_scalars.c add_multiply.c \
+	add_multiply_invalid.c add_name_len.c add_ns.c add_ns_frag.c \
+	add_ns_frag2.c add_phase.c add_phase_inaff.c \
+	add_phase_invalid.c add_polynom.c add_polynom_inaff.c \
+	add_polynom_order.c add_polynom_order2.c add_polynom_scalar.c \
 	add_protect.c add_raw.c add_raw_include.c add_raw_invalid.c \
-	add_raw_spf.c add_raw_spf_scalar.c add_raw_sub.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_clincom.c \
-	alter_const.c alter_const_c2r.c alter_const_r2c.c \
-	alter_const_r2r.c alter_cpolynom.c alter_cpolynom_null.c \
-	alter_crecip.c alter_crecip89.c alter_crecip89_null.c \
-	alter_crecip_zero.c alter_divide.c alter_entry.c \
-	alter_entry_affix.c alter_entry_hidden.c alter_entry_lincom.c \
+	add_raw_prot.c add_raw_spf.c add_raw_spf_scalar.c \
+	add_raw_sub.c add_raw_type.c add_rdonly.c add_recip.c \
+	add_recip_inaff.c add_resolv.c add_sarray.c add_sarray_dup.c \
+	add_sarray_nil.c add_sbit.c add_scalar.c add_scalar_carray.c \
+	add_scalar_carray_bad.c add_sindir.c add_sort.c add_spec.c \
+	add_spec_affix.c add_spec_directive.c add_spec_index.c \
+	add_spec_invalid.c add_spec_meta.c add_spec_nil.c \
+	add_spec_prot.c add_spec_raw_autoenc.c add_spec_raw_prot.c \
+	add_spec_raw_unkenc.c add_spec_resolv.c add_string.c \
+	add_string_affix.c add_string_dup.c add_string_entry.c \
+	add_type.c add_window.c add_window_inaff.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 \
+	alloc_affix.c alloc_callback.c alloc_clear.c alloc_entry.c \
+	alloc_tok.c alter_bit_bitnum.c alter_bit_in.c \
+	alter_bit_numbits.c alter_bit_scalar.c alter_carray_len.c \
+	alter_carray_type.c alter_clincom.c alter_clincom_32.c \
+	alter_clincom_nfields.c alter_clincom_nfields_code.c \
+	alter_clincom_null.c alter_code.c alter_const.c \
+	alter_const_c2r.c alter_const_r2c.c alter_const_r2r.c \
+	alter_const_type.c alter_cpolynom.c alter_cpolynom_null.c \
+	alter_cpolynom_ord.c alter_cpolynom_ord_code.c alter_crecip.c \
+	alter_crecip89.c alter_crecip89_null.c alter_crecip_zero.c \
+	alter_divide.c alter_divide_in.c alter_entry.c \
+	alter_entry_affix.c alter_entry_entype.c alter_entry_hidden.c \
+	alter_entry_lincom.c alter_entry_lincom_nfields.c \
 	alter_entry_recode.c alter_entry_recode_recalc.c \
-	alter_entry_scalar1.c alter_entry_scalar2a.c \
-	alter_entry_scalar2n.c alter_entry_scalar3.c \
-	alter_entry_scalar3c.c alter_entry_scalar3i.c \
-	alter_entry_scalar3r.c alter_entry_scalar4.c \
-	alter_entry_scalar_amb.c alter_index.c alter_lincom_23.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_scalar_affix.c \
-	alter_spec.c alter_spec_affix.c alter_spec_meta.c \
-	alter_spec_polynom.c alter_window.c ascii_add.c ascii_get.c \
-	ascii_get_complex.c ascii_get_get.c ascii_get_here.c \
-	ascii_get_sub.c ascii_nframes.c ascii_put.c ascii_put_here.c \
-	ascii_seek.c ascii_seek_far.c ascii_sync.c bof.c bof_bit.c \
-	bof_index.c bof_lincom.c bof_phase.c bof_phase_neg.c \
-	bzip_add.c bzip_get.c bzip_get_far.c bzip_get_get.c \
-	bzip_get_get2.c bzip_get_put.c bzip_move_from.c bzip_move_to.c \
-	bzip_nframes.c bzip_put.c bzip_put_back.c bzip_put_endian.c \
-	bzip_put_get.c bzip_put_pad.c bzip_put_sub.c bzip_seek.c \
-	bzip_seek_far.c bzip_sync.c close_bad.c close_close.c \
+	alter_entry_sarray.c alter_entry_scalar1.c \
+	alter_entry_scalar2a.c alter_entry_scalar2n.c \
+	alter_entry_scalar3.c alter_entry_scalar3c.c \
+	alter_entry_scalar3i.c alter_entry_scalar3r.c \
+	alter_entry_scalar4.c alter_entry_scalar_amb.c alter_index.c \
+	alter_indir.c alter_lincom_23.c alter_lincom_32.c \
+	alter_lincom_affix.c alter_lincom_input.c \
+	alter_lincom_nfields.c alter_lincom_nfields_code.c \
+	alter_lincom_offset.c alter_lincom_scalar.c \
+	alter_lincom_slope.c alter_linterp.c alter_linterp_in.c \
+	alter_linterp_move.c alter_mplex.c alter_mplex_in.c \
+	alter_mplex_scalar.c alter_mspec.c alter_mspec_affix.c \
+	alter_multiply.c alter_phase.c alter_phase_in.c \
+	alter_phase_scalar.c alter_polynom_coeff.c \
+	alter_polynom_input.c alter_polynom_ord.c alter_polynom_ord2.c \
+	alter_polynom_ord_code.c alter_polynom_scalar.c alter_prot.c \
+	alter_raw_prot.c alter_raw_spf.c alter_raw_spf_type.c \
+	alter_raw_type.c alter_rdonly.c alter_recip.c \
+	alter_recip_scalar.c alter_recip_zero.c alter_sarray.c \
+	alter_sarray_nop.c alter_sbit.c alter_scalar_affix.c \
+	alter_sindir.c alter_spec.c alter_spec_affix.c \
+	alter_spec_code.c alter_spec_format.c alter_spec_meta.c \
+	alter_spec_nil.c alter_spec_polynom.c alter_spec_prot.c \
+	alter_spec_rdonly.c alter_window.c alter_window_in.c \
+	alter_window_op.c alter_window_scalar.c ascii_add.c \
+	ascii_complex128.c ascii_complex64.c ascii_float32.c \
+	ascii_float64.c ascii_get.c ascii_get_complex.c \
+	ascii_get_get.c ascii_get_here.c ascii_get_sub.c ascii_int16.c \
+	ascii_int32.c ascii_int64.c ascii_int8.c ascii_nframes.c \
+	ascii_put.c ascii_put_here.c ascii_seek.c ascii_seek_far.c \
+	ascii_sync.c ascii_uint16.c ascii_uint32.c ascii_uint64.c \
+	ascii_uint8.c bof.c bof_bit.c bof_bit_code.c bof_code.c \
+	bof_const.c bof_index.c bof_lincom.c bof_lincom_code.c \
+	bof_phase.c bof_phase_code.c bof_phase_neg.c bof_recurse.c \
+	bzip_add.c bzip_complex128.c bzip_complex64.c bzip_del.c \
+	bzip_enoent.c bzip_float32.c bzip_float64.c bzip_get.c \
+	bzip_get_cont.c bzip_get_far.c bzip_get_get.c bzip_get_get2.c \
+	bzip_get_put.c bzip_int16.c bzip_int32.c bzip_int64.c \
+	bzip_int8.c bzip_move_from.c bzip_move_to.c bzip_nframes.c \
+	bzip_put.c bzip_put_back.c bzip_put_endian.c bzip_put_get.c \
+	bzip_put_offs.c bzip_put_pad.c bzip_put_sub.c bzip_seek.c \
+	bzip_seek_far.c bzip_sync.c bzip_uint16.c bzip_uint32.c \
+	bzip_uint64.c bzip_uint8.c calist.c calist0.c calist_free.c \
+	calist_hidden.c calist_long.c calist_meta.c calist_meta0.c \
+	calist_meta_free.c calist_meta_hidden.c calist_meta_meta.c \
+	calist_meta_parent.c calist_null.c close_bad.c close_close.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 \
@@ -6098,25 +8365,27 @@ DIST_SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.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 creat_rdonly_exists.c cvlist.c \
-	cvlist_array.c cvlist_array0.c cvlist_array_free.c \
-	cvlist_array_hidden.c cvlist_array_meta.c cvlist_array_meta0.c \
-	cvlist_array_meta_free.c cvlist_array_meta_hidden.c \
-	cvlist_array_null.c cvlist_hidden.c cvlist_invalid.c \
-	cvlist_meta.c cvlist_meta0.c cvlist_meta_hidden.c \
-	cvlist_meta_invalid.c cvlist_null.c del_alias.c del_bad_code.c \
-	del_carray.c del_carray_deref.c del_const.c del_const_deref.c \
-	del_const_force.c del_data.c del_data_enoent.c del_data_open.c \
-	del_del.c del_derived.c del_derived_after.c \
-	del_derived_force.c del_meta.c del_meta_force.c del_ref.c \
-	desync.c desync_flush.c desync_path.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_alter_all.c encode_alter_open.c encode_get.c \
-	encode_recode.c encode_recode_open.c encode_support.c \
-	endian_alter.c endian_alter_all.c endian_alter_sie.c \
-	endian_get.c endian_move.c entry_bad_code.c entry_bit.c \
+	cvlist_hidden.c cvlist_invalid.c cvlist_long.c cvlist_meta.c \
+	cvlist_meta0.c cvlist_meta_code.c cvlist_meta_hidden.c \
+	cvlist_meta_invalid.c cvlist_meta_parent.c cvlist_null.c \
+	del_alias.c del_alias_dangle.c del_alias_target.c \
+	del_bad_code.c del_carray.c del_carray_deref.c del_const.c \
+	del_const_deref.c del_const_force.c del_data.c \
+	del_data_enoent.c del_data_open.c del_data_prot.c del_del.c \
+	del_derived.c del_derived_after.c del_derived_force.c \
+	del_divide.c del_meta.c del_meta_force.c del_prot.c \
+	del_rdonly.c del_ref.c desync.c desync_flush.c desync_path.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_parent.c elist_parent2.c \
+	elist_scalar.c elist_type.c encode_alter.c encode_alter_all.c \
+	encode_alter_open.c encode_get.c encode_recode.c \
+	encode_recode_open.c encode_support.c endian_alter.c \
+	endian_alter_all.c endian_alter_arg.c endian_alter_dprot.c \
+	endian_alter_fprot.c endian_alter_index.c \
+	endian_alter_rdonly.c endian_alter_sie.c endian_get.c \
+	endian_index.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 \
@@ -6125,36 +8394,54 @@ DIST_SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.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_bit.c \
-	eof_index.c eof_lincom.c eof_phase.c eof_phase_neg.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 \
-	flac_add.c flac_get_big.c flac_get_far.c flac_get_get.c \
+	eof_bit_code.c eof_const.c eof_index.c eof_lincom.c \
+	eof_lincom_code.c eof_phase.c eof_phase_code.c eof_phase_neg.c \
+	eof_recurse.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 flac_add.c flac_complex128.c flac_complex64.c \
+	flac_del.c flac_enoent.c flac_float32.c flac_float64.c \
+	flac_get_big.c flac_get_cont.c flac_get_far.c flac_get_get.c \
 	flac_get_get2.c flac_get_int64.c flac_get_int8.c \
-	flac_get_little.c flac_get_long.c flac_nframes.c \
+	flac_get_little.c flac_get_long.c flac_int16.c flac_int32.c \
+	flac_int64.c flac_int8.c flac_move_from.c flac_nframes.c \
 	flac_put_big.c flac_put_complex128.c flac_put_float64.c \
-	flac_put_int32.c flac_put_little.c flac_seek.c flac_seek_far.c \
-	flac_sync.c flist.c flist0.c flist2.c flist_hidden.c \
-	flist_invalid.c flist_meta.c flist_meta2.c flist_meta_hidden.c \
-	flist_meta_invalid.c flist_type.c flist_type_hidden.c \
-	flist_type_invalid.c flist_type_meta.c \
+	flac_put_int32.c flac_put_little.c flac_put_offs.c flac_seek.c \
+	flac_seek_far.c flac_sync.c flac_uint16.c flac_uint32.c \
+	flac_uint64.c flac_uint8.c flist.c flist0.c flist2.c \
+	flist_hidden.c flist_invalid.c flist_meta.c flist_meta2.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_all.c \
-	flush_amb_code.c flush_bad_code.c flush_flush.c flush_hex.c \
-	flush_invalid.c flush_lincom.c flush_lincom1.c flush_meta.c \
-	flush_mult.c flush_raw_close.c flush_ref.c flush_spec.c \
-	flush_string.c flush_sync.c foffs_alter.c foffs_alter_all.c \
-	foffs_get.c foffs_move.c fragment_affix.c \
+	flush_bad_code.c flush_flush.c flush_invalid.c flush_lincom.c \
+	flush_lincom1.c flush_mult.c flush_raw_close.c flush_recurse.c \
+	flush_sync.c foffs_alter.c foffs_alter_all.c \
+	foffs_alter_dprot.c foffs_alter_fprot.c foffs_alter_index.c \
+	foffs_alter_range.c foffs_alter_rdonly.c foffs_get.c \
+	foffs_index.c foffs_move.c fragment_affix.c \
 	fragment_affix_alter.c fragment_affix_alter2.c \
-	fragment_affix_alter_code.c fragment_affix_alter_nop.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_c2r.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_carray.c \
-	get_const_complex.c get_const_repr.c get_cpolynom.c \
-	get_cpolynom1.c get_cpolynom_int.c get_dim.c get_divide.c \
-	get_divide_ccin.c get_divide_crin.c get_divide_crinr.c \
-	get_divide_rcin.c get_divide_s.c get_endian16.c get_endian32.c \
+	fragment_affix_alter_code.c fragment_affix_alter_dotpx.c \
+	fragment_affix_alter_index.c fragment_affix_alter_nons.c \
+	fragment_affix_alter_nop.c fragment_affix_alter_ns.c \
+	fragment_affix_alter_pns.c fragment_affix_dup.c \
+	fragment_affix_index.c fragment_affix_ns.c fragment_index.c \
+	fragment_index_alias.c fragment_name.c fragment_name_oor.c \
+	fragment_ndotdots.c fragment_ndots.c fragment_ns.c \
+	fragment_ns0.c fragment_ns_add.c fragment_ns_add0.c \
+	fragment_ns_alter.c fragment_ns_alter_nop.c \
+	fragment_ns_alter_pdel.c fragment_ns_del.c fragment_ns_dot.c \
+	fragment_ns_dotdot.c fragment_ns_dotns.c fragment_ns_nsdot.c \
+	fragment_num.c fragment_parent.c fragment_parent_index.c \
+	fragment_parent_root.c get64.c get_affix.c get_bad_code.c \
+	get_bit.c get_carray.c get_carray_bad.c get_carray_c2r.c \
+	get_carray_slice.c get_carray_slice_bounds.c \
+	get_carray_slice_type.c get_carray_type.c get_char.c \
+	get_clincom.c get_complex128.c get_complex64.c get_const.c \
+	get_const_bad.c get_const_carray.c get_const_complex.c \
+	get_const_repr.c get_const_reprz.c get_cpolynom.c \
+	get_cpolynom1.c get_cpolynom_int.c get_dim.c get_dimin.c \
+	get_divide.c get_divide_ccin.c get_divide_code.c \
+	get_divide_crin.c get_divide_crinr.c get_divide_rcin.c \
+	get_divide_s.c get_dot.c get_endian16.c get_endian32.c \
 	get_endian64.c get_endian8.c get_endian_complex128_arm.c \
 	get_endian_complex128_big.c get_endian_complex128_little.c \
 	get_endian_complex64_arm.c get_endian_complex64_big.c \
@@ -6163,115 +8450,165 @@ DIST_SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.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_foffs2.c get_fs.c get_here.c \
-	get_here_foffs.c get_heres.c get_index_complex.c get_int16.c \
+	get_here_foffs.c get_heres.c get_index_complex.c \
+	get_index_type.c get_indir.c get_indir_typein.c get_int16.c \
 	get_int32.c get_int64.c get_int8.c get_invalid.c get_lincom1.c \
 	get_lincom2.c get_lincom2s.c get_lincom3.c get_lincom3s.c \
-	get_lincom_mdt.c get_lincom_noin.c get_lincom_non.c \
-	get_lincom_null.c get_lincom_spf.c get_linterp.c \
-	get_linterp1.c get_linterp_abs.c get_linterp_complex.c \
-	get_linterp_empty.c get_linterp_nodir.c get_linterp_noin.c \
-	get_linterp_notab.c get_linterp_sort.c get_mplex.c \
-	get_mplex_bof.c get_mplex_complex.c get_mplex_lb.c \
+	get_lincom_code.c get_lincom_mdt.c get_lincom_noin.c \
+	get_lincom_non.c get_lincom_null.c get_lincom_spf.c \
+	get_linterp.c get_linterp1.c get_linterp_abs.c \
+	get_linterp_complex.c get_linterp_empty.c get_linterp_nodir.c \
+	get_linterp_noin.c get_linterp_notab.c get_linterp_sort.c \
+	get_mplex.c get_mplex_bof.c get_mplex_complex.c get_mplex_lb.c \
 	get_mplex_lball.c get_mplex_nolb.c get_mplex_s.c \
 	get_mplex_saved.c get_multiply.c get_multiply_ccin.c \
-	get_multiply_crin.c get_multiply_crinr.c get_multiply_noin.c \
-	get_multiply_rcin.c get_multiply_s.c get_neg.c get_none.c \
-	get_nonexistent.c get_null.c get_off64.c get_phase.c \
-	get_phase_affix.c get_polynom.c get_polynom_cmpin.c \
-	get_polynom_noin.c get_range.c get_recip.c get_recip_const.c \
-	get_recurse.c get_rofs.c get_sbit.c get_sf.c get_ss.c \
-	get_string.c get_type.c get_uint16.c get_uint32.c get_uint64.c \
-	get_window.c get_window_clr.c get_window_complex.c \
-	get_window_ge.c get_window_gt.c get_window_le.c \
-	get_window_lt.c get_window_ne.c get_window_s.c \
-	get_window_set.c get_zero.c get_zero_complex.c \
-	get_zero_float.c global_flags.c global_name.c global_ref.c \
-	global_ref_empty.c global_ref_set.c gzip_add.c gzip_del.c \
-	gzip_get.c gzip_get_far.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_back.c gzip_put_endian.c gzip_put_get.c \
-	gzip_put_nframes.c gzip_put_off.c gzip_put_pad.c \
-	gzip_put_sub.c gzip_seek.c gzip_seek_far.c gzip_seek_put.c \
-	gzip_sync.c header_complex.c header_off64t.c hide.c hide_bad.c \
-	hide_hidden.c hide_hidden_bad.c hide_unhide.c \
-	hide_unhide_bad.c include_accmode.c include_affix.c \
-	include_auto.c include_cb.c include_creat.c include_ignore.c \
-	include_include.c include_index.c include_invalid.c \
-	include_nonexistent.c include_pc.c include_ref.c include_sub.c \
-	include_syntax.c index_domain.c index_index.c index_range.c \
-	index_s.c index_subset.c legacy_error.c legacy_estring.c \
-	legacy_format.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 lzma_put.c \
-	lzma_xz_add.c lzma_xz_get.c lzma_xz_get_far.c \
-	lzma_xz_get_get.c lzma_xz_get_get2.c lzma_xz_get_put.c \
-	lzma_xz_move_to.c lzma_xz_nframes.c lzma_xz_put.c \
-	lzma_xz_put_back.c lzma_xz_put_endian.c lzma_xz_put_get.c \
-	lzma_xz_put_pad.c lzma_xz_seek.c lzma_xz_seek_far.c \
-	lzma_xz_sync.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_spec_resolv.c madd_string.c \
-	madd_window.c move_affix.c move_affix_dup.c move_affix_meta.c \
-	move_affix_updb.c move_alias.c move_data_enc_ar.c \
-	move_data_enc_ra.c move_data_endian.c move_data_foffs.c \
-	move_data_foffs_neg.c move_data_nop.c move_index.c move_meta.c \
-	move_move.c move_protect.c move_subdir.c name_affix.c \
-	name_affix_bad.c name_alias.c name_dangle.c name_dot5.c \
-	name_dot5r.c name_dot9.c name_dup.c name_meta.c name_move.c \
-	name_move_alias.c name_name.c name_updb.c name_updb_affix.c \
-	name_updb_alias.c name_updb_carray.c name_updb_const.c \
-	name_updb_const_alias.c native_bit.c native_const.c \
-	native_index.c native_lincom.c native_lincom_cmpin.c \
-	native_lincom_cmpscal.c native_linterp.c native_linterp_cmp.c \
-	native_mult.c native_mult1.c native_mult2.c native_phase.c \
-	native_polynom.c native_polynom_cmpin.c \
-	native_polynom_cmpscal.c native_raw.c native_recip.c \
-	native_recip_cmpin.c native_recip_cmpscal.c native_sbit.c \
-	native_string.c nentries_alias.c nentries_hidden.c \
+	get_multiply_code.c get_multiply_crin.c get_multiply_crinr.c \
+	get_multiply_noin.c get_multiply_rcin.c get_multiply_s.c \
+	get_neg.c get_none.c get_nonexistent.c get_null.c get_off64.c \
+	get_phase.c get_phase_affix.c get_polynom.c \
+	get_polynom_cmpin.c get_polynom_noin.c get_range.c get_recip.c \
+	get_recip_cmpin.c get_recip_const.c get_recurse.c get_reprz.c \
+	get_rofs.c get_sarray.c get_sarray_bad.c get_sarray_slice.c \
+	get_sarray_slice_bounds.c get_sarray_slice_type.c \
+	get_sarray_type.c get_sbit.c get_sf.c get_sindir.c \
+	get_sindir_code.c get_sindir_neg.c get_sindir_none.c \
+	get_sindir_null.c get_sindir_reprz.c get_sindir_type.c \
+	get_sindir_typein.c get_ss.c get_string.c get_type.c \
+	get_uint16.c get_uint32.c get_uint64.c get_window.c \
+	get_window_clr.c get_window_complex.c get_window_ge.c \
+	get_window_gt.c get_window_le.c get_window_lt.c \
+	get_window_ne.c get_window_s.c get_window_set.c get_zero.c \
+	get_zero_complex.c get_zero_float.c global_flags.c \
+	global_name.c gzip_add.c gzip_complex128.c gzip_complex64.c \
+	gzip_del.c gzip_enoent.c gzip_float32.c gzip_float64.c \
+	gzip_get.c gzip_get_cont.c gzip_get_far.c gzip_get_get.c \
+	gzip_get_get2.c gzip_get_put.c gzip_int16.c gzip_int32.c \
+	gzip_int64.c gzip_int8.c gzip_move_from.c gzip_move_to.c \
+	gzip_nframes.c gzip_put.c gzip_put_back.c gzip_put_endian.c \
+	gzip_put_get.c gzip_put_nframes.c gzip_put_off.c \
+	gzip_put_offs.c gzip_put_pad.c gzip_put_sub.c gzip_seek.c \
+	gzip_seek_far.c gzip_seek_put.c gzip_sync.c gzip_uint16.c \
+	gzip_uint32.c gzip_uint64.c gzip_uint8.c header_complex.c \
+	header_off64t.c hide.c hide_bad.c hide_hidden.c \
+	hide_hidden_bad.c hide_unhide.c hide_unhide_bad.c \
+	include_accmode.c include_affix.c include_affix_ns.c \
+	include_auto.c include_cb.c include_creat.c include_format.c \
+	include_ignore.c include_include.c include_index.c \
+	include_invalid.c include_ndotdots.c include_ndots.c \
+	include_nonexistent.c include_ns.c include_ns_dot.c \
+	include_ns_dotdot.c include_ns_dotns.c include_ns_nil.c \
+	include_ns_null.c include_ns_prefix.c include_pc.c \
+	include_prot.c include_ref.c include_ref_code.c \
+	include_ref_type.c include_sub.c include_syntax.c \
+	index_domain.c index_empty.c index_index.c index_one.c \
+	index_range.c index_reprz.c index_s.c index_scalar.c \
+	index_subset.c legacy_error.c legacy_estring.c legacy_format.c \
+	legacy_get.c legacy_get_put.c legacy_get_rofs.c \
+	legacy_nframes.c legacy_nonexistent.c legacy_put.c \
+	legacy_spf.c len_bad.c len_carray.c len_const.c len_sarray.c \
+	len_string.c len_type.c lzma_enoent.c lzma_get.c \
+	lzma_nframes.c lzma_put.c lzma_xz_add.c lzma_xz_complex128.c \
+	lzma_xz_complex64.c lzma_xz_del.c lzma_xz_float32.c \
+	lzma_xz_float64.c lzma_xz_get.c lzma_xz_get_cont.c \
+	lzma_xz_get_far.c lzma_xz_get_get.c lzma_xz_get_get2.c \
+	lzma_xz_get_put.c lzma_xz_int16.c lzma_xz_int32.c \
+	lzma_xz_int64.c lzma_xz_int8.c lzma_xz_move_from.c \
+	lzma_xz_move_to.c lzma_xz_nframes.c lzma_xz_offs_clear.c \
+	lzma_xz_put.c lzma_xz_put_back.c lzma_xz_put_endian.c \
+	lzma_xz_put_get.c lzma_xz_put_offs.c lzma_xz_put_pad.c \
+	lzma_xz_seek.c lzma_xz_seek_far.c lzma_xz_sync.c \
+	lzma_xz_uint16.c lzma_xz_uint32.c lzma_xz_uint64.c \
+	lzma_xz_uint8.c madd.c madd_affix.c madd_alias.c \
+	madd_alias_affix.c madd_alias_alias.c madd_alias_subsub.c \
+	madd_aliasmeta.c madd_bit.c madd_bit_invalid.c madd_carray.c \
+	madd_clincom.c madd_clincom_nfields.c madd_const.c \
+	madd_cpolynom.c madd_cpolynom_order.c madd_crecip.c \
+	madd_crecip89.c madd_divide.c madd_index.c madd_indir.c \
+	madd_lincom.c madd_lincom_invalid.c madd_lincom_nfields.c \
+	madd_linterp.c madd_linterp_invalid.c madd_mplex.c \
+	madd_multiply.c madd_multiply_invalid.c madd_parent_bad.c \
+	madd_phase.c madd_phase_invalid.c madd_polynom.c \
+	madd_polynom_order.c madd_raw.c madd_recip.c madd_sarray.c \
+	madd_sarray_dup.c madd_sbit.c madd_sindir.c madd_spec.c \
+	madd_spec_directive.c madd_spec_invalid.c madd_spec_parent.c \
+	madd_spec_resolv.c madd_string.c madd_string_dup.c \
+	madd_subsub.c madd_window.c match_fragment.c match_pcre.c \
+	match_pcre_bad.c match_pcre_caseless.c match_pcre_ext.c \
+	match_pcre_js.c match_pcre_utf8.c match_regex.c \
+	match_regex_bad.c match_regex_ext.c match_regex_icase.c \
+	mflush.c mflush_affix.c mflush_amb_code.c mflush_carray.c \
+	mflush_hex.c mflush_indir.c mflush_mplex.c mflush_ns.c \
+	mflush_pretty.c mflush_prot.c mflush_ref.c mflush_repr.c \
+	mflush_repr9.c mflush_reprz.c mflush_sindir.c mflush_spec.c \
+	mflush_string.c mflush_type.c mflush_type4.c mflush_windop.c \
+	move_affix.c move_affix_dup.c move_affix_meta.c \
+	move_affix_updb.c move_alias.c move_code.c move_data_enc_ar.c \
+	move_data_enc_ra.c move_data_enc_un.c move_data_endian.c \
+	move_data_foffs.c move_data_foffs_neg.c move_data_nop.c \
+	move_data_prot.c move_entype.c move_index.c move_meta.c \
+	move_move.c move_nop.c move_ns.c move_nsns.c move_protect.c \
+	move_rdonly.c move_subdir.c move_unkenc.c name_affix.c \
+	name_affix_bad.c name_alias.c name_code.c name_dangle.c \
+	name_dot10.c name_dot5.c name_dot5r.c name_dot9.c name_dup.c \
+	name_index.c name_meta.c name_meta2.c name_move.c \
+	name_move_alias.c name_name.c name_ns.c name_ns2.c \
+	name_nsdot.c name_prot.c name_rdonly.c name_updb.c \
+	name_updb_affix.c name_updb_alias.c name_updb_carray.c \
+	name_updb_const.c name_updb_const_alias.c name_updb_sarray.c \
+	native_bit.c native_code.c native_const.c native_index.c \
+	native_lincom.c native_lincom_cmpin.c native_lincom_cmpscal.c \
+	native_linterp.c native_linterp_cmp.c native_mult.c \
+	native_mult1.c native_mult2.c native_phase.c native_polynom.c \
+	native_polynom_cmpin.c native_polynom_cmpscal.c native_raw.c \
+	native_recip.c native_recip_cmpin.c native_recip_cmpscal.c \
+	native_recurse.c native_reprz.c native_sbit.c native_string.c \
+	nentries_alias.c nentries_entype.c nentries_hidden.c \
 	nentries_noalias.c nentries_scalar.c nfields_hidden.c \
 	nfields_invalid.c nfields_nfields.c nfields_type.c \
 	nfields_type_hidden.c nfields_type_invalid.c nfields_vector.c \
 	nfields_vector_hidden.c nfields_vector_invalid.c nframes64.c \
 	nframes_empty.c nframes_invalid.c nframes_nframes.c \
 	nframes_off64.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_abs.c \
-	open_cb_abort.c open_cb_cont.c open_cb_ignore.c \
-	open_cb_invalid.c open_cb_rescan.c open_cb_rescan_alloc.c \
-	open_eaccess.c open_invalid.c open_nonexistent.c \
-	open_notdirfile.c open_open.c open_rofs.c open_sym_al.c \
-	open_sym_at.c open_sym_c.c open_sym_cl.c open_sym_ct.c \
-	open_sym_d.c open_sym_l.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 \
+	nmeta_invalid.c nmeta_parent.c nmeta_parent_meta.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_abs.c open_cb_abort.c \
+	open_cb_cont.c open_cb_ignore.c open_cb_invalid.c \
+	open_cb_rescan.c open_cb_rescan_alloc.c open_eaccess.c \
+	open_invalid.c open_nonexistent.c open_notdirfile.c \
+	open_open.c open_rofs.c open_sym_al.c open_sym_at.c \
+	open_sym_c.c open_sym_cl.c open_sym_ct.c open_sym_d.c \
+	open_sym_l.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_loop.c parse_alias_meta.c parse_alias_missing.c \
+	parse_alias_ncols.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_carray_ncols.c parse_carray_type.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_hex.c \
-	parse_hidden.c parse_hidden_field.c parse_hidden_meta.c \
-	parse_include.c parse_include_absolute.c \
+	parse_const_type.c parse_divide.c parse_double.c \
+	parse_duplicate.c parse_duplicate_ignore.c parse_endian_bad.c \
+	parse_endian_bad2.c parse_endian_big.c parse_endian_force.c \
+	parse_endian_little.c parse_endian_slash.c parse_eol.c \
+	parse_esc.c parse_foffs.c parse_foffs_include.c \
+	parse_foffs_slash.c parse_hex.c parse_hidden.c \
+	parse_hidden_field.c parse_hidden_frag.c parse_hidden_meta.c \
+	parse_huge.c parse_include.c parse_include_absolute.c \
 	parse_include_absrel.c parse_include_affix_bad.c \
 	parse_include_affix_ref.c parse_include_dir.c \
-	parse_include_loop.c parse_include_nonexistent.c \
+	parse_include_loop.c parse_include_nodir.c \
+	parse_include_nonexistent.c parse_include_ns.c \
+	parse_include_ns2.c parse_include_nsabs.c \
+	parse_include_nsinh.c parse_include_nspop.c \
+	parse_include_nsrabs.c parse_include_nsrainh.c \
+	parse_include_nsrinh.c parse_include_nsroot.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_include_sufsuffix.c parse_index.c parse_indir.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 \
@@ -6283,34 +8620,47 @@ DIST_SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.c \
 	parse_meta_alias.c parse_meta_frag.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_octal_zero.c parse_phase.c parse_phase_ncols.c \
-	parse_phase_scalar.c parse_polynom.c parse_polynom_ncols1.c \
-	parse_polynom_ncols2.c parse_polynom_scalar.c \
-	parse_protect_all.c parse_protect_bad.c parse_protect_data.c \
-	parse_protect_format.c parse_protect_none.c parse_quote.c \
-	parse_quote_mismatch.c parse_raw.c parse_raw_char.c \
-	parse_raw_char_bad.c parse_raw_ncols.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_scalar1.c \
-	parse_scalar2.c parse_scalar_repr.c parse_sort.c \
-	parse_string.c parse_string_ncols.c parse_string_null.c \
-	parse_utf8.c parse_utf8_invalid.c parse_utf8_zero.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_meta_malias.c parse_meta_meta.c parse_meta_ncols.c \
+	parse_meta_parent.c parse_meta_raw.c parse_mplex.c \
+	parse_mplex_ncols.c parse_mplex_neg.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_ncols.c \
+	parse_ns.c parse_ns_dot.c parse_ns_dotdot.c \
+	parse_ns_dotdotns.c parse_ns_dotns.c parse_ns_include.c \
+	parse_ns_include_ns.c parse_ns_ndotdots.c parse_ns_ndots.c \
+	parse_ns_nsdot.c parse_ns_nsdotdot.c parse_nsf.c \
+	parse_nsf_abs.c parse_nsf_alias.c parse_nsf_dot.c \
+	parse_nsf_hide.c parse_nsf_index.c parse_nsf_meta.c \
+	parse_nsf_meta2.c parse_nsf_ref.c parse_nsf_refabs.c \
+	parse_nsf_root.c parse_nsf_sub.c parse_octal_zero.c \
+	parse_phase.c parse_phase_ncols.c parse_phase_scalar.c \
+	parse_polynom.c parse_polynom_ncols1.c parse_polynom_ncols2.c \
+	parse_polynom_scalar.c parse_protect_all.c parse_protect_bad.c \
+	parse_protect_data.c parse_protect_format.c \
+	parse_protect_none.c parse_quote.c parse_quote_mismatch.c \
+	parse_raw.c parse_raw_char.c parse_raw_char_bad.c \
+	parse_raw_ncols.c parse_raw_scalar.c parse_raw_spf.c \
+	parse_raw_type.c parse_recip.c parse_recip_ncols.c parse_ref.c \
+	parse_ref_nonexistent.c parse_ref_type.c parse_sarray.c \
+	parse_sarray_long.c parse_sarray_ncols.c parse_sbit.c \
+	parse_scalar1.c parse_scalar2.c parse_scalar_repr.c \
+	parse_sindir.c parse_sort.c parse_string.c \
+	parse_string_ncols.c parse_string_null.c parse_utf8.c \
+	parse_utf8_invalid.c parse_utf8_zero.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_alter_all.c protect_get.c put64.c put_bad_code.c \
-	put_bit.c put_bof.c put_carray.c put_carray_client.c \
-	put_carray_slice.c put_char.c put_clincom1.c put_complex128.c \
-	put_complex64.c put_const.c put_const_protect.c put_cpolynom.c \
-	put_crecip.c put_divide.c put_endian16.c put_endian32.c \
-	put_endian64.c put_endian8.c put_endian_complex128_arm.c \
+	protect_alter_all.c protect_alter_arg.c protect_alter_index.c \
+	protect_alter_rdonly.c protect_get.c protect_index.c put64.c \
+	put_bad_code.c put_bit.c put_bit_repr.c put_bof.c put_carray.c \
+	put_carray_bad.c put_carray_bounds.c put_carray_client.c \
+	put_carray_rdonly.c put_carray_slice.c put_carray_type.c \
+	put_char.c put_clincom1.c put_complex128.c put_complex64.c \
+	put_const.c put_const_protect.c put_cpolynom.c put_crecip.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 \
@@ -6318,25 +8668,37 @@ DIST_SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.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_indir.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_lincom_repr.c put_linterp.c put_linterp_cmp.c \
 	put_linterp_noin.c put_linterp_nomono.c put_linterp_notab.c \
-	put_linterp_reverse.c put_mplex.c put_mplex_complex.c \
-	put_multiply.c put_nofile.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_range.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_sub.c \
+	put_linterp_repr.c put_linterp_reverse.c put_mplex.c \
+	put_mplex_complex.c put_mplex_repr.c put_multiply.c put_neg.c \
+	put_nofile.c put_null.c put_off64.c put_phase.c \
+	put_phase_noin.c put_phase_repr.c put_polynom1.c \
+	put_polynom2.c put_polynom_noin.c put_polynom_repr.c \
+	put_protect.c put_range.c put_rdonly.c put_recip.c \
+	put_recip_repr.c put_recurse.c put_repr.c put_rofs.c \
+	put_sarray.c put_sarray_bad.c put_sarray_bounds.c \
+	put_sarray_rdonly.c put_sarray_slice.c put_sarray_type.c \
+	put_sbit.c put_scalar.c put_sf.c put_sindir.c put_ss.c \
+	put_string.c put_string_protect.c put_string_type.c put_sub.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_bad.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_far.c seek_foffs.c \
-	seek_foffs2.c seek_index.c seek_lincom.c seek_mult.c \
-	seek_neg.c seek_phase.c seek_range.c seek_range2.c seek_set.c \
-	seek_sub.c sie_get_big.c sie_get_header.c sie_get_little.c \
+	put_zero.c ref.c ref_empty.c ref_get.c ref_none.c ref_set.c \
+	ref_set_code.c ref_set_prot.c ref_set_rdonly.c ref_set_type.c \
+	ref_two.c repr_a.c repr_bad.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 salist.c salist0.c salist_hidden.c salist_long.c \
+	salist_meta.c salist_meta0.c salist_meta_free.c \
+	salist_meta_hidden.c salist_meta_meta.c salist_meta_parent.c \
+	seek64.c seek_arg.c seek_code.c seek_cur.c seek_dim.c \
+	seek_end.c seek_far.c seek_foffs.c seek_foffs2.c seek_index.c \
+	seek_index_end.c seek_lincom.c seek_mplex.c seek_mult.c \
+	seek_neg.c seek_phase.c seek_range.c seek_range2.c \
+	seek_range_end.c seek_recurse.c seek_set.c seek_sub.c \
+	sie_err_open.c sie_get_big.c sie_get_header.c sie_get_little.c \
 	sie_move_from.c sie_move_to.c sie_nframes_big.c \
 	sie_nframes_little.c sie_put_append.c sie_put_append2.c \
 	sie_put_back.c sie_put_big.c sie_put_header.c sie_put_little.c \
@@ -6344,27 +8706,31 @@ DIST_SOURCES = add_add.c add_affix.c add_alias.c add_alias_affix.c \
 	sie_put_pad0.c sie_put_trunc.c sie_put_trunc2.c \
 	sie_put_trunc_nf.c sie_seek.c sie_seek_far.c sie_sync.c \
 	slim_get.c slim_nframes.c slim_seek.c slim_seek_far.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_raw.c \
-	spf_recip.c spf_recurse.c svlist.c svlist0.c svlist2.c \
-	svlist_hidden.c svlist_invalid.c svlist_meta.c svlist_meta0.c \
-	svlist_meta_hidden.c svlist_meta_invalid.c table.c \
-	table_code.c table_type.c tell.c tell64.c tell_multidiv.c \
+	spf_alias.c spf_alias_meta.c spf_alias_missing.c spf_const.c \
+	spf_divide.c spf_lincom.c spf_multiply.c spf_polynom.c \
+	spf_raw.c spf_recip.c spf_recurse.c svlist.c svlist0.c \
+	svlist2.c svlist_hidden.c svlist_invalid.c svlist_long.c \
+	svlist_meta.c svlist_meta0.c svlist_meta_hidden.c \
+	svlist_meta_invalid.c svlist_meta_meta.c svlist_meta_parent.c \
+	table.c table_code.c table_type.c tell.c tell64.c tell_code.c \
+	tell_dim.c tell_multi_div.c tell_multi_lincom.c tell_recurse.c \
 	tell_sub.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 unclude_open.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 zzip_data.c zzip_get.c zzip_get_get.c \
-	zzip_nframes.c zzip_seek.c zzip_seek_far.c zzslim_get.c \
-	zzslim_nframes.c zzslim_seek.c zzslim_seek_far.c
+	unclude.c unclude_del.c unclude_index.c unclude_keep.c \
+	unclude_move.c unclude_open.c unclude_prot.c unclude_rdonly.c \
+	valid_reprz.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 zzip_data.c \
+	zzip_get.c zzip_get_get.c zzip_nframes.c zzip_seek.c \
+	zzip_seek_far.c zzslim_get.c zzslim_nframes.c zzslim_seek.c \
+	zzslim_seek_far.c
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -6443,6 +8809,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
@@ -6664,53 +9032,99 @@ top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign serial-tests
 LDADD = ../src/libgetdata.la
 AM_CPPFLAGS = ${GD_CC_WALL} $(GD_CC_WEXTRA) -I$(top_srcdir)/src
-EXTRA_DIST = test.h
-ADD_TESTS = add_add add_affix add_alias add_alias_affix add_alias_meta \
-					add_amb_code7 add_bit add_bit_bitnum add_bit_bitsize add_bit_invalid \
-					add_bit_numbits add_bit_scalars add_carray add_clincom add_code \
-					add_const add_cpolynom add_crecip add_crecip89 add_dangle_dup \
-					add_divide add_divide_invalid add_dot5 add_dot6 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_scalars add_multiply add_multiply_invalid add_phase \
-					add_phase_invalid add_polynom add_polynom_scalar add_protect add_raw \
-					add_raw_include add_raw_invalid add_raw_spf add_raw_spf_scalar \
-					add_raw_sub 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
+
+# The enc_*.c files aren't directly used as tests.  They're included by
+# corresponding encoding tests.
+EXTRA_DIST = test.h enc_add.c enc_complex64.c enc_complex128.c enc_del.c \
+					 enc_enoent.c enc_float32.c enc_float64.c enc_get_cont.c enc_int8.c \
+					 enc_int16.c enc_int32.c enc_int64.c enc_move_from.c enc_nframes.c \
+					 enc_put_offs.c enc_seek.c enc_uint8.c enc_uint16.c enc_uint32.c \
+					 enc_uint64.c
+
+ADD_TESTS = add_add add_affix add_alias add_alias_affix add_alias_index \
+					add_alias_meta add_alias_name add_alias_ns add_alias_prot \
+					add_alias_rdonly add_amb_code7 add_bit add_bit_bitnum \
+					add_bit_bitsize add_bit_inaff add_bit_invalid add_bit_numbits \
+					add_bit_scalars add_carray add_carray_entry add_carray_type \
+					add_clincom add_clincom_nfields add_code add_const add_const_type \
+					add_cpolynom add_cpolynom_order add_crecip add_crecip89 \
+					add_dangle_dup add_divide add_divide_inaff1 add_divide_inaff2 \
+					add_divide_invalid add_dot5 add_dot6 add_dot10 add_duplicate \
+					add_format add_indir add_invalid add_lincom add_lincom_affix \
+					add_lincom_invalid add_lincom_nfields add_lincom_nfields2 \
+					add_linterp add_linterp_inaff add_linterp_invalid add_meta \
+					add_meta_alias add_meta_parent add_mplex add_mplex_inaff \
+					add_mplex_period add_mplex_scalars add_multiply add_multiply_invalid \
+					add_name_len add_ns add_ns_frag add_ns_frag2 add_phase \
+					add_phase_inaff add_phase_invalid add_polynom add_polynom_inaff \
+					add_polynom_order add_polynom_order2 add_polynom_scalar add_protect \
+					add_raw add_raw_include add_raw_invalid add_raw_prot add_raw_spf \
+					add_raw_spf_scalar add_raw_sub add_raw_type add_rdonly add_recip \
+					add_recip_inaff add_resolv add_sarray add_sarray_dup add_sarray_nil \
+					add_sbit add_scalar add_scalar_carray add_scalar_carray_bad \
+					add_sindir add_sort add_spec add_spec_affix add_spec_directive \
+					add_spec_index \
+					add_spec_invalid add_spec_meta add_spec_nil add_spec_prot \
+					add_spec_raw_autoenc add_spec_raw_prot add_spec_raw_unkenc \
+					add_spec_resolv add_string add_string_affix add_string_dup \
+					add_string_entry add_type add_window add_window_inaff 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_clincom alter_const alter_const_c2r \
-						alter_const_r2c alter_const_r2r alter_cpolynom alter_cpolynom_null \
+ALLOC_TESTS = alloc_affix alloc_callback alloc_clear alloc_entry alloc_tok
+ALTER_TESTS = alter_bit_bitnum alter_bit_in alter_bit_numbits alter_bit_scalar \
+						alter_carray_len alter_carray_type alter_clincom alter_clincom_32 \
+						alter_clincom_nfields alter_clincom_nfields_code \
+						alter_clincom_null alter_code alter_const alter_const_c2r \
+						alter_const_r2c alter_const_r2r alter_const_type alter_cpolynom \
+						alter_cpolynom_null alter_cpolynom_ord alter_cpolynom_ord_code \
 						alter_crecip alter_crecip89 alter_crecip89_null alter_crecip_zero \
-						alter_divide alter_entry alter_entry_affix alter_entry_hidden \
-						alter_entry_lincom alter_entry_recode alter_entry_recode_recalc \
-						alter_entry_scalar1 alter_entry_scalar2a alter_entry_scalar2n \
-						alter_entry_scalar3 alter_entry_scalar3c alter_entry_scalar3i \
-						alter_entry_scalar3r alter_entry_scalar4 alter_entry_scalar_amb \
-						alter_index 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_spec_polynom alter_window
-
-ASCII_TESTS = ascii_add ascii_get ascii_get_complex ascii_get_get ascii_get_here \
-						ascii_get_sub ascii_nframes ascii_put ascii_put_here ascii_seek \
-						ascii_seek_far ascii_sync
-
-BOF_TESTS = bof bof_bit bof_index bof_lincom bof_phase bof_phase_neg
-BZIP_TESTS = bzip_add bzip_get bzip_get_far bzip_get_get bzip_get_get2 \
-					 bzip_get_put bzip_move_from bzip_move_to bzip_nframes bzip_put \
-					 bzip_put_back bzip_put_endian bzip_put_get bzip_put_pad \
-					 bzip_put_sub bzip_seek bzip_seek_far bzip_sync
+						alter_divide alter_divide_in alter_entry alter_entry_affix \
+						alter_entry_entype alter_entry_hidden alter_entry_lincom \
+						alter_entry_lincom_nfields alter_entry_recode \
+						alter_entry_recode_recalc alter_entry_sarray alter_entry_scalar1 \
+						alter_entry_scalar2a alter_entry_scalar2n alter_entry_scalar3 \
+						alter_entry_scalar3c alter_entry_scalar3i alter_entry_scalar3r \
+						alter_entry_scalar4 alter_entry_scalar_amb alter_index alter_indir \
+						alter_lincom_23 alter_lincom_32 alter_lincom_affix \
+						alter_lincom_input alter_lincom_nfields alter_lincom_nfields_code \
+						alter_lincom_offset alter_lincom_scalar alter_lincom_slope \
+						alter_linterp alter_linterp_in alter_linterp_move alter_mplex \
+						alter_mplex_in alter_mplex_scalar alter_mspec alter_mspec_affix \
+						alter_multiply alter_phase alter_phase_in alter_phase_scalar \
+						alter_polynom_coeff alter_polynom_input alter_polynom_ord \
+						alter_polynom_ord2 alter_polynom_ord_code alter_polynom_scalar \
+						alter_prot alter_raw_prot alter_raw_spf alter_raw_spf_type \
+						alter_raw_type alter_rdonly alter_recip alter_recip_scalar \
+						alter_recip_zero alter_sarray alter_sarray_nop alter_sbit \
+						alter_scalar_affix alter_sindir alter_spec alter_spec_affix \
+						alter_spec_code alter_spec_format alter_spec_meta alter_spec_nil \
+						alter_spec_polynom alter_spec_prot alter_spec_rdonly alter_window \
+						alter_window_in alter_window_op alter_window_scalar
+
+ASCII_TESTS = ascii_add ascii_complex64 ascii_complex128 ascii_get \
+						ascii_get_complex ascii_float32 ascii_float64 ascii_get_get \
+						ascii_get_here ascii_get_sub ascii_int8 ascii_int16 ascii_int32 \
+						ascii_int64 ascii_nframes ascii_put ascii_put_here ascii_seek \
+						ascii_seek_far ascii_sync ascii_uint8 ascii_uint16 ascii_uint32 \
+						ascii_uint64
+
+BOF_TESTS = bof bof_bit bof_bit_code bof_code bof_const bof_index bof_lincom \
+					bof_lincom_code bof_phase bof_phase_code bof_phase_neg bof_recurse
+
+BZIP_TESTS = bzip_add bzip_complex64 bzip_complex128 bzip_del bzip_enoent \
+					 bzip_float32 bzip_float64 bzip_get bzip_get_cont bzip_get_far \
+					 bzip_get_get bzip_get_get2 bzip_get_put bzip_int8 bzip_int16 \
+					 bzip_int32 bzip_int64 bzip_move_from bzip_move_to bzip_nframes \
+					 bzip_put bzip_put_back bzip_put_endian bzip_put_get bzip_put_offs \
+					 bzip_put_pad bzip_put_sub bzip_seek bzip_seek_far bzip_sync \
+					 bzip_uint8 bzip_uint16 bzip_uint32 bzip_uint64
+
+CALIST_TESTS = calist calist0 calist_free calist_hidden calist_long calist_meta \
+						 calist_meta0 calist_meta_free calist_meta_hidden calist_meta_meta \
+						 calist_meta_parent calist_null
 
 CLOSE_TESTS = close_bad close_close close_discard close_null
 CONVERT_TESTS = convert_complex128_complex64 convert_complex128_float64 \
@@ -6763,27 +9177,29 @@ CONVERT_TESTS = convert_complex128_complex64 convert_complex128_float64 \
 							convert_uint8_uint32 convert_uint8_uint64
 
 CREAT_TESTS = creat creat_excl creat_rdonly creat_rdonly_exists
-CVLIST_TESTS = cvlist cvlist_array cvlist_array0 cvlist_array_free \
-						 cvlist_array_hidden cvlist_array_meta cvlist_array_meta0 \
-						 cvlist_array_meta_free cvlist_array_meta_hidden cvlist_array_null \
-						 cvlist_hidden cvlist_invalid cvlist_meta cvlist_meta0 \
-						 cvlist_meta_hidden cvlist_meta_invalid cvlist_null
+CVLIST_TESTS = cvlist cvlist_hidden cvlist_invalid cvlist_long cvlist_meta \
+						 cvlist_meta0 cvlist_meta_code cvlist_meta_hidden \
+						 cvlist_meta_invalid cvlist_meta cvlist_null cvlist_meta_parent
 
-DEL_TESTS = del_alias del_bad_code del_carray del_carray_deref del_const \
-					del_const_deref del_const_force del_data del_data_enoent \
-					del_data_open del_derived del_derived_after del_derived_force \
-					del_del del_meta del_meta_force del_ref
+DEL_TESTS = del_alias del_alias_dangle del_alias_target del_bad_code del_carray \
+					del_carray_deref del_const del_const_deref del_const_force del_data \
+					del_data_enoent del_data_open del_data_prot del_del del_derived \
+					del_derived_after del_derived_force del_divide del_meta \
+					del_meta_force del_prot del_rdonly del_ref
 
 DESYNC_TESTS = desync desync_flush desync_path desync_reopen desync_reopen_inv
 DFES_TESTS = dfes_bit dfes_divide dfes_lincom dfes_linterp dfes_multiply \
 					 dfes_null dfes_phase dfes_raw dfes_recip dfes_zero
 
-ELIST_TESTS = elist_alias elist_hidden elist_noalias elist_scalar
+ELIST_TESTS = elist_alias elist_hidden elist_noalias elist_parent elist_parent2 \
+						elist_scalar elist_type
+
 ENCODE_TESTS = encode_alter encode_alter_all encode_alter_open encode_get \
 						 encode_recode encode_recode_open encode_support
 
-ENDIAN_TESTS = endian_alter endian_alter_all endian_alter_sie endian_get \
-						 endian_move
+ENDIAN_TESTS = endian_alter endian_alter_all endian_alter_arg endian_alter_dprot \
+						 endian_alter_fprot endian_alter_index endian_alter_rdonly \
+						 endian_alter_sie endian_get endian_index endian_move
 
 ENTRY_TESTS = entry_bad_code entry_bit entry_bit_scalar entry_divide \
 						entry_invalid entry_lincom entry_lincom_scalar entry_linterp \
@@ -6793,117 +9209,176 @@ ENTRY_TESTS = entry_bad_code entry_bit entry_bit_scalar entry_divide \
 						entry_scalar_repr entry_recip entry_type entry_type_alias \
 						entry_window entry_window_scalar
 
-EOF_TESTS = eof eof_bit eof_index eof_lincom eof_phase eof_phase_neg
+EOF_TESTS = eof eof_bit eof_bit_code eof_const eof_index eof_lincom \
+					eof_lincom_code eof_phase eof_phase_code eof_phase_neg eof_recurse
+
 ERROR_TESTS = error error_error error_num error_short error_verbose \
 						error_verbose_prefix
 
 FILE_TESTS = file file_code file_type
-FLAC_TESTS = flac_add flac_get_big flac_get_far flac_get_get flac_get_get2 \
-					 flac_get_int8 flac_get_int64 flac_get_little flac_get_long \
-					 flac_nframes flac_put_big flac_put_complex128 flac_put_float64 \
-					 flac_put_int32 flac_put_little flac_seek flac_seek_far flac_sync
+FLAC_TESTS = flac_add flac_complex64 flac_complex128 flac_del flac_enoent \
+					 flac_float32 flac_float64 flac_get_big flac_get_cont \
+					 flac_get_far flac_get_get flac_get_get2 flac_get_int8 \
+					 flac_get_int64 flac_get_little flac_get_long flac_int8 \
+					 flac_int16 flac_int32 flac_int64 flac_move_from flac_nframes \
+					 flac_put_big flac_put_complex128 flac_put_float64 \
+					 flac_put_int32 flac_put_little flac_put_offs flac_seek \
+					 flac_seek_far flac_sync flac_uint8 flac_uint16 flac_uint32 \
+					 flac_uint64
 
 FLIST_TESTS = flist flist0 flist2 flist_hidden flist_invalid flist_meta \
 						flist_meta2 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_all flush_amb_code flush_bad_code flush_flush flush_hex \
-						flush_invalid flush_lincom flush_lincom1 flush_meta flush_mult \
-						flush_raw_close flush_ref flush_spec flush_string flush_sync
+FLUSH_TESTS = flush_all flush_bad_code flush_flush flush_invalid flush_lincom \
+						flush_lincom1 flush_mult flush_raw_close flush_recurse flush_sync
+
+FOFFS_TESTS = foffs_alter foffs_alter_all foffs_alter_dprot foffs_alter_fprot \
+						foffs_alter_index foffs_alter_range foffs_alter_rdonly foffs_get \
+						foffs_index foffs_move
 
-FOFFS_TESTS = foffs_alter foffs_alter_all foffs_get foffs_move
 FRAGMENT_TESTS = fragment_affix fragment_affix_alter fragment_affix_alter2 \
-							 fragment_affix_alter_code fragment_affix_alter_nop \
-							 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_c2r get_carray_slice get_char get_clincom get_complex128 \
-					get_complex64 get_const get_const_carray get_const_complex \
-					get_const_repr get_cpolynom get_cpolynom1 get_cpolynom_int get_dim \
-					get_divide get_divide_ccin get_divide_crin get_divide_crinr \
-					get_divide_rcin get_divide_s get_endian8 get_endian16 get_endian32 \
-					get_endian64 get_endian_complex128_arm get_endian_complex128_big \
-					get_endian_complex128_little get_endian_complex64_arm \
-					get_endian_complex64_big get_endian_complex64_little \
-					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_foffs2 get_fs get_here get_here_foffs \
-					get_heres get_index_complex get_int8 get_int16 get_int32 \
-					get_int64 get_invalid get_lincom1 get_lincom2 get_lincom2s \
-					get_lincom3 get_lincom3s get_lincom_mdt get_lincom_noin \
-					get_lincom_non get_lincom_null get_lincom_spf get_linterp \
-					get_linterp1 get_linterp_abs get_linterp_complex get_linterp_empty \
-					get_linterp_nodir get_linterp_noin get_linterp_notab \
-					get_linterp_sort get_mplex get_mplex_bof get_mplex_complex \
-					get_mplex_lb get_mplex_lball get_mplex_nolb get_mplex_s \
-					get_mplex_saved get_multiply get_multiply_ccin get_multiply_crin \
-					get_multiply_crinr get_multiply_noin get_multiply_rcin \
-					get_multiply_s get_neg get_none get_nonexistent get_null get_off64 \
-					get_phase get_phase_affix get_polynom get_polynom_cmpin \
-					get_polynom_noin get_range get_recip get_recip_const get_recurse \
-					get_rofs get_sbit get_sf get_ss get_string get_type get_uint16 \
-					get_uint32 get_uint64 get_window get_window_clr get_window_complex \
-					get_window_ge get_window_gt get_window_le get_window_lt \
-					get_window_ne get_window_s get_window_set get_zero get_zero_complex \
-					get_zero_float
-
-GLOBAL_TESTS = global_flags global_name global_ref global_ref_empty global_ref_set
-GZIP_TESTS = gzip_add gzip_del gzip_get gzip_get_far gzip_get_get gzip_get_get2 \
-					 gzip_get_put gzip_move_from gzip_move_to gzip_nframes gzip_put \
-					 gzip_put_back gzip_put_endian gzip_put_get gzip_put_nframes \
-					 gzip_put_off gzip_put_pad gzip_put_sub gzip_seek gzip_seek_far \
-					 gzip_seek_put gzip_sync
+							 fragment_affix_alter_code fragment_affix_alter_dotpx \
+							 fragment_affix_alter_index fragment_affix_alter_nop \
+							 fragment_affix_alter_nons fragment_affix_alter_ns \
+							 fragment_affix_alter_pns fragment_affix_dup \
+							 fragment_affix_index fragment_affix_ns fragment_index \
+							 fragment_index_alias fragment_name fragment_name_oor \
+							 fragment_ndotdots fragment_ndots fragment_ns fragment_ns0 \
+							 fragment_ns_add fragment_ns_add0 fragment_ns_alter \
+							 fragment_ns_alter_nop fragment_ns_alter_pdel \
+							 fragment_ns_del fragment_ns_dot fragment_ns_dotdot \
+							 fragment_ns_dotns fragment_ns_nsdot fragment_num \
+							 fragment_parent fragment_parent_index fragment_parent_root
+
+GET_TESTS = get64 get_affix get_bad_code get_bit get_carray get_carray_bad \
+					get_carray_c2r get_carray_slice get_carray_slice_bounds \
+					get_carray_slice_type get_carray_type get_char get_clincom \
+					get_complex128 get_complex64 get_const get_const_bad \
+					get_const_carray get_const_complex get_const_repr get_const_reprz \
+					get_cpolynom get_cpolynom1 get_cpolynom_int get_dim get_dimin \
+					get_divide get_divide_ccin get_divide_code get_divide_crin \
+					get_divide_crinr get_divide_rcin get_divide_s get_dot get_endian8 \
+					get_endian16 get_endian32 get_endian64 get_endian_complex128_arm \
+					get_endian_complex128_big get_endian_complex128_little \
+					get_endian_complex64_arm get_endian_complex64_big \
+					get_endian_complex64_little 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_foffs2 get_fs get_here get_here_foffs get_heres \
+					get_index_complex get_index_type get_indir get_indir_typein get_int8 \
+					get_int16 get_int32 get_int64 get_invalid get_lincom1 get_lincom2 \
+					get_lincom2s get_lincom3 get_lincom3s get_lincom_mdt get_lincom_noin \
+					get_lincom_non get_lincom_null get_lincom_spf get_lincom_code \
+					get_linterp get_linterp1 get_linterp_abs get_linterp_complex \
+					get_linterp_empty get_linterp_nodir get_linterp_noin \
+					get_linterp_notab get_linterp_sort get_mplex get_mplex_bof \
+					get_mplex_complex get_mplex_lb get_mplex_lball get_mplex_nolb \
+					get_mplex_s get_mplex_saved get_multiply get_multiply_ccin \
+					get_multiply_code get_multiply_crin get_multiply_crinr \
+					get_multiply_noin get_multiply_rcin get_multiply_s get_neg get_none \
+					get_nonexistent get_null get_off64 get_phase get_phase_affix \
+					get_polynom get_polynom_cmpin get_polynom_noin get_range get_recip \
+					get_recip_cmpin get_recip_const get_recurse get_reprz get_rofs \
+					get_sarray get_sarray_bad get_sarray_slice get_sarray_slice_bounds \
+					get_sarray_slice_type get_sarray_type get_sbit get_sf get_sindir \
+					get_sindir_code get_sindir_neg get_sindir_none get_sindir_null \
+					get_sindir_reprz get_sindir_type get_sindir_typein get_ss get_string \
+					get_type get_uint16 get_uint32 get_uint64 get_window get_window_clr \
+					get_window_complex get_window_ge get_window_gt get_window_le \
+					get_window_lt get_window_ne get_window_s get_window_set get_zero \
+					get_zero_complex get_zero_float
+
+GLOBAL_TESTS = global_flags global_name
+GZIP_TESTS = gzip_add gzip_complex64 gzip_complex128 gzip_del gzip_enoent \
+					 gzip_float32 gzip_float64 gzip_get gzip_get_cont gzip_get_far \
+					 gzip_get_get gzip_get_get2 gzip_get_put gzip_int8 gzip_int16 \
+					 gzip_int32 gzip_int64 gzip_move_from gzip_move_to gzip_nframes \
+					 gzip_put gzip_put_back gzip_put_endian gzip_put_get \
+					 gzip_put_nframes gzip_put_off gzip_put_offs gzip_put_pad \
+					 gzip_put_sub gzip_seek gzip_seek_far gzip_seek_put gzip_sync \
+					 gzip_uint8 gzip_uint16 gzip_uint32 gzip_uint64
 
 HEADER_TESTS = header_complex header_off64t
 HIDE_TESTS = hide hide_bad hide_hidden hide_hidden_bad hide_unhide \
 					 hide_unhide_bad
 
-INCLUDE_TESTS = include_accmode include_affix include_auto include_cb \
-							include_creat include_ignore include_include include_index \
-							include_invalid include_nonexistent include_pc \
-							include_ref include_sub include_syntax
+INCLUDE_TESTS = include_accmode include_affix include_affix_ns include_auto \
+							include_cb include_creat include_format include_ignore \
+							include_include include_index include_invalid \
+							include_nonexistent include_ndotdots include_ndots include_ns \
+							include_ns_dot include_ns_dotdot include_ns_dotns include_ns_nil \
+							include_ns_null include_ns_prefix include_pc include_prot \
+							include_ref include_ref_code include_ref_type include_sub \
+							include_syntax
+
+INDEX_TESTS = index_domain index_empty index_index index_one index_range \
+						index_reprz index_s index_scalar index_subset
 
-INDEX_TESTS = index_domain index_index index_range index_s index_subset
 @INCLUDE_LEGACY_API_TRUE at LEGACY_TESTS = legacy_error legacy_estring legacy_format legacy_get \
 @INCLUDE_LEGACY_API_TRUE@						 legacy_get_put legacy_get_rofs legacy_nframes legacy_nonexistent \
 @INCLUDE_LEGACY_API_TRUE@						 legacy_put legacy_spf
 
-LZMA_TESTS = lzma_get lzma_nframes lzma_put lzma_xz_add lzma_xz_get \
-					 lzma_xz_get_far lzma_xz_get_get lzma_xz_get_get2 lzma_xz_get_put \
-					 lzma_xz_move_to lzma_xz_nframes lzma_xz_put lzma_xz_put_back \
-					 lzma_xz_put_endian lzma_xz_put_get lzma_xz_put_pad lzma_xz_seek \
-					 lzma_xz_seek_far lzma_xz_sync
-
-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
+LEN_TESTS = len_bad len_carray len_const len_sarray len_string len_type
+LZMA_TESTS = lzma_enoent lzma_get lzma_nframes lzma_put lzma_xz_add \
+					 lzma_xz_complex64 lzma_xz_complex128 lzma_xz_del lzma_xz_float32 \
+					 lzma_xz_float64 lzma_xz_get lzma_xz_get_cont lzma_xz_get_far \
+					 lzma_xz_get_get lzma_xz_get_get2 lzma_xz_get_put lzma_xz_int8 \
+					 lzma_xz_int16 lzma_xz_int32 lzma_xz_int64 lzma_xz_move_from \
+					 lzma_xz_move_to lzma_xz_nframes lzma_xz_offs_clear lzma_xz_put \
+					 lzma_xz_put_back lzma_xz_put_endian lzma_xz_put_get \
+					 lzma_xz_put_offs lzma_xz_put_pad lzma_xz_seek lzma_xz_seek_far \
+					 lzma_xz_sync lzma_xz_uint8 lzma_xz_uint16 lzma_xz_uint32 \
+					 lzma_xz_uint64
+
+MADD_TESTS = madd madd_affix madd_alias madd_aliasmeta madd_alias_affix \
+					 madd_alias_alias madd_alias_subsub madd_bit madd_bit_invalid \
+					 madd_carray madd_clincom madd_clincom_nfields madd_const \
+					 madd_cpolynom madd_cpolynom_order madd_crecip madd_crecip89 \
+					 madd_divide madd_index madd_indir madd_lincom madd_lincom_invalid \
+					 madd_lincom_nfields madd_linterp madd_linterp_invalid madd_mplex \
+					 madd_multiply madd_multiply_invalid madd_parent_bad madd_phase \
+					 madd_phase_invalid madd_polynom madd_polynom_order madd_raw \
+					 madd_recip madd_sarray madd_sarray_dup madd_sbit madd_sindir \
+					 madd_spec madd_spec_directive madd_spec_invalid madd_spec_parent \
+					 madd_spec_resolv madd_string madd_string_dup madd_subsub madd_window
+
+MATCH_TESTS = match_fragment match_pcre match_pcre_bad match_pcre_caseless \
+						match_pcre_ext match_pcre_js match_pcre_utf8 match_regex \
+						match_regex_bad match_regex_ext match_regex_icase
+
+MFLUSH_TESTS = mflush mflush_affix mflush_amb_code mflush_carray mflush_hex \
+						 mflush_indir mflush_mplex mflush_ns mflush_pretty mflush_prot \
+						 mflush_ref mflush_repr mflush_repr9 mflush_reprz mflush_sindir \
+						 mflush_spec mflush_string mflush_type mflush_type4 mflush_windop
 
 MOVE_TESTS = move_affix move_affix_dup move_affix_meta move_affix_updb \
-					 move_alias move_data_enc_ar move_data_enc_ra move_data_endian \
-					 move_data_foffs move_data_foffs_neg move_data_nop move_index \
-					 move_meta move_move move_protect move_subdir
-
-NAME_TESTS = name_affix name_affix_bad name_alias name_dangle name_dot5 \
-					 name_dot5r name_dot9 name_dup name_meta name_move name_move_alias \
-					 name_name name_updb name_updb_affix name_updb_alias \
-					 name_updb_carray name_updb_const name_updb_const_alias
-
-NATIVE_TESTS = native_bit native_const native_index native_lincom \
+					 move_alias move_code move_data_enc_ar move_data_enc_ra \
+					 move_data_enc_un move_data_endian move_data_foffs \
+					 move_data_foffs_neg move_data_nop move_data_prot move_entype \
+					 move_index move_meta move_move move_nop move_ns move_nsns \
+					 move_protect move_rdonly move_subdir move_unkenc
+
+NAME_TESTS = name_affix name_affix_bad name_alias name_code name_dangle \
+					 name_dot5 name_dot5r name_dot9 name_dot10 name_dup name_index \
+					 name_meta name_meta2 name_move name_move_alias name_name name_ns \
+					 name_ns2 name_nsdot name_prot name_rdonly name_updb name_updb_affix \
+					 name_updb_alias name_updb_carray name_updb_const \
+					 name_updb_const_alias name_updb_sarray
+
+NATIVE_TESTS = native_bit native_code native_const native_index native_lincom \
 						 native_lincom_cmpin native_lincom_cmpscal native_linterp \
 						 native_linterp_cmp native_mult native_mult1 native_mult2 \
 						 native_polynom native_polynom_cmpin native_polynom_cmpscal \
 						 native_raw native_phase native_recip native_recip_cmpin \
-						 native_recip_cmpscal native_sbit native_string
+						 native_recip_cmpscal native_recurse native_reprz native_sbit \
+						 native_string
+
+NENTRIES_TESTS = nentries_alias nentries_entype nentries_hidden nentries_noalias \
+							 nentries_scalar
 
-NENTRIES_TESTS = nentries_alias nentries_hidden nentries_noalias nentries_scalar
 NFIELDS_TESTS = nfields_hidden nfields_invalid nfields_nfields nfields_type \
 							nfields_type_hidden nfields_type_invalid nfields_vector \
 							nfields_vector_hidden nfields_vector_invalid
@@ -6913,8 +9388,8 @@ NFRAMES_TESTS = nframes64 nframes_empty nframes_invalid nframes_nframes \
 
 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
+						nmeta_parent_meta nmeta_vectors nmeta_vectors_del \
+						nmeta_vectors_hidden nmeta_vectors_invalid nmeta_vectors_parent
 
 OPEN_TESTS = open_abs open_cb_abort open_cb_cont open_cb_ignore open_cb_invalid \
 					 open_cb_rescan open_cb_rescan_alloc open_eaccess open_invalid \
@@ -6922,23 +9397,29 @@ OPEN_TESTS = open_abs open_cb_abort open_cb_cont open_cb_ignore open_cb_invalid
 					 open_sym_at open_sym_c open_sym_cl open_sym_ct open_sym_d \
 					 open_sym_l 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_hex parse_hidden \
-						parse_hidden_field parse_hidden_meta parse_include \
-						parse_include_absolute parse_include_absrel \
-						parse_include_affix_bad parse_include_affix_ref parse_include_dir \
-						parse_include_loop parse_include_nonexistent parse_include_prefix \
+PARSE_TESTS = parse_alias parse_alias_code parse_alias_dup parse_alias_loop \
+						parse_alias_meta parse_alias_missing parse_alias_ncols \
+						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_carray_ncols \
+						parse_carray_type parse_const parse_const_complex \
+						parse_const_ncols parse_const_type parse_divide parse_double \
+						parse_duplicate parse_duplicate_ignore parse_endian_bad \
+						parse_endian_bad2 parse_endian_big parse_endian_force \
+						parse_endian_little parse_endian_slash parse_eol parse_esc \
+						parse_foffs parse_foffs_include parse_foffs_slash parse_hex \
+						parse_hidden parse_hidden_field parse_hidden_frag \
+						parse_hidden_meta parse_huge parse_include parse_include_absolute \
+						parse_include_absrel parse_include_affix_bad \
+						parse_include_affix_ref parse_include_dir parse_include_loop \
+						parse_include_nodir parse_include_nonexistent parse_include_ns \
+						parse_include_ns2 parse_include_nsabs parse_include_nsinh \
+						parse_include_nspop parse_include_nsrabs parse_include_nsrainh \
+						parse_include_nsrinh parse_include_nsroot 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_indir 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_literal_cmpbad parse_literal_fltcmp \
@@ -6948,74 +9429,104 @@ PARSE_TESTS = parse_alias parse_alias_code parse_alias_dup parse_alias_meta \
 						parse_meta_alias parse_meta_frag 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_octal_zero \
-						parse_phase parse_phase_ncols parse_phase_scalar parse_polynom \
+						parse_meta_meta parse_meta_ncols parse_meta_parent parse_meta_raw \
+						parse_mplex parse_mplex_ncols parse_mplex_neg parse_mplex_nomax \
+						parse_mplex_scalar parse_multiply parse_multiply_ncols parse_name \
+						parse_name_dot parse_name_ext parse_ncols parse_ns parse_ns_dot \
+						parse_ns_dotdot parse_ns_dotdotns parse_ns_dotns parse_ns_include \
+						parse_ns_include_ns parse_ns_ndotdots parse_ns_ndots \
+						parse_ns_nsdot parse_ns_nsdotdot parse_nsf parse_nsf_abs \
+						parse_nsf_alias parse_nsf_dot parse_nsf_hide parse_nsf_index \
+						parse_nsf_meta parse_nsf_meta2 parse_nsf_ref parse_nsf_refabs \
+						parse_nsf_root parse_nsf_sub parse_octal_zero 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_char_bad \
 						parse_raw_ncols parse_raw_scalar parse_raw_spf parse_raw_type \
-						parse_recip parse_ref parse_ref_nonexistent parse_sbit \
-						parse_scalar1 parse_scalar2 parse_scalar_repr parse_sort \
-						parse_string parse_string_ncols parse_string_null parse_utf8 \
-						parse_utf8_invalid parse_utf8_zero 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_alter_all protect_get
-PUT_TESTS = put64 put_bad_code put_bit put_bof put_carray put_carray_client \
-					put_carray_slice put_char put_clincom1 put_complex128 put_complex64 \
-					put_const put_const_protect put_cpolynom put_crecip put_divide \
-					put_endian8 put_endian16 put_endian32 put_endian64 \
-					put_endian_complex128_arm put_endian_complex128_big \
-					put_endian_complex128_little put_endian_complex64_arm \
-					put_endian_complex64_big put_endian_complex64_little \
-					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_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_mplex_complex \
-					put_multiply put_nofile put_null put_off64 put_phase put_phase_noin \
-					put_polynom1 put_polynom2 put_polynom_noin put_protect put_range \
-					put_rdonly put_recip put_recurse put_repr put_rofs put_sbit put_sf \
-					put_ss put_string put_string_protect put_sub put_type put_uint16 \
-					put_uint32 put_uint64 put_window put_zero
-
-REF_TESTS = ref ref_none ref_two
+						parse_recip parse_recip_ncols parse_ref parse_ref_nonexistent \
+						parse_ref_type parse_sarray parse_sarray_long parse_sarray_ncols \
+						parse_sbit parse_scalar1 parse_scalar2 parse_scalar_repr \
+						parse_sindir parse_sort parse_string parse_string_ncols \
+						parse_string_null parse_utf8 parse_utf8_invalid parse_utf8_zero \
+						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_alter_all protect_alter_arg \
+							protect_alter_index protect_alter_rdonly protect_get \
+							protect_index
+
+PUT_TESTS = put64 put_bad_code put_bit put_bit_repr put_bof put_carray \
+					put_carray_client put_carray_bad put_carray_bounds put_carray_rdonly \
+					put_carray_slice put_carray_type put_char put_clincom1 \
+					put_complex128 put_complex64 put_const put_const_protect \
+					put_cpolynom put_crecip put_divide put_endian8 put_endian16 \
+					put_endian32 put_endian64 put_endian_complex128_arm \
+					put_endian_complex128_big put_endian_complex128_little \
+					put_endian_complex64_arm put_endian_complex64_big \
+					put_endian_complex64_little 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_here put_heres put_indir put_int8 put_int16 put_int32 \
+					put_int64 put_invalid put_lincom1 put_lincom2 put_lincom_noin \
+					put_lincom_repr put_linterp put_linterp_cmp put_linterp_noin \
+					put_linterp_nomono put_linterp_notab put_linterp_repr \
+					put_linterp_reverse put_mplex put_mplex_complex put_mplex_repr \
+					put_multiply put_neg put_nofile put_null put_off64 put_phase \
+					put_phase_noin put_phase_repr put_polynom1 put_polynom2 \
+					put_polynom_noin put_polynom_repr put_protect put_range put_rdonly \
+					put_recip put_recip_repr put_recurse put_repr put_rofs put_sarray \
+					put_sarray_bad put_sarray_bounds put_sarray_rdonly put_sarray_slice \
+					put_sarray_type put_sbit put_scalar put_sf put_sindir put_ss \
+					put_string put_string_protect put_string_type put_sub put_type \
+					put_uint16 put_uint32 put_uint64 put_window put_zero
+
+REF_TESTS = ref ref_empty ref_get ref_none ref_set ref_set_code ref_set_prot \
+					ref_set_rdonly ref_set_type ref_two
+
 REPR_TESTS = repr_a repr_bad repr_float32 repr_float64 repr_i repr_int16 \
 					 repr_int32 repr_int64 repr_int8 repr_m repr_r repr_real_a \
 					 repr_real_i repr_real_m repr_real_r repr_uint16 repr_uint32 \
 					 repr_uint64 repr_uint8
 
-SEEK_TESTS = seek64 seek_cur seek_end seek_far seek_foffs seek_foffs2 seek_index \
-					 seek_lincom seek_mult seek_neg seek_phase seek_range seek_range2 \
-					 seek_set seek_sub
+SALIST_TESTS = salist salist0 salist_hidden salist_long salist_meta salist_meta0 \
+						 salist_meta_free salist_meta_hidden salist_meta_meta \
+						 salist_meta_parent
+
+SEEK_TESTS = seek64 seek_arg seek_code seek_cur seek_dim seek_end seek_far \
+					 seek_foffs seek_foffs2 seek_index seek_index_end seek_lincom \
+					 seek_mplex seek_mult seek_neg seek_phase seek_range seek_range2 \
+					 seek_range_end seek_recurse seek_set seek_sub
 
-SIE_TESTS = sie_get_big sie_get_header sie_get_little sie_move_from sie_move_to \
-					sie_nframes_big sie_nframes_little sie_put_append sie_put_append2 \
-					sie_put_back sie_put_big sie_put_header sie_put_little sie_put_many \
-					sie_put_newo sie_put_newo0 sie_put_pad sie_put_pad0 sie_put_trunc \
-					sie_put_trunc2 sie_put_trunc_nf sie_seek sie_seek_far sie_sync
+SIE_TESTS = sie_err_open sie_get_big sie_get_header sie_get_little sie_move_from \
+					sie_move_to sie_nframes_big sie_nframes_little sie_put_append \
+					sie_put_append2 sie_put_back sie_put_big sie_put_header \
+					sie_put_little sie_put_many sie_put_newo sie_put_newo0 sie_put_pad \
+					sie_put_pad0 sie_put_trunc sie_put_trunc2 sie_put_trunc_nf sie_seek \
+					sie_seek_far sie_sync
 
 SLIM_TESTS = slim_get slim_nframes slim_seek slim_seek_far
-SVLIST_TESTS = svlist svlist0 svlist2 svlist_hidden svlist_invalid svlist_meta \
-						 svlist_meta0 svlist_meta_hidden svlist_meta_invalid
+SVLIST_TESTS = svlist svlist0 svlist2 svlist_hidden svlist_invalid svlist_long \
+						 svlist_meta svlist_meta0 svlist_meta_hidden svlist_meta_invalid \
+						 svlist_meta_meta svlist_meta_parent
 
-SPF_TESTS = spf_alias spf_alias_missing spf_alias_meta spf_divide spf_lincom \
-					spf_multiply spf_polynom spf_raw spf_recip spf_recurse
+SPF_TESTS = spf_alias spf_alias_missing spf_alias_meta spf_const spf_divide \
+					spf_lincom spf_multiply spf_polynom spf_raw spf_recip spf_recurse
 
 TABLE_TESTS = table table_code table_type
-TELL_TESTS = tell tell64 tell_multidiv tell_sub
+TELL_TESTS = tell tell64 tell_code tell_dim tell_multi_div tell_multi_lincom \
+					 tell_recurse tell_sub
+
 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 unclude_open
+VALID_TESTS = valid_reprz
+UNCLUDE_TESTS = unclude unclude_del unclude_index unclude_keep unclude_move \
+							unclude_open unclude_prot unclude_rdonly
+
 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 \
@@ -7087,10 +9598,30 @@ add_alias_affix$(EXEEXT): $(add_alias_affix_OBJECTS) $(add_alias_affix_DEPENDENC
 	@rm -f add_alias_affix$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_alias_affix_OBJECTS) $(add_alias_affix_LDADD) $(LIBS)
 
+add_alias_index$(EXEEXT): $(add_alias_index_OBJECTS) $(add_alias_index_DEPENDENCIES) $(EXTRA_add_alias_index_DEPENDENCIES) 
+	@rm -f add_alias_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_alias_index_OBJECTS) $(add_alias_index_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)
 	$(AM_V_CCLD)$(LINK) $(add_alias_meta_OBJECTS) $(add_alias_meta_LDADD) $(LIBS)
 
+add_alias_name$(EXEEXT): $(add_alias_name_OBJECTS) $(add_alias_name_DEPENDENCIES) $(EXTRA_add_alias_name_DEPENDENCIES) 
+	@rm -f add_alias_name$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_alias_name_OBJECTS) $(add_alias_name_LDADD) $(LIBS)
+
+add_alias_ns$(EXEEXT): $(add_alias_ns_OBJECTS) $(add_alias_ns_DEPENDENCIES) $(EXTRA_add_alias_ns_DEPENDENCIES) 
+	@rm -f add_alias_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_alias_ns_OBJECTS) $(add_alias_ns_LDADD) $(LIBS)
+
+add_alias_prot$(EXEEXT): $(add_alias_prot_OBJECTS) $(add_alias_prot_DEPENDENCIES) $(EXTRA_add_alias_prot_DEPENDENCIES) 
+	@rm -f add_alias_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_alias_prot_OBJECTS) $(add_alias_prot_LDADD) $(LIBS)
+
+add_alias_rdonly$(EXEEXT): $(add_alias_rdonly_OBJECTS) $(add_alias_rdonly_DEPENDENCIES) $(EXTRA_add_alias_rdonly_DEPENDENCIES) 
+	@rm -f add_alias_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_alias_rdonly_OBJECTS) $(add_alias_rdonly_LDADD) $(LIBS)
+
 add_amb_code7$(EXEEXT): $(add_amb_code7_OBJECTS) $(add_amb_code7_DEPENDENCIES) $(EXTRA_add_amb_code7_DEPENDENCIES) 
 	@rm -f add_amb_code7$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_amb_code7_OBJECTS) $(add_amb_code7_LDADD) $(LIBS)
@@ -7107,6 +9638,10 @@ add_bit_bitsize$(EXEEXT): $(add_bit_bitsize_OBJECTS) $(add_bit_bitsize_DEPENDENC
 	@rm -f add_bit_bitsize$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_bit_bitsize_OBJECTS) $(add_bit_bitsize_LDADD) $(LIBS)
 
+add_bit_inaff$(EXEEXT): $(add_bit_inaff_OBJECTS) $(add_bit_inaff_DEPENDENCIES) $(EXTRA_add_bit_inaff_DEPENDENCIES) 
+	@rm -f add_bit_inaff$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_bit_inaff_OBJECTS) $(add_bit_inaff_LDADD) $(LIBS)
+
 add_bit_invalid$(EXEEXT): $(add_bit_invalid_OBJECTS) $(add_bit_invalid_DEPENDENCIES) $(EXTRA_add_bit_invalid_DEPENDENCIES) 
 	@rm -f add_bit_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_bit_invalid_OBJECTS) $(add_bit_invalid_LDADD) $(LIBS)
@@ -7123,10 +9658,22 @@ add_carray$(EXEEXT): $(add_carray_OBJECTS) $(add_carray_DEPENDENCIES) $(EXTRA_ad
 	@rm -f add_carray$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_carray_OBJECTS) $(add_carray_LDADD) $(LIBS)
 
+add_carray_entry$(EXEEXT): $(add_carray_entry_OBJECTS) $(add_carray_entry_DEPENDENCIES) $(EXTRA_add_carray_entry_DEPENDENCIES) 
+	@rm -f add_carray_entry$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_carray_entry_OBJECTS) $(add_carray_entry_LDADD) $(LIBS)
+
+add_carray_type$(EXEEXT): $(add_carray_type_OBJECTS) $(add_carray_type_DEPENDENCIES) $(EXTRA_add_carray_type_DEPENDENCIES) 
+	@rm -f add_carray_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_carray_type_OBJECTS) $(add_carray_type_LDADD) $(LIBS)
+
 add_clincom$(EXEEXT): $(add_clincom_OBJECTS) $(add_clincom_DEPENDENCIES) $(EXTRA_add_clincom_DEPENDENCIES) 
 	@rm -f add_clincom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_clincom_OBJECTS) $(add_clincom_LDADD) $(LIBS)
 
+add_clincom_nfields$(EXEEXT): $(add_clincom_nfields_OBJECTS) $(add_clincom_nfields_DEPENDENCIES) $(EXTRA_add_clincom_nfields_DEPENDENCIES) 
+	@rm -f add_clincom_nfields$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_clincom_nfields_OBJECTS) $(add_clincom_nfields_LDADD) $(LIBS)
+
 add_code$(EXEEXT): $(add_code_OBJECTS) $(add_code_DEPENDENCIES) $(EXTRA_add_code_DEPENDENCIES) 
 	@rm -f add_code$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_code_OBJECTS) $(add_code_LDADD) $(LIBS)
@@ -7135,10 +9682,18 @@ add_const$(EXEEXT): $(add_const_OBJECTS) $(add_const_DEPENDENCIES) $(EXTRA_add_c
 	@rm -f add_const$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_const_OBJECTS) $(add_const_LDADD) $(LIBS)
 
+add_const_type$(EXEEXT): $(add_const_type_OBJECTS) $(add_const_type_DEPENDENCIES) $(EXTRA_add_const_type_DEPENDENCIES) 
+	@rm -f add_const_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_const_type_OBJECTS) $(add_const_type_LDADD) $(LIBS)
+
 add_cpolynom$(EXEEXT): $(add_cpolynom_OBJECTS) $(add_cpolynom_DEPENDENCIES) $(EXTRA_add_cpolynom_DEPENDENCIES) 
 	@rm -f add_cpolynom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_cpolynom_OBJECTS) $(add_cpolynom_LDADD) $(LIBS)
 
+add_cpolynom_order$(EXEEXT): $(add_cpolynom_order_OBJECTS) $(add_cpolynom_order_DEPENDENCIES) $(EXTRA_add_cpolynom_order_DEPENDENCIES) 
+	@rm -f add_cpolynom_order$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_cpolynom_order_OBJECTS) $(add_cpolynom_order_LDADD) $(LIBS)
+
 add_crecip$(EXEEXT): $(add_crecip_OBJECTS) $(add_crecip_DEPENDENCIES) $(EXTRA_add_crecip_DEPENDENCIES) 
 	@rm -f add_crecip$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_crecip_OBJECTS) $(add_crecip_LDADD) $(LIBS)
@@ -7155,10 +9710,22 @@ add_divide$(EXEEXT): $(add_divide_OBJECTS) $(add_divide_DEPENDENCIES) $(EXTRA_ad
 	@rm -f add_divide$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_divide_OBJECTS) $(add_divide_LDADD) $(LIBS)
 
+add_divide_inaff1$(EXEEXT): $(add_divide_inaff1_OBJECTS) $(add_divide_inaff1_DEPENDENCIES) $(EXTRA_add_divide_inaff1_DEPENDENCIES) 
+	@rm -f add_divide_inaff1$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_divide_inaff1_OBJECTS) $(add_divide_inaff1_LDADD) $(LIBS)
+
+add_divide_inaff2$(EXEEXT): $(add_divide_inaff2_OBJECTS) $(add_divide_inaff2_DEPENDENCIES) $(EXTRA_add_divide_inaff2_DEPENDENCIES) 
+	@rm -f add_divide_inaff2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_divide_inaff2_OBJECTS) $(add_divide_inaff2_LDADD) $(LIBS)
+
 add_divide_invalid$(EXEEXT): $(add_divide_invalid_OBJECTS) $(add_divide_invalid_DEPENDENCIES) $(EXTRA_add_divide_invalid_DEPENDENCIES) 
 	@rm -f add_divide_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_divide_invalid_OBJECTS) $(add_divide_invalid_LDADD) $(LIBS)
 
+add_dot10$(EXEEXT): $(add_dot10_OBJECTS) $(add_dot10_DEPENDENCIES) $(EXTRA_add_dot10_DEPENDENCIES) 
+	@rm -f add_dot10$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_dot10_OBJECTS) $(add_dot10_LDADD) $(LIBS)
+
 add_dot5$(EXEEXT): $(add_dot5_OBJECTS) $(add_dot5_DEPENDENCIES) $(EXTRA_add_dot5_DEPENDENCIES) 
 	@rm -f add_dot5$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_dot5_OBJECTS) $(add_dot5_LDADD) $(LIBS)
@@ -7175,6 +9742,10 @@ add_format$(EXEEXT): $(add_format_OBJECTS) $(add_format_DEPENDENCIES) $(EXTRA_ad
 	@rm -f add_format$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_format_OBJECTS) $(add_format_LDADD) $(LIBS)
 
+add_indir$(EXEEXT): $(add_indir_OBJECTS) $(add_indir_DEPENDENCIES) $(EXTRA_add_indir_DEPENDENCIES) 
+	@rm -f add_indir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_indir_OBJECTS) $(add_indir_LDADD) $(LIBS)
+
 add_invalid$(EXEEXT): $(add_invalid_OBJECTS) $(add_invalid_DEPENDENCIES) $(EXTRA_add_invalid_DEPENDENCIES) 
 	@rm -f add_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_invalid_OBJECTS) $(add_invalid_LDADD) $(LIBS)
@@ -7195,10 +9766,18 @@ add_lincom_nfields$(EXEEXT): $(add_lincom_nfields_OBJECTS) $(add_lincom_nfields_
 	@rm -f add_lincom_nfields$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_lincom_nfields_OBJECTS) $(add_lincom_nfields_LDADD) $(LIBS)
 
+add_lincom_nfields2$(EXEEXT): $(add_lincom_nfields2_OBJECTS) $(add_lincom_nfields2_DEPENDENCIES) $(EXTRA_add_lincom_nfields2_DEPENDENCIES) 
+	@rm -f add_lincom_nfields2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_lincom_nfields2_OBJECTS) $(add_lincom_nfields2_LDADD) $(LIBS)
+
 add_linterp$(EXEEXT): $(add_linterp_OBJECTS) $(add_linterp_DEPENDENCIES) $(EXTRA_add_linterp_DEPENDENCIES) 
 	@rm -f add_linterp$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_linterp_OBJECTS) $(add_linterp_LDADD) $(LIBS)
 
+add_linterp_inaff$(EXEEXT): $(add_linterp_inaff_OBJECTS) $(add_linterp_inaff_DEPENDENCIES) $(EXTRA_add_linterp_inaff_DEPENDENCIES) 
+	@rm -f add_linterp_inaff$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_linterp_inaff_OBJECTS) $(add_linterp_inaff_LDADD) $(LIBS)
+
 add_linterp_invalid$(EXEEXT): $(add_linterp_invalid_OBJECTS) $(add_linterp_invalid_DEPENDENCIES) $(EXTRA_add_linterp_invalid_DEPENDENCIES) 
 	@rm -f add_linterp_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_linterp_invalid_OBJECTS) $(add_linterp_invalid_LDADD) $(LIBS)
@@ -7211,10 +9790,22 @@ add_meta_alias$(EXEEXT): $(add_meta_alias_OBJECTS) $(add_meta_alias_DEPENDENCIES
 	@rm -f add_meta_alias$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_meta_alias_OBJECTS) $(add_meta_alias_LDADD) $(LIBS)
 
+add_meta_parent$(EXEEXT): $(add_meta_parent_OBJECTS) $(add_meta_parent_DEPENDENCIES) $(EXTRA_add_meta_parent_DEPENDENCIES) 
+	@rm -f add_meta_parent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_meta_parent_OBJECTS) $(add_meta_parent_LDADD) $(LIBS)
+
 add_mplex$(EXEEXT): $(add_mplex_OBJECTS) $(add_mplex_DEPENDENCIES) $(EXTRA_add_mplex_DEPENDENCIES) 
 	@rm -f add_mplex$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_mplex_OBJECTS) $(add_mplex_LDADD) $(LIBS)
 
+add_mplex_inaff$(EXEEXT): $(add_mplex_inaff_OBJECTS) $(add_mplex_inaff_DEPENDENCIES) $(EXTRA_add_mplex_inaff_DEPENDENCIES) 
+	@rm -f add_mplex_inaff$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_mplex_inaff_OBJECTS) $(add_mplex_inaff_LDADD) $(LIBS)
+
+add_mplex_period$(EXEEXT): $(add_mplex_period_OBJECTS) $(add_mplex_period_DEPENDENCIES) $(EXTRA_add_mplex_period_DEPENDENCIES) 
+	@rm -f add_mplex_period$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_mplex_period_OBJECTS) $(add_mplex_period_LDADD) $(LIBS)
+
 add_mplex_scalars$(EXEEXT): $(add_mplex_scalars_OBJECTS) $(add_mplex_scalars_DEPENDENCIES) $(EXTRA_add_mplex_scalars_DEPENDENCIES) 
 	@rm -f add_mplex_scalars$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_mplex_scalars_OBJECTS) $(add_mplex_scalars_LDADD) $(LIBS)
@@ -7227,10 +9818,30 @@ add_multiply_invalid$(EXEEXT): $(add_multiply_invalid_OBJECTS) $(add_multiply_in
 	@rm -f add_multiply_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_multiply_invalid_OBJECTS) $(add_multiply_invalid_LDADD) $(LIBS)
 
+add_name_len$(EXEEXT): $(add_name_len_OBJECTS) $(add_name_len_DEPENDENCIES) $(EXTRA_add_name_len_DEPENDENCIES) 
+	@rm -f add_name_len$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_name_len_OBJECTS) $(add_name_len_LDADD) $(LIBS)
+
+add_ns$(EXEEXT): $(add_ns_OBJECTS) $(add_ns_DEPENDENCIES) $(EXTRA_add_ns_DEPENDENCIES) 
+	@rm -f add_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_ns_OBJECTS) $(add_ns_LDADD) $(LIBS)
+
+add_ns_frag$(EXEEXT): $(add_ns_frag_OBJECTS) $(add_ns_frag_DEPENDENCIES) $(EXTRA_add_ns_frag_DEPENDENCIES) 
+	@rm -f add_ns_frag$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_ns_frag_OBJECTS) $(add_ns_frag_LDADD) $(LIBS)
+
+add_ns_frag2$(EXEEXT): $(add_ns_frag2_OBJECTS) $(add_ns_frag2_DEPENDENCIES) $(EXTRA_add_ns_frag2_DEPENDENCIES) 
+	@rm -f add_ns_frag2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_ns_frag2_OBJECTS) $(add_ns_frag2_LDADD) $(LIBS)
+
 add_phase$(EXEEXT): $(add_phase_OBJECTS) $(add_phase_DEPENDENCIES) $(EXTRA_add_phase_DEPENDENCIES) 
 	@rm -f add_phase$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_phase_OBJECTS) $(add_phase_LDADD) $(LIBS)
 
+add_phase_inaff$(EXEEXT): $(add_phase_inaff_OBJECTS) $(add_phase_inaff_DEPENDENCIES) $(EXTRA_add_phase_inaff_DEPENDENCIES) 
+	@rm -f add_phase_inaff$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_phase_inaff_OBJECTS) $(add_phase_inaff_LDADD) $(LIBS)
+
 add_phase_invalid$(EXEEXT): $(add_phase_invalid_OBJECTS) $(add_phase_invalid_DEPENDENCIES) $(EXTRA_add_phase_invalid_DEPENDENCIES) 
 	@rm -f add_phase_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_phase_invalid_OBJECTS) $(add_phase_invalid_LDADD) $(LIBS)
@@ -7239,6 +9850,18 @@ add_polynom$(EXEEXT): $(add_polynom_OBJECTS) $(add_polynom_DEPENDENCIES) $(EXTRA
 	@rm -f add_polynom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_polynom_OBJECTS) $(add_polynom_LDADD) $(LIBS)
 
+add_polynom_inaff$(EXEEXT): $(add_polynom_inaff_OBJECTS) $(add_polynom_inaff_DEPENDENCIES) $(EXTRA_add_polynom_inaff_DEPENDENCIES) 
+	@rm -f add_polynom_inaff$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_polynom_inaff_OBJECTS) $(add_polynom_inaff_LDADD) $(LIBS)
+
+add_polynom_order$(EXEEXT): $(add_polynom_order_OBJECTS) $(add_polynom_order_DEPENDENCIES) $(EXTRA_add_polynom_order_DEPENDENCIES) 
+	@rm -f add_polynom_order$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_polynom_order_OBJECTS) $(add_polynom_order_LDADD) $(LIBS)
+
+add_polynom_order2$(EXEEXT): $(add_polynom_order2_OBJECTS) $(add_polynom_order2_DEPENDENCIES) $(EXTRA_add_polynom_order2_DEPENDENCIES) 
+	@rm -f add_polynom_order2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_polynom_order2_OBJECTS) $(add_polynom_order2_LDADD) $(LIBS)
+
 add_polynom_scalar$(EXEEXT): $(add_polynom_scalar_OBJECTS) $(add_polynom_scalar_DEPENDENCIES) $(EXTRA_add_polynom_scalar_DEPENDENCIES) 
 	@rm -f add_polynom_scalar$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_polynom_scalar_OBJECTS) $(add_polynom_scalar_LDADD) $(LIBS)
@@ -7259,6 +9882,10 @@ add_raw_invalid$(EXEEXT): $(add_raw_invalid_OBJECTS) $(add_raw_invalid_DEPENDENC
 	@rm -f add_raw_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_raw_invalid_OBJECTS) $(add_raw_invalid_LDADD) $(LIBS)
 
+add_raw_prot$(EXEEXT): $(add_raw_prot_OBJECTS) $(add_raw_prot_DEPENDENCIES) $(EXTRA_add_raw_prot_DEPENDENCIES) 
+	@rm -f add_raw_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_raw_prot_OBJECTS) $(add_raw_prot_LDADD) $(LIBS)
+
 add_raw_spf$(EXEEXT): $(add_raw_spf_OBJECTS) $(add_raw_spf_DEPENDENCIES) $(EXTRA_add_raw_spf_DEPENDENCIES) 
 	@rm -f add_raw_spf$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_raw_spf_OBJECTS) $(add_raw_spf_LDADD) $(LIBS)
@@ -7283,10 +9910,26 @@ add_recip$(EXEEXT): $(add_recip_OBJECTS) $(add_recip_DEPENDENCIES) $(EXTRA_add_r
 	@rm -f add_recip$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_recip_OBJECTS) $(add_recip_LDADD) $(LIBS)
 
+add_recip_inaff$(EXEEXT): $(add_recip_inaff_OBJECTS) $(add_recip_inaff_DEPENDENCIES) $(EXTRA_add_recip_inaff_DEPENDENCIES) 
+	@rm -f add_recip_inaff$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_recip_inaff_OBJECTS) $(add_recip_inaff_LDADD) $(LIBS)
+
 add_resolv$(EXEEXT): $(add_resolv_OBJECTS) $(add_resolv_DEPENDENCIES) $(EXTRA_add_resolv_DEPENDENCIES) 
 	@rm -f add_resolv$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_resolv_OBJECTS) $(add_resolv_LDADD) $(LIBS)
 
+add_sarray$(EXEEXT): $(add_sarray_OBJECTS) $(add_sarray_DEPENDENCIES) $(EXTRA_add_sarray_DEPENDENCIES) 
+	@rm -f add_sarray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_sarray_OBJECTS) $(add_sarray_LDADD) $(LIBS)
+
+add_sarray_dup$(EXEEXT): $(add_sarray_dup_OBJECTS) $(add_sarray_dup_DEPENDENCIES) $(EXTRA_add_sarray_dup_DEPENDENCIES) 
+	@rm -f add_sarray_dup$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_sarray_dup_OBJECTS) $(add_sarray_dup_LDADD) $(LIBS)
+
+add_sarray_nil$(EXEEXT): $(add_sarray_nil_OBJECTS) $(add_sarray_nil_DEPENDENCIES) $(EXTRA_add_sarray_nil_DEPENDENCIES) 
+	@rm -f add_sarray_nil$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_sarray_nil_OBJECTS) $(add_sarray_nil_LDADD) $(LIBS)
+
 add_sbit$(EXEEXT): $(add_sbit_OBJECTS) $(add_sbit_DEPENDENCIES) $(EXTRA_add_sbit_DEPENDENCIES) 
 	@rm -f add_sbit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_sbit_OBJECTS) $(add_sbit_LDADD) $(LIBS)
@@ -7303,6 +9946,10 @@ add_scalar_carray_bad$(EXEEXT): $(add_scalar_carray_bad_OBJECTS) $(add_scalar_ca
 	@rm -f add_scalar_carray_bad$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_scalar_carray_bad_OBJECTS) $(add_scalar_carray_bad_LDADD) $(LIBS)
 
+add_sindir$(EXEEXT): $(add_sindir_OBJECTS) $(add_sindir_DEPENDENCIES) $(EXTRA_add_sindir_DEPENDENCIES) 
+	@rm -f add_sindir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_sindir_OBJECTS) $(add_sindir_LDADD) $(LIBS)
+
 add_sort$(EXEEXT): $(add_sort_OBJECTS) $(add_sort_DEPENDENCIES) $(EXTRA_add_sort_DEPENDENCIES) 
 	@rm -f add_sort$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_sort_OBJECTS) $(add_sort_LDADD) $(LIBS)
@@ -7311,10 +9958,18 @@ add_spec$(EXEEXT): $(add_spec_OBJECTS) $(add_spec_DEPENDENCIES) $(EXTRA_add_spec
 	@rm -f add_spec$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_spec_OBJECTS) $(add_spec_LDADD) $(LIBS)
 
+add_spec_affix$(EXEEXT): $(add_spec_affix_OBJECTS) $(add_spec_affix_DEPENDENCIES) $(EXTRA_add_spec_affix_DEPENDENCIES) 
+	@rm -f add_spec_affix$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_spec_affix_OBJECTS) $(add_spec_affix_LDADD) $(LIBS)
+
 add_spec_directive$(EXEEXT): $(add_spec_directive_OBJECTS) $(add_spec_directive_DEPENDENCIES) $(EXTRA_add_spec_directive_DEPENDENCIES) 
 	@rm -f add_spec_directive$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_spec_directive_OBJECTS) $(add_spec_directive_LDADD) $(LIBS)
 
+add_spec_index$(EXEEXT): $(add_spec_index_OBJECTS) $(add_spec_index_DEPENDENCIES) $(EXTRA_add_spec_index_DEPENDENCIES) 
+	@rm -f add_spec_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_spec_index_OBJECTS) $(add_spec_index_LDADD) $(LIBS)
+
 add_spec_invalid$(EXEEXT): $(add_spec_invalid_OBJECTS) $(add_spec_invalid_DEPENDENCIES) $(EXTRA_add_spec_invalid_DEPENDENCIES) 
 	@rm -f add_spec_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_spec_invalid_OBJECTS) $(add_spec_invalid_LDADD) $(LIBS)
@@ -7323,6 +9978,26 @@ add_spec_meta$(EXEEXT): $(add_spec_meta_OBJECTS) $(add_spec_meta_DEPENDENCIES) $
 	@rm -f add_spec_meta$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_spec_meta_OBJECTS) $(add_spec_meta_LDADD) $(LIBS)
 
+add_spec_nil$(EXEEXT): $(add_spec_nil_OBJECTS) $(add_spec_nil_DEPENDENCIES) $(EXTRA_add_spec_nil_DEPENDENCIES) 
+	@rm -f add_spec_nil$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_spec_nil_OBJECTS) $(add_spec_nil_LDADD) $(LIBS)
+
+add_spec_prot$(EXEEXT): $(add_spec_prot_OBJECTS) $(add_spec_prot_DEPENDENCIES) $(EXTRA_add_spec_prot_DEPENDENCIES) 
+	@rm -f add_spec_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_spec_prot_OBJECTS) $(add_spec_prot_LDADD) $(LIBS)
+
+add_spec_raw_autoenc$(EXEEXT): $(add_spec_raw_autoenc_OBJECTS) $(add_spec_raw_autoenc_DEPENDENCIES) $(EXTRA_add_spec_raw_autoenc_DEPENDENCIES) 
+	@rm -f add_spec_raw_autoenc$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_spec_raw_autoenc_OBJECTS) $(add_spec_raw_autoenc_LDADD) $(LIBS)
+
+add_spec_raw_prot$(EXEEXT): $(add_spec_raw_prot_OBJECTS) $(add_spec_raw_prot_DEPENDENCIES) $(EXTRA_add_spec_raw_prot_DEPENDENCIES) 
+	@rm -f add_spec_raw_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_spec_raw_prot_OBJECTS) $(add_spec_raw_prot_LDADD) $(LIBS)
+
+add_spec_raw_unkenc$(EXEEXT): $(add_spec_raw_unkenc_OBJECTS) $(add_spec_raw_unkenc_DEPENDENCIES) $(EXTRA_add_spec_raw_unkenc_DEPENDENCIES) 
+	@rm -f add_spec_raw_unkenc$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_spec_raw_unkenc_OBJECTS) $(add_spec_raw_unkenc_LDADD) $(LIBS)
+
 add_spec_resolv$(EXEEXT): $(add_spec_resolv_OBJECTS) $(add_spec_resolv_DEPENDENCIES) $(EXTRA_add_spec_resolv_DEPENDENCIES) 
 	@rm -f add_spec_resolv$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_spec_resolv_OBJECTS) $(add_spec_resolv_LDADD) $(LIBS)
@@ -7335,6 +10010,14 @@ add_string_affix$(EXEEXT): $(add_string_affix_OBJECTS) $(add_string_affix_DEPEND
 	@rm -f add_string_affix$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_string_affix_OBJECTS) $(add_string_affix_LDADD) $(LIBS)
 
+add_string_dup$(EXEEXT): $(add_string_dup_OBJECTS) $(add_string_dup_DEPENDENCIES) $(EXTRA_add_string_dup_DEPENDENCIES) 
+	@rm -f add_string_dup$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_string_dup_OBJECTS) $(add_string_dup_LDADD) $(LIBS)
+
+add_string_entry$(EXEEXT): $(add_string_entry_OBJECTS) $(add_string_entry_DEPENDENCIES) $(EXTRA_add_string_entry_DEPENDENCIES) 
+	@rm -f add_string_entry$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_string_entry_OBJECTS) $(add_string_entry_LDADD) $(LIBS)
+
 add_type$(EXEEXT): $(add_type_OBJECTS) $(add_type_DEPENDENCIES) $(EXTRA_add_type_DEPENDENCIES) 
 	@rm -f add_type$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_type_OBJECTS) $(add_type_LDADD) $(LIBS)
@@ -7343,6 +10026,10 @@ add_window$(EXEEXT): $(add_window_OBJECTS) $(add_window_DEPENDENCIES) $(EXTRA_ad
 	@rm -f add_window$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(add_window_OBJECTS) $(add_window_LDADD) $(LIBS)
 
+add_window_inaff$(EXEEXT): $(add_window_inaff_OBJECTS) $(add_window_inaff_DEPENDENCIES) $(EXTRA_add_window_inaff_DEPENDENCIES) 
+	@rm -f add_window_inaff$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(add_window_inaff_OBJECTS) $(add_window_inaff_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)
 	$(AM_V_CCLD)$(LINK) $(add_window_op_OBJECTS) $(add_window_op_LDADD) $(LIBS)
@@ -7383,14 +10070,42 @@ alias_target_missing$(EXEEXT): $(alias_target_missing_OBJECTS) $(alias_target_mi
 	@rm -f alias_target_missing$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alias_target_missing_OBJECTS) $(alias_target_missing_LDADD) $(LIBS)
 
+alloc_affix$(EXEEXT): $(alloc_affix_OBJECTS) $(alloc_affix_DEPENDENCIES) $(EXTRA_alloc_affix_DEPENDENCIES) 
+	@rm -f alloc_affix$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alloc_affix_OBJECTS) $(alloc_affix_LDADD) $(LIBS)
+
+alloc_callback$(EXEEXT): $(alloc_callback_OBJECTS) $(alloc_callback_DEPENDENCIES) $(EXTRA_alloc_callback_DEPENDENCIES) 
+	@rm -f alloc_callback$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alloc_callback_OBJECTS) $(alloc_callback_LDADD) $(LIBS)
+
+alloc_clear$(EXEEXT): $(alloc_clear_OBJECTS) $(alloc_clear_DEPENDENCIES) $(EXTRA_alloc_clear_DEPENDENCIES) 
+	@rm -f alloc_clear$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alloc_clear_OBJECTS) $(alloc_clear_LDADD) $(LIBS)
+
+alloc_entry$(EXEEXT): $(alloc_entry_OBJECTS) $(alloc_entry_DEPENDENCIES) $(EXTRA_alloc_entry_DEPENDENCIES) 
+	@rm -f alloc_entry$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alloc_entry_OBJECTS) $(alloc_entry_LDADD) $(LIBS)
+
+alloc_tok$(EXEEXT): $(alloc_tok_OBJECTS) $(alloc_tok_DEPENDENCIES) $(EXTRA_alloc_tok_DEPENDENCIES) 
+	@rm -f alloc_tok$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alloc_tok_OBJECTS) $(alloc_tok_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)
 	$(AM_V_CCLD)$(LINK) $(alter_bit_bitnum_OBJECTS) $(alter_bit_bitnum_LDADD) $(LIBS)
 
+alter_bit_in$(EXEEXT): $(alter_bit_in_OBJECTS) $(alter_bit_in_DEPENDENCIES) $(EXTRA_alter_bit_in_DEPENDENCIES) 
+	@rm -f alter_bit_in$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_bit_in_OBJECTS) $(alter_bit_in_LDADD) $(LIBS)
+
 alter_bit_numbits$(EXEEXT): $(alter_bit_numbits_OBJECTS) $(alter_bit_numbits_DEPENDENCIES) $(EXTRA_alter_bit_numbits_DEPENDENCIES) 
 	@rm -f alter_bit_numbits$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_bit_numbits_OBJECTS) $(alter_bit_numbits_LDADD) $(LIBS)
 
+alter_bit_scalar$(EXEEXT): $(alter_bit_scalar_OBJECTS) $(alter_bit_scalar_DEPENDENCIES) $(EXTRA_alter_bit_scalar_DEPENDENCIES) 
+	@rm -f alter_bit_scalar$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_bit_scalar_OBJECTS) $(alter_bit_scalar_LDADD) $(LIBS)
+
 alter_carray_len$(EXEEXT): $(alter_carray_len_OBJECTS) $(alter_carray_len_DEPENDENCIES) $(EXTRA_alter_carray_len_DEPENDENCIES) 
 	@rm -f alter_carray_len$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_carray_len_OBJECTS) $(alter_carray_len_LDADD) $(LIBS)
@@ -7403,6 +10118,26 @@ alter_clincom$(EXEEXT): $(alter_clincom_OBJECTS) $(alter_clincom_DEPENDENCIES) $
 	@rm -f alter_clincom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_clincom_OBJECTS) $(alter_clincom_LDADD) $(LIBS)
 
+alter_clincom_32$(EXEEXT): $(alter_clincom_32_OBJECTS) $(alter_clincom_32_DEPENDENCIES) $(EXTRA_alter_clincom_32_DEPENDENCIES) 
+	@rm -f alter_clincom_32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_clincom_32_OBJECTS) $(alter_clincom_32_LDADD) $(LIBS)
+
+alter_clincom_nfields$(EXEEXT): $(alter_clincom_nfields_OBJECTS) $(alter_clincom_nfields_DEPENDENCIES) $(EXTRA_alter_clincom_nfields_DEPENDENCIES) 
+	@rm -f alter_clincom_nfields$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_clincom_nfields_OBJECTS) $(alter_clincom_nfields_LDADD) $(LIBS)
+
+alter_clincom_nfields_code$(EXEEXT): $(alter_clincom_nfields_code_OBJECTS) $(alter_clincom_nfields_code_DEPENDENCIES) $(EXTRA_alter_clincom_nfields_code_DEPENDENCIES) 
+	@rm -f alter_clincom_nfields_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_clincom_nfields_code_OBJECTS) $(alter_clincom_nfields_code_LDADD) $(LIBS)
+
+alter_clincom_null$(EXEEXT): $(alter_clincom_null_OBJECTS) $(alter_clincom_null_DEPENDENCIES) $(EXTRA_alter_clincom_null_DEPENDENCIES) 
+	@rm -f alter_clincom_null$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_clincom_null_OBJECTS) $(alter_clincom_null_LDADD) $(LIBS)
+
+alter_code$(EXEEXT): $(alter_code_OBJECTS) $(alter_code_DEPENDENCIES) $(EXTRA_alter_code_DEPENDENCIES) 
+	@rm -f alter_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_code_OBJECTS) $(alter_code_LDADD) $(LIBS)
+
 alter_const$(EXEEXT): $(alter_const_OBJECTS) $(alter_const_DEPENDENCIES) $(EXTRA_alter_const_DEPENDENCIES) 
 	@rm -f alter_const$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_const_OBJECTS) $(alter_const_LDADD) $(LIBS)
@@ -7419,6 +10154,10 @@ alter_const_r2r$(EXEEXT): $(alter_const_r2r_OBJECTS) $(alter_const_r2r_DEPENDENC
 	@rm -f alter_const_r2r$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_const_r2r_OBJECTS) $(alter_const_r2r_LDADD) $(LIBS)
 
+alter_const_type$(EXEEXT): $(alter_const_type_OBJECTS) $(alter_const_type_DEPENDENCIES) $(EXTRA_alter_const_type_DEPENDENCIES) 
+	@rm -f alter_const_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_const_type_OBJECTS) $(alter_const_type_LDADD) $(LIBS)
+
 alter_cpolynom$(EXEEXT): $(alter_cpolynom_OBJECTS) $(alter_cpolynom_DEPENDENCIES) $(EXTRA_alter_cpolynom_DEPENDENCIES) 
 	@rm -f alter_cpolynom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_cpolynom_OBJECTS) $(alter_cpolynom_LDADD) $(LIBS)
@@ -7427,6 +10166,14 @@ alter_cpolynom_null$(EXEEXT): $(alter_cpolynom_null_OBJECTS) $(alter_cpolynom_nu
 	@rm -f alter_cpolynom_null$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_cpolynom_null_OBJECTS) $(alter_cpolynom_null_LDADD) $(LIBS)
 
+alter_cpolynom_ord$(EXEEXT): $(alter_cpolynom_ord_OBJECTS) $(alter_cpolynom_ord_DEPENDENCIES) $(EXTRA_alter_cpolynom_ord_DEPENDENCIES) 
+	@rm -f alter_cpolynom_ord$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_cpolynom_ord_OBJECTS) $(alter_cpolynom_ord_LDADD) $(LIBS)
+
+alter_cpolynom_ord_code$(EXEEXT): $(alter_cpolynom_ord_code_OBJECTS) $(alter_cpolynom_ord_code_DEPENDENCIES) $(EXTRA_alter_cpolynom_ord_code_DEPENDENCIES) 
+	@rm -f alter_cpolynom_ord_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_cpolynom_ord_code_OBJECTS) $(alter_cpolynom_ord_code_LDADD) $(LIBS)
+
 alter_crecip$(EXEEXT): $(alter_crecip_OBJECTS) $(alter_crecip_DEPENDENCIES) $(EXTRA_alter_crecip_DEPENDENCIES) 
 	@rm -f alter_crecip$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_crecip_OBJECTS) $(alter_crecip_LDADD) $(LIBS)
@@ -7447,6 +10194,10 @@ alter_divide$(EXEEXT): $(alter_divide_OBJECTS) $(alter_divide_DEPENDENCIES) $(EX
 	@rm -f alter_divide$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_divide_OBJECTS) $(alter_divide_LDADD) $(LIBS)
 
+alter_divide_in$(EXEEXT): $(alter_divide_in_OBJECTS) $(alter_divide_in_DEPENDENCIES) $(EXTRA_alter_divide_in_DEPENDENCIES) 
+	@rm -f alter_divide_in$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_divide_in_OBJECTS) $(alter_divide_in_LDADD) $(LIBS)
+
 alter_entry$(EXEEXT): $(alter_entry_OBJECTS) $(alter_entry_DEPENDENCIES) $(EXTRA_alter_entry_DEPENDENCIES) 
 	@rm -f alter_entry$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_entry_OBJECTS) $(alter_entry_LDADD) $(LIBS)
@@ -7455,6 +10206,10 @@ alter_entry_affix$(EXEEXT): $(alter_entry_affix_OBJECTS) $(alter_entry_affix_DEP
 	@rm -f alter_entry_affix$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_entry_affix_OBJECTS) $(alter_entry_affix_LDADD) $(LIBS)
 
+alter_entry_entype$(EXEEXT): $(alter_entry_entype_OBJECTS) $(alter_entry_entype_DEPENDENCIES) $(EXTRA_alter_entry_entype_DEPENDENCIES) 
+	@rm -f alter_entry_entype$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_entry_entype_OBJECTS) $(alter_entry_entype_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)
 	$(AM_V_CCLD)$(LINK) $(alter_entry_hidden_OBJECTS) $(alter_entry_hidden_LDADD) $(LIBS)
@@ -7463,6 +10218,10 @@ alter_entry_lincom$(EXEEXT): $(alter_entry_lincom_OBJECTS) $(alter_entry_lincom_
 	@rm -f alter_entry_lincom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_entry_lincom_OBJECTS) $(alter_entry_lincom_LDADD) $(LIBS)
 
+alter_entry_lincom_nfields$(EXEEXT): $(alter_entry_lincom_nfields_OBJECTS) $(alter_entry_lincom_nfields_DEPENDENCIES) $(EXTRA_alter_entry_lincom_nfields_DEPENDENCIES) 
+	@rm -f alter_entry_lincom_nfields$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_entry_lincom_nfields_OBJECTS) $(alter_entry_lincom_nfields_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)
 	$(AM_V_CCLD)$(LINK) $(alter_entry_recode_OBJECTS) $(alter_entry_recode_LDADD) $(LIBS)
@@ -7471,6 +10230,10 @@ alter_entry_recode_recalc$(EXEEXT): $(alter_entry_recode_recalc_OBJECTS) $(alter
 	@rm -f alter_entry_recode_recalc$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_entry_recode_recalc_OBJECTS) $(alter_entry_recode_recalc_LDADD) $(LIBS)
 
+alter_entry_sarray$(EXEEXT): $(alter_entry_sarray_OBJECTS) $(alter_entry_sarray_DEPENDENCIES) $(EXTRA_alter_entry_sarray_DEPENDENCIES) 
+	@rm -f alter_entry_sarray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_entry_sarray_OBJECTS) $(alter_entry_sarray_LDADD) $(LIBS)
+
 alter_entry_scalar1$(EXEEXT): $(alter_entry_scalar1_OBJECTS) $(alter_entry_scalar1_DEPENDENCIES) $(EXTRA_alter_entry_scalar1_DEPENDENCIES) 
 	@rm -f alter_entry_scalar1$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_entry_scalar1_OBJECTS) $(alter_entry_scalar1_LDADD) $(LIBS)
@@ -7511,6 +10274,10 @@ alter_index$(EXEEXT): $(alter_index_OBJECTS) $(alter_index_DEPENDENCIES) $(EXTRA
 	@rm -f alter_index$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_index_OBJECTS) $(alter_index_LDADD) $(LIBS)
 
+alter_indir$(EXEEXT): $(alter_indir_OBJECTS) $(alter_indir_DEPENDENCIES) $(EXTRA_alter_indir_DEPENDENCIES) 
+	@rm -f alter_indir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_indir_OBJECTS) $(alter_indir_LDADD) $(LIBS)
+
 alter_lincom_23$(EXEEXT): $(alter_lincom_23_OBJECTS) $(alter_lincom_23_DEPENDENCIES) $(EXTRA_alter_lincom_23_DEPENDENCIES) 
 	@rm -f alter_lincom_23$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_lincom_23_OBJECTS) $(alter_lincom_23_LDADD) $(LIBS)
@@ -7527,10 +10294,22 @@ alter_lincom_input$(EXEEXT): $(alter_lincom_input_OBJECTS) $(alter_lincom_input_
 	@rm -f alter_lincom_input$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_lincom_input_OBJECTS) $(alter_lincom_input_LDADD) $(LIBS)
 
+alter_lincom_nfields$(EXEEXT): $(alter_lincom_nfields_OBJECTS) $(alter_lincom_nfields_DEPENDENCIES) $(EXTRA_alter_lincom_nfields_DEPENDENCIES) 
+	@rm -f alter_lincom_nfields$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_lincom_nfields_OBJECTS) $(alter_lincom_nfields_LDADD) $(LIBS)
+
+alter_lincom_nfields_code$(EXEEXT): $(alter_lincom_nfields_code_OBJECTS) $(alter_lincom_nfields_code_DEPENDENCIES) $(EXTRA_alter_lincom_nfields_code_DEPENDENCIES) 
+	@rm -f alter_lincom_nfields_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_lincom_nfields_code_OBJECTS) $(alter_lincom_nfields_code_LDADD) $(LIBS)
+
 alter_lincom_offset$(EXEEXT): $(alter_lincom_offset_OBJECTS) $(alter_lincom_offset_DEPENDENCIES) $(EXTRA_alter_lincom_offset_DEPENDENCIES) 
 	@rm -f alter_lincom_offset$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_lincom_offset_OBJECTS) $(alter_lincom_offset_LDADD) $(LIBS)
 
+alter_lincom_scalar$(EXEEXT): $(alter_lincom_scalar_OBJECTS) $(alter_lincom_scalar_DEPENDENCIES) $(EXTRA_alter_lincom_scalar_DEPENDENCIES) 
+	@rm -f alter_lincom_scalar$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_lincom_scalar_OBJECTS) $(alter_lincom_scalar_LDADD) $(LIBS)
+
 alter_lincom_slope$(EXEEXT): $(alter_lincom_slope_OBJECTS) $(alter_lincom_slope_DEPENDENCIES) $(EXTRA_alter_lincom_slope_DEPENDENCIES) 
 	@rm -f alter_lincom_slope$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_lincom_slope_OBJECTS) $(alter_lincom_slope_LDADD) $(LIBS)
@@ -7539,6 +10318,10 @@ alter_linterp$(EXEEXT): $(alter_linterp_OBJECTS) $(alter_linterp_DEPENDENCIES) $
 	@rm -f alter_linterp$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_linterp_OBJECTS) $(alter_linterp_LDADD) $(LIBS)
 
+alter_linterp_in$(EXEEXT): $(alter_linterp_in_OBJECTS) $(alter_linterp_in_DEPENDENCIES) $(EXTRA_alter_linterp_in_DEPENDENCIES) 
+	@rm -f alter_linterp_in$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_linterp_in_OBJECTS) $(alter_linterp_in_LDADD) $(LIBS)
+
 alter_linterp_move$(EXEEXT): $(alter_linterp_move_OBJECTS) $(alter_linterp_move_DEPENDENCIES) $(EXTRA_alter_linterp_move_DEPENDENCIES) 
 	@rm -f alter_linterp_move$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_linterp_move_OBJECTS) $(alter_linterp_move_LDADD) $(LIBS)
@@ -7547,6 +10330,14 @@ alter_mplex$(EXEEXT): $(alter_mplex_OBJECTS) $(alter_mplex_DEPENDENCIES) $(EXTRA
 	@rm -f alter_mplex$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_mplex_OBJECTS) $(alter_mplex_LDADD) $(LIBS)
 
+alter_mplex_in$(EXEEXT): $(alter_mplex_in_OBJECTS) $(alter_mplex_in_DEPENDENCIES) $(EXTRA_alter_mplex_in_DEPENDENCIES) 
+	@rm -f alter_mplex_in$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_mplex_in_OBJECTS) $(alter_mplex_in_LDADD) $(LIBS)
+
+alter_mplex_scalar$(EXEEXT): $(alter_mplex_scalar_OBJECTS) $(alter_mplex_scalar_DEPENDENCIES) $(EXTRA_alter_mplex_scalar_DEPENDENCIES) 
+	@rm -f alter_mplex_scalar$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_mplex_scalar_OBJECTS) $(alter_mplex_scalar_LDADD) $(LIBS)
+
 alter_mspec$(EXEEXT): $(alter_mspec_OBJECTS) $(alter_mspec_DEPENDENCIES) $(EXTRA_alter_mspec_DEPENDENCIES) 
 	@rm -f alter_mspec$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_mspec_OBJECTS) $(alter_mspec_LDADD) $(LIBS)
@@ -7563,6 +10354,14 @@ alter_phase$(EXEEXT): $(alter_phase_OBJECTS) $(alter_phase_DEPENDENCIES) $(EXTRA
 	@rm -f alter_phase$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_phase_OBJECTS) $(alter_phase_LDADD) $(LIBS)
 
+alter_phase_in$(EXEEXT): $(alter_phase_in_OBJECTS) $(alter_phase_in_DEPENDENCIES) $(EXTRA_alter_phase_in_DEPENDENCIES) 
+	@rm -f alter_phase_in$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_phase_in_OBJECTS) $(alter_phase_in_LDADD) $(LIBS)
+
+alter_phase_scalar$(EXEEXT): $(alter_phase_scalar_OBJECTS) $(alter_phase_scalar_DEPENDENCIES) $(EXTRA_alter_phase_scalar_DEPENDENCIES) 
+	@rm -f alter_phase_scalar$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_phase_scalar_OBJECTS) $(alter_phase_scalar_LDADD) $(LIBS)
+
 alter_polynom_coeff$(EXEEXT): $(alter_polynom_coeff_OBJECTS) $(alter_polynom_coeff_DEPENDENCIES) $(EXTRA_alter_polynom_coeff_DEPENDENCIES) 
 	@rm -f alter_polynom_coeff$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_polynom_coeff_OBJECTS) $(alter_polynom_coeff_LDADD) $(LIBS)
@@ -7575,26 +10374,74 @@ alter_polynom_ord$(EXEEXT): $(alter_polynom_ord_OBJECTS) $(alter_polynom_ord_DEP
 	@rm -f alter_polynom_ord$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_polynom_ord_OBJECTS) $(alter_polynom_ord_LDADD) $(LIBS)
 
+alter_polynom_ord2$(EXEEXT): $(alter_polynom_ord2_OBJECTS) $(alter_polynom_ord2_DEPENDENCIES) $(EXTRA_alter_polynom_ord2_DEPENDENCIES) 
+	@rm -f alter_polynom_ord2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_polynom_ord2_OBJECTS) $(alter_polynom_ord2_LDADD) $(LIBS)
+
+alter_polynom_ord_code$(EXEEXT): $(alter_polynom_ord_code_OBJECTS) $(alter_polynom_ord_code_DEPENDENCIES) $(EXTRA_alter_polynom_ord_code_DEPENDENCIES) 
+	@rm -f alter_polynom_ord_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_polynom_ord_code_OBJECTS) $(alter_polynom_ord_code_LDADD) $(LIBS)
+
+alter_polynom_scalar$(EXEEXT): $(alter_polynom_scalar_OBJECTS) $(alter_polynom_scalar_DEPENDENCIES) $(EXTRA_alter_polynom_scalar_DEPENDENCIES) 
+	@rm -f alter_polynom_scalar$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_polynom_scalar_OBJECTS) $(alter_polynom_scalar_LDADD) $(LIBS)
+
+alter_prot$(EXEEXT): $(alter_prot_OBJECTS) $(alter_prot_DEPENDENCIES) $(EXTRA_alter_prot_DEPENDENCIES) 
+	@rm -f alter_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_prot_OBJECTS) $(alter_prot_LDADD) $(LIBS)
+
+alter_raw_prot$(EXEEXT): $(alter_raw_prot_OBJECTS) $(alter_raw_prot_DEPENDENCIES) $(EXTRA_alter_raw_prot_DEPENDENCIES) 
+	@rm -f alter_raw_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_raw_prot_OBJECTS) $(alter_raw_prot_LDADD) $(LIBS)
+
 alter_raw_spf$(EXEEXT): $(alter_raw_spf_OBJECTS) $(alter_raw_spf_DEPENDENCIES) $(EXTRA_alter_raw_spf_DEPENDENCIES) 
 	@rm -f alter_raw_spf$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_raw_spf_OBJECTS) $(alter_raw_spf_LDADD) $(LIBS)
 
+alter_raw_spf_type$(EXEEXT): $(alter_raw_spf_type_OBJECTS) $(alter_raw_spf_type_DEPENDENCIES) $(EXTRA_alter_raw_spf_type_DEPENDENCIES) 
+	@rm -f alter_raw_spf_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_raw_spf_type_OBJECTS) $(alter_raw_spf_type_LDADD) $(LIBS)
+
 alter_raw_type$(EXEEXT): $(alter_raw_type_OBJECTS) $(alter_raw_type_DEPENDENCIES) $(EXTRA_alter_raw_type_DEPENDENCIES) 
 	@rm -f alter_raw_type$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_raw_type_OBJECTS) $(alter_raw_type_LDADD) $(LIBS)
 
+alter_rdonly$(EXEEXT): $(alter_rdonly_OBJECTS) $(alter_rdonly_DEPENDENCIES) $(EXTRA_alter_rdonly_DEPENDENCIES) 
+	@rm -f alter_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_rdonly_OBJECTS) $(alter_rdonly_LDADD) $(LIBS)
+
 alter_recip$(EXEEXT): $(alter_recip_OBJECTS) $(alter_recip_DEPENDENCIES) $(EXTRA_alter_recip_DEPENDENCIES) 
 	@rm -f alter_recip$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_recip_OBJECTS) $(alter_recip_LDADD) $(LIBS)
 
+alter_recip_scalar$(EXEEXT): $(alter_recip_scalar_OBJECTS) $(alter_recip_scalar_DEPENDENCIES) $(EXTRA_alter_recip_scalar_DEPENDENCIES) 
+	@rm -f alter_recip_scalar$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_recip_scalar_OBJECTS) $(alter_recip_scalar_LDADD) $(LIBS)
+
 alter_recip_zero$(EXEEXT): $(alter_recip_zero_OBJECTS) $(alter_recip_zero_DEPENDENCIES) $(EXTRA_alter_recip_zero_DEPENDENCIES) 
 	@rm -f alter_recip_zero$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_recip_zero_OBJECTS) $(alter_recip_zero_LDADD) $(LIBS)
 
+alter_sarray$(EXEEXT): $(alter_sarray_OBJECTS) $(alter_sarray_DEPENDENCIES) $(EXTRA_alter_sarray_DEPENDENCIES) 
+	@rm -f alter_sarray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_sarray_OBJECTS) $(alter_sarray_LDADD) $(LIBS)
+
+alter_sarray_nop$(EXEEXT): $(alter_sarray_nop_OBJECTS) $(alter_sarray_nop_DEPENDENCIES) $(EXTRA_alter_sarray_nop_DEPENDENCIES) 
+	@rm -f alter_sarray_nop$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_sarray_nop_OBJECTS) $(alter_sarray_nop_LDADD) $(LIBS)
+
+alter_sbit$(EXEEXT): $(alter_sbit_OBJECTS) $(alter_sbit_DEPENDENCIES) $(EXTRA_alter_sbit_DEPENDENCIES) 
+	@rm -f alter_sbit$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_sbit_OBJECTS) $(alter_sbit_LDADD) $(LIBS)
+
 alter_scalar_affix$(EXEEXT): $(alter_scalar_affix_OBJECTS) $(alter_scalar_affix_DEPENDENCIES) $(EXTRA_alter_scalar_affix_DEPENDENCIES) 
 	@rm -f alter_scalar_affix$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_scalar_affix_OBJECTS) $(alter_scalar_affix_LDADD) $(LIBS)
 
+alter_sindir$(EXEEXT): $(alter_sindir_OBJECTS) $(alter_sindir_DEPENDENCIES) $(EXTRA_alter_sindir_DEPENDENCIES) 
+	@rm -f alter_sindir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_sindir_OBJECTS) $(alter_sindir_LDADD) $(LIBS)
+
 alter_spec$(EXEEXT): $(alter_spec_OBJECTS) $(alter_spec_DEPENDENCIES) $(EXTRA_alter_spec_DEPENDENCIES) 
 	@rm -f alter_spec$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_spec_OBJECTS) $(alter_spec_LDADD) $(LIBS)
@@ -7603,22 +10450,70 @@ alter_spec_affix$(EXEEXT): $(alter_spec_affix_OBJECTS) $(alter_spec_affix_DEPEND
 	@rm -f alter_spec_affix$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_spec_affix_OBJECTS) $(alter_spec_affix_LDADD) $(LIBS)
 
+alter_spec_code$(EXEEXT): $(alter_spec_code_OBJECTS) $(alter_spec_code_DEPENDENCIES) $(EXTRA_alter_spec_code_DEPENDENCIES) 
+	@rm -f alter_spec_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_spec_code_OBJECTS) $(alter_spec_code_LDADD) $(LIBS)
+
+alter_spec_format$(EXEEXT): $(alter_spec_format_OBJECTS) $(alter_spec_format_DEPENDENCIES) $(EXTRA_alter_spec_format_DEPENDENCIES) 
+	@rm -f alter_spec_format$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_spec_format_OBJECTS) $(alter_spec_format_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)
 	$(AM_V_CCLD)$(LINK) $(alter_spec_meta_OBJECTS) $(alter_spec_meta_LDADD) $(LIBS)
 
+alter_spec_nil$(EXEEXT): $(alter_spec_nil_OBJECTS) $(alter_spec_nil_DEPENDENCIES) $(EXTRA_alter_spec_nil_DEPENDENCIES) 
+	@rm -f alter_spec_nil$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_spec_nil_OBJECTS) $(alter_spec_nil_LDADD) $(LIBS)
+
 alter_spec_polynom$(EXEEXT): $(alter_spec_polynom_OBJECTS) $(alter_spec_polynom_DEPENDENCIES) $(EXTRA_alter_spec_polynom_DEPENDENCIES) 
 	@rm -f alter_spec_polynom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_spec_polynom_OBJECTS) $(alter_spec_polynom_LDADD) $(LIBS)
 
+alter_spec_prot$(EXEEXT): $(alter_spec_prot_OBJECTS) $(alter_spec_prot_DEPENDENCIES) $(EXTRA_alter_spec_prot_DEPENDENCIES) 
+	@rm -f alter_spec_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_spec_prot_OBJECTS) $(alter_spec_prot_LDADD) $(LIBS)
+
+alter_spec_rdonly$(EXEEXT): $(alter_spec_rdonly_OBJECTS) $(alter_spec_rdonly_DEPENDENCIES) $(EXTRA_alter_spec_rdonly_DEPENDENCIES) 
+	@rm -f alter_spec_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_spec_rdonly_OBJECTS) $(alter_spec_rdonly_LDADD) $(LIBS)
+
 alter_window$(EXEEXT): $(alter_window_OBJECTS) $(alter_window_DEPENDENCIES) $(EXTRA_alter_window_DEPENDENCIES) 
 	@rm -f alter_window$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(alter_window_OBJECTS) $(alter_window_LDADD) $(LIBS)
 
+alter_window_in$(EXEEXT): $(alter_window_in_OBJECTS) $(alter_window_in_DEPENDENCIES) $(EXTRA_alter_window_in_DEPENDENCIES) 
+	@rm -f alter_window_in$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_window_in_OBJECTS) $(alter_window_in_LDADD) $(LIBS)
+
+alter_window_op$(EXEEXT): $(alter_window_op_OBJECTS) $(alter_window_op_DEPENDENCIES) $(EXTRA_alter_window_op_DEPENDENCIES) 
+	@rm -f alter_window_op$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_window_op_OBJECTS) $(alter_window_op_LDADD) $(LIBS)
+
+alter_window_scalar$(EXEEXT): $(alter_window_scalar_OBJECTS) $(alter_window_scalar_DEPENDENCIES) $(EXTRA_alter_window_scalar_DEPENDENCIES) 
+	@rm -f alter_window_scalar$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(alter_window_scalar_OBJECTS) $(alter_window_scalar_LDADD) $(LIBS)
+
 ascii_add$(EXEEXT): $(ascii_add_OBJECTS) $(ascii_add_DEPENDENCIES) $(EXTRA_ascii_add_DEPENDENCIES) 
 	@rm -f ascii_add$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(ascii_add_OBJECTS) $(ascii_add_LDADD) $(LIBS)
 
+ascii_complex128$(EXEEXT): $(ascii_complex128_OBJECTS) $(ascii_complex128_DEPENDENCIES) $(EXTRA_ascii_complex128_DEPENDENCIES) 
+	@rm -f ascii_complex128$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_complex128_OBJECTS) $(ascii_complex128_LDADD) $(LIBS)
+
+ascii_complex64$(EXEEXT): $(ascii_complex64_OBJECTS) $(ascii_complex64_DEPENDENCIES) $(EXTRA_ascii_complex64_DEPENDENCIES) 
+	@rm -f ascii_complex64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_complex64_OBJECTS) $(ascii_complex64_LDADD) $(LIBS)
+
+ascii_float32$(EXEEXT): $(ascii_float32_OBJECTS) $(ascii_float32_DEPENDENCIES) $(EXTRA_ascii_float32_DEPENDENCIES) 
+	@rm -f ascii_float32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_float32_OBJECTS) $(ascii_float32_LDADD) $(LIBS)
+
+ascii_float64$(EXEEXT): $(ascii_float64_OBJECTS) $(ascii_float64_DEPENDENCIES) $(EXTRA_ascii_float64_DEPENDENCIES) 
+	@rm -f ascii_float64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_float64_OBJECTS) $(ascii_float64_LDADD) $(LIBS)
+
 ascii_get$(EXEEXT): $(ascii_get_OBJECTS) $(ascii_get_DEPENDENCIES) $(EXTRA_ascii_get_DEPENDENCIES) 
 	@rm -f ascii_get$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(ascii_get_OBJECTS) $(ascii_get_LDADD) $(LIBS)
@@ -7639,6 +10534,22 @@ ascii_get_sub$(EXEEXT): $(ascii_get_sub_OBJECTS) $(ascii_get_sub_DEPENDENCIES) $
 	@rm -f ascii_get_sub$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(ascii_get_sub_OBJECTS) $(ascii_get_sub_LDADD) $(LIBS)
 
+ascii_int16$(EXEEXT): $(ascii_int16_OBJECTS) $(ascii_int16_DEPENDENCIES) $(EXTRA_ascii_int16_DEPENDENCIES) 
+	@rm -f ascii_int16$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_int16_OBJECTS) $(ascii_int16_LDADD) $(LIBS)
+
+ascii_int32$(EXEEXT): $(ascii_int32_OBJECTS) $(ascii_int32_DEPENDENCIES) $(EXTRA_ascii_int32_DEPENDENCIES) 
+	@rm -f ascii_int32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_int32_OBJECTS) $(ascii_int32_LDADD) $(LIBS)
+
+ascii_int64$(EXEEXT): $(ascii_int64_OBJECTS) $(ascii_int64_DEPENDENCIES) $(EXTRA_ascii_int64_DEPENDENCIES) 
+	@rm -f ascii_int64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_int64_OBJECTS) $(ascii_int64_LDADD) $(LIBS)
+
+ascii_int8$(EXEEXT): $(ascii_int8_OBJECTS) $(ascii_int8_DEPENDENCIES) $(EXTRA_ascii_int8_DEPENDENCIES) 
+	@rm -f ascii_int8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_int8_OBJECTS) $(ascii_int8_LDADD) $(LIBS)
+
 ascii_nframes$(EXEEXT): $(ascii_nframes_OBJECTS) $(ascii_nframes_DEPENDENCIES) $(EXTRA_ascii_nframes_DEPENDENCIES) 
 	@rm -f ascii_nframes$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(ascii_nframes_OBJECTS) $(ascii_nframes_LDADD) $(LIBS)
@@ -7663,6 +10574,22 @@ ascii_sync$(EXEEXT): $(ascii_sync_OBJECTS) $(ascii_sync_DEPENDENCIES) $(EXTRA_as
 	@rm -f ascii_sync$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(ascii_sync_OBJECTS) $(ascii_sync_LDADD) $(LIBS)
 
+ascii_uint16$(EXEEXT): $(ascii_uint16_OBJECTS) $(ascii_uint16_DEPENDENCIES) $(EXTRA_ascii_uint16_DEPENDENCIES) 
+	@rm -f ascii_uint16$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_uint16_OBJECTS) $(ascii_uint16_LDADD) $(LIBS)
+
+ascii_uint32$(EXEEXT): $(ascii_uint32_OBJECTS) $(ascii_uint32_DEPENDENCIES) $(EXTRA_ascii_uint32_DEPENDENCIES) 
+	@rm -f ascii_uint32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_uint32_OBJECTS) $(ascii_uint32_LDADD) $(LIBS)
+
+ascii_uint64$(EXEEXT): $(ascii_uint64_OBJECTS) $(ascii_uint64_DEPENDENCIES) $(EXTRA_ascii_uint64_DEPENDENCIES) 
+	@rm -f ascii_uint64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_uint64_OBJECTS) $(ascii_uint64_LDADD) $(LIBS)
+
+ascii_uint8$(EXEEXT): $(ascii_uint8_OBJECTS) $(ascii_uint8_DEPENDENCIES) $(EXTRA_ascii_uint8_DEPENDENCIES) 
+	@rm -f ascii_uint8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ascii_uint8_OBJECTS) $(ascii_uint8_LDADD) $(LIBS)
+
 bof$(EXEEXT): $(bof_OBJECTS) $(bof_DEPENDENCIES) $(EXTRA_bof_DEPENDENCIES) 
 	@rm -f bof$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bof_OBJECTS) $(bof_LDADD) $(LIBS)
@@ -7671,6 +10598,18 @@ bof_bit$(EXEEXT): $(bof_bit_OBJECTS) $(bof_bit_DEPENDENCIES) $(EXTRA_bof_bit_DEP
 	@rm -f bof_bit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bof_bit_OBJECTS) $(bof_bit_LDADD) $(LIBS)
 
+bof_bit_code$(EXEEXT): $(bof_bit_code_OBJECTS) $(bof_bit_code_DEPENDENCIES) $(EXTRA_bof_bit_code_DEPENDENCIES) 
+	@rm -f bof_bit_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bof_bit_code_OBJECTS) $(bof_bit_code_LDADD) $(LIBS)
+
+bof_code$(EXEEXT): $(bof_code_OBJECTS) $(bof_code_DEPENDENCIES) $(EXTRA_bof_code_DEPENDENCIES) 
+	@rm -f bof_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bof_code_OBJECTS) $(bof_code_LDADD) $(LIBS)
+
+bof_const$(EXEEXT): $(bof_const_OBJECTS) $(bof_const_DEPENDENCIES) $(EXTRA_bof_const_DEPENDENCIES) 
+	@rm -f bof_const$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bof_const_OBJECTS) $(bof_const_LDADD) $(LIBS)
+
 bof_index$(EXEEXT): $(bof_index_OBJECTS) $(bof_index_DEPENDENCIES) $(EXTRA_bof_index_DEPENDENCIES) 
 	@rm -f bof_index$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bof_index_OBJECTS) $(bof_index_LDADD) $(LIBS)
@@ -7679,22 +10618,62 @@ bof_lincom$(EXEEXT): $(bof_lincom_OBJECTS) $(bof_lincom_DEPENDENCIES) $(EXTRA_bo
 	@rm -f bof_lincom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bof_lincom_OBJECTS) $(bof_lincom_LDADD) $(LIBS)
 
+bof_lincom_code$(EXEEXT): $(bof_lincom_code_OBJECTS) $(bof_lincom_code_DEPENDENCIES) $(EXTRA_bof_lincom_code_DEPENDENCIES) 
+	@rm -f bof_lincom_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bof_lincom_code_OBJECTS) $(bof_lincom_code_LDADD) $(LIBS)
+
 bof_phase$(EXEEXT): $(bof_phase_OBJECTS) $(bof_phase_DEPENDENCIES) $(EXTRA_bof_phase_DEPENDENCIES) 
 	@rm -f bof_phase$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bof_phase_OBJECTS) $(bof_phase_LDADD) $(LIBS)
 
+bof_phase_code$(EXEEXT): $(bof_phase_code_OBJECTS) $(bof_phase_code_DEPENDENCIES) $(EXTRA_bof_phase_code_DEPENDENCIES) 
+	@rm -f bof_phase_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bof_phase_code_OBJECTS) $(bof_phase_code_LDADD) $(LIBS)
+
 bof_phase_neg$(EXEEXT): $(bof_phase_neg_OBJECTS) $(bof_phase_neg_DEPENDENCIES) $(EXTRA_bof_phase_neg_DEPENDENCIES) 
 	@rm -f bof_phase_neg$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bof_phase_neg_OBJECTS) $(bof_phase_neg_LDADD) $(LIBS)
 
+bof_recurse$(EXEEXT): $(bof_recurse_OBJECTS) $(bof_recurse_DEPENDENCIES) $(EXTRA_bof_recurse_DEPENDENCIES) 
+	@rm -f bof_recurse$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bof_recurse_OBJECTS) $(bof_recurse_LDADD) $(LIBS)
+
 bzip_add$(EXEEXT): $(bzip_add_OBJECTS) $(bzip_add_DEPENDENCIES) $(EXTRA_bzip_add_DEPENDENCIES) 
 	@rm -f bzip_add$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bzip_add_OBJECTS) $(bzip_add_LDADD) $(LIBS)
 
+bzip_complex128$(EXEEXT): $(bzip_complex128_OBJECTS) $(bzip_complex128_DEPENDENCIES) $(EXTRA_bzip_complex128_DEPENDENCIES) 
+	@rm -f bzip_complex128$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_complex128_OBJECTS) $(bzip_complex128_LDADD) $(LIBS)
+
+bzip_complex64$(EXEEXT): $(bzip_complex64_OBJECTS) $(bzip_complex64_DEPENDENCIES) $(EXTRA_bzip_complex64_DEPENDENCIES) 
+	@rm -f bzip_complex64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_complex64_OBJECTS) $(bzip_complex64_LDADD) $(LIBS)
+
+bzip_del$(EXEEXT): $(bzip_del_OBJECTS) $(bzip_del_DEPENDENCIES) $(EXTRA_bzip_del_DEPENDENCIES) 
+	@rm -f bzip_del$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_del_OBJECTS) $(bzip_del_LDADD) $(LIBS)
+
+bzip_enoent$(EXEEXT): $(bzip_enoent_OBJECTS) $(bzip_enoent_DEPENDENCIES) $(EXTRA_bzip_enoent_DEPENDENCIES) 
+	@rm -f bzip_enoent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_enoent_OBJECTS) $(bzip_enoent_LDADD) $(LIBS)
+
+bzip_float32$(EXEEXT): $(bzip_float32_OBJECTS) $(bzip_float32_DEPENDENCIES) $(EXTRA_bzip_float32_DEPENDENCIES) 
+	@rm -f bzip_float32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_float32_OBJECTS) $(bzip_float32_LDADD) $(LIBS)
+
+bzip_float64$(EXEEXT): $(bzip_float64_OBJECTS) $(bzip_float64_DEPENDENCIES) $(EXTRA_bzip_float64_DEPENDENCIES) 
+	@rm -f bzip_float64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_float64_OBJECTS) $(bzip_float64_LDADD) $(LIBS)
+
 bzip_get$(EXEEXT): $(bzip_get_OBJECTS) $(bzip_get_DEPENDENCIES) $(EXTRA_bzip_get_DEPENDENCIES) 
 	@rm -f bzip_get$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bzip_get_OBJECTS) $(bzip_get_LDADD) $(LIBS)
 
+bzip_get_cont$(EXEEXT): $(bzip_get_cont_OBJECTS) $(bzip_get_cont_DEPENDENCIES) $(EXTRA_bzip_get_cont_DEPENDENCIES) 
+	@rm -f bzip_get_cont$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_get_cont_OBJECTS) $(bzip_get_cont_LDADD) $(LIBS)
+
 bzip_get_far$(EXEEXT): $(bzip_get_far_OBJECTS) $(bzip_get_far_DEPENDENCIES) $(EXTRA_bzip_get_far_DEPENDENCIES) 
 	@rm -f bzip_get_far$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bzip_get_far_OBJECTS) $(bzip_get_far_LDADD) $(LIBS)
@@ -7711,6 +10690,22 @@ bzip_get_put$(EXEEXT): $(bzip_get_put_OBJECTS) $(bzip_get_put_DEPENDENCIES) $(EX
 	@rm -f bzip_get_put$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bzip_get_put_OBJECTS) $(bzip_get_put_LDADD) $(LIBS)
 
+bzip_int16$(EXEEXT): $(bzip_int16_OBJECTS) $(bzip_int16_DEPENDENCIES) $(EXTRA_bzip_int16_DEPENDENCIES) 
+	@rm -f bzip_int16$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_int16_OBJECTS) $(bzip_int16_LDADD) $(LIBS)
+
+bzip_int32$(EXEEXT): $(bzip_int32_OBJECTS) $(bzip_int32_DEPENDENCIES) $(EXTRA_bzip_int32_DEPENDENCIES) 
+	@rm -f bzip_int32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_int32_OBJECTS) $(bzip_int32_LDADD) $(LIBS)
+
+bzip_int64$(EXEEXT): $(bzip_int64_OBJECTS) $(bzip_int64_DEPENDENCIES) $(EXTRA_bzip_int64_DEPENDENCIES) 
+	@rm -f bzip_int64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_int64_OBJECTS) $(bzip_int64_LDADD) $(LIBS)
+
+bzip_int8$(EXEEXT): $(bzip_int8_OBJECTS) $(bzip_int8_DEPENDENCIES) $(EXTRA_bzip_int8_DEPENDENCIES) 
+	@rm -f bzip_int8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_int8_OBJECTS) $(bzip_int8_LDADD) $(LIBS)
+
 bzip_move_from$(EXEEXT): $(bzip_move_from_OBJECTS) $(bzip_move_from_DEPENDENCIES) $(EXTRA_bzip_move_from_DEPENDENCIES) 
 	@rm -f bzip_move_from$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bzip_move_from_OBJECTS) $(bzip_move_from_LDADD) $(LIBS)
@@ -7739,6 +10734,10 @@ bzip_put_get$(EXEEXT): $(bzip_put_get_OBJECTS) $(bzip_put_get_DEPENDENCIES) $(EX
 	@rm -f bzip_put_get$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bzip_put_get_OBJECTS) $(bzip_put_get_LDADD) $(LIBS)
 
+bzip_put_offs$(EXEEXT): $(bzip_put_offs_OBJECTS) $(bzip_put_offs_DEPENDENCIES) $(EXTRA_bzip_put_offs_DEPENDENCIES) 
+	@rm -f bzip_put_offs$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_put_offs_OBJECTS) $(bzip_put_offs_LDADD) $(LIBS)
+
 bzip_put_pad$(EXEEXT): $(bzip_put_pad_OBJECTS) $(bzip_put_pad_DEPENDENCIES) $(EXTRA_bzip_put_pad_DEPENDENCIES) 
 	@rm -f bzip_put_pad$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bzip_put_pad_OBJECTS) $(bzip_put_pad_LDADD) $(LIBS)
@@ -7759,6 +10758,70 @@ bzip_sync$(EXEEXT): $(bzip_sync_OBJECTS) $(bzip_sync_DEPENDENCIES) $(EXTRA_bzip_
 	@rm -f bzip_sync$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bzip_sync_OBJECTS) $(bzip_sync_LDADD) $(LIBS)
 
+bzip_uint16$(EXEEXT): $(bzip_uint16_OBJECTS) $(bzip_uint16_DEPENDENCIES) $(EXTRA_bzip_uint16_DEPENDENCIES) 
+	@rm -f bzip_uint16$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_uint16_OBJECTS) $(bzip_uint16_LDADD) $(LIBS)
+
+bzip_uint32$(EXEEXT): $(bzip_uint32_OBJECTS) $(bzip_uint32_DEPENDENCIES) $(EXTRA_bzip_uint32_DEPENDENCIES) 
+	@rm -f bzip_uint32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_uint32_OBJECTS) $(bzip_uint32_LDADD) $(LIBS)
+
+bzip_uint64$(EXEEXT): $(bzip_uint64_OBJECTS) $(bzip_uint64_DEPENDENCIES) $(EXTRA_bzip_uint64_DEPENDENCIES) 
+	@rm -f bzip_uint64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_uint64_OBJECTS) $(bzip_uint64_LDADD) $(LIBS)
+
+bzip_uint8$(EXEEXT): $(bzip_uint8_OBJECTS) $(bzip_uint8_DEPENDENCIES) $(EXTRA_bzip_uint8_DEPENDENCIES) 
+	@rm -f bzip_uint8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(bzip_uint8_OBJECTS) $(bzip_uint8_LDADD) $(LIBS)
+
+calist$(EXEEXT): $(calist_OBJECTS) $(calist_DEPENDENCIES) $(EXTRA_calist_DEPENDENCIES) 
+	@rm -f calist$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_OBJECTS) $(calist_LDADD) $(LIBS)
+
+calist0$(EXEEXT): $(calist0_OBJECTS) $(calist0_DEPENDENCIES) $(EXTRA_calist0_DEPENDENCIES) 
+	@rm -f calist0$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist0_OBJECTS) $(calist0_LDADD) $(LIBS)
+
+calist_free$(EXEEXT): $(calist_free_OBJECTS) $(calist_free_DEPENDENCIES) $(EXTRA_calist_free_DEPENDENCIES) 
+	@rm -f calist_free$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_free_OBJECTS) $(calist_free_LDADD) $(LIBS)
+
+calist_hidden$(EXEEXT): $(calist_hidden_OBJECTS) $(calist_hidden_DEPENDENCIES) $(EXTRA_calist_hidden_DEPENDENCIES) 
+	@rm -f calist_hidden$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_hidden_OBJECTS) $(calist_hidden_LDADD) $(LIBS)
+
+calist_long$(EXEEXT): $(calist_long_OBJECTS) $(calist_long_DEPENDENCIES) $(EXTRA_calist_long_DEPENDENCIES) 
+	@rm -f calist_long$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_long_OBJECTS) $(calist_long_LDADD) $(LIBS)
+
+calist_meta$(EXEEXT): $(calist_meta_OBJECTS) $(calist_meta_DEPENDENCIES) $(EXTRA_calist_meta_DEPENDENCIES) 
+	@rm -f calist_meta$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_meta_OBJECTS) $(calist_meta_LDADD) $(LIBS)
+
+calist_meta0$(EXEEXT): $(calist_meta0_OBJECTS) $(calist_meta0_DEPENDENCIES) $(EXTRA_calist_meta0_DEPENDENCIES) 
+	@rm -f calist_meta0$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_meta0_OBJECTS) $(calist_meta0_LDADD) $(LIBS)
+
+calist_meta_free$(EXEEXT): $(calist_meta_free_OBJECTS) $(calist_meta_free_DEPENDENCIES) $(EXTRA_calist_meta_free_DEPENDENCIES) 
+	@rm -f calist_meta_free$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_meta_free_OBJECTS) $(calist_meta_free_LDADD) $(LIBS)
+
+calist_meta_hidden$(EXEEXT): $(calist_meta_hidden_OBJECTS) $(calist_meta_hidden_DEPENDENCIES) $(EXTRA_calist_meta_hidden_DEPENDENCIES) 
+	@rm -f calist_meta_hidden$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_meta_hidden_OBJECTS) $(calist_meta_hidden_LDADD) $(LIBS)
+
+calist_meta_meta$(EXEEXT): $(calist_meta_meta_OBJECTS) $(calist_meta_meta_DEPENDENCIES) $(EXTRA_calist_meta_meta_DEPENDENCIES) 
+	@rm -f calist_meta_meta$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_meta_meta_OBJECTS) $(calist_meta_meta_LDADD) $(LIBS)
+
+calist_meta_parent$(EXEEXT): $(calist_meta_parent_OBJECTS) $(calist_meta_parent_DEPENDENCIES) $(EXTRA_calist_meta_parent_DEPENDENCIES) 
+	@rm -f calist_meta_parent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_meta_parent_OBJECTS) $(calist_meta_parent_LDADD) $(LIBS)
+
+calist_null$(EXEEXT): $(calist_null_OBJECTS) $(calist_null_DEPENDENCIES) $(EXTRA_calist_null_DEPENDENCIES) 
+	@rm -f calist_null$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(calist_null_OBJECTS) $(calist_null_LDADD) $(LIBS)
+
 close_bad$(EXEEXT): $(close_bad_OBJECTS) $(close_bad_DEPENDENCIES) $(EXTRA_close_bad_DEPENDENCIES) 
 	@rm -f close_bad$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(close_bad_OBJECTS) $(close_bad_LDADD) $(LIBS)
@@ -8267,42 +11330,6 @@ cvlist$(EXEEXT): $(cvlist_OBJECTS) $(cvlist_DEPENDENCIES) $(EXTRA_cvlist_DEPENDE
 	@rm -f cvlist$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(cvlist_OBJECTS) $(cvlist_LDADD) $(LIBS)
 
-cvlist_array$(EXEEXT): $(cvlist_array_OBJECTS) $(cvlist_array_DEPENDENCIES) $(EXTRA_cvlist_array_DEPENDENCIES) 
-	@rm -f cvlist_array$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(cvlist_array_OBJECTS) $(cvlist_array_LDADD) $(LIBS)
-
-cvlist_array0$(EXEEXT): $(cvlist_array0_OBJECTS) $(cvlist_array0_DEPENDENCIES) $(EXTRA_cvlist_array0_DEPENDENCIES) 
-	@rm -f cvlist_array0$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(cvlist_array0_OBJECTS) $(cvlist_array0_LDADD) $(LIBS)
-
-cvlist_array_free$(EXEEXT): $(cvlist_array_free_OBJECTS) $(cvlist_array_free_DEPENDENCIES) $(EXTRA_cvlist_array_free_DEPENDENCIES) 
-	@rm -f cvlist_array_free$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(cvlist_array_free_OBJECTS) $(cvlist_array_free_LDADD) $(LIBS)
-
-cvlist_array_hidden$(EXEEXT): $(cvlist_array_hidden_OBJECTS) $(cvlist_array_hidden_DEPENDENCIES) $(EXTRA_cvlist_array_hidden_DEPENDENCIES) 
-	@rm -f cvlist_array_hidden$(EXEEXT)
-	$(AM_V_CCLD)$(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)
-	$(AM_V_CCLD)$(LINK) $(cvlist_array_meta_OBJECTS) $(cvlist_array_meta_LDADD) $(LIBS)
-
-cvlist_array_meta0$(EXEEXT): $(cvlist_array_meta0_OBJECTS) $(cvlist_array_meta0_DEPENDENCIES) $(EXTRA_cvlist_array_meta0_DEPENDENCIES) 
-	@rm -f cvlist_array_meta0$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(cvlist_array_meta0_OBJECTS) $(cvlist_array_meta0_LDADD) $(LIBS)
-
-cvlist_array_meta_free$(EXEEXT): $(cvlist_array_meta_free_OBJECTS) $(cvlist_array_meta_free_DEPENDENCIES) $(EXTRA_cvlist_array_meta_free_DEPENDENCIES) 
-	@rm -f cvlist_array_meta_free$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(cvlist_array_meta_free_OBJECTS) $(cvlist_array_meta_free_LDADD) $(LIBS)
-
-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)
-	$(AM_V_CCLD)$(LINK) $(cvlist_array_meta_hidden_OBJECTS) $(cvlist_array_meta_hidden_LDADD) $(LIBS)
-
-cvlist_array_null$(EXEEXT): $(cvlist_array_null_OBJECTS) $(cvlist_array_null_DEPENDENCIES) $(EXTRA_cvlist_array_null_DEPENDENCIES) 
-	@rm -f cvlist_array_null$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(cvlist_array_null_OBJECTS) $(cvlist_array_null_LDADD) $(LIBS)
-
 cvlist_hidden$(EXEEXT): $(cvlist_hidden_OBJECTS) $(cvlist_hidden_DEPENDENCIES) $(EXTRA_cvlist_hidden_DEPENDENCIES) 
 	@rm -f cvlist_hidden$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(cvlist_hidden_OBJECTS) $(cvlist_hidden_LDADD) $(LIBS)
@@ -8311,6 +11338,10 @@ cvlist_invalid$(EXEEXT): $(cvlist_invalid_OBJECTS) $(cvlist_invalid_DEPENDENCIES
 	@rm -f cvlist_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(cvlist_invalid_OBJECTS) $(cvlist_invalid_LDADD) $(LIBS)
 
+cvlist_long$(EXEEXT): $(cvlist_long_OBJECTS) $(cvlist_long_DEPENDENCIES) $(EXTRA_cvlist_long_DEPENDENCIES) 
+	@rm -f cvlist_long$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(cvlist_long_OBJECTS) $(cvlist_long_LDADD) $(LIBS)
+
 cvlist_meta$(EXEEXT): $(cvlist_meta_OBJECTS) $(cvlist_meta_DEPENDENCIES) $(EXTRA_cvlist_meta_DEPENDENCIES) 
 	@rm -f cvlist_meta$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(cvlist_meta_OBJECTS) $(cvlist_meta_LDADD) $(LIBS)
@@ -8319,6 +11350,10 @@ cvlist_meta0$(EXEEXT): $(cvlist_meta0_OBJECTS) $(cvlist_meta0_DEPENDENCIES) $(EX
 	@rm -f cvlist_meta0$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(cvlist_meta0_OBJECTS) $(cvlist_meta0_LDADD) $(LIBS)
 
+cvlist_meta_code$(EXEEXT): $(cvlist_meta_code_OBJECTS) $(cvlist_meta_code_DEPENDENCIES) $(EXTRA_cvlist_meta_code_DEPENDENCIES) 
+	@rm -f cvlist_meta_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(cvlist_meta_code_OBJECTS) $(cvlist_meta_code_LDADD) $(LIBS)
+
 cvlist_meta_hidden$(EXEEXT): $(cvlist_meta_hidden_OBJECTS) $(cvlist_meta_hidden_DEPENDENCIES) $(EXTRA_cvlist_meta_hidden_DEPENDENCIES) 
 	@rm -f cvlist_meta_hidden$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(cvlist_meta_hidden_OBJECTS) $(cvlist_meta_hidden_LDADD) $(LIBS)
@@ -8327,6 +11362,10 @@ cvlist_meta_invalid$(EXEEXT): $(cvlist_meta_invalid_OBJECTS) $(cvlist_meta_inval
 	@rm -f cvlist_meta_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(cvlist_meta_invalid_OBJECTS) $(cvlist_meta_invalid_LDADD) $(LIBS)
 
+cvlist_meta_parent$(EXEEXT): $(cvlist_meta_parent_OBJECTS) $(cvlist_meta_parent_DEPENDENCIES) $(EXTRA_cvlist_meta_parent_DEPENDENCIES) 
+	@rm -f cvlist_meta_parent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(cvlist_meta_parent_OBJECTS) $(cvlist_meta_parent_LDADD) $(LIBS)
+
 cvlist_null$(EXEEXT): $(cvlist_null_OBJECTS) $(cvlist_null_DEPENDENCIES) $(EXTRA_cvlist_null_DEPENDENCIES) 
 	@rm -f cvlist_null$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(cvlist_null_OBJECTS) $(cvlist_null_LDADD) $(LIBS)
@@ -8335,6 +11374,14 @@ del_alias$(EXEEXT): $(del_alias_OBJECTS) $(del_alias_DEPENDENCIES) $(EXTRA_del_a
 	@rm -f del_alias$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(del_alias_OBJECTS) $(del_alias_LDADD) $(LIBS)
 
+del_alias_dangle$(EXEEXT): $(del_alias_dangle_OBJECTS) $(del_alias_dangle_DEPENDENCIES) $(EXTRA_del_alias_dangle_DEPENDENCIES) 
+	@rm -f del_alias_dangle$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(del_alias_dangle_OBJECTS) $(del_alias_dangle_LDADD) $(LIBS)
+
+del_alias_target$(EXEEXT): $(del_alias_target_OBJECTS) $(del_alias_target_DEPENDENCIES) $(EXTRA_del_alias_target_DEPENDENCIES) 
+	@rm -f del_alias_target$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(del_alias_target_OBJECTS) $(del_alias_target_LDADD) $(LIBS)
+
 del_bad_code$(EXEEXT): $(del_bad_code_OBJECTS) $(del_bad_code_DEPENDENCIES) $(EXTRA_del_bad_code_DEPENDENCIES) 
 	@rm -f del_bad_code$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(del_bad_code_OBJECTS) $(del_bad_code_LDADD) $(LIBS)
@@ -8371,6 +11418,10 @@ del_data_open$(EXEEXT): $(del_data_open_OBJECTS) $(del_data_open_DEPENDENCIES) $
 	@rm -f del_data_open$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(del_data_open_OBJECTS) $(del_data_open_LDADD) $(LIBS)
 
+del_data_prot$(EXEEXT): $(del_data_prot_OBJECTS) $(del_data_prot_DEPENDENCIES) $(EXTRA_del_data_prot_DEPENDENCIES) 
+	@rm -f del_data_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(del_data_prot_OBJECTS) $(del_data_prot_LDADD) $(LIBS)
+
 del_del$(EXEEXT): $(del_del_OBJECTS) $(del_del_DEPENDENCIES) $(EXTRA_del_del_DEPENDENCIES) 
 	@rm -f del_del$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(del_del_OBJECTS) $(del_del_LDADD) $(LIBS)
@@ -8387,6 +11438,10 @@ del_derived_force$(EXEEXT): $(del_derived_force_OBJECTS) $(del_derived_force_DEP
 	@rm -f del_derived_force$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(del_derived_force_OBJECTS) $(del_derived_force_LDADD) $(LIBS)
 
+del_divide$(EXEEXT): $(del_divide_OBJECTS) $(del_divide_DEPENDENCIES) $(EXTRA_del_divide_DEPENDENCIES) 
+	@rm -f del_divide$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(del_divide_OBJECTS) $(del_divide_LDADD) $(LIBS)
+
 del_meta$(EXEEXT): $(del_meta_OBJECTS) $(del_meta_DEPENDENCIES) $(EXTRA_del_meta_DEPENDENCIES) 
 	@rm -f del_meta$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(del_meta_OBJECTS) $(del_meta_LDADD) $(LIBS)
@@ -8395,6 +11450,14 @@ del_meta_force$(EXEEXT): $(del_meta_force_OBJECTS) $(del_meta_force_DEPENDENCIES
 	@rm -f del_meta_force$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(del_meta_force_OBJECTS) $(del_meta_force_LDADD) $(LIBS)
 
+del_prot$(EXEEXT): $(del_prot_OBJECTS) $(del_prot_DEPENDENCIES) $(EXTRA_del_prot_DEPENDENCIES) 
+	@rm -f del_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(del_prot_OBJECTS) $(del_prot_LDADD) $(LIBS)
+
+del_rdonly$(EXEEXT): $(del_rdonly_OBJECTS) $(del_rdonly_DEPENDENCIES) $(EXTRA_del_rdonly_DEPENDENCIES) 
+	@rm -f del_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(del_rdonly_OBJECTS) $(del_rdonly_LDADD) $(LIBS)
+
 del_ref$(EXEEXT): $(del_ref_OBJECTS) $(del_ref_DEPENDENCIES) $(EXTRA_del_ref_DEPENDENCIES) 
 	@rm -f del_ref$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(del_ref_OBJECTS) $(del_ref_LDADD) $(LIBS)
@@ -8471,10 +11534,22 @@ elist_noalias$(EXEEXT): $(elist_noalias_OBJECTS) $(elist_noalias_DEPENDENCIES) $
 	@rm -f elist_noalias$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(elist_noalias_OBJECTS) $(elist_noalias_LDADD) $(LIBS)
 
+elist_parent$(EXEEXT): $(elist_parent_OBJECTS) $(elist_parent_DEPENDENCIES) $(EXTRA_elist_parent_DEPENDENCIES) 
+	@rm -f elist_parent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(elist_parent_OBJECTS) $(elist_parent_LDADD) $(LIBS)
+
+elist_parent2$(EXEEXT): $(elist_parent2_OBJECTS) $(elist_parent2_DEPENDENCIES) $(EXTRA_elist_parent2_DEPENDENCIES) 
+	@rm -f elist_parent2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(elist_parent2_OBJECTS) $(elist_parent2_LDADD) $(LIBS)
+
 elist_scalar$(EXEEXT): $(elist_scalar_OBJECTS) $(elist_scalar_DEPENDENCIES) $(EXTRA_elist_scalar_DEPENDENCIES) 
 	@rm -f elist_scalar$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(elist_scalar_OBJECTS) $(elist_scalar_LDADD) $(LIBS)
 
+elist_type$(EXEEXT): $(elist_type_OBJECTS) $(elist_type_DEPENDENCIES) $(EXTRA_elist_type_DEPENDENCIES) 
+	@rm -f elist_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(elist_type_OBJECTS) $(elist_type_LDADD) $(LIBS)
+
 encode_alter$(EXEEXT): $(encode_alter_OBJECTS) $(encode_alter_DEPENDENCIES) $(EXTRA_encode_alter_DEPENDENCIES) 
 	@rm -f encode_alter$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(encode_alter_OBJECTS) $(encode_alter_LDADD) $(LIBS)
@@ -8511,6 +11586,26 @@ endian_alter_all$(EXEEXT): $(endian_alter_all_OBJECTS) $(endian_alter_all_DEPEND
 	@rm -f endian_alter_all$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(endian_alter_all_OBJECTS) $(endian_alter_all_LDADD) $(LIBS)
 
+endian_alter_arg$(EXEEXT): $(endian_alter_arg_OBJECTS) $(endian_alter_arg_DEPENDENCIES) $(EXTRA_endian_alter_arg_DEPENDENCIES) 
+	@rm -f endian_alter_arg$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(endian_alter_arg_OBJECTS) $(endian_alter_arg_LDADD) $(LIBS)
+
+endian_alter_dprot$(EXEEXT): $(endian_alter_dprot_OBJECTS) $(endian_alter_dprot_DEPENDENCIES) $(EXTRA_endian_alter_dprot_DEPENDENCIES) 
+	@rm -f endian_alter_dprot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(endian_alter_dprot_OBJECTS) $(endian_alter_dprot_LDADD) $(LIBS)
+
+endian_alter_fprot$(EXEEXT): $(endian_alter_fprot_OBJECTS) $(endian_alter_fprot_DEPENDENCIES) $(EXTRA_endian_alter_fprot_DEPENDENCIES) 
+	@rm -f endian_alter_fprot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(endian_alter_fprot_OBJECTS) $(endian_alter_fprot_LDADD) $(LIBS)
+
+endian_alter_index$(EXEEXT): $(endian_alter_index_OBJECTS) $(endian_alter_index_DEPENDENCIES) $(EXTRA_endian_alter_index_DEPENDENCIES) 
+	@rm -f endian_alter_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(endian_alter_index_OBJECTS) $(endian_alter_index_LDADD) $(LIBS)
+
+endian_alter_rdonly$(EXEEXT): $(endian_alter_rdonly_OBJECTS) $(endian_alter_rdonly_DEPENDENCIES) $(EXTRA_endian_alter_rdonly_DEPENDENCIES) 
+	@rm -f endian_alter_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(endian_alter_rdonly_OBJECTS) $(endian_alter_rdonly_LDADD) $(LIBS)
+
 endian_alter_sie$(EXEEXT): $(endian_alter_sie_OBJECTS) $(endian_alter_sie_DEPENDENCIES) $(EXTRA_endian_alter_sie_DEPENDENCIES) 
 	@rm -f endian_alter_sie$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(endian_alter_sie_OBJECTS) $(endian_alter_sie_LDADD) $(LIBS)
@@ -8519,6 +11614,10 @@ endian_get$(EXEEXT): $(endian_get_OBJECTS) $(endian_get_DEPENDENCIES) $(EXTRA_en
 	@rm -f endian_get$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(endian_get_OBJECTS) $(endian_get_LDADD) $(LIBS)
 
+endian_index$(EXEEXT): $(endian_index_OBJECTS) $(endian_index_DEPENDENCIES) $(EXTRA_endian_index_DEPENDENCIES) 
+	@rm -f endian_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(endian_index_OBJECTS) $(endian_index_LDADD) $(LIBS)
+
 endian_move$(EXEEXT): $(endian_move_OBJECTS) $(endian_move_DEPENDENCIES) $(EXTRA_endian_move_DEPENDENCIES) 
 	@rm -f endian_move$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(endian_move_OBJECTS) $(endian_move_LDADD) $(LIBS)
@@ -8631,6 +11730,14 @@ eof_bit$(EXEEXT): $(eof_bit_OBJECTS) $(eof_bit_DEPENDENCIES) $(EXTRA_eof_bit_DEP
 	@rm -f eof_bit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(eof_bit_OBJECTS) $(eof_bit_LDADD) $(LIBS)
 
+eof_bit_code$(EXEEXT): $(eof_bit_code_OBJECTS) $(eof_bit_code_DEPENDENCIES) $(EXTRA_eof_bit_code_DEPENDENCIES) 
+	@rm -f eof_bit_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(eof_bit_code_OBJECTS) $(eof_bit_code_LDADD) $(LIBS)
+
+eof_const$(EXEEXT): $(eof_const_OBJECTS) $(eof_const_DEPENDENCIES) $(EXTRA_eof_const_DEPENDENCIES) 
+	@rm -f eof_const$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(eof_const_OBJECTS) $(eof_const_LDADD) $(LIBS)
+
 eof_index$(EXEEXT): $(eof_index_OBJECTS) $(eof_index_DEPENDENCIES) $(EXTRA_eof_index_DEPENDENCIES) 
 	@rm -f eof_index$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(eof_index_OBJECTS) $(eof_index_LDADD) $(LIBS)
@@ -8639,14 +11746,26 @@ eof_lincom$(EXEEXT): $(eof_lincom_OBJECTS) $(eof_lincom_DEPENDENCIES) $(EXTRA_eo
 	@rm -f eof_lincom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(eof_lincom_OBJECTS) $(eof_lincom_LDADD) $(LIBS)
 
+eof_lincom_code$(EXEEXT): $(eof_lincom_code_OBJECTS) $(eof_lincom_code_DEPENDENCIES) $(EXTRA_eof_lincom_code_DEPENDENCIES) 
+	@rm -f eof_lincom_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(eof_lincom_code_OBJECTS) $(eof_lincom_code_LDADD) $(LIBS)
+
 eof_phase$(EXEEXT): $(eof_phase_OBJECTS) $(eof_phase_DEPENDENCIES) $(EXTRA_eof_phase_DEPENDENCIES) 
 	@rm -f eof_phase$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(eof_phase_OBJECTS) $(eof_phase_LDADD) $(LIBS)
 
+eof_phase_code$(EXEEXT): $(eof_phase_code_OBJECTS) $(eof_phase_code_DEPENDENCIES) $(EXTRA_eof_phase_code_DEPENDENCIES) 
+	@rm -f eof_phase_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(eof_phase_code_OBJECTS) $(eof_phase_code_LDADD) $(LIBS)
+
 eof_phase_neg$(EXEEXT): $(eof_phase_neg_OBJECTS) $(eof_phase_neg_DEPENDENCIES) $(EXTRA_eof_phase_neg_DEPENDENCIES) 
 	@rm -f eof_phase_neg$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(eof_phase_neg_OBJECTS) $(eof_phase_neg_LDADD) $(LIBS)
 
+eof_recurse$(EXEEXT): $(eof_recurse_OBJECTS) $(eof_recurse_DEPENDENCIES) $(EXTRA_eof_recurse_DEPENDENCIES) 
+	@rm -f eof_recurse$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(eof_recurse_OBJECTS) $(eof_recurse_LDADD) $(LIBS)
+
 error$(EXEEXT): $(error_OBJECTS) $(error_DEPENDENCIES) $(EXTRA_error_DEPENDENCIES) 
 	@rm -f error$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(error_OBJECTS) $(error_LDADD) $(LIBS)
@@ -8687,10 +11806,38 @@ flac_add$(EXEEXT): $(flac_add_OBJECTS) $(flac_add_DEPENDENCIES) $(EXTRA_flac_add
 	@rm -f flac_add$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flac_add_OBJECTS) $(flac_add_LDADD) $(LIBS)
 
+flac_complex128$(EXEEXT): $(flac_complex128_OBJECTS) $(flac_complex128_DEPENDENCIES) $(EXTRA_flac_complex128_DEPENDENCIES) 
+	@rm -f flac_complex128$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_complex128_OBJECTS) $(flac_complex128_LDADD) $(LIBS)
+
+flac_complex64$(EXEEXT): $(flac_complex64_OBJECTS) $(flac_complex64_DEPENDENCIES) $(EXTRA_flac_complex64_DEPENDENCIES) 
+	@rm -f flac_complex64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_complex64_OBJECTS) $(flac_complex64_LDADD) $(LIBS)
+
+flac_del$(EXEEXT): $(flac_del_OBJECTS) $(flac_del_DEPENDENCIES) $(EXTRA_flac_del_DEPENDENCIES) 
+	@rm -f flac_del$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_del_OBJECTS) $(flac_del_LDADD) $(LIBS)
+
+flac_enoent$(EXEEXT): $(flac_enoent_OBJECTS) $(flac_enoent_DEPENDENCIES) $(EXTRA_flac_enoent_DEPENDENCIES) 
+	@rm -f flac_enoent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_enoent_OBJECTS) $(flac_enoent_LDADD) $(LIBS)
+
+flac_float32$(EXEEXT): $(flac_float32_OBJECTS) $(flac_float32_DEPENDENCIES) $(EXTRA_flac_float32_DEPENDENCIES) 
+	@rm -f flac_float32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_float32_OBJECTS) $(flac_float32_LDADD) $(LIBS)
+
+flac_float64$(EXEEXT): $(flac_float64_OBJECTS) $(flac_float64_DEPENDENCIES) $(EXTRA_flac_float64_DEPENDENCIES) 
+	@rm -f flac_float64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_float64_OBJECTS) $(flac_float64_LDADD) $(LIBS)
+
 flac_get_big$(EXEEXT): $(flac_get_big_OBJECTS) $(flac_get_big_DEPENDENCIES) $(EXTRA_flac_get_big_DEPENDENCIES) 
 	@rm -f flac_get_big$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flac_get_big_OBJECTS) $(flac_get_big_LDADD) $(LIBS)
 
+flac_get_cont$(EXEEXT): $(flac_get_cont_OBJECTS) $(flac_get_cont_DEPENDENCIES) $(EXTRA_flac_get_cont_DEPENDENCIES) 
+	@rm -f flac_get_cont$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_get_cont_OBJECTS) $(flac_get_cont_LDADD) $(LIBS)
+
 flac_get_far$(EXEEXT): $(flac_get_far_OBJECTS) $(flac_get_far_DEPENDENCIES) $(EXTRA_flac_get_far_DEPENDENCIES) 
 	@rm -f flac_get_far$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flac_get_far_OBJECTS) $(flac_get_far_LDADD) $(LIBS)
@@ -8719,6 +11866,26 @@ flac_get_long$(EXEEXT): $(flac_get_long_OBJECTS) $(flac_get_long_DEPENDENCIES) $
 	@rm -f flac_get_long$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flac_get_long_OBJECTS) $(flac_get_long_LDADD) $(LIBS)
 
+flac_int16$(EXEEXT): $(flac_int16_OBJECTS) $(flac_int16_DEPENDENCIES) $(EXTRA_flac_int16_DEPENDENCIES) 
+	@rm -f flac_int16$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_int16_OBJECTS) $(flac_int16_LDADD) $(LIBS)
+
+flac_int32$(EXEEXT): $(flac_int32_OBJECTS) $(flac_int32_DEPENDENCIES) $(EXTRA_flac_int32_DEPENDENCIES) 
+	@rm -f flac_int32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_int32_OBJECTS) $(flac_int32_LDADD) $(LIBS)
+
+flac_int64$(EXEEXT): $(flac_int64_OBJECTS) $(flac_int64_DEPENDENCIES) $(EXTRA_flac_int64_DEPENDENCIES) 
+	@rm -f flac_int64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_int64_OBJECTS) $(flac_int64_LDADD) $(LIBS)
+
+flac_int8$(EXEEXT): $(flac_int8_OBJECTS) $(flac_int8_DEPENDENCIES) $(EXTRA_flac_int8_DEPENDENCIES) 
+	@rm -f flac_int8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_int8_OBJECTS) $(flac_int8_LDADD) $(LIBS)
+
+flac_move_from$(EXEEXT): $(flac_move_from_OBJECTS) $(flac_move_from_DEPENDENCIES) $(EXTRA_flac_move_from_DEPENDENCIES) 
+	@rm -f flac_move_from$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_move_from_OBJECTS) $(flac_move_from_LDADD) $(LIBS)
+
 flac_nframes$(EXEEXT): $(flac_nframes_OBJECTS) $(flac_nframes_DEPENDENCIES) $(EXTRA_flac_nframes_DEPENDENCIES) 
 	@rm -f flac_nframes$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flac_nframes_OBJECTS) $(flac_nframes_LDADD) $(LIBS)
@@ -8743,6 +11910,10 @@ flac_put_little$(EXEEXT): $(flac_put_little_OBJECTS) $(flac_put_little_DEPENDENC
 	@rm -f flac_put_little$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flac_put_little_OBJECTS) $(flac_put_little_LDADD) $(LIBS)
 
+flac_put_offs$(EXEEXT): $(flac_put_offs_OBJECTS) $(flac_put_offs_DEPENDENCIES) $(EXTRA_flac_put_offs_DEPENDENCIES) 
+	@rm -f flac_put_offs$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_put_offs_OBJECTS) $(flac_put_offs_LDADD) $(LIBS)
+
 flac_seek$(EXEEXT): $(flac_seek_OBJECTS) $(flac_seek_DEPENDENCIES) $(EXTRA_flac_seek_DEPENDENCIES) 
 	@rm -f flac_seek$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flac_seek_OBJECTS) $(flac_seek_LDADD) $(LIBS)
@@ -8755,6 +11926,22 @@ flac_sync$(EXEEXT): $(flac_sync_OBJECTS) $(flac_sync_DEPENDENCIES) $(EXTRA_flac_
 	@rm -f flac_sync$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flac_sync_OBJECTS) $(flac_sync_LDADD) $(LIBS)
 
+flac_uint16$(EXEEXT): $(flac_uint16_OBJECTS) $(flac_uint16_DEPENDENCIES) $(EXTRA_flac_uint16_DEPENDENCIES) 
+	@rm -f flac_uint16$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_uint16_OBJECTS) $(flac_uint16_LDADD) $(LIBS)
+
+flac_uint32$(EXEEXT): $(flac_uint32_OBJECTS) $(flac_uint32_DEPENDENCIES) $(EXTRA_flac_uint32_DEPENDENCIES) 
+	@rm -f flac_uint32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_uint32_OBJECTS) $(flac_uint32_LDADD) $(LIBS)
+
+flac_uint64$(EXEEXT): $(flac_uint64_OBJECTS) $(flac_uint64_DEPENDENCIES) $(EXTRA_flac_uint64_DEPENDENCIES) 
+	@rm -f flac_uint64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_uint64_OBJECTS) $(flac_uint64_LDADD) $(LIBS)
+
+flac_uint8$(EXEEXT): $(flac_uint8_OBJECTS) $(flac_uint8_DEPENDENCIES) $(EXTRA_flac_uint8_DEPENDENCIES) 
+	@rm -f flac_uint8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flac_uint8_OBJECTS) $(flac_uint8_LDADD) $(LIBS)
+
 flist$(EXEEXT): $(flist_OBJECTS) $(flist_DEPENDENCIES) $(EXTRA_flist_DEPENDENCIES) 
 	@rm -f flist$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flist_OBJECTS) $(flist_LDADD) $(LIBS)
@@ -8819,10 +12006,6 @@ flush_all$(EXEEXT): $(flush_all_OBJECTS) $(flush_all_DEPENDENCIES) $(EXTRA_flush
 	@rm -f flush_all$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flush_all_OBJECTS) $(flush_all_LDADD) $(LIBS)
 
-flush_amb_code$(EXEEXT): $(flush_amb_code_OBJECTS) $(flush_amb_code_DEPENDENCIES) $(EXTRA_flush_amb_code_DEPENDENCIES) 
-	@rm -f flush_amb_code$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(flush_amb_code_OBJECTS) $(flush_amb_code_LDADD) $(LIBS)
-
 flush_bad_code$(EXEEXT): $(flush_bad_code_OBJECTS) $(flush_bad_code_DEPENDENCIES) $(EXTRA_flush_bad_code_DEPENDENCIES) 
 	@rm -f flush_bad_code$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flush_bad_code_OBJECTS) $(flush_bad_code_LDADD) $(LIBS)
@@ -8831,10 +12014,6 @@ flush_flush$(EXEEXT): $(flush_flush_OBJECTS) $(flush_flush_DEPENDENCIES) $(EXTRA
 	@rm -f flush_flush$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flush_flush_OBJECTS) $(flush_flush_LDADD) $(LIBS)
 
-flush_hex$(EXEEXT): $(flush_hex_OBJECTS) $(flush_hex_DEPENDENCIES) $(EXTRA_flush_hex_DEPENDENCIES) 
-	@rm -f flush_hex$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(flush_hex_OBJECTS) $(flush_hex_LDADD) $(LIBS)
-
 flush_invalid$(EXEEXT): $(flush_invalid_OBJECTS) $(flush_invalid_DEPENDENCIES) $(EXTRA_flush_invalid_DEPENDENCIES) 
 	@rm -f flush_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flush_invalid_OBJECTS) $(flush_invalid_LDADD) $(LIBS)
@@ -8847,10 +12026,6 @@ flush_lincom1$(EXEEXT): $(flush_lincom1_OBJECTS) $(flush_lincom1_DEPENDENCIES) $
 	@rm -f flush_lincom1$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flush_lincom1_OBJECTS) $(flush_lincom1_LDADD) $(LIBS)
 
-flush_meta$(EXEEXT): $(flush_meta_OBJECTS) $(flush_meta_DEPENDENCIES) $(EXTRA_flush_meta_DEPENDENCIES) 
-	@rm -f flush_meta$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(flush_meta_OBJECTS) $(flush_meta_LDADD) $(LIBS)
-
 flush_mult$(EXEEXT): $(flush_mult_OBJECTS) $(flush_mult_DEPENDENCIES) $(EXTRA_flush_mult_DEPENDENCIES) 
 	@rm -f flush_mult$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flush_mult_OBJECTS) $(flush_mult_LDADD) $(LIBS)
@@ -8859,17 +12034,9 @@ flush_raw_close$(EXEEXT): $(flush_raw_close_OBJECTS) $(flush_raw_close_DEPENDENC
 	@rm -f flush_raw_close$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(flush_raw_close_OBJECTS) $(flush_raw_close_LDADD) $(LIBS)
 
-flush_ref$(EXEEXT): $(flush_ref_OBJECTS) $(flush_ref_DEPENDENCIES) $(EXTRA_flush_ref_DEPENDENCIES) 
-	@rm -f flush_ref$(EXEEXT)
-	$(AM_V_CCLD)$(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)
-	$(AM_V_CCLD)$(LINK) $(flush_spec_OBJECTS) $(flush_spec_LDADD) $(LIBS)
-
-flush_string$(EXEEXT): $(flush_string_OBJECTS) $(flush_string_DEPENDENCIES) $(EXTRA_flush_string_DEPENDENCIES) 
-	@rm -f flush_string$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(flush_string_OBJECTS) $(flush_string_LDADD) $(LIBS)
+flush_recurse$(EXEEXT): $(flush_recurse_OBJECTS) $(flush_recurse_DEPENDENCIES) $(EXTRA_flush_recurse_DEPENDENCIES) 
+	@rm -f flush_recurse$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(flush_recurse_OBJECTS) $(flush_recurse_LDADD) $(LIBS)
 
 flush_sync$(EXEEXT): $(flush_sync_OBJECTS) $(flush_sync_DEPENDENCIES) $(EXTRA_flush_sync_DEPENDENCIES) 
 	@rm -f flush_sync$(EXEEXT)
@@ -8883,10 +12050,34 @@ foffs_alter_all$(EXEEXT): $(foffs_alter_all_OBJECTS) $(foffs_alter_all_DEPENDENC
 	@rm -f foffs_alter_all$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(foffs_alter_all_OBJECTS) $(foffs_alter_all_LDADD) $(LIBS)
 
+foffs_alter_dprot$(EXEEXT): $(foffs_alter_dprot_OBJECTS) $(foffs_alter_dprot_DEPENDENCIES) $(EXTRA_foffs_alter_dprot_DEPENDENCIES) 
+	@rm -f foffs_alter_dprot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(foffs_alter_dprot_OBJECTS) $(foffs_alter_dprot_LDADD) $(LIBS)
+
+foffs_alter_fprot$(EXEEXT): $(foffs_alter_fprot_OBJECTS) $(foffs_alter_fprot_DEPENDENCIES) $(EXTRA_foffs_alter_fprot_DEPENDENCIES) 
+	@rm -f foffs_alter_fprot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(foffs_alter_fprot_OBJECTS) $(foffs_alter_fprot_LDADD) $(LIBS)
+
+foffs_alter_index$(EXEEXT): $(foffs_alter_index_OBJECTS) $(foffs_alter_index_DEPENDENCIES) $(EXTRA_foffs_alter_index_DEPENDENCIES) 
+	@rm -f foffs_alter_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(foffs_alter_index_OBJECTS) $(foffs_alter_index_LDADD) $(LIBS)
+
+foffs_alter_range$(EXEEXT): $(foffs_alter_range_OBJECTS) $(foffs_alter_range_DEPENDENCIES) $(EXTRA_foffs_alter_range_DEPENDENCIES) 
+	@rm -f foffs_alter_range$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(foffs_alter_range_OBJECTS) $(foffs_alter_range_LDADD) $(LIBS)
+
+foffs_alter_rdonly$(EXEEXT): $(foffs_alter_rdonly_OBJECTS) $(foffs_alter_rdonly_DEPENDENCIES) $(EXTRA_foffs_alter_rdonly_DEPENDENCIES) 
+	@rm -f foffs_alter_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(foffs_alter_rdonly_OBJECTS) $(foffs_alter_rdonly_LDADD) $(LIBS)
+
 foffs_get$(EXEEXT): $(foffs_get_OBJECTS) $(foffs_get_DEPENDENCIES) $(EXTRA_foffs_get_DEPENDENCIES) 
 	@rm -f foffs_get$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(foffs_get_OBJECTS) $(foffs_get_LDADD) $(LIBS)
 
+foffs_index$(EXEEXT): $(foffs_index_OBJECTS) $(foffs_index_DEPENDENCIES) $(EXTRA_foffs_index_DEPENDENCIES) 
+	@rm -f foffs_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(foffs_index_OBJECTS) $(foffs_index_LDADD) $(LIBS)
+
 foffs_move$(EXEEXT): $(foffs_move_OBJECTS) $(foffs_move_DEPENDENCIES) $(EXTRA_foffs_move_DEPENDENCIES) 
 	@rm -f foffs_move$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(foffs_move_OBJECTS) $(foffs_move_LDADD) $(LIBS)
@@ -8907,14 +12098,42 @@ fragment_affix_alter_code$(EXEEXT): $(fragment_affix_alter_code_OBJECTS) $(fragm
 	@rm -f fragment_affix_alter_code$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(fragment_affix_alter_code_OBJECTS) $(fragment_affix_alter_code_LDADD) $(LIBS)
 
+fragment_affix_alter_dotpx$(EXEEXT): $(fragment_affix_alter_dotpx_OBJECTS) $(fragment_affix_alter_dotpx_DEPENDENCIES) $(EXTRA_fragment_affix_alter_dotpx_DEPENDENCIES) 
+	@rm -f fragment_affix_alter_dotpx$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_affix_alter_dotpx_OBJECTS) $(fragment_affix_alter_dotpx_LDADD) $(LIBS)
+
+fragment_affix_alter_index$(EXEEXT): $(fragment_affix_alter_index_OBJECTS) $(fragment_affix_alter_index_DEPENDENCIES) $(EXTRA_fragment_affix_alter_index_DEPENDENCIES) 
+	@rm -f fragment_affix_alter_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_affix_alter_index_OBJECTS) $(fragment_affix_alter_index_LDADD) $(LIBS)
+
+fragment_affix_alter_nons$(EXEEXT): $(fragment_affix_alter_nons_OBJECTS) $(fragment_affix_alter_nons_DEPENDENCIES) $(EXTRA_fragment_affix_alter_nons_DEPENDENCIES) 
+	@rm -f fragment_affix_alter_nons$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_affix_alter_nons_OBJECTS) $(fragment_affix_alter_nons_LDADD) $(LIBS)
+
 fragment_affix_alter_nop$(EXEEXT): $(fragment_affix_alter_nop_OBJECTS) $(fragment_affix_alter_nop_DEPENDENCIES) $(EXTRA_fragment_affix_alter_nop_DEPENDENCIES) 
 	@rm -f fragment_affix_alter_nop$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(fragment_affix_alter_nop_OBJECTS) $(fragment_affix_alter_nop_LDADD) $(LIBS)
 
+fragment_affix_alter_ns$(EXEEXT): $(fragment_affix_alter_ns_OBJECTS) $(fragment_affix_alter_ns_DEPENDENCIES) $(EXTRA_fragment_affix_alter_ns_DEPENDENCIES) 
+	@rm -f fragment_affix_alter_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_affix_alter_ns_OBJECTS) $(fragment_affix_alter_ns_LDADD) $(LIBS)
+
+fragment_affix_alter_pns$(EXEEXT): $(fragment_affix_alter_pns_OBJECTS) $(fragment_affix_alter_pns_DEPENDENCIES) $(EXTRA_fragment_affix_alter_pns_DEPENDENCIES) 
+	@rm -f fragment_affix_alter_pns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_affix_alter_pns_OBJECTS) $(fragment_affix_alter_pns_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)
 	$(AM_V_CCLD)$(LINK) $(fragment_affix_dup_OBJECTS) $(fragment_affix_dup_LDADD) $(LIBS)
 
+fragment_affix_index$(EXEEXT): $(fragment_affix_index_OBJECTS) $(fragment_affix_index_DEPENDENCIES) $(EXTRA_fragment_affix_index_DEPENDENCIES) 
+	@rm -f fragment_affix_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_affix_index_OBJECTS) $(fragment_affix_index_LDADD) $(LIBS)
+
+fragment_affix_ns$(EXEEXT): $(fragment_affix_ns_OBJECTS) $(fragment_affix_ns_DEPENDENCIES) $(EXTRA_fragment_affix_ns_DEPENDENCIES) 
+	@rm -f fragment_affix_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_affix_ns_OBJECTS) $(fragment_affix_ns_LDADD) $(LIBS)
+
 fragment_index$(EXEEXT): $(fragment_index_OBJECTS) $(fragment_index_DEPENDENCIES) $(EXTRA_fragment_index_DEPENDENCIES) 
 	@rm -f fragment_index$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(fragment_index_OBJECTS) $(fragment_index_LDADD) $(LIBS)
@@ -8931,6 +12150,62 @@ fragment_name_oor$(EXEEXT): $(fragment_name_oor_OBJECTS) $(fragment_name_oor_DEP
 	@rm -f fragment_name_oor$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(fragment_name_oor_OBJECTS) $(fragment_name_oor_LDADD) $(LIBS)
 
+fragment_ndotdots$(EXEEXT): $(fragment_ndotdots_OBJECTS) $(fragment_ndotdots_DEPENDENCIES) $(EXTRA_fragment_ndotdots_DEPENDENCIES) 
+	@rm -f fragment_ndotdots$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ndotdots_OBJECTS) $(fragment_ndotdots_LDADD) $(LIBS)
+
+fragment_ndots$(EXEEXT): $(fragment_ndots_OBJECTS) $(fragment_ndots_DEPENDENCIES) $(EXTRA_fragment_ndots_DEPENDENCIES) 
+	@rm -f fragment_ndots$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ndots_OBJECTS) $(fragment_ndots_LDADD) $(LIBS)
+
+fragment_ns$(EXEEXT): $(fragment_ns_OBJECTS) $(fragment_ns_DEPENDENCIES) $(EXTRA_fragment_ns_DEPENDENCIES) 
+	@rm -f fragment_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_OBJECTS) $(fragment_ns_LDADD) $(LIBS)
+
+fragment_ns0$(EXEEXT): $(fragment_ns0_OBJECTS) $(fragment_ns0_DEPENDENCIES) $(EXTRA_fragment_ns0_DEPENDENCIES) 
+	@rm -f fragment_ns0$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns0_OBJECTS) $(fragment_ns0_LDADD) $(LIBS)
+
+fragment_ns_add$(EXEEXT): $(fragment_ns_add_OBJECTS) $(fragment_ns_add_DEPENDENCIES) $(EXTRA_fragment_ns_add_DEPENDENCIES) 
+	@rm -f fragment_ns_add$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_add_OBJECTS) $(fragment_ns_add_LDADD) $(LIBS)
+
+fragment_ns_add0$(EXEEXT): $(fragment_ns_add0_OBJECTS) $(fragment_ns_add0_DEPENDENCIES) $(EXTRA_fragment_ns_add0_DEPENDENCIES) 
+	@rm -f fragment_ns_add0$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_add0_OBJECTS) $(fragment_ns_add0_LDADD) $(LIBS)
+
+fragment_ns_alter$(EXEEXT): $(fragment_ns_alter_OBJECTS) $(fragment_ns_alter_DEPENDENCIES) $(EXTRA_fragment_ns_alter_DEPENDENCIES) 
+	@rm -f fragment_ns_alter$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_alter_OBJECTS) $(fragment_ns_alter_LDADD) $(LIBS)
+
+fragment_ns_alter_nop$(EXEEXT): $(fragment_ns_alter_nop_OBJECTS) $(fragment_ns_alter_nop_DEPENDENCIES) $(EXTRA_fragment_ns_alter_nop_DEPENDENCIES) 
+	@rm -f fragment_ns_alter_nop$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_alter_nop_OBJECTS) $(fragment_ns_alter_nop_LDADD) $(LIBS)
+
+fragment_ns_alter_pdel$(EXEEXT): $(fragment_ns_alter_pdel_OBJECTS) $(fragment_ns_alter_pdel_DEPENDENCIES) $(EXTRA_fragment_ns_alter_pdel_DEPENDENCIES) 
+	@rm -f fragment_ns_alter_pdel$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_alter_pdel_OBJECTS) $(fragment_ns_alter_pdel_LDADD) $(LIBS)
+
+fragment_ns_del$(EXEEXT): $(fragment_ns_del_OBJECTS) $(fragment_ns_del_DEPENDENCIES) $(EXTRA_fragment_ns_del_DEPENDENCIES) 
+	@rm -f fragment_ns_del$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_del_OBJECTS) $(fragment_ns_del_LDADD) $(LIBS)
+
+fragment_ns_dot$(EXEEXT): $(fragment_ns_dot_OBJECTS) $(fragment_ns_dot_DEPENDENCIES) $(EXTRA_fragment_ns_dot_DEPENDENCIES) 
+	@rm -f fragment_ns_dot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_dot_OBJECTS) $(fragment_ns_dot_LDADD) $(LIBS)
+
+fragment_ns_dotdot$(EXEEXT): $(fragment_ns_dotdot_OBJECTS) $(fragment_ns_dotdot_DEPENDENCIES) $(EXTRA_fragment_ns_dotdot_DEPENDENCIES) 
+	@rm -f fragment_ns_dotdot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_dotdot_OBJECTS) $(fragment_ns_dotdot_LDADD) $(LIBS)
+
+fragment_ns_dotns$(EXEEXT): $(fragment_ns_dotns_OBJECTS) $(fragment_ns_dotns_DEPENDENCIES) $(EXTRA_fragment_ns_dotns_DEPENDENCIES) 
+	@rm -f fragment_ns_dotns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_dotns_OBJECTS) $(fragment_ns_dotns_LDADD) $(LIBS)
+
+fragment_ns_nsdot$(EXEEXT): $(fragment_ns_nsdot_OBJECTS) $(fragment_ns_nsdot_DEPENDENCIES) $(EXTRA_fragment_ns_nsdot_DEPENDENCIES) 
+	@rm -f fragment_ns_nsdot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_ns_nsdot_OBJECTS) $(fragment_ns_nsdot_LDADD) $(LIBS)
+
 fragment_num$(EXEEXT): $(fragment_num_OBJECTS) $(fragment_num_DEPENDENCIES) $(EXTRA_fragment_num_DEPENDENCIES) 
 	@rm -f fragment_num$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(fragment_num_OBJECTS) $(fragment_num_LDADD) $(LIBS)
@@ -8939,6 +12214,14 @@ fragment_parent$(EXEEXT): $(fragment_parent_OBJECTS) $(fragment_parent_DEPENDENC
 	@rm -f fragment_parent$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(fragment_parent_OBJECTS) $(fragment_parent_LDADD) $(LIBS)
 
+fragment_parent_index$(EXEEXT): $(fragment_parent_index_OBJECTS) $(fragment_parent_index_DEPENDENCIES) $(EXTRA_fragment_parent_index_DEPENDENCIES) 
+	@rm -f fragment_parent_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_parent_index_OBJECTS) $(fragment_parent_index_LDADD) $(LIBS)
+
+fragment_parent_root$(EXEEXT): $(fragment_parent_root_OBJECTS) $(fragment_parent_root_DEPENDENCIES) $(EXTRA_fragment_parent_root_DEPENDENCIES) 
+	@rm -f fragment_parent_root$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(fragment_parent_root_OBJECTS) $(fragment_parent_root_LDADD) $(LIBS)
+
 get64$(EXEEXT): $(get64_OBJECTS) $(get64_DEPENDENCIES) $(EXTRA_get64_DEPENDENCIES) 
 	@rm -f get64$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get64_OBJECTS) $(get64_LDADD) $(LIBS)
@@ -8959,18 +12242,30 @@ get_carray$(EXEEXT): $(get_carray_OBJECTS) $(get_carray_DEPENDENCIES) $(EXTRA_ge
 	@rm -f get_carray$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_carray_OBJECTS) $(get_carray_LDADD) $(LIBS)
 
+get_carray_bad$(EXEEXT): $(get_carray_bad_OBJECTS) $(get_carray_bad_DEPENDENCIES) $(EXTRA_get_carray_bad_DEPENDENCIES) 
+	@rm -f get_carray_bad$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_carray_bad_OBJECTS) $(get_carray_bad_LDADD) $(LIBS)
+
 get_carray_c2r$(EXEEXT): $(get_carray_c2r_OBJECTS) $(get_carray_c2r_DEPENDENCIES) $(EXTRA_get_carray_c2r_DEPENDENCIES) 
 	@rm -f get_carray_c2r$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_carray_c2r_OBJECTS) $(get_carray_c2r_LDADD) $(LIBS)
 
-get_carray_len$(EXEEXT): $(get_carray_len_OBJECTS) $(get_carray_len_DEPENDENCIES) $(EXTRA_get_carray_len_DEPENDENCIES) 
-	@rm -f get_carray_len$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(get_carray_len_OBJECTS) $(get_carray_len_LDADD) $(LIBS)
-
 get_carray_slice$(EXEEXT): $(get_carray_slice_OBJECTS) $(get_carray_slice_DEPENDENCIES) $(EXTRA_get_carray_slice_DEPENDENCIES) 
 	@rm -f get_carray_slice$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_carray_slice_OBJECTS) $(get_carray_slice_LDADD) $(LIBS)
 
+get_carray_slice_bounds$(EXEEXT): $(get_carray_slice_bounds_OBJECTS) $(get_carray_slice_bounds_DEPENDENCIES) $(EXTRA_get_carray_slice_bounds_DEPENDENCIES) 
+	@rm -f get_carray_slice_bounds$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_carray_slice_bounds_OBJECTS) $(get_carray_slice_bounds_LDADD) $(LIBS)
+
+get_carray_slice_type$(EXEEXT): $(get_carray_slice_type_OBJECTS) $(get_carray_slice_type_DEPENDENCIES) $(EXTRA_get_carray_slice_type_DEPENDENCIES) 
+	@rm -f get_carray_slice_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_carray_slice_type_OBJECTS) $(get_carray_slice_type_LDADD) $(LIBS)
+
+get_carray_type$(EXEEXT): $(get_carray_type_OBJECTS) $(get_carray_type_DEPENDENCIES) $(EXTRA_get_carray_type_DEPENDENCIES) 
+	@rm -f get_carray_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_carray_type_OBJECTS) $(get_carray_type_LDADD) $(LIBS)
+
 get_char$(EXEEXT): $(get_char_OBJECTS) $(get_char_DEPENDENCIES) $(EXTRA_get_char_DEPENDENCIES) 
 	@rm -f get_char$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_char_OBJECTS) $(get_char_LDADD) $(LIBS)
@@ -8991,6 +12286,10 @@ get_const$(EXEEXT): $(get_const_OBJECTS) $(get_const_DEPENDENCIES) $(EXTRA_get_c
 	@rm -f get_const$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_const_OBJECTS) $(get_const_LDADD) $(LIBS)
 
+get_const_bad$(EXEEXT): $(get_const_bad_OBJECTS) $(get_const_bad_DEPENDENCIES) $(EXTRA_get_const_bad_DEPENDENCIES) 
+	@rm -f get_const_bad$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_const_bad_OBJECTS) $(get_const_bad_LDADD) $(LIBS)
+
 get_const_carray$(EXEEXT): $(get_const_carray_OBJECTS) $(get_const_carray_DEPENDENCIES) $(EXTRA_get_const_carray_DEPENDENCIES) 
 	@rm -f get_const_carray$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_const_carray_OBJECTS) $(get_const_carray_LDADD) $(LIBS)
@@ -9003,6 +12302,10 @@ get_const_repr$(EXEEXT): $(get_const_repr_OBJECTS) $(get_const_repr_DEPENDENCIES
 	@rm -f get_const_repr$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_const_repr_OBJECTS) $(get_const_repr_LDADD) $(LIBS)
 
+get_const_reprz$(EXEEXT): $(get_const_reprz_OBJECTS) $(get_const_reprz_DEPENDENCIES) $(EXTRA_get_const_reprz_DEPENDENCIES) 
+	@rm -f get_const_reprz$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_const_reprz_OBJECTS) $(get_const_reprz_LDADD) $(LIBS)
+
 get_cpolynom$(EXEEXT): $(get_cpolynom_OBJECTS) $(get_cpolynom_DEPENDENCIES) $(EXTRA_get_cpolynom_DEPENDENCIES) 
 	@rm -f get_cpolynom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_cpolynom_OBJECTS) $(get_cpolynom_LDADD) $(LIBS)
@@ -9019,6 +12322,10 @@ get_dim$(EXEEXT): $(get_dim_OBJECTS) $(get_dim_DEPENDENCIES) $(EXTRA_get_dim_DEP
 	@rm -f get_dim$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_dim_OBJECTS) $(get_dim_LDADD) $(LIBS)
 
+get_dimin$(EXEEXT): $(get_dimin_OBJECTS) $(get_dimin_DEPENDENCIES) $(EXTRA_get_dimin_DEPENDENCIES) 
+	@rm -f get_dimin$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_dimin_OBJECTS) $(get_dimin_LDADD) $(LIBS)
+
 get_divide$(EXEEXT): $(get_divide_OBJECTS) $(get_divide_DEPENDENCIES) $(EXTRA_get_divide_DEPENDENCIES) 
 	@rm -f get_divide$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_divide_OBJECTS) $(get_divide_LDADD) $(LIBS)
@@ -9027,6 +12334,10 @@ get_divide_ccin$(EXEEXT): $(get_divide_ccin_OBJECTS) $(get_divide_ccin_DEPENDENC
 	@rm -f get_divide_ccin$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_divide_ccin_OBJECTS) $(get_divide_ccin_LDADD) $(LIBS)
 
+get_divide_code$(EXEEXT): $(get_divide_code_OBJECTS) $(get_divide_code_DEPENDENCIES) $(EXTRA_get_divide_code_DEPENDENCIES) 
+	@rm -f get_divide_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_divide_code_OBJECTS) $(get_divide_code_LDADD) $(LIBS)
+
 get_divide_crin$(EXEEXT): $(get_divide_crin_OBJECTS) $(get_divide_crin_DEPENDENCIES) $(EXTRA_get_divide_crin_DEPENDENCIES) 
 	@rm -f get_divide_crin$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_divide_crin_OBJECTS) $(get_divide_crin_LDADD) $(LIBS)
@@ -9043,6 +12354,10 @@ get_divide_s$(EXEEXT): $(get_divide_s_OBJECTS) $(get_divide_s_DEPENDENCIES) $(EX
 	@rm -f get_divide_s$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_divide_s_OBJECTS) $(get_divide_s_LDADD) $(LIBS)
 
+get_dot$(EXEEXT): $(get_dot_OBJECTS) $(get_dot_DEPENDENCIES) $(EXTRA_get_dot_DEPENDENCIES) 
+	@rm -f get_dot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_dot_OBJECTS) $(get_dot_LDADD) $(LIBS)
+
 get_endian16$(EXEEXT): $(get_endian16_OBJECTS) $(get_endian16_DEPENDENCIES) $(EXTRA_get_endian16_DEPENDENCIES) 
 	@rm -f get_endian16$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_endian16_OBJECTS) $(get_endian16_LDADD) $(LIBS)
@@ -9147,6 +12462,18 @@ get_index_complex$(EXEEXT): $(get_index_complex_OBJECTS) $(get_index_complex_DEP
 	@rm -f get_index_complex$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_index_complex_OBJECTS) $(get_index_complex_LDADD) $(LIBS)
 
+get_index_type$(EXEEXT): $(get_index_type_OBJECTS) $(get_index_type_DEPENDENCIES) $(EXTRA_get_index_type_DEPENDENCIES) 
+	@rm -f get_index_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_index_type_OBJECTS) $(get_index_type_LDADD) $(LIBS)
+
+get_indir$(EXEEXT): $(get_indir_OBJECTS) $(get_indir_DEPENDENCIES) $(EXTRA_get_indir_DEPENDENCIES) 
+	@rm -f get_indir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_indir_OBJECTS) $(get_indir_LDADD) $(LIBS)
+
+get_indir_typein$(EXEEXT): $(get_indir_typein_OBJECTS) $(get_indir_typein_DEPENDENCIES) $(EXTRA_get_indir_typein_DEPENDENCIES) 
+	@rm -f get_indir_typein$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_indir_typein_OBJECTS) $(get_indir_typein_LDADD) $(LIBS)
+
 get_int16$(EXEEXT): $(get_int16_OBJECTS) $(get_int16_DEPENDENCIES) $(EXTRA_get_int16_DEPENDENCIES) 
 	@rm -f get_int16$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_int16_OBJECTS) $(get_int16_LDADD) $(LIBS)
@@ -9187,6 +12514,10 @@ get_lincom3s$(EXEEXT): $(get_lincom3s_OBJECTS) $(get_lincom3s_DEPENDENCIES) $(EX
 	@rm -f get_lincom3s$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_lincom3s_OBJECTS) $(get_lincom3s_LDADD) $(LIBS)
 
+get_lincom_code$(EXEEXT): $(get_lincom_code_OBJECTS) $(get_lincom_code_DEPENDENCIES) $(EXTRA_get_lincom_code_DEPENDENCIES) 
+	@rm -f get_lincom_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_lincom_code_OBJECTS) $(get_lincom_code_LDADD) $(LIBS)
+
 get_lincom_mdt$(EXEEXT): $(get_lincom_mdt_OBJECTS) $(get_lincom_mdt_DEPENDENCIES) $(EXTRA_get_lincom_mdt_DEPENDENCIES) 
 	@rm -f get_lincom_mdt$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_lincom_mdt_OBJECTS) $(get_lincom_mdt_LDADD) $(LIBS)
@@ -9283,6 +12614,10 @@ get_multiply_ccin$(EXEEXT): $(get_multiply_ccin_OBJECTS) $(get_multiply_ccin_DEP
 	@rm -f get_multiply_ccin$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_multiply_ccin_OBJECTS) $(get_multiply_ccin_LDADD) $(LIBS)
 
+get_multiply_code$(EXEEXT): $(get_multiply_code_OBJECTS) $(get_multiply_code_DEPENDENCIES) $(EXTRA_get_multiply_code_DEPENDENCIES) 
+	@rm -f get_multiply_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_multiply_code_OBJECTS) $(get_multiply_code_LDADD) $(LIBS)
+
 get_multiply_crin$(EXEEXT): $(get_multiply_crin_OBJECTS) $(get_multiply_crin_DEPENDENCIES) $(EXTRA_get_multiply_crin_DEPENDENCIES) 
 	@rm -f get_multiply_crin$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_multiply_crin_OBJECTS) $(get_multiply_crin_LDADD) $(LIBS)
@@ -9351,6 +12686,10 @@ get_recip$(EXEEXT): $(get_recip_OBJECTS) $(get_recip_DEPENDENCIES) $(EXTRA_get_r
 	@rm -f get_recip$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_recip_OBJECTS) $(get_recip_LDADD) $(LIBS)
 
+get_recip_cmpin$(EXEEXT): $(get_recip_cmpin_OBJECTS) $(get_recip_cmpin_DEPENDENCIES) $(EXTRA_get_recip_cmpin_DEPENDENCIES) 
+	@rm -f get_recip_cmpin$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_recip_cmpin_OBJECTS) $(get_recip_cmpin_LDADD) $(LIBS)
+
 get_recip_const$(EXEEXT): $(get_recip_const_OBJECTS) $(get_recip_const_DEPENDENCIES) $(EXTRA_get_recip_const_DEPENDENCIES) 
 	@rm -f get_recip_const$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_recip_const_OBJECTS) $(get_recip_const_LDADD) $(LIBS)
@@ -9359,10 +12698,38 @@ get_recurse$(EXEEXT): $(get_recurse_OBJECTS) $(get_recurse_DEPENDENCIES) $(EXTRA
 	@rm -f get_recurse$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_recurse_OBJECTS) $(get_recurse_LDADD) $(LIBS)
 
+get_reprz$(EXEEXT): $(get_reprz_OBJECTS) $(get_reprz_DEPENDENCIES) $(EXTRA_get_reprz_DEPENDENCIES) 
+	@rm -f get_reprz$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_reprz_OBJECTS) $(get_reprz_LDADD) $(LIBS)
+
 get_rofs$(EXEEXT): $(get_rofs_OBJECTS) $(get_rofs_DEPENDENCIES) $(EXTRA_get_rofs_DEPENDENCIES) 
 	@rm -f get_rofs$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_rofs_OBJECTS) $(get_rofs_LDADD) $(LIBS)
 
+get_sarray$(EXEEXT): $(get_sarray_OBJECTS) $(get_sarray_DEPENDENCIES) $(EXTRA_get_sarray_DEPENDENCIES) 
+	@rm -f get_sarray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sarray_OBJECTS) $(get_sarray_LDADD) $(LIBS)
+
+get_sarray_bad$(EXEEXT): $(get_sarray_bad_OBJECTS) $(get_sarray_bad_DEPENDENCIES) $(EXTRA_get_sarray_bad_DEPENDENCIES) 
+	@rm -f get_sarray_bad$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sarray_bad_OBJECTS) $(get_sarray_bad_LDADD) $(LIBS)
+
+get_sarray_slice$(EXEEXT): $(get_sarray_slice_OBJECTS) $(get_sarray_slice_DEPENDENCIES) $(EXTRA_get_sarray_slice_DEPENDENCIES) 
+	@rm -f get_sarray_slice$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sarray_slice_OBJECTS) $(get_sarray_slice_LDADD) $(LIBS)
+
+get_sarray_slice_bounds$(EXEEXT): $(get_sarray_slice_bounds_OBJECTS) $(get_sarray_slice_bounds_DEPENDENCIES) $(EXTRA_get_sarray_slice_bounds_DEPENDENCIES) 
+	@rm -f get_sarray_slice_bounds$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sarray_slice_bounds_OBJECTS) $(get_sarray_slice_bounds_LDADD) $(LIBS)
+
+get_sarray_slice_type$(EXEEXT): $(get_sarray_slice_type_OBJECTS) $(get_sarray_slice_type_DEPENDENCIES) $(EXTRA_get_sarray_slice_type_DEPENDENCIES) 
+	@rm -f get_sarray_slice_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sarray_slice_type_OBJECTS) $(get_sarray_slice_type_LDADD) $(LIBS)
+
+get_sarray_type$(EXEEXT): $(get_sarray_type_OBJECTS) $(get_sarray_type_DEPENDENCIES) $(EXTRA_get_sarray_type_DEPENDENCIES) 
+	@rm -f get_sarray_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sarray_type_OBJECTS) $(get_sarray_type_LDADD) $(LIBS)
+
 get_sbit$(EXEEXT): $(get_sbit_OBJECTS) $(get_sbit_DEPENDENCIES) $(EXTRA_get_sbit_DEPENDENCIES) 
 	@rm -f get_sbit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_sbit_OBJECTS) $(get_sbit_LDADD) $(LIBS)
@@ -9371,6 +12738,38 @@ get_sf$(EXEEXT): $(get_sf_OBJECTS) $(get_sf_DEPENDENCIES) $(EXTRA_get_sf_DEPENDE
 	@rm -f get_sf$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_sf_OBJECTS) $(get_sf_LDADD) $(LIBS)
 
+get_sindir$(EXEEXT): $(get_sindir_OBJECTS) $(get_sindir_DEPENDENCIES) $(EXTRA_get_sindir_DEPENDENCIES) 
+	@rm -f get_sindir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sindir_OBJECTS) $(get_sindir_LDADD) $(LIBS)
+
+get_sindir_code$(EXEEXT): $(get_sindir_code_OBJECTS) $(get_sindir_code_DEPENDENCIES) $(EXTRA_get_sindir_code_DEPENDENCIES) 
+	@rm -f get_sindir_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sindir_code_OBJECTS) $(get_sindir_code_LDADD) $(LIBS)
+
+get_sindir_neg$(EXEEXT): $(get_sindir_neg_OBJECTS) $(get_sindir_neg_DEPENDENCIES) $(EXTRA_get_sindir_neg_DEPENDENCIES) 
+	@rm -f get_sindir_neg$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sindir_neg_OBJECTS) $(get_sindir_neg_LDADD) $(LIBS)
+
+get_sindir_none$(EXEEXT): $(get_sindir_none_OBJECTS) $(get_sindir_none_DEPENDENCIES) $(EXTRA_get_sindir_none_DEPENDENCIES) 
+	@rm -f get_sindir_none$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sindir_none_OBJECTS) $(get_sindir_none_LDADD) $(LIBS)
+
+get_sindir_null$(EXEEXT): $(get_sindir_null_OBJECTS) $(get_sindir_null_DEPENDENCIES) $(EXTRA_get_sindir_null_DEPENDENCIES) 
+	@rm -f get_sindir_null$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sindir_null_OBJECTS) $(get_sindir_null_LDADD) $(LIBS)
+
+get_sindir_reprz$(EXEEXT): $(get_sindir_reprz_OBJECTS) $(get_sindir_reprz_DEPENDENCIES) $(EXTRA_get_sindir_reprz_DEPENDENCIES) 
+	@rm -f get_sindir_reprz$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sindir_reprz_OBJECTS) $(get_sindir_reprz_LDADD) $(LIBS)
+
+get_sindir_type$(EXEEXT): $(get_sindir_type_OBJECTS) $(get_sindir_type_DEPENDENCIES) $(EXTRA_get_sindir_type_DEPENDENCIES) 
+	@rm -f get_sindir_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sindir_type_OBJECTS) $(get_sindir_type_LDADD) $(LIBS)
+
+get_sindir_typein$(EXEEXT): $(get_sindir_typein_OBJECTS) $(get_sindir_typein_DEPENDENCIES) $(EXTRA_get_sindir_typein_DEPENDENCIES) 
+	@rm -f get_sindir_typein$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(get_sindir_typein_OBJECTS) $(get_sindir_typein_LDADD) $(LIBS)
+
 get_ss$(EXEEXT): $(get_ss_OBJECTS) $(get_ss_DEPENDENCIES) $(EXTRA_get_ss_DEPENDENCIES) 
 	@rm -f get_ss$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(get_ss_OBJECTS) $(get_ss_LDADD) $(LIBS)
@@ -9455,30 +12854,42 @@ global_name$(EXEEXT): $(global_name_OBJECTS) $(global_name_DEPENDENCIES) $(EXTRA
 	@rm -f global_name$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(global_name_OBJECTS) $(global_name_LDADD) $(LIBS)
 
-global_ref$(EXEEXT): $(global_ref_OBJECTS) $(global_ref_DEPENDENCIES) $(EXTRA_global_ref_DEPENDENCIES) 
-	@rm -f global_ref$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(global_ref_OBJECTS) $(global_ref_LDADD) $(LIBS)
-
-global_ref_empty$(EXEEXT): $(global_ref_empty_OBJECTS) $(global_ref_empty_DEPENDENCIES) $(EXTRA_global_ref_empty_DEPENDENCIES) 
-	@rm -f global_ref_empty$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(global_ref_empty_OBJECTS) $(global_ref_empty_LDADD) $(LIBS)
-
-global_ref_set$(EXEEXT): $(global_ref_set_OBJECTS) $(global_ref_set_DEPENDENCIES) $(EXTRA_global_ref_set_DEPENDENCIES) 
-	@rm -f global_ref_set$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(global_ref_set_OBJECTS) $(global_ref_set_LDADD) $(LIBS)
-
 gzip_add$(EXEEXT): $(gzip_add_OBJECTS) $(gzip_add_DEPENDENCIES) $(EXTRA_gzip_add_DEPENDENCIES) 
 	@rm -f gzip_add$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(gzip_add_OBJECTS) $(gzip_add_LDADD) $(LIBS)
 
+gzip_complex128$(EXEEXT): $(gzip_complex128_OBJECTS) $(gzip_complex128_DEPENDENCIES) $(EXTRA_gzip_complex128_DEPENDENCIES) 
+	@rm -f gzip_complex128$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_complex128_OBJECTS) $(gzip_complex128_LDADD) $(LIBS)
+
+gzip_complex64$(EXEEXT): $(gzip_complex64_OBJECTS) $(gzip_complex64_DEPENDENCIES) $(EXTRA_gzip_complex64_DEPENDENCIES) 
+	@rm -f gzip_complex64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_complex64_OBJECTS) $(gzip_complex64_LDADD) $(LIBS)
+
 gzip_del$(EXEEXT): $(gzip_del_OBJECTS) $(gzip_del_DEPENDENCIES) $(EXTRA_gzip_del_DEPENDENCIES) 
 	@rm -f gzip_del$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(gzip_del_OBJECTS) $(gzip_del_LDADD) $(LIBS)
 
+gzip_enoent$(EXEEXT): $(gzip_enoent_OBJECTS) $(gzip_enoent_DEPENDENCIES) $(EXTRA_gzip_enoent_DEPENDENCIES) 
+	@rm -f gzip_enoent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_enoent_OBJECTS) $(gzip_enoent_LDADD) $(LIBS)
+
+gzip_float32$(EXEEXT): $(gzip_float32_OBJECTS) $(gzip_float32_DEPENDENCIES) $(EXTRA_gzip_float32_DEPENDENCIES) 
+	@rm -f gzip_float32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_float32_OBJECTS) $(gzip_float32_LDADD) $(LIBS)
+
+gzip_float64$(EXEEXT): $(gzip_float64_OBJECTS) $(gzip_float64_DEPENDENCIES) $(EXTRA_gzip_float64_DEPENDENCIES) 
+	@rm -f gzip_float64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_float64_OBJECTS) $(gzip_float64_LDADD) $(LIBS)
+
 gzip_get$(EXEEXT): $(gzip_get_OBJECTS) $(gzip_get_DEPENDENCIES) $(EXTRA_gzip_get_DEPENDENCIES) 
 	@rm -f gzip_get$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(gzip_get_OBJECTS) $(gzip_get_LDADD) $(LIBS)
 
+gzip_get_cont$(EXEEXT): $(gzip_get_cont_OBJECTS) $(gzip_get_cont_DEPENDENCIES) $(EXTRA_gzip_get_cont_DEPENDENCIES) 
+	@rm -f gzip_get_cont$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_get_cont_OBJECTS) $(gzip_get_cont_LDADD) $(LIBS)
+
 gzip_get_far$(EXEEXT): $(gzip_get_far_OBJECTS) $(gzip_get_far_DEPENDENCIES) $(EXTRA_gzip_get_far_DEPENDENCIES) 
 	@rm -f gzip_get_far$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(gzip_get_far_OBJECTS) $(gzip_get_far_LDADD) $(LIBS)
@@ -9495,6 +12906,22 @@ gzip_get_put$(EXEEXT): $(gzip_get_put_OBJECTS) $(gzip_get_put_DEPENDENCIES) $(EX
 	@rm -f gzip_get_put$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(gzip_get_put_OBJECTS) $(gzip_get_put_LDADD) $(LIBS)
 
+gzip_int16$(EXEEXT): $(gzip_int16_OBJECTS) $(gzip_int16_DEPENDENCIES) $(EXTRA_gzip_int16_DEPENDENCIES) 
+	@rm -f gzip_int16$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_int16_OBJECTS) $(gzip_int16_LDADD) $(LIBS)
+
+gzip_int32$(EXEEXT): $(gzip_int32_OBJECTS) $(gzip_int32_DEPENDENCIES) $(EXTRA_gzip_int32_DEPENDENCIES) 
+	@rm -f gzip_int32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_int32_OBJECTS) $(gzip_int32_LDADD) $(LIBS)
+
+gzip_int64$(EXEEXT): $(gzip_int64_OBJECTS) $(gzip_int64_DEPENDENCIES) $(EXTRA_gzip_int64_DEPENDENCIES) 
+	@rm -f gzip_int64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_int64_OBJECTS) $(gzip_int64_LDADD) $(LIBS)
+
+gzip_int8$(EXEEXT): $(gzip_int8_OBJECTS) $(gzip_int8_DEPENDENCIES) $(EXTRA_gzip_int8_DEPENDENCIES) 
+	@rm -f gzip_int8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_int8_OBJECTS) $(gzip_int8_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)
 	$(AM_V_CCLD)$(LINK) $(gzip_move_from_OBJECTS) $(gzip_move_from_LDADD) $(LIBS)
@@ -9531,6 +12958,10 @@ gzip_put_off$(EXEEXT): $(gzip_put_off_OBJECTS) $(gzip_put_off_DEPENDENCIES) $(EX
 	@rm -f gzip_put_off$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(gzip_put_off_OBJECTS) $(gzip_put_off_LDADD) $(LIBS)
 
+gzip_put_offs$(EXEEXT): $(gzip_put_offs_OBJECTS) $(gzip_put_offs_DEPENDENCIES) $(EXTRA_gzip_put_offs_DEPENDENCIES) 
+	@rm -f gzip_put_offs$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_put_offs_OBJECTS) $(gzip_put_offs_LDADD) $(LIBS)
+
 gzip_put_pad$(EXEEXT): $(gzip_put_pad_OBJECTS) $(gzip_put_pad_DEPENDENCIES) $(EXTRA_gzip_put_pad_DEPENDENCIES) 
 	@rm -f gzip_put_pad$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(gzip_put_pad_OBJECTS) $(gzip_put_pad_LDADD) $(LIBS)
@@ -9555,6 +12986,22 @@ gzip_sync$(EXEEXT): $(gzip_sync_OBJECTS) $(gzip_sync_DEPENDENCIES) $(EXTRA_gzip_
 	@rm -f gzip_sync$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(gzip_sync_OBJECTS) $(gzip_sync_LDADD) $(LIBS)
 
+gzip_uint16$(EXEEXT): $(gzip_uint16_OBJECTS) $(gzip_uint16_DEPENDENCIES) $(EXTRA_gzip_uint16_DEPENDENCIES) 
+	@rm -f gzip_uint16$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_uint16_OBJECTS) $(gzip_uint16_LDADD) $(LIBS)
+
+gzip_uint32$(EXEEXT): $(gzip_uint32_OBJECTS) $(gzip_uint32_DEPENDENCIES) $(EXTRA_gzip_uint32_DEPENDENCIES) 
+	@rm -f gzip_uint32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_uint32_OBJECTS) $(gzip_uint32_LDADD) $(LIBS)
+
+gzip_uint64$(EXEEXT): $(gzip_uint64_OBJECTS) $(gzip_uint64_DEPENDENCIES) $(EXTRA_gzip_uint64_DEPENDENCIES) 
+	@rm -f gzip_uint64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_uint64_OBJECTS) $(gzip_uint64_LDADD) $(LIBS)
+
+gzip_uint8$(EXEEXT): $(gzip_uint8_OBJECTS) $(gzip_uint8_DEPENDENCIES) $(EXTRA_gzip_uint8_DEPENDENCIES) 
+	@rm -f gzip_uint8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(gzip_uint8_OBJECTS) $(gzip_uint8_LDADD) $(LIBS)
+
 header_complex$(EXEEXT): $(header_complex_OBJECTS) $(header_complex_DEPENDENCIES) $(EXTRA_header_complex_DEPENDENCIES) 
 	@rm -f header_complex$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(header_complex_OBJECTS) $(header_complex_LDADD) $(LIBS)
@@ -9595,6 +13042,10 @@ include_affix$(EXEEXT): $(include_affix_OBJECTS) $(include_affix_DEPENDENCIES) $
 	@rm -f include_affix$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(include_affix_OBJECTS) $(include_affix_LDADD) $(LIBS)
 
+include_affix_ns$(EXEEXT): $(include_affix_ns_OBJECTS) $(include_affix_ns_DEPENDENCIES) $(EXTRA_include_affix_ns_DEPENDENCIES) 
+	@rm -f include_affix_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_affix_ns_OBJECTS) $(include_affix_ns_LDADD) $(LIBS)
+
 include_auto$(EXEEXT): $(include_auto_OBJECTS) $(include_auto_DEPENDENCIES) $(EXTRA_include_auto_DEPENDENCIES) 
 	@rm -f include_auto$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(include_auto_OBJECTS) $(include_auto_LDADD) $(LIBS)
@@ -9607,6 +13058,10 @@ include_creat$(EXEEXT): $(include_creat_OBJECTS) $(include_creat_DEPENDENCIES) $
 	@rm -f include_creat$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(include_creat_OBJECTS) $(include_creat_LDADD) $(LIBS)
 
+include_format$(EXEEXT): $(include_format_OBJECTS) $(include_format_DEPENDENCIES) $(EXTRA_include_format_DEPENDENCIES) 
+	@rm -f include_format$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_format_OBJECTS) $(include_format_LDADD) $(LIBS)
+
 include_ignore$(EXEEXT): $(include_ignore_OBJECTS) $(include_ignore_DEPENDENCIES) $(EXTRA_include_ignore_DEPENDENCIES) 
 	@rm -f include_ignore$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(include_ignore_OBJECTS) $(include_ignore_LDADD) $(LIBS)
@@ -9623,18 +13078,66 @@ include_invalid$(EXEEXT): $(include_invalid_OBJECTS) $(include_invalid_DEPENDENC
 	@rm -f include_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(include_invalid_OBJECTS) $(include_invalid_LDADD) $(LIBS)
 
+include_ndotdots$(EXEEXT): $(include_ndotdots_OBJECTS) $(include_ndotdots_DEPENDENCIES) $(EXTRA_include_ndotdots_DEPENDENCIES) 
+	@rm -f include_ndotdots$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ndotdots_OBJECTS) $(include_ndotdots_LDADD) $(LIBS)
+
+include_ndots$(EXEEXT): $(include_ndots_OBJECTS) $(include_ndots_DEPENDENCIES) $(EXTRA_include_ndots_DEPENDENCIES) 
+	@rm -f include_ndots$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ndots_OBJECTS) $(include_ndots_LDADD) $(LIBS)
+
 include_nonexistent$(EXEEXT): $(include_nonexistent_OBJECTS) $(include_nonexistent_DEPENDENCIES) $(EXTRA_include_nonexistent_DEPENDENCIES) 
 	@rm -f include_nonexistent$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(include_nonexistent_OBJECTS) $(include_nonexistent_LDADD) $(LIBS)
 
+include_ns$(EXEEXT): $(include_ns_OBJECTS) $(include_ns_DEPENDENCIES) $(EXTRA_include_ns_DEPENDENCIES) 
+	@rm -f include_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ns_OBJECTS) $(include_ns_LDADD) $(LIBS)
+
+include_ns_dot$(EXEEXT): $(include_ns_dot_OBJECTS) $(include_ns_dot_DEPENDENCIES) $(EXTRA_include_ns_dot_DEPENDENCIES) 
+	@rm -f include_ns_dot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ns_dot_OBJECTS) $(include_ns_dot_LDADD) $(LIBS)
+
+include_ns_dotdot$(EXEEXT): $(include_ns_dotdot_OBJECTS) $(include_ns_dotdot_DEPENDENCIES) $(EXTRA_include_ns_dotdot_DEPENDENCIES) 
+	@rm -f include_ns_dotdot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ns_dotdot_OBJECTS) $(include_ns_dotdot_LDADD) $(LIBS)
+
+include_ns_dotns$(EXEEXT): $(include_ns_dotns_OBJECTS) $(include_ns_dotns_DEPENDENCIES) $(EXTRA_include_ns_dotns_DEPENDENCIES) 
+	@rm -f include_ns_dotns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ns_dotns_OBJECTS) $(include_ns_dotns_LDADD) $(LIBS)
+
+include_ns_nil$(EXEEXT): $(include_ns_nil_OBJECTS) $(include_ns_nil_DEPENDENCIES) $(EXTRA_include_ns_nil_DEPENDENCIES) 
+	@rm -f include_ns_nil$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ns_nil_OBJECTS) $(include_ns_nil_LDADD) $(LIBS)
+
+include_ns_null$(EXEEXT): $(include_ns_null_OBJECTS) $(include_ns_null_DEPENDENCIES) $(EXTRA_include_ns_null_DEPENDENCIES) 
+	@rm -f include_ns_null$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ns_null_OBJECTS) $(include_ns_null_LDADD) $(LIBS)
+
+include_ns_prefix$(EXEEXT): $(include_ns_prefix_OBJECTS) $(include_ns_prefix_DEPENDENCIES) $(EXTRA_include_ns_prefix_DEPENDENCIES) 
+	@rm -f include_ns_prefix$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ns_prefix_OBJECTS) $(include_ns_prefix_LDADD) $(LIBS)
+
 include_pc$(EXEEXT): $(include_pc_OBJECTS) $(include_pc_DEPENDENCIES) $(EXTRA_include_pc_DEPENDENCIES) 
 	@rm -f include_pc$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(include_pc_OBJECTS) $(include_pc_LDADD) $(LIBS)
 
+include_prot$(EXEEXT): $(include_prot_OBJECTS) $(include_prot_DEPENDENCIES) $(EXTRA_include_prot_DEPENDENCIES) 
+	@rm -f include_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_prot_OBJECTS) $(include_prot_LDADD) $(LIBS)
+
 include_ref$(EXEEXT): $(include_ref_OBJECTS) $(include_ref_DEPENDENCIES) $(EXTRA_include_ref_DEPENDENCIES) 
 	@rm -f include_ref$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(include_ref_OBJECTS) $(include_ref_LDADD) $(LIBS)
 
+include_ref_code$(EXEEXT): $(include_ref_code_OBJECTS) $(include_ref_code_DEPENDENCIES) $(EXTRA_include_ref_code_DEPENDENCIES) 
+	@rm -f include_ref_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ref_code_OBJECTS) $(include_ref_code_LDADD) $(LIBS)
+
+include_ref_type$(EXEEXT): $(include_ref_type_OBJECTS) $(include_ref_type_DEPENDENCIES) $(EXTRA_include_ref_type_DEPENDENCIES) 
+	@rm -f include_ref_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(include_ref_type_OBJECTS) $(include_ref_type_LDADD) $(LIBS)
+
 include_sub$(EXEEXT): $(include_sub_OBJECTS) $(include_sub_DEPENDENCIES) $(EXTRA_include_sub_DEPENDENCIES) 
 	@rm -f include_sub$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(include_sub_OBJECTS) $(include_sub_LDADD) $(LIBS)
@@ -9647,18 +13150,34 @@ index_domain$(EXEEXT): $(index_domain_OBJECTS) $(index_domain_DEPENDENCIES) $(EX
 	@rm -f index_domain$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(index_domain_OBJECTS) $(index_domain_LDADD) $(LIBS)
 
+index_empty$(EXEEXT): $(index_empty_OBJECTS) $(index_empty_DEPENDENCIES) $(EXTRA_index_empty_DEPENDENCIES) 
+	@rm -f index_empty$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(index_empty_OBJECTS) $(index_empty_LDADD) $(LIBS)
+
 index_index$(EXEEXT): $(index_index_OBJECTS) $(index_index_DEPENDENCIES) $(EXTRA_index_index_DEPENDENCIES) 
 	@rm -f index_index$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(index_index_OBJECTS) $(index_index_LDADD) $(LIBS)
 
+index_one$(EXEEXT): $(index_one_OBJECTS) $(index_one_DEPENDENCIES) $(EXTRA_index_one_DEPENDENCIES) 
+	@rm -f index_one$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(index_one_OBJECTS) $(index_one_LDADD) $(LIBS)
+
 index_range$(EXEEXT): $(index_range_OBJECTS) $(index_range_DEPENDENCIES) $(EXTRA_index_range_DEPENDENCIES) 
 	@rm -f index_range$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(index_range_OBJECTS) $(index_range_LDADD) $(LIBS)
 
+index_reprz$(EXEEXT): $(index_reprz_OBJECTS) $(index_reprz_DEPENDENCIES) $(EXTRA_index_reprz_DEPENDENCIES) 
+	@rm -f index_reprz$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(index_reprz_OBJECTS) $(index_reprz_LDADD) $(LIBS)
+
 index_s$(EXEEXT): $(index_s_OBJECTS) $(index_s_DEPENDENCIES) $(EXTRA_index_s_DEPENDENCIES) 
 	@rm -f index_s$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(index_s_OBJECTS) $(index_s_LDADD) $(LIBS)
 
+index_scalar$(EXEEXT): $(index_scalar_OBJECTS) $(index_scalar_DEPENDENCIES) $(EXTRA_index_scalar_DEPENDENCIES) 
+	@rm -f index_scalar$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(index_scalar_OBJECTS) $(index_scalar_LDADD) $(LIBS)
+
 index_subset$(EXEEXT): $(index_subset_OBJECTS) $(index_subset_DEPENDENCIES) $(EXTRA_index_subset_DEPENDENCIES) 
 	@rm -f index_subset$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(index_subset_OBJECTS) $(index_subset_LDADD) $(LIBS)
@@ -9703,6 +13222,34 @@ legacy_spf$(EXEEXT): $(legacy_spf_OBJECTS) $(legacy_spf_DEPENDENCIES) $(EXTRA_le
 	@rm -f legacy_spf$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(legacy_spf_OBJECTS) $(legacy_spf_LDADD) $(LIBS)
 
+len_bad$(EXEEXT): $(len_bad_OBJECTS) $(len_bad_DEPENDENCIES) $(EXTRA_len_bad_DEPENDENCIES) 
+	@rm -f len_bad$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(len_bad_OBJECTS) $(len_bad_LDADD) $(LIBS)
+
+len_carray$(EXEEXT): $(len_carray_OBJECTS) $(len_carray_DEPENDENCIES) $(EXTRA_len_carray_DEPENDENCIES) 
+	@rm -f len_carray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(len_carray_OBJECTS) $(len_carray_LDADD) $(LIBS)
+
+len_const$(EXEEXT): $(len_const_OBJECTS) $(len_const_DEPENDENCIES) $(EXTRA_len_const_DEPENDENCIES) 
+	@rm -f len_const$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(len_const_OBJECTS) $(len_const_LDADD) $(LIBS)
+
+len_sarray$(EXEEXT): $(len_sarray_OBJECTS) $(len_sarray_DEPENDENCIES) $(EXTRA_len_sarray_DEPENDENCIES) 
+	@rm -f len_sarray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(len_sarray_OBJECTS) $(len_sarray_LDADD) $(LIBS)
+
+len_string$(EXEEXT): $(len_string_OBJECTS) $(len_string_DEPENDENCIES) $(EXTRA_len_string_DEPENDENCIES) 
+	@rm -f len_string$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(len_string_OBJECTS) $(len_string_LDADD) $(LIBS)
+
+len_type$(EXEEXT): $(len_type_OBJECTS) $(len_type_DEPENDENCIES) $(EXTRA_len_type_DEPENDENCIES) 
+	@rm -f len_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(len_type_OBJECTS) $(len_type_LDADD) $(LIBS)
+
+lzma_enoent$(EXEEXT): $(lzma_enoent_OBJECTS) $(lzma_enoent_DEPENDENCIES) $(EXTRA_lzma_enoent_DEPENDENCIES) 
+	@rm -f lzma_enoent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_enoent_OBJECTS) $(lzma_enoent_LDADD) $(LIBS)
+
 lzma_get$(EXEEXT): $(lzma_get_OBJECTS) $(lzma_get_DEPENDENCIES) $(EXTRA_lzma_get_DEPENDENCIES) 
 	@rm -f lzma_get$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_get_OBJECTS) $(lzma_get_LDADD) $(LIBS)
@@ -9719,10 +13266,34 @@ lzma_xz_add$(EXEEXT): $(lzma_xz_add_OBJECTS) $(lzma_xz_add_DEPENDENCIES) $(EXTRA
 	@rm -f lzma_xz_add$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_xz_add_OBJECTS) $(lzma_xz_add_LDADD) $(LIBS)
 
+lzma_xz_complex128$(EXEEXT): $(lzma_xz_complex128_OBJECTS) $(lzma_xz_complex128_DEPENDENCIES) $(EXTRA_lzma_xz_complex128_DEPENDENCIES) 
+	@rm -f lzma_xz_complex128$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_complex128_OBJECTS) $(lzma_xz_complex128_LDADD) $(LIBS)
+
+lzma_xz_complex64$(EXEEXT): $(lzma_xz_complex64_OBJECTS) $(lzma_xz_complex64_DEPENDENCIES) $(EXTRA_lzma_xz_complex64_DEPENDENCIES) 
+	@rm -f lzma_xz_complex64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_complex64_OBJECTS) $(lzma_xz_complex64_LDADD) $(LIBS)
+
+lzma_xz_del$(EXEEXT): $(lzma_xz_del_OBJECTS) $(lzma_xz_del_DEPENDENCIES) $(EXTRA_lzma_xz_del_DEPENDENCIES) 
+	@rm -f lzma_xz_del$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_del_OBJECTS) $(lzma_xz_del_LDADD) $(LIBS)
+
+lzma_xz_float32$(EXEEXT): $(lzma_xz_float32_OBJECTS) $(lzma_xz_float32_DEPENDENCIES) $(EXTRA_lzma_xz_float32_DEPENDENCIES) 
+	@rm -f lzma_xz_float32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_float32_OBJECTS) $(lzma_xz_float32_LDADD) $(LIBS)
+
+lzma_xz_float64$(EXEEXT): $(lzma_xz_float64_OBJECTS) $(lzma_xz_float64_DEPENDENCIES) $(EXTRA_lzma_xz_float64_DEPENDENCIES) 
+	@rm -f lzma_xz_float64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_float64_OBJECTS) $(lzma_xz_float64_LDADD) $(LIBS)
+
 lzma_xz_get$(EXEEXT): $(lzma_xz_get_OBJECTS) $(lzma_xz_get_DEPENDENCIES) $(EXTRA_lzma_xz_get_DEPENDENCIES) 
 	@rm -f lzma_xz_get$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_xz_get_OBJECTS) $(lzma_xz_get_LDADD) $(LIBS)
 
+lzma_xz_get_cont$(EXEEXT): $(lzma_xz_get_cont_OBJECTS) $(lzma_xz_get_cont_DEPENDENCIES) $(EXTRA_lzma_xz_get_cont_DEPENDENCIES) 
+	@rm -f lzma_xz_get_cont$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_get_cont_OBJECTS) $(lzma_xz_get_cont_LDADD) $(LIBS)
+
 lzma_xz_get_far$(EXEEXT): $(lzma_xz_get_far_OBJECTS) $(lzma_xz_get_far_DEPENDENCIES) $(EXTRA_lzma_xz_get_far_DEPENDENCIES) 
 	@rm -f lzma_xz_get_far$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_xz_get_far_OBJECTS) $(lzma_xz_get_far_LDADD) $(LIBS)
@@ -9739,6 +13310,26 @@ lzma_xz_get_put$(EXEEXT): $(lzma_xz_get_put_OBJECTS) $(lzma_xz_get_put_DEPENDENC
 	@rm -f lzma_xz_get_put$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_xz_get_put_OBJECTS) $(lzma_xz_get_put_LDADD) $(LIBS)
 
+lzma_xz_int16$(EXEEXT): $(lzma_xz_int16_OBJECTS) $(lzma_xz_int16_DEPENDENCIES) $(EXTRA_lzma_xz_int16_DEPENDENCIES) 
+	@rm -f lzma_xz_int16$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_int16_OBJECTS) $(lzma_xz_int16_LDADD) $(LIBS)
+
+lzma_xz_int32$(EXEEXT): $(lzma_xz_int32_OBJECTS) $(lzma_xz_int32_DEPENDENCIES) $(EXTRA_lzma_xz_int32_DEPENDENCIES) 
+	@rm -f lzma_xz_int32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_int32_OBJECTS) $(lzma_xz_int32_LDADD) $(LIBS)
+
+lzma_xz_int64$(EXEEXT): $(lzma_xz_int64_OBJECTS) $(lzma_xz_int64_DEPENDENCIES) $(EXTRA_lzma_xz_int64_DEPENDENCIES) 
+	@rm -f lzma_xz_int64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_int64_OBJECTS) $(lzma_xz_int64_LDADD) $(LIBS)
+
+lzma_xz_int8$(EXEEXT): $(lzma_xz_int8_OBJECTS) $(lzma_xz_int8_DEPENDENCIES) $(EXTRA_lzma_xz_int8_DEPENDENCIES) 
+	@rm -f lzma_xz_int8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_int8_OBJECTS) $(lzma_xz_int8_LDADD) $(LIBS)
+
+lzma_xz_move_from$(EXEEXT): $(lzma_xz_move_from_OBJECTS) $(lzma_xz_move_from_DEPENDENCIES) $(EXTRA_lzma_xz_move_from_DEPENDENCIES) 
+	@rm -f lzma_xz_move_from$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_move_from_OBJECTS) $(lzma_xz_move_from_LDADD) $(LIBS)
+
 lzma_xz_move_to$(EXEEXT): $(lzma_xz_move_to_OBJECTS) $(lzma_xz_move_to_DEPENDENCIES) $(EXTRA_lzma_xz_move_to_DEPENDENCIES) 
 	@rm -f lzma_xz_move_to$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_xz_move_to_OBJECTS) $(lzma_xz_move_to_LDADD) $(LIBS)
@@ -9747,6 +13338,10 @@ lzma_xz_nframes$(EXEEXT): $(lzma_xz_nframes_OBJECTS) $(lzma_xz_nframes_DEPENDENC
 	@rm -f lzma_xz_nframes$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_xz_nframes_OBJECTS) $(lzma_xz_nframes_LDADD) $(LIBS)
 
+lzma_xz_offs_clear$(EXEEXT): $(lzma_xz_offs_clear_OBJECTS) $(lzma_xz_offs_clear_DEPENDENCIES) $(EXTRA_lzma_xz_offs_clear_DEPENDENCIES) 
+	@rm -f lzma_xz_offs_clear$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_offs_clear_OBJECTS) $(lzma_xz_offs_clear_LDADD) $(LIBS)
+
 lzma_xz_put$(EXEEXT): $(lzma_xz_put_OBJECTS) $(lzma_xz_put_DEPENDENCIES) $(EXTRA_lzma_xz_put_DEPENDENCIES) 
 	@rm -f lzma_xz_put$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_xz_put_OBJECTS) $(lzma_xz_put_LDADD) $(LIBS)
@@ -9763,6 +13358,10 @@ lzma_xz_put_get$(EXEEXT): $(lzma_xz_put_get_OBJECTS) $(lzma_xz_put_get_DEPENDENC
 	@rm -f lzma_xz_put_get$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_xz_put_get_OBJECTS) $(lzma_xz_put_get_LDADD) $(LIBS)
 
+lzma_xz_put_offs$(EXEEXT): $(lzma_xz_put_offs_OBJECTS) $(lzma_xz_put_offs_DEPENDENCIES) $(EXTRA_lzma_xz_put_offs_DEPENDENCIES) 
+	@rm -f lzma_xz_put_offs$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_put_offs_OBJECTS) $(lzma_xz_put_offs_LDADD) $(LIBS)
+
 lzma_xz_put_pad$(EXEEXT): $(lzma_xz_put_pad_OBJECTS) $(lzma_xz_put_pad_DEPENDENCIES) $(EXTRA_lzma_xz_put_pad_DEPENDENCIES) 
 	@rm -f lzma_xz_put_pad$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_xz_put_pad_OBJECTS) $(lzma_xz_put_pad_LDADD) $(LIBS)
@@ -9779,6 +13378,22 @@ lzma_xz_sync$(EXEEXT): $(lzma_xz_sync_OBJECTS) $(lzma_xz_sync_DEPENDENCIES) $(EX
 	@rm -f lzma_xz_sync$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(lzma_xz_sync_OBJECTS) $(lzma_xz_sync_LDADD) $(LIBS)
 
+lzma_xz_uint16$(EXEEXT): $(lzma_xz_uint16_OBJECTS) $(lzma_xz_uint16_DEPENDENCIES) $(EXTRA_lzma_xz_uint16_DEPENDENCIES) 
+	@rm -f lzma_xz_uint16$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_uint16_OBJECTS) $(lzma_xz_uint16_LDADD) $(LIBS)
+
+lzma_xz_uint32$(EXEEXT): $(lzma_xz_uint32_OBJECTS) $(lzma_xz_uint32_DEPENDENCIES) $(EXTRA_lzma_xz_uint32_DEPENDENCIES) 
+	@rm -f lzma_xz_uint32$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_uint32_OBJECTS) $(lzma_xz_uint32_LDADD) $(LIBS)
+
+lzma_xz_uint64$(EXEEXT): $(lzma_xz_uint64_OBJECTS) $(lzma_xz_uint64_DEPENDENCIES) $(EXTRA_lzma_xz_uint64_DEPENDENCIES) 
+	@rm -f lzma_xz_uint64$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_uint64_OBJECTS) $(lzma_xz_uint64_LDADD) $(LIBS)
+
+lzma_xz_uint8$(EXEEXT): $(lzma_xz_uint8_OBJECTS) $(lzma_xz_uint8_DEPENDENCIES) $(EXTRA_lzma_xz_uint8_DEPENDENCIES) 
+	@rm -f lzma_xz_uint8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(lzma_xz_uint8_OBJECTS) $(lzma_xz_uint8_LDADD) $(LIBS)
+
 madd$(EXEEXT): $(madd_OBJECTS) $(madd_DEPENDENCIES) $(EXTRA_madd_DEPENDENCIES) 
 	@rm -f madd$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_OBJECTS) $(madd_LDADD) $(LIBS)
@@ -9795,6 +13410,18 @@ madd_alias_affix$(EXEEXT): $(madd_alias_affix_OBJECTS) $(madd_alias_affix_DEPEND
 	@rm -f madd_alias_affix$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_alias_affix_OBJECTS) $(madd_alias_affix_LDADD) $(LIBS)
 
+madd_alias_alias$(EXEEXT): $(madd_alias_alias_OBJECTS) $(madd_alias_alias_DEPENDENCIES) $(EXTRA_madd_alias_alias_DEPENDENCIES) 
+	@rm -f madd_alias_alias$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_alias_alias_OBJECTS) $(madd_alias_alias_LDADD) $(LIBS)
+
+madd_alias_subsub$(EXEEXT): $(madd_alias_subsub_OBJECTS) $(madd_alias_subsub_DEPENDENCIES) $(EXTRA_madd_alias_subsub_DEPENDENCIES) 
+	@rm -f madd_alias_subsub$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_alias_subsub_OBJECTS) $(madd_alias_subsub_LDADD) $(LIBS)
+
+madd_aliasmeta$(EXEEXT): $(madd_aliasmeta_OBJECTS) $(madd_aliasmeta_DEPENDENCIES) $(EXTRA_madd_aliasmeta_DEPENDENCIES) 
+	@rm -f madd_aliasmeta$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_aliasmeta_OBJECTS) $(madd_aliasmeta_LDADD) $(LIBS)
+
 madd_bit$(EXEEXT): $(madd_bit_OBJECTS) $(madd_bit_DEPENDENCIES) $(EXTRA_madd_bit_DEPENDENCIES) 
 	@rm -f madd_bit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_bit_OBJECTS) $(madd_bit_LDADD) $(LIBS)
@@ -9811,6 +13438,10 @@ madd_clincom$(EXEEXT): $(madd_clincom_OBJECTS) $(madd_clincom_DEPENDENCIES) $(EX
 	@rm -f madd_clincom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_clincom_OBJECTS) $(madd_clincom_LDADD) $(LIBS)
 
+madd_clincom_nfields$(EXEEXT): $(madd_clincom_nfields_OBJECTS) $(madd_clincom_nfields_DEPENDENCIES) $(EXTRA_madd_clincom_nfields_DEPENDENCIES) 
+	@rm -f madd_clincom_nfields$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_clincom_nfields_OBJECTS) $(madd_clincom_nfields_LDADD) $(LIBS)
+
 madd_const$(EXEEXT): $(madd_const_OBJECTS) $(madd_const_DEPENDENCIES) $(EXTRA_madd_const_DEPENDENCIES) 
 	@rm -f madd_const$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_const_OBJECTS) $(madd_const_LDADD) $(LIBS)
@@ -9819,6 +13450,10 @@ madd_cpolynom$(EXEEXT): $(madd_cpolynom_OBJECTS) $(madd_cpolynom_DEPENDENCIES) $
 	@rm -f madd_cpolynom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_cpolynom_OBJECTS) $(madd_cpolynom_LDADD) $(LIBS)
 
+madd_cpolynom_order$(EXEEXT): $(madd_cpolynom_order_OBJECTS) $(madd_cpolynom_order_DEPENDENCIES) $(EXTRA_madd_cpolynom_order_DEPENDENCIES) 
+	@rm -f madd_cpolynom_order$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_cpolynom_order_OBJECTS) $(madd_cpolynom_order_LDADD) $(LIBS)
+
 madd_crecip$(EXEEXT): $(madd_crecip_OBJECTS) $(madd_crecip_DEPENDENCIES) $(EXTRA_madd_crecip_DEPENDENCIES) 
 	@rm -f madd_crecip$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_crecip_OBJECTS) $(madd_crecip_LDADD) $(LIBS)
@@ -9835,6 +13470,10 @@ madd_index$(EXEEXT): $(madd_index_OBJECTS) $(madd_index_DEPENDENCIES) $(EXTRA_ma
 	@rm -f madd_index$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_index_OBJECTS) $(madd_index_LDADD) $(LIBS)
 
+madd_indir$(EXEEXT): $(madd_indir_OBJECTS) $(madd_indir_DEPENDENCIES) $(EXTRA_madd_indir_DEPENDENCIES) 
+	@rm -f madd_indir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_indir_OBJECTS) $(madd_indir_LDADD) $(LIBS)
+
 madd_lincom$(EXEEXT): $(madd_lincom_OBJECTS) $(madd_lincom_DEPENDENCIES) $(EXTRA_madd_lincom_DEPENDENCIES) 
 	@rm -f madd_lincom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_lincom_OBJECTS) $(madd_lincom_LDADD) $(LIBS)
@@ -9843,6 +13482,10 @@ madd_lincom_invalid$(EXEEXT): $(madd_lincom_invalid_OBJECTS) $(madd_lincom_inval
 	@rm -f madd_lincom_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_lincom_invalid_OBJECTS) $(madd_lincom_invalid_LDADD) $(LIBS)
 
+madd_lincom_nfields$(EXEEXT): $(madd_lincom_nfields_OBJECTS) $(madd_lincom_nfields_DEPENDENCIES) $(EXTRA_madd_lincom_nfields_DEPENDENCIES) 
+	@rm -f madd_lincom_nfields$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_lincom_nfields_OBJECTS) $(madd_lincom_nfields_LDADD) $(LIBS)
+
 madd_linterp$(EXEEXT): $(madd_linterp_OBJECTS) $(madd_linterp_DEPENDENCIES) $(EXTRA_madd_linterp_DEPENDENCIES) 
 	@rm -f madd_linterp$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_linterp_OBJECTS) $(madd_linterp_LDADD) $(LIBS)
@@ -9863,6 +13506,10 @@ madd_multiply_invalid$(EXEEXT): $(madd_multiply_invalid_OBJECTS) $(madd_multiply
 	@rm -f madd_multiply_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_multiply_invalid_OBJECTS) $(madd_multiply_invalid_LDADD) $(LIBS)
 
+madd_parent_bad$(EXEEXT): $(madd_parent_bad_OBJECTS) $(madd_parent_bad_DEPENDENCIES) $(EXTRA_madd_parent_bad_DEPENDENCIES) 
+	@rm -f madd_parent_bad$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_parent_bad_OBJECTS) $(madd_parent_bad_LDADD) $(LIBS)
+
 madd_phase$(EXEEXT): $(madd_phase_OBJECTS) $(madd_phase_DEPENDENCIES) $(EXTRA_madd_phase_DEPENDENCIES) 
 	@rm -f madd_phase$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_phase_OBJECTS) $(madd_phase_LDADD) $(LIBS)
@@ -9875,14 +13522,34 @@ madd_polynom$(EXEEXT): $(madd_polynom_OBJECTS) $(madd_polynom_DEPENDENCIES) $(EX
 	@rm -f madd_polynom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_polynom_OBJECTS) $(madd_polynom_LDADD) $(LIBS)
 
+madd_polynom_order$(EXEEXT): $(madd_polynom_order_OBJECTS) $(madd_polynom_order_DEPENDENCIES) $(EXTRA_madd_polynom_order_DEPENDENCIES) 
+	@rm -f madd_polynom_order$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_polynom_order_OBJECTS) $(madd_polynom_order_LDADD) $(LIBS)
+
+madd_raw$(EXEEXT): $(madd_raw_OBJECTS) $(madd_raw_DEPENDENCIES) $(EXTRA_madd_raw_DEPENDENCIES) 
+	@rm -f madd_raw$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_raw_OBJECTS) $(madd_raw_LDADD) $(LIBS)
+
 madd_recip$(EXEEXT): $(madd_recip_OBJECTS) $(madd_recip_DEPENDENCIES) $(EXTRA_madd_recip_DEPENDENCIES) 
 	@rm -f madd_recip$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_recip_OBJECTS) $(madd_recip_LDADD) $(LIBS)
 
+madd_sarray$(EXEEXT): $(madd_sarray_OBJECTS) $(madd_sarray_DEPENDENCIES) $(EXTRA_madd_sarray_DEPENDENCIES) 
+	@rm -f madd_sarray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_sarray_OBJECTS) $(madd_sarray_LDADD) $(LIBS)
+
+madd_sarray_dup$(EXEEXT): $(madd_sarray_dup_OBJECTS) $(madd_sarray_dup_DEPENDENCIES) $(EXTRA_madd_sarray_dup_DEPENDENCIES) 
+	@rm -f madd_sarray_dup$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_sarray_dup_OBJECTS) $(madd_sarray_dup_LDADD) $(LIBS)
+
 madd_sbit$(EXEEXT): $(madd_sbit_OBJECTS) $(madd_sbit_DEPENDENCIES) $(EXTRA_madd_sbit_DEPENDENCIES) 
 	@rm -f madd_sbit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_sbit_OBJECTS) $(madd_sbit_LDADD) $(LIBS)
 
+madd_sindir$(EXEEXT): $(madd_sindir_OBJECTS) $(madd_sindir_DEPENDENCIES) $(EXTRA_madd_sindir_DEPENDENCIES) 
+	@rm -f madd_sindir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_sindir_OBJECTS) $(madd_sindir_LDADD) $(LIBS)
+
 madd_spec$(EXEEXT): $(madd_spec_OBJECTS) $(madd_spec_DEPENDENCIES) $(EXTRA_madd_spec_DEPENDENCIES) 
 	@rm -f madd_spec$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_spec_OBJECTS) $(madd_spec_LDADD) $(LIBS)
@@ -9895,6 +13562,10 @@ madd_spec_invalid$(EXEEXT): $(madd_spec_invalid_OBJECTS) $(madd_spec_invalid_DEP
 	@rm -f madd_spec_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_spec_invalid_OBJECTS) $(madd_spec_invalid_LDADD) $(LIBS)
 
+madd_spec_parent$(EXEEXT): $(madd_spec_parent_OBJECTS) $(madd_spec_parent_DEPENDENCIES) $(EXTRA_madd_spec_parent_DEPENDENCIES) 
+	@rm -f madd_spec_parent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_spec_parent_OBJECTS) $(madd_spec_parent_LDADD) $(LIBS)
+
 madd_spec_resolv$(EXEEXT): $(madd_spec_resolv_OBJECTS) $(madd_spec_resolv_DEPENDENCIES) $(EXTRA_madd_spec_resolv_DEPENDENCIES) 
 	@rm -f madd_spec_resolv$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_spec_resolv_OBJECTS) $(madd_spec_resolv_LDADD) $(LIBS)
@@ -9903,10 +13574,142 @@ madd_string$(EXEEXT): $(madd_string_OBJECTS) $(madd_string_DEPENDENCIES) $(EXTRA
 	@rm -f madd_string$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_string_OBJECTS) $(madd_string_LDADD) $(LIBS)
 
+madd_string_dup$(EXEEXT): $(madd_string_dup_OBJECTS) $(madd_string_dup_DEPENDENCIES) $(EXTRA_madd_string_dup_DEPENDENCIES) 
+	@rm -f madd_string_dup$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_string_dup_OBJECTS) $(madd_string_dup_LDADD) $(LIBS)
+
+madd_subsub$(EXEEXT): $(madd_subsub_OBJECTS) $(madd_subsub_DEPENDENCIES) $(EXTRA_madd_subsub_DEPENDENCIES) 
+	@rm -f madd_subsub$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(madd_subsub_OBJECTS) $(madd_subsub_LDADD) $(LIBS)
+
 madd_window$(EXEEXT): $(madd_window_OBJECTS) $(madd_window_DEPENDENCIES) $(EXTRA_madd_window_DEPENDENCIES) 
 	@rm -f madd_window$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(madd_window_OBJECTS) $(madd_window_LDADD) $(LIBS)
 
+match_fragment$(EXEEXT): $(match_fragment_OBJECTS) $(match_fragment_DEPENDENCIES) $(EXTRA_match_fragment_DEPENDENCIES) 
+	@rm -f match_fragment$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_fragment_OBJECTS) $(match_fragment_LDADD) $(LIBS)
+
+match_pcre$(EXEEXT): $(match_pcre_OBJECTS) $(match_pcre_DEPENDENCIES) $(EXTRA_match_pcre_DEPENDENCIES) 
+	@rm -f match_pcre$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_pcre_OBJECTS) $(match_pcre_LDADD) $(LIBS)
+
+match_pcre_bad$(EXEEXT): $(match_pcre_bad_OBJECTS) $(match_pcre_bad_DEPENDENCIES) $(EXTRA_match_pcre_bad_DEPENDENCIES) 
+	@rm -f match_pcre_bad$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_pcre_bad_OBJECTS) $(match_pcre_bad_LDADD) $(LIBS)
+
+match_pcre_caseless$(EXEEXT): $(match_pcre_caseless_OBJECTS) $(match_pcre_caseless_DEPENDENCIES) $(EXTRA_match_pcre_caseless_DEPENDENCIES) 
+	@rm -f match_pcre_caseless$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_pcre_caseless_OBJECTS) $(match_pcre_caseless_LDADD) $(LIBS)
+
+match_pcre_ext$(EXEEXT): $(match_pcre_ext_OBJECTS) $(match_pcre_ext_DEPENDENCIES) $(EXTRA_match_pcre_ext_DEPENDENCIES) 
+	@rm -f match_pcre_ext$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_pcre_ext_OBJECTS) $(match_pcre_ext_LDADD) $(LIBS)
+
+match_pcre_js$(EXEEXT): $(match_pcre_js_OBJECTS) $(match_pcre_js_DEPENDENCIES) $(EXTRA_match_pcre_js_DEPENDENCIES) 
+	@rm -f match_pcre_js$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_pcre_js_OBJECTS) $(match_pcre_js_LDADD) $(LIBS)
+
+match_pcre_utf8$(EXEEXT): $(match_pcre_utf8_OBJECTS) $(match_pcre_utf8_DEPENDENCIES) $(EXTRA_match_pcre_utf8_DEPENDENCIES) 
+	@rm -f match_pcre_utf8$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_pcre_utf8_OBJECTS) $(match_pcre_utf8_LDADD) $(LIBS)
+
+match_regex$(EXEEXT): $(match_regex_OBJECTS) $(match_regex_DEPENDENCIES) $(EXTRA_match_regex_DEPENDENCIES) 
+	@rm -f match_regex$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_regex_OBJECTS) $(match_regex_LDADD) $(LIBS)
+
+match_regex_bad$(EXEEXT): $(match_regex_bad_OBJECTS) $(match_regex_bad_DEPENDENCIES) $(EXTRA_match_regex_bad_DEPENDENCIES) 
+	@rm -f match_regex_bad$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_regex_bad_OBJECTS) $(match_regex_bad_LDADD) $(LIBS)
+
+match_regex_ext$(EXEEXT): $(match_regex_ext_OBJECTS) $(match_regex_ext_DEPENDENCIES) $(EXTRA_match_regex_ext_DEPENDENCIES) 
+	@rm -f match_regex_ext$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_regex_ext_OBJECTS) $(match_regex_ext_LDADD) $(LIBS)
+
+match_regex_icase$(EXEEXT): $(match_regex_icase_OBJECTS) $(match_regex_icase_DEPENDENCIES) $(EXTRA_match_regex_icase_DEPENDENCIES) 
+	@rm -f match_regex_icase$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(match_regex_icase_OBJECTS) $(match_regex_icase_LDADD) $(LIBS)
+
+mflush$(EXEEXT): $(mflush_OBJECTS) $(mflush_DEPENDENCIES) $(EXTRA_mflush_DEPENDENCIES) 
+	@rm -f mflush$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_OBJECTS) $(mflush_LDADD) $(LIBS)
+
+mflush_affix$(EXEEXT): $(mflush_affix_OBJECTS) $(mflush_affix_DEPENDENCIES) $(EXTRA_mflush_affix_DEPENDENCIES) 
+	@rm -f mflush_affix$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_affix_OBJECTS) $(mflush_affix_LDADD) $(LIBS)
+
+mflush_amb_code$(EXEEXT): $(mflush_amb_code_OBJECTS) $(mflush_amb_code_DEPENDENCIES) $(EXTRA_mflush_amb_code_DEPENDENCIES) 
+	@rm -f mflush_amb_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_amb_code_OBJECTS) $(mflush_amb_code_LDADD) $(LIBS)
+
+mflush_carray$(EXEEXT): $(mflush_carray_OBJECTS) $(mflush_carray_DEPENDENCIES) $(EXTRA_mflush_carray_DEPENDENCIES) 
+	@rm -f mflush_carray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_carray_OBJECTS) $(mflush_carray_LDADD) $(LIBS)
+
+mflush_hex$(EXEEXT): $(mflush_hex_OBJECTS) $(mflush_hex_DEPENDENCIES) $(EXTRA_mflush_hex_DEPENDENCIES) 
+	@rm -f mflush_hex$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_hex_OBJECTS) $(mflush_hex_LDADD) $(LIBS)
+
+mflush_indir$(EXEEXT): $(mflush_indir_OBJECTS) $(mflush_indir_DEPENDENCIES) $(EXTRA_mflush_indir_DEPENDENCIES) 
+	@rm -f mflush_indir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_indir_OBJECTS) $(mflush_indir_LDADD) $(LIBS)
+
+mflush_mplex$(EXEEXT): $(mflush_mplex_OBJECTS) $(mflush_mplex_DEPENDENCIES) $(EXTRA_mflush_mplex_DEPENDENCIES) 
+	@rm -f mflush_mplex$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_mplex_OBJECTS) $(mflush_mplex_LDADD) $(LIBS)
+
+mflush_ns$(EXEEXT): $(mflush_ns_OBJECTS) $(mflush_ns_DEPENDENCIES) $(EXTRA_mflush_ns_DEPENDENCIES) 
+	@rm -f mflush_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_ns_OBJECTS) $(mflush_ns_LDADD) $(LIBS)
+
+mflush_pretty$(EXEEXT): $(mflush_pretty_OBJECTS) $(mflush_pretty_DEPENDENCIES) $(EXTRA_mflush_pretty_DEPENDENCIES) 
+	@rm -f mflush_pretty$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_pretty_OBJECTS) $(mflush_pretty_LDADD) $(LIBS)
+
+mflush_prot$(EXEEXT): $(mflush_prot_OBJECTS) $(mflush_prot_DEPENDENCIES) $(EXTRA_mflush_prot_DEPENDENCIES) 
+	@rm -f mflush_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_prot_OBJECTS) $(mflush_prot_LDADD) $(LIBS)
+
+mflush_ref$(EXEEXT): $(mflush_ref_OBJECTS) $(mflush_ref_DEPENDENCIES) $(EXTRA_mflush_ref_DEPENDENCIES) 
+	@rm -f mflush_ref$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_ref_OBJECTS) $(mflush_ref_LDADD) $(LIBS)
+
+mflush_repr$(EXEEXT): $(mflush_repr_OBJECTS) $(mflush_repr_DEPENDENCIES) $(EXTRA_mflush_repr_DEPENDENCIES) 
+	@rm -f mflush_repr$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_repr_OBJECTS) $(mflush_repr_LDADD) $(LIBS)
+
+mflush_repr9$(EXEEXT): $(mflush_repr9_OBJECTS) $(mflush_repr9_DEPENDENCIES) $(EXTRA_mflush_repr9_DEPENDENCIES) 
+	@rm -f mflush_repr9$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_repr9_OBJECTS) $(mflush_repr9_LDADD) $(LIBS)
+
+mflush_reprz$(EXEEXT): $(mflush_reprz_OBJECTS) $(mflush_reprz_DEPENDENCIES) $(EXTRA_mflush_reprz_DEPENDENCIES) 
+	@rm -f mflush_reprz$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_reprz_OBJECTS) $(mflush_reprz_LDADD) $(LIBS)
+
+mflush_sindir$(EXEEXT): $(mflush_sindir_OBJECTS) $(mflush_sindir_DEPENDENCIES) $(EXTRA_mflush_sindir_DEPENDENCIES) 
+	@rm -f mflush_sindir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_sindir_OBJECTS) $(mflush_sindir_LDADD) $(LIBS)
+
+mflush_spec$(EXEEXT): $(mflush_spec_OBJECTS) $(mflush_spec_DEPENDENCIES) $(EXTRA_mflush_spec_DEPENDENCIES) 
+	@rm -f mflush_spec$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_spec_OBJECTS) $(mflush_spec_LDADD) $(LIBS)
+
+mflush_string$(EXEEXT): $(mflush_string_OBJECTS) $(mflush_string_DEPENDENCIES) $(EXTRA_mflush_string_DEPENDENCIES) 
+	@rm -f mflush_string$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_string_OBJECTS) $(mflush_string_LDADD) $(LIBS)
+
+mflush_type$(EXEEXT): $(mflush_type_OBJECTS) $(mflush_type_DEPENDENCIES) $(EXTRA_mflush_type_DEPENDENCIES) 
+	@rm -f mflush_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_type_OBJECTS) $(mflush_type_LDADD) $(LIBS)
+
+mflush_type4$(EXEEXT): $(mflush_type4_OBJECTS) $(mflush_type4_DEPENDENCIES) $(EXTRA_mflush_type4_DEPENDENCIES) 
+	@rm -f mflush_type4$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_type4_OBJECTS) $(mflush_type4_LDADD) $(LIBS)
+
+mflush_windop$(EXEEXT): $(mflush_windop_OBJECTS) $(mflush_windop_DEPENDENCIES) $(EXTRA_mflush_windop_DEPENDENCIES) 
+	@rm -f mflush_windop$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(mflush_windop_OBJECTS) $(mflush_windop_LDADD) $(LIBS)
+
 move_affix$(EXEEXT): $(move_affix_OBJECTS) $(move_affix_DEPENDENCIES) $(EXTRA_move_affix_DEPENDENCIES) 
 	@rm -f move_affix$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(move_affix_OBJECTS) $(move_affix_LDADD) $(LIBS)
@@ -9927,6 +13730,10 @@ move_alias$(EXEEXT): $(move_alias_OBJECTS) $(move_alias_DEPENDENCIES) $(EXTRA_mo
 	@rm -f move_alias$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(move_alias_OBJECTS) $(move_alias_LDADD) $(LIBS)
 
+move_code$(EXEEXT): $(move_code_OBJECTS) $(move_code_DEPENDENCIES) $(EXTRA_move_code_DEPENDENCIES) 
+	@rm -f move_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(move_code_OBJECTS) $(move_code_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)
 	$(AM_V_CCLD)$(LINK) $(move_data_enc_ar_OBJECTS) $(move_data_enc_ar_LDADD) $(LIBS)
@@ -9935,6 +13742,10 @@ move_data_enc_ra$(EXEEXT): $(move_data_enc_ra_OBJECTS) $(move_data_enc_ra_DEPEND
 	@rm -f move_data_enc_ra$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(move_data_enc_ra_OBJECTS) $(move_data_enc_ra_LDADD) $(LIBS)
 
+move_data_enc_un$(EXEEXT): $(move_data_enc_un_OBJECTS) $(move_data_enc_un_DEPENDENCIES) $(EXTRA_move_data_enc_un_DEPENDENCIES) 
+	@rm -f move_data_enc_un$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(move_data_enc_un_OBJECTS) $(move_data_enc_un_LDADD) $(LIBS)
+
 move_data_endian$(EXEEXT): $(move_data_endian_OBJECTS) $(move_data_endian_DEPENDENCIES) $(EXTRA_move_data_endian_DEPENDENCIES) 
 	@rm -f move_data_endian$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(move_data_endian_OBJECTS) $(move_data_endian_LDADD) $(LIBS)
@@ -9951,6 +13762,14 @@ move_data_nop$(EXEEXT): $(move_data_nop_OBJECTS) $(move_data_nop_DEPENDENCIES) $
 	@rm -f move_data_nop$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(move_data_nop_OBJECTS) $(move_data_nop_LDADD) $(LIBS)
 
+move_data_prot$(EXEEXT): $(move_data_prot_OBJECTS) $(move_data_prot_DEPENDENCIES) $(EXTRA_move_data_prot_DEPENDENCIES) 
+	@rm -f move_data_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(move_data_prot_OBJECTS) $(move_data_prot_LDADD) $(LIBS)
+
+move_entype$(EXEEXT): $(move_entype_OBJECTS) $(move_entype_DEPENDENCIES) $(EXTRA_move_entype_DEPENDENCIES) 
+	@rm -f move_entype$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(move_entype_OBJECTS) $(move_entype_LDADD) $(LIBS)
+
 move_index$(EXEEXT): $(move_index_OBJECTS) $(move_index_DEPENDENCIES) $(EXTRA_move_index_DEPENDENCIES) 
 	@rm -f move_index$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(move_index_OBJECTS) $(move_index_LDADD) $(LIBS)
@@ -9963,14 +13782,34 @@ move_move$(EXEEXT): $(move_move_OBJECTS) $(move_move_DEPENDENCIES) $(EXTRA_move_
 	@rm -f move_move$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(move_move_OBJECTS) $(move_move_LDADD) $(LIBS)
 
+move_nop$(EXEEXT): $(move_nop_OBJECTS) $(move_nop_DEPENDENCIES) $(EXTRA_move_nop_DEPENDENCIES) 
+	@rm -f move_nop$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(move_nop_OBJECTS) $(move_nop_LDADD) $(LIBS)
+
+move_ns$(EXEEXT): $(move_ns_OBJECTS) $(move_ns_DEPENDENCIES) $(EXTRA_move_ns_DEPENDENCIES) 
+	@rm -f move_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(move_ns_OBJECTS) $(move_ns_LDADD) $(LIBS)
+
+move_nsns$(EXEEXT): $(move_nsns_OBJECTS) $(move_nsns_DEPENDENCIES) $(EXTRA_move_nsns_DEPENDENCIES) 
+	@rm -f move_nsns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(move_nsns_OBJECTS) $(move_nsns_LDADD) $(LIBS)
+
 move_protect$(EXEEXT): $(move_protect_OBJECTS) $(move_protect_DEPENDENCIES) $(EXTRA_move_protect_DEPENDENCIES) 
 	@rm -f move_protect$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(move_protect_OBJECTS) $(move_protect_LDADD) $(LIBS)
 
+move_rdonly$(EXEEXT): $(move_rdonly_OBJECTS) $(move_rdonly_DEPENDENCIES) $(EXTRA_move_rdonly_DEPENDENCIES) 
+	@rm -f move_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(move_rdonly_OBJECTS) $(move_rdonly_LDADD) $(LIBS)
+
 move_subdir$(EXEEXT): $(move_subdir_OBJECTS) $(move_subdir_DEPENDENCIES) $(EXTRA_move_subdir_DEPENDENCIES) 
 	@rm -f move_subdir$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(move_subdir_OBJECTS) $(move_subdir_LDADD) $(LIBS)
 
+move_unkenc$(EXEEXT): $(move_unkenc_OBJECTS) $(move_unkenc_DEPENDENCIES) $(EXTRA_move_unkenc_DEPENDENCIES) 
+	@rm -f move_unkenc$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(move_unkenc_OBJECTS) $(move_unkenc_LDADD) $(LIBS)
+
 name_affix$(EXEEXT): $(name_affix_OBJECTS) $(name_affix_DEPENDENCIES) $(EXTRA_name_affix_DEPENDENCIES) 
 	@rm -f name_affix$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(name_affix_OBJECTS) $(name_affix_LDADD) $(LIBS)
@@ -9983,10 +13822,18 @@ name_alias$(EXEEXT): $(name_alias_OBJECTS) $(name_alias_DEPENDENCIES) $(EXTRA_na
 	@rm -f name_alias$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(name_alias_OBJECTS) $(name_alias_LDADD) $(LIBS)
 
+name_code$(EXEEXT): $(name_code_OBJECTS) $(name_code_DEPENDENCIES) $(EXTRA_name_code_DEPENDENCIES) 
+	@rm -f name_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(name_code_OBJECTS) $(name_code_LDADD) $(LIBS)
+
 name_dangle$(EXEEXT): $(name_dangle_OBJECTS) $(name_dangle_DEPENDENCIES) $(EXTRA_name_dangle_DEPENDENCIES) 
 	@rm -f name_dangle$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(name_dangle_OBJECTS) $(name_dangle_LDADD) $(LIBS)
 
+name_dot10$(EXEEXT): $(name_dot10_OBJECTS) $(name_dot10_DEPENDENCIES) $(EXTRA_name_dot10_DEPENDENCIES) 
+	@rm -f name_dot10$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(name_dot10_OBJECTS) $(name_dot10_LDADD) $(LIBS)
+
 name_dot5$(EXEEXT): $(name_dot5_OBJECTS) $(name_dot5_DEPENDENCIES) $(EXTRA_name_dot5_DEPENDENCIES) 
 	@rm -f name_dot5$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(name_dot5_OBJECTS) $(name_dot5_LDADD) $(LIBS)
@@ -10003,10 +13850,18 @@ name_dup$(EXEEXT): $(name_dup_OBJECTS) $(name_dup_DEPENDENCIES) $(EXTRA_name_dup
 	@rm -f name_dup$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(name_dup_OBJECTS) $(name_dup_LDADD) $(LIBS)
 
+name_index$(EXEEXT): $(name_index_OBJECTS) $(name_index_DEPENDENCIES) $(EXTRA_name_index_DEPENDENCIES) 
+	@rm -f name_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(name_index_OBJECTS) $(name_index_LDADD) $(LIBS)
+
 name_meta$(EXEEXT): $(name_meta_OBJECTS) $(name_meta_DEPENDENCIES) $(EXTRA_name_meta_DEPENDENCIES) 
 	@rm -f name_meta$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(name_meta_OBJECTS) $(name_meta_LDADD) $(LIBS)
 
+name_meta2$(EXEEXT): $(name_meta2_OBJECTS) $(name_meta2_DEPENDENCIES) $(EXTRA_name_meta2_DEPENDENCIES) 
+	@rm -f name_meta2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(name_meta2_OBJECTS) $(name_meta2_LDADD) $(LIBS)
+
 name_move$(EXEEXT): $(name_move_OBJECTS) $(name_move_DEPENDENCIES) $(EXTRA_name_move_DEPENDENCIES) 
 	@rm -f name_move$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(name_move_OBJECTS) $(name_move_LDADD) $(LIBS)
@@ -10019,6 +13874,26 @@ name_name$(EXEEXT): $(name_name_OBJECTS) $(name_name_DEPENDENCIES) $(EXTRA_name_
 	@rm -f name_name$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(name_name_OBJECTS) $(name_name_LDADD) $(LIBS)
 
+name_ns$(EXEEXT): $(name_ns_OBJECTS) $(name_ns_DEPENDENCIES) $(EXTRA_name_ns_DEPENDENCIES) 
+	@rm -f name_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(name_ns_OBJECTS) $(name_ns_LDADD) $(LIBS)
+
+name_ns2$(EXEEXT): $(name_ns2_OBJECTS) $(name_ns2_DEPENDENCIES) $(EXTRA_name_ns2_DEPENDENCIES) 
+	@rm -f name_ns2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(name_ns2_OBJECTS) $(name_ns2_LDADD) $(LIBS)
+
+name_nsdot$(EXEEXT): $(name_nsdot_OBJECTS) $(name_nsdot_DEPENDENCIES) $(EXTRA_name_nsdot_DEPENDENCIES) 
+	@rm -f name_nsdot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(name_nsdot_OBJECTS) $(name_nsdot_LDADD) $(LIBS)
+
+name_prot$(EXEEXT): $(name_prot_OBJECTS) $(name_prot_DEPENDENCIES) $(EXTRA_name_prot_DEPENDENCIES) 
+	@rm -f name_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(name_prot_OBJECTS) $(name_prot_LDADD) $(LIBS)
+
+name_rdonly$(EXEEXT): $(name_rdonly_OBJECTS) $(name_rdonly_DEPENDENCIES) $(EXTRA_name_rdonly_DEPENDENCIES) 
+	@rm -f name_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(name_rdonly_OBJECTS) $(name_rdonly_LDADD) $(LIBS)
+
 name_updb$(EXEEXT): $(name_updb_OBJECTS) $(name_updb_DEPENDENCIES) $(EXTRA_name_updb_DEPENDENCIES) 
 	@rm -f name_updb$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(name_updb_OBJECTS) $(name_updb_LDADD) $(LIBS)
@@ -10043,10 +13918,18 @@ name_updb_const_alias$(EXEEXT): $(name_updb_const_alias_OBJECTS) $(name_updb_con
 	@rm -f name_updb_const_alias$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(name_updb_const_alias_OBJECTS) $(name_updb_const_alias_LDADD) $(LIBS)
 
+name_updb_sarray$(EXEEXT): $(name_updb_sarray_OBJECTS) $(name_updb_sarray_DEPENDENCIES) $(EXTRA_name_updb_sarray_DEPENDENCIES) 
+	@rm -f name_updb_sarray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(name_updb_sarray_OBJECTS) $(name_updb_sarray_LDADD) $(LIBS)
+
 native_bit$(EXEEXT): $(native_bit_OBJECTS) $(native_bit_DEPENDENCIES) $(EXTRA_native_bit_DEPENDENCIES) 
 	@rm -f native_bit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(native_bit_OBJECTS) $(native_bit_LDADD) $(LIBS)
 
+native_code$(EXEEXT): $(native_code_OBJECTS) $(native_code_DEPENDENCIES) $(EXTRA_native_code_DEPENDENCIES) 
+	@rm -f native_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(native_code_OBJECTS) $(native_code_LDADD) $(LIBS)
+
 native_const$(EXEEXT): $(native_const_OBJECTS) $(native_const_DEPENDENCIES) $(EXTRA_native_const_DEPENDENCIES) 
 	@rm -f native_const$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(native_const_OBJECTS) $(native_const_LDADD) $(LIBS)
@@ -10119,6 +14002,14 @@ native_recip_cmpscal$(EXEEXT): $(native_recip_cmpscal_OBJECTS) $(native_recip_cm
 	@rm -f native_recip_cmpscal$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(native_recip_cmpscal_OBJECTS) $(native_recip_cmpscal_LDADD) $(LIBS)
 
+native_recurse$(EXEEXT): $(native_recurse_OBJECTS) $(native_recurse_DEPENDENCIES) $(EXTRA_native_recurse_DEPENDENCIES) 
+	@rm -f native_recurse$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(native_recurse_OBJECTS) $(native_recurse_LDADD) $(LIBS)
+
+native_reprz$(EXEEXT): $(native_reprz_OBJECTS) $(native_reprz_DEPENDENCIES) $(EXTRA_native_reprz_DEPENDENCIES) 
+	@rm -f native_reprz$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(native_reprz_OBJECTS) $(native_reprz_LDADD) $(LIBS)
+
 native_sbit$(EXEEXT): $(native_sbit_OBJECTS) $(native_sbit_DEPENDENCIES) $(EXTRA_native_sbit_DEPENDENCIES) 
 	@rm -f native_sbit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(native_sbit_OBJECTS) $(native_sbit_LDADD) $(LIBS)
@@ -10131,6 +14022,10 @@ nentries_alias$(EXEEXT): $(nentries_alias_OBJECTS) $(nentries_alias_DEPENDENCIES
 	@rm -f nentries_alias$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(nentries_alias_OBJECTS) $(nentries_alias_LDADD) $(LIBS)
 
+nentries_entype$(EXEEXT): $(nentries_entype_OBJECTS) $(nentries_entype_DEPENDENCIES) $(EXTRA_nentries_entype_DEPENDENCIES) 
+	@rm -f nentries_entype$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(nentries_entype_OBJECTS) $(nentries_entype_LDADD) $(LIBS)
+
 nentries_hidden$(EXEEXT): $(nentries_hidden_OBJECTS) $(nentries_hidden_DEPENDENCIES) $(EXTRA_nentries_hidden_DEPENDENCIES) 
 	@rm -f nentries_hidden$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(nentries_hidden_OBJECTS) $(nentries_hidden_LDADD) $(LIBS)
@@ -10219,6 +14114,10 @@ nmeta_parent$(EXEEXT): $(nmeta_parent_OBJECTS) $(nmeta_parent_DEPENDENCIES) $(EX
 	@rm -f nmeta_parent$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(nmeta_parent_OBJECTS) $(nmeta_parent_LDADD) $(LIBS)
 
+nmeta_parent_meta$(EXEEXT): $(nmeta_parent_meta_OBJECTS) $(nmeta_parent_meta_DEPENDENCIES) $(EXTRA_nmeta_parent_meta_DEPENDENCIES) 
+	@rm -f nmeta_parent_meta$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(nmeta_parent_meta_OBJECTS) $(nmeta_parent_meta_LDADD) $(LIBS)
+
 nmeta_type$(EXEEXT): $(nmeta_type_OBJECTS) $(nmeta_type_DEPENDENCIES) $(EXTRA_nmeta_type_DEPENDENCIES) 
 	@rm -f nmeta_type$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(nmeta_type_OBJECTS) $(nmeta_type_LDADD) $(LIBS)
@@ -10359,6 +14258,10 @@ parse_alias_dup$(EXEEXT): $(parse_alias_dup_OBJECTS) $(parse_alias_dup_DEPENDENC
 	@rm -f parse_alias_dup$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_alias_dup_OBJECTS) $(parse_alias_dup_LDADD) $(LIBS)
 
+parse_alias_loop$(EXEEXT): $(parse_alias_loop_OBJECTS) $(parse_alias_loop_DEPENDENCIES) $(EXTRA_parse_alias_loop_DEPENDENCIES) 
+	@rm -f parse_alias_loop$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_alias_loop_OBJECTS) $(parse_alias_loop_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)
 	$(AM_V_CCLD)$(LINK) $(parse_alias_meta_OBJECTS) $(parse_alias_meta_LDADD) $(LIBS)
@@ -10367,6 +14270,10 @@ parse_alias_missing$(EXEEXT): $(parse_alias_missing_OBJECTS) $(parse_alias_missi
 	@rm -f parse_alias_missing$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_alias_missing_OBJECTS) $(parse_alias_missing_LDADD) $(LIBS)
 
+parse_alias_ncols$(EXEEXT): $(parse_alias_ncols_OBJECTS) $(parse_alias_ncols_DEPENDENCIES) $(EXTRA_parse_alias_ncols_DEPENDENCIES) 
+	@rm -f parse_alias_ncols$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_alias_ncols_OBJECTS) $(parse_alias_ncols_LDADD) $(LIBS)
+
 parse_badline$(EXEEXT): $(parse_badline_OBJECTS) $(parse_badline_DEPENDENCIES) $(EXTRA_parse_badline_DEPENDENCIES) 
 	@rm -f parse_badline$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_badline_OBJECTS) $(parse_badline_LDADD) $(LIBS)
@@ -10407,6 +14314,14 @@ parse_carray_long$(EXEEXT): $(parse_carray_long_OBJECTS) $(parse_carray_long_DEP
 	@rm -f parse_carray_long$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_carray_long_OBJECTS) $(parse_carray_long_LDADD) $(LIBS)
 
+parse_carray_ncols$(EXEEXT): $(parse_carray_ncols_OBJECTS) $(parse_carray_ncols_DEPENDENCIES) $(EXTRA_parse_carray_ncols_DEPENDENCIES) 
+	@rm -f parse_carray_ncols$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_carray_ncols_OBJECTS) $(parse_carray_ncols_LDADD) $(LIBS)
+
+parse_carray_type$(EXEEXT): $(parse_carray_type_OBJECTS) $(parse_carray_type_DEPENDENCIES) $(EXTRA_parse_carray_type_DEPENDENCIES) 
+	@rm -f parse_carray_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_carray_type_OBJECTS) $(parse_carray_type_LDADD) $(LIBS)
+
 parse_const$(EXEEXT): $(parse_const_OBJECTS) $(parse_const_DEPENDENCIES) $(EXTRA_parse_const_DEPENDENCIES) 
 	@rm -f parse_const$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_const_OBJECTS) $(parse_const_LDADD) $(LIBS)
@@ -10419,6 +14334,10 @@ parse_const_ncols$(EXEEXT): $(parse_const_ncols_OBJECTS) $(parse_const_ncols_DEP
 	@rm -f parse_const_ncols$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_const_ncols_OBJECTS) $(parse_const_ncols_LDADD) $(LIBS)
 
+parse_const_type$(EXEEXT): $(parse_const_type_OBJECTS) $(parse_const_type_DEPENDENCIES) $(EXTRA_parse_const_type_DEPENDENCIES) 
+	@rm -f parse_const_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_const_type_OBJECTS) $(parse_const_type_LDADD) $(LIBS)
+
 parse_divide$(EXEEXT): $(parse_divide_OBJECTS) $(parse_divide_DEPENDENCIES) $(EXTRA_parse_divide_DEPENDENCIES) 
 	@rm -f parse_divide$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_divide_OBJECTS) $(parse_divide_LDADD) $(LIBS)
@@ -10439,6 +14358,10 @@ parse_endian_bad$(EXEEXT): $(parse_endian_bad_OBJECTS) $(parse_endian_bad_DEPEND
 	@rm -f parse_endian_bad$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_endian_bad_OBJECTS) $(parse_endian_bad_LDADD) $(LIBS)
 
+parse_endian_bad2$(EXEEXT): $(parse_endian_bad2_OBJECTS) $(parse_endian_bad2_DEPENDENCIES) $(EXTRA_parse_endian_bad2_DEPENDENCIES) 
+	@rm -f parse_endian_bad2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_endian_bad2_OBJECTS) $(parse_endian_bad2_LDADD) $(LIBS)
+
 parse_endian_big$(EXEEXT): $(parse_endian_big_OBJECTS) $(parse_endian_big_DEPENDENCIES) $(EXTRA_parse_endian_big_DEPENDENCIES) 
 	@rm -f parse_endian_big$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_endian_big_OBJECTS) $(parse_endian_big_LDADD) $(LIBS)
@@ -10459,6 +14382,10 @@ parse_eol$(EXEEXT): $(parse_eol_OBJECTS) $(parse_eol_DEPENDENCIES) $(EXTRA_parse
 	@rm -f parse_eol$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_eol_OBJECTS) $(parse_eol_LDADD) $(LIBS)
 
+parse_esc$(EXEEXT): $(parse_esc_OBJECTS) $(parse_esc_DEPENDENCIES) $(EXTRA_parse_esc_DEPENDENCIES) 
+	@rm -f parse_esc$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_esc_OBJECTS) $(parse_esc_LDADD) $(LIBS)
+
 parse_foffs$(EXEEXT): $(parse_foffs_OBJECTS) $(parse_foffs_DEPENDENCIES) $(EXTRA_parse_foffs_DEPENDENCIES) 
 	@rm -f parse_foffs$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_foffs_OBJECTS) $(parse_foffs_LDADD) $(LIBS)
@@ -10483,10 +14410,18 @@ parse_hidden_field$(EXEEXT): $(parse_hidden_field_OBJECTS) $(parse_hidden_field_
 	@rm -f parse_hidden_field$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_hidden_field_OBJECTS) $(parse_hidden_field_LDADD) $(LIBS)
 
+parse_hidden_frag$(EXEEXT): $(parse_hidden_frag_OBJECTS) $(parse_hidden_frag_DEPENDENCIES) $(EXTRA_parse_hidden_frag_DEPENDENCIES) 
+	@rm -f parse_hidden_frag$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_hidden_frag_OBJECTS) $(parse_hidden_frag_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)
 	$(AM_V_CCLD)$(LINK) $(parse_hidden_meta_OBJECTS) $(parse_hidden_meta_LDADD) $(LIBS)
 
+parse_huge$(EXEEXT): $(parse_huge_OBJECTS) $(parse_huge_DEPENDENCIES) $(EXTRA_parse_huge_DEPENDENCIES) 
+	@rm -f parse_huge$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_huge_OBJECTS) $(parse_huge_LDADD) $(LIBS)
+
 parse_include$(EXEEXT): $(parse_include_OBJECTS) $(parse_include_DEPENDENCIES) $(EXTRA_parse_include_DEPENDENCIES) 
 	@rm -f parse_include$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_include_OBJECTS) $(parse_include_LDADD) $(LIBS)
@@ -10515,10 +14450,50 @@ parse_include_loop$(EXEEXT): $(parse_include_loop_OBJECTS) $(parse_include_loop_
 	@rm -f parse_include_loop$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_include_loop_OBJECTS) $(parse_include_loop_LDADD) $(LIBS)
 
+parse_include_nodir$(EXEEXT): $(parse_include_nodir_OBJECTS) $(parse_include_nodir_DEPENDENCIES) $(EXTRA_parse_include_nodir_DEPENDENCIES) 
+	@rm -f parse_include_nodir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_include_nodir_OBJECTS) $(parse_include_nodir_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)
 	$(AM_V_CCLD)$(LINK) $(parse_include_nonexistent_OBJECTS) $(parse_include_nonexistent_LDADD) $(LIBS)
 
+parse_include_ns$(EXEEXT): $(parse_include_ns_OBJECTS) $(parse_include_ns_DEPENDENCIES) $(EXTRA_parse_include_ns_DEPENDENCIES) 
+	@rm -f parse_include_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_include_ns_OBJECTS) $(parse_include_ns_LDADD) $(LIBS)
+
+parse_include_ns2$(EXEEXT): $(parse_include_ns2_OBJECTS) $(parse_include_ns2_DEPENDENCIES) $(EXTRA_parse_include_ns2_DEPENDENCIES) 
+	@rm -f parse_include_ns2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_include_ns2_OBJECTS) $(parse_include_ns2_LDADD) $(LIBS)
+
+parse_include_nsabs$(EXEEXT): $(parse_include_nsabs_OBJECTS) $(parse_include_nsabs_DEPENDENCIES) $(EXTRA_parse_include_nsabs_DEPENDENCIES) 
+	@rm -f parse_include_nsabs$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_include_nsabs_OBJECTS) $(parse_include_nsabs_LDADD) $(LIBS)
+
+parse_include_nsinh$(EXEEXT): $(parse_include_nsinh_OBJECTS) $(parse_include_nsinh_DEPENDENCIES) $(EXTRA_parse_include_nsinh_DEPENDENCIES) 
+	@rm -f parse_include_nsinh$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_include_nsinh_OBJECTS) $(parse_include_nsinh_LDADD) $(LIBS)
+
+parse_include_nspop$(EXEEXT): $(parse_include_nspop_OBJECTS) $(parse_include_nspop_DEPENDENCIES) $(EXTRA_parse_include_nspop_DEPENDENCIES) 
+	@rm -f parse_include_nspop$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_include_nspop_OBJECTS) $(parse_include_nspop_LDADD) $(LIBS)
+
+parse_include_nsrabs$(EXEEXT): $(parse_include_nsrabs_OBJECTS) $(parse_include_nsrabs_DEPENDENCIES) $(EXTRA_parse_include_nsrabs_DEPENDENCIES) 
+	@rm -f parse_include_nsrabs$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_include_nsrabs_OBJECTS) $(parse_include_nsrabs_LDADD) $(LIBS)
+
+parse_include_nsrainh$(EXEEXT): $(parse_include_nsrainh_OBJECTS) $(parse_include_nsrainh_DEPENDENCIES) $(EXTRA_parse_include_nsrainh_DEPENDENCIES) 
+	@rm -f parse_include_nsrainh$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_include_nsrainh_OBJECTS) $(parse_include_nsrainh_LDADD) $(LIBS)
+
+parse_include_nsrinh$(EXEEXT): $(parse_include_nsrinh_OBJECTS) $(parse_include_nsrinh_DEPENDENCIES) $(EXTRA_parse_include_nsrinh_DEPENDENCIES) 
+	@rm -f parse_include_nsrinh$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_include_nsrinh_OBJECTS) $(parse_include_nsrinh_LDADD) $(LIBS)
+
+parse_include_nsroot$(EXEEXT): $(parse_include_nsroot_OBJECTS) $(parse_include_nsroot_DEPENDENCIES) $(EXTRA_parse_include_nsroot_DEPENDENCIES) 
+	@rm -f parse_include_nsroot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_include_nsroot_OBJECTS) $(parse_include_nsroot_LDADD) $(LIBS)
+
 parse_include_prefix$(EXEEXT): $(parse_include_prefix_OBJECTS) $(parse_include_prefix_DEPENDENCIES) $(EXTRA_parse_include_prefix_DEPENDENCIES) 
 	@rm -f parse_include_prefix$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_include_prefix_OBJECTS) $(parse_include_prefix_LDADD) $(LIBS)
@@ -10559,6 +14534,10 @@ parse_index$(EXEEXT): $(parse_index_OBJECTS) $(parse_index_DEPENDENCIES) $(EXTRA
 	@rm -f parse_index$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_index_OBJECTS) $(parse_index_LDADD) $(LIBS)
 
+parse_indir$(EXEEXT): $(parse_indir_OBJECTS) $(parse_indir_DEPENDENCIES) $(EXTRA_parse_indir_DEPENDENCIES) 
+	@rm -f parse_indir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_indir_OBJECTS) $(parse_indir_LDADD) $(LIBS)
+
 parse_lincom$(EXEEXT): $(parse_lincom_OBJECTS) $(parse_lincom_DEPENDENCIES) $(EXTRA_parse_lincom_DEPENDENCIES) 
 	@rm -f parse_lincom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_lincom_OBJECTS) $(parse_lincom_LDADD) $(LIBS)
@@ -10687,6 +14666,10 @@ parse_meta_meta$(EXEEXT): $(parse_meta_meta_OBJECTS) $(parse_meta_meta_DEPENDENC
 	@rm -f parse_meta_meta$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_meta_meta_OBJECTS) $(parse_meta_meta_LDADD) $(LIBS)
 
+parse_meta_ncols$(EXEEXT): $(parse_meta_ncols_OBJECTS) $(parse_meta_ncols_DEPENDENCIES) $(EXTRA_parse_meta_ncols_DEPENDENCIES) 
+	@rm -f parse_meta_ncols$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_meta_ncols_OBJECTS) $(parse_meta_ncols_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)
 	$(AM_V_CCLD)$(LINK) $(parse_meta_parent_OBJECTS) $(parse_meta_parent_LDADD) $(LIBS)
@@ -10703,6 +14686,10 @@ parse_mplex_ncols$(EXEEXT): $(parse_mplex_ncols_OBJECTS) $(parse_mplex_ncols_DEP
 	@rm -f parse_mplex_ncols$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_mplex_ncols_OBJECTS) $(parse_mplex_ncols_LDADD) $(LIBS)
 
+parse_mplex_neg$(EXEEXT): $(parse_mplex_neg_OBJECTS) $(parse_mplex_neg_DEPENDENCIES) $(EXTRA_parse_mplex_neg_DEPENDENCIES) 
+	@rm -f parse_mplex_neg$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_mplex_neg_OBJECTS) $(parse_mplex_neg_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)
 	$(AM_V_CCLD)$(LINK) $(parse_mplex_nomax_OBJECTS) $(parse_mplex_nomax_LDADD) $(LIBS)
@@ -10731,14 +14718,102 @@ parse_name_ext$(EXEEXT): $(parse_name_ext_OBJECTS) $(parse_name_ext_DEPENDENCIES
 	@rm -f parse_name_ext$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_name_ext_OBJECTS) $(parse_name_ext_LDADD) $(LIBS)
 
-parse_name_pedantic$(EXEEXT): $(parse_name_pedantic_OBJECTS) $(parse_name_pedantic_DEPENDENCIES) $(EXTRA_parse_name_pedantic_DEPENDENCIES) 
-	@rm -f parse_name_pedantic$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(parse_name_pedantic_OBJECTS) $(parse_name_pedantic_LDADD) $(LIBS)
-
 parse_ncols$(EXEEXT): $(parse_ncols_OBJECTS) $(parse_ncols_DEPENDENCIES) $(EXTRA_parse_ncols_DEPENDENCIES) 
 	@rm -f parse_ncols$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_ncols_OBJECTS) $(parse_ncols_LDADD) $(LIBS)
 
+parse_ns$(EXEEXT): $(parse_ns_OBJECTS) $(parse_ns_DEPENDENCIES) $(EXTRA_parse_ns_DEPENDENCIES) 
+	@rm -f parse_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_OBJECTS) $(parse_ns_LDADD) $(LIBS)
+
+parse_ns_dot$(EXEEXT): $(parse_ns_dot_OBJECTS) $(parse_ns_dot_DEPENDENCIES) $(EXTRA_parse_ns_dot_DEPENDENCIES) 
+	@rm -f parse_ns_dot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_dot_OBJECTS) $(parse_ns_dot_LDADD) $(LIBS)
+
+parse_ns_dotdot$(EXEEXT): $(parse_ns_dotdot_OBJECTS) $(parse_ns_dotdot_DEPENDENCIES) $(EXTRA_parse_ns_dotdot_DEPENDENCIES) 
+	@rm -f parse_ns_dotdot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_dotdot_OBJECTS) $(parse_ns_dotdot_LDADD) $(LIBS)
+
+parse_ns_dotdotns$(EXEEXT): $(parse_ns_dotdotns_OBJECTS) $(parse_ns_dotdotns_DEPENDENCIES) $(EXTRA_parse_ns_dotdotns_DEPENDENCIES) 
+	@rm -f parse_ns_dotdotns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_dotdotns_OBJECTS) $(parse_ns_dotdotns_LDADD) $(LIBS)
+
+parse_ns_dotns$(EXEEXT): $(parse_ns_dotns_OBJECTS) $(parse_ns_dotns_DEPENDENCIES) $(EXTRA_parse_ns_dotns_DEPENDENCIES) 
+	@rm -f parse_ns_dotns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_dotns_OBJECTS) $(parse_ns_dotns_LDADD) $(LIBS)
+
+parse_ns_include$(EXEEXT): $(parse_ns_include_OBJECTS) $(parse_ns_include_DEPENDENCIES) $(EXTRA_parse_ns_include_DEPENDENCIES) 
+	@rm -f parse_ns_include$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_include_OBJECTS) $(parse_ns_include_LDADD) $(LIBS)
+
+parse_ns_include_ns$(EXEEXT): $(parse_ns_include_ns_OBJECTS) $(parse_ns_include_ns_DEPENDENCIES) $(EXTRA_parse_ns_include_ns_DEPENDENCIES) 
+	@rm -f parse_ns_include_ns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_include_ns_OBJECTS) $(parse_ns_include_ns_LDADD) $(LIBS)
+
+parse_ns_ndotdots$(EXEEXT): $(parse_ns_ndotdots_OBJECTS) $(parse_ns_ndotdots_DEPENDENCIES) $(EXTRA_parse_ns_ndotdots_DEPENDENCIES) 
+	@rm -f parse_ns_ndotdots$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_ndotdots_OBJECTS) $(parse_ns_ndotdots_LDADD) $(LIBS)
+
+parse_ns_ndots$(EXEEXT): $(parse_ns_ndots_OBJECTS) $(parse_ns_ndots_DEPENDENCIES) $(EXTRA_parse_ns_ndots_DEPENDENCIES) 
+	@rm -f parse_ns_ndots$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_ndots_OBJECTS) $(parse_ns_ndots_LDADD) $(LIBS)
+
+parse_ns_nsdot$(EXEEXT): $(parse_ns_nsdot_OBJECTS) $(parse_ns_nsdot_DEPENDENCIES) $(EXTRA_parse_ns_nsdot_DEPENDENCIES) 
+	@rm -f parse_ns_nsdot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_nsdot_OBJECTS) $(parse_ns_nsdot_LDADD) $(LIBS)
+
+parse_ns_nsdotdot$(EXEEXT): $(parse_ns_nsdotdot_OBJECTS) $(parse_ns_nsdotdot_DEPENDENCIES) $(EXTRA_parse_ns_nsdotdot_DEPENDENCIES) 
+	@rm -f parse_ns_nsdotdot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ns_nsdotdot_OBJECTS) $(parse_ns_nsdotdot_LDADD) $(LIBS)
+
+parse_nsf$(EXEEXT): $(parse_nsf_OBJECTS) $(parse_nsf_DEPENDENCIES) $(EXTRA_parse_nsf_DEPENDENCIES) 
+	@rm -f parse_nsf$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_OBJECTS) $(parse_nsf_LDADD) $(LIBS)
+
+parse_nsf_abs$(EXEEXT): $(parse_nsf_abs_OBJECTS) $(parse_nsf_abs_DEPENDENCIES) $(EXTRA_parse_nsf_abs_DEPENDENCIES) 
+	@rm -f parse_nsf_abs$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_abs_OBJECTS) $(parse_nsf_abs_LDADD) $(LIBS)
+
+parse_nsf_alias$(EXEEXT): $(parse_nsf_alias_OBJECTS) $(parse_nsf_alias_DEPENDENCIES) $(EXTRA_parse_nsf_alias_DEPENDENCIES) 
+	@rm -f parse_nsf_alias$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_alias_OBJECTS) $(parse_nsf_alias_LDADD) $(LIBS)
+
+parse_nsf_dot$(EXEEXT): $(parse_nsf_dot_OBJECTS) $(parse_nsf_dot_DEPENDENCIES) $(EXTRA_parse_nsf_dot_DEPENDENCIES) 
+	@rm -f parse_nsf_dot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_dot_OBJECTS) $(parse_nsf_dot_LDADD) $(LIBS)
+
+parse_nsf_hide$(EXEEXT): $(parse_nsf_hide_OBJECTS) $(parse_nsf_hide_DEPENDENCIES) $(EXTRA_parse_nsf_hide_DEPENDENCIES) 
+	@rm -f parse_nsf_hide$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_hide_OBJECTS) $(parse_nsf_hide_LDADD) $(LIBS)
+
+parse_nsf_index$(EXEEXT): $(parse_nsf_index_OBJECTS) $(parse_nsf_index_DEPENDENCIES) $(EXTRA_parse_nsf_index_DEPENDENCIES) 
+	@rm -f parse_nsf_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_index_OBJECTS) $(parse_nsf_index_LDADD) $(LIBS)
+
+parse_nsf_meta$(EXEEXT): $(parse_nsf_meta_OBJECTS) $(parse_nsf_meta_DEPENDENCIES) $(EXTRA_parse_nsf_meta_DEPENDENCIES) 
+	@rm -f parse_nsf_meta$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_meta_OBJECTS) $(parse_nsf_meta_LDADD) $(LIBS)
+
+parse_nsf_meta2$(EXEEXT): $(parse_nsf_meta2_OBJECTS) $(parse_nsf_meta2_DEPENDENCIES) $(EXTRA_parse_nsf_meta2_DEPENDENCIES) 
+	@rm -f parse_nsf_meta2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_meta2_OBJECTS) $(parse_nsf_meta2_LDADD) $(LIBS)
+
+parse_nsf_ref$(EXEEXT): $(parse_nsf_ref_OBJECTS) $(parse_nsf_ref_DEPENDENCIES) $(EXTRA_parse_nsf_ref_DEPENDENCIES) 
+	@rm -f parse_nsf_ref$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_ref_OBJECTS) $(parse_nsf_ref_LDADD) $(LIBS)
+
+parse_nsf_refabs$(EXEEXT): $(parse_nsf_refabs_OBJECTS) $(parse_nsf_refabs_DEPENDENCIES) $(EXTRA_parse_nsf_refabs_DEPENDENCIES) 
+	@rm -f parse_nsf_refabs$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_refabs_OBJECTS) $(parse_nsf_refabs_LDADD) $(LIBS)
+
+parse_nsf_root$(EXEEXT): $(parse_nsf_root_OBJECTS) $(parse_nsf_root_DEPENDENCIES) $(EXTRA_parse_nsf_root_DEPENDENCIES) 
+	@rm -f parse_nsf_root$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_root_OBJECTS) $(parse_nsf_root_LDADD) $(LIBS)
+
+parse_nsf_sub$(EXEEXT): $(parse_nsf_sub_OBJECTS) $(parse_nsf_sub_DEPENDENCIES) $(EXTRA_parse_nsf_sub_DEPENDENCIES) 
+	@rm -f parse_nsf_sub$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_nsf_sub_OBJECTS) $(parse_nsf_sub_LDADD) $(LIBS)
+
 parse_octal_zero$(EXEEXT): $(parse_octal_zero_OBJECTS) $(parse_octal_zero_DEPENDENCIES) $(EXTRA_parse_octal_zero_DEPENDENCIES) 
 	@rm -f parse_octal_zero$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_octal_zero_OBJECTS) $(parse_octal_zero_LDADD) $(LIBS)
@@ -10831,6 +14906,10 @@ parse_recip$(EXEEXT): $(parse_recip_OBJECTS) $(parse_recip_DEPENDENCIES) $(EXTRA
 	@rm -f parse_recip$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_recip_OBJECTS) $(parse_recip_LDADD) $(LIBS)
 
+parse_recip_ncols$(EXEEXT): $(parse_recip_ncols_OBJECTS) $(parse_recip_ncols_DEPENDENCIES) $(EXTRA_parse_recip_ncols_DEPENDENCIES) 
+	@rm -f parse_recip_ncols$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_recip_ncols_OBJECTS) $(parse_recip_ncols_LDADD) $(LIBS)
+
 parse_ref$(EXEEXT): $(parse_ref_OBJECTS) $(parse_ref_DEPENDENCIES) $(EXTRA_parse_ref_DEPENDENCIES) 
 	@rm -f parse_ref$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_ref_OBJECTS) $(parse_ref_LDADD) $(LIBS)
@@ -10839,6 +14918,22 @@ parse_ref_nonexistent$(EXEEXT): $(parse_ref_nonexistent_OBJECTS) $(parse_ref_non
 	@rm -f parse_ref_nonexistent$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_ref_nonexistent_OBJECTS) $(parse_ref_nonexistent_LDADD) $(LIBS)
 
+parse_ref_type$(EXEEXT): $(parse_ref_type_OBJECTS) $(parse_ref_type_DEPENDENCIES) $(EXTRA_parse_ref_type_DEPENDENCIES) 
+	@rm -f parse_ref_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_ref_type_OBJECTS) $(parse_ref_type_LDADD) $(LIBS)
+
+parse_sarray$(EXEEXT): $(parse_sarray_OBJECTS) $(parse_sarray_DEPENDENCIES) $(EXTRA_parse_sarray_DEPENDENCIES) 
+	@rm -f parse_sarray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_sarray_OBJECTS) $(parse_sarray_LDADD) $(LIBS)
+
+parse_sarray_long$(EXEEXT): $(parse_sarray_long_OBJECTS) $(parse_sarray_long_DEPENDENCIES) $(EXTRA_parse_sarray_long_DEPENDENCIES) 
+	@rm -f parse_sarray_long$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_sarray_long_OBJECTS) $(parse_sarray_long_LDADD) $(LIBS)
+
+parse_sarray_ncols$(EXEEXT): $(parse_sarray_ncols_OBJECTS) $(parse_sarray_ncols_DEPENDENCIES) $(EXTRA_parse_sarray_ncols_DEPENDENCIES) 
+	@rm -f parse_sarray_ncols$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_sarray_ncols_OBJECTS) $(parse_sarray_ncols_LDADD) $(LIBS)
+
 parse_sbit$(EXEEXT): $(parse_sbit_OBJECTS) $(parse_sbit_DEPENDENCIES) $(EXTRA_parse_sbit_DEPENDENCIES) 
 	@rm -f parse_sbit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_sbit_OBJECTS) $(parse_sbit_LDADD) $(LIBS)
@@ -10855,6 +14950,10 @@ parse_scalar_repr$(EXEEXT): $(parse_scalar_repr_OBJECTS) $(parse_scalar_repr_DEP
 	@rm -f parse_scalar_repr$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_scalar_repr_OBJECTS) $(parse_scalar_repr_LDADD) $(LIBS)
 
+parse_sindir$(EXEEXT): $(parse_sindir_OBJECTS) $(parse_sindir_DEPENDENCIES) $(EXTRA_parse_sindir_DEPENDENCIES) 
+	@rm -f parse_sindir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(parse_sindir_OBJECTS) $(parse_sindir_LDADD) $(LIBS)
+
 parse_sort$(EXEEXT): $(parse_sort_OBJECTS) $(parse_sort_DEPENDENCIES) $(EXTRA_parse_sort_DEPENDENCIES) 
 	@rm -f parse_sort$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(parse_sort_OBJECTS) $(parse_sort_LDADD) $(LIBS)
@@ -10943,10 +15042,26 @@ protect_alter_all$(EXEEXT): $(protect_alter_all_OBJECTS) $(protect_alter_all_DEP
 	@rm -f protect_alter_all$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(protect_alter_all_OBJECTS) $(protect_alter_all_LDADD) $(LIBS)
 
+protect_alter_arg$(EXEEXT): $(protect_alter_arg_OBJECTS) $(protect_alter_arg_DEPENDENCIES) $(EXTRA_protect_alter_arg_DEPENDENCIES) 
+	@rm -f protect_alter_arg$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(protect_alter_arg_OBJECTS) $(protect_alter_arg_LDADD) $(LIBS)
+
+protect_alter_index$(EXEEXT): $(protect_alter_index_OBJECTS) $(protect_alter_index_DEPENDENCIES) $(EXTRA_protect_alter_index_DEPENDENCIES) 
+	@rm -f protect_alter_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(protect_alter_index_OBJECTS) $(protect_alter_index_LDADD) $(LIBS)
+
+protect_alter_rdonly$(EXEEXT): $(protect_alter_rdonly_OBJECTS) $(protect_alter_rdonly_DEPENDENCIES) $(EXTRA_protect_alter_rdonly_DEPENDENCIES) 
+	@rm -f protect_alter_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(protect_alter_rdonly_OBJECTS) $(protect_alter_rdonly_LDADD) $(LIBS)
+
 protect_get$(EXEEXT): $(protect_get_OBJECTS) $(protect_get_DEPENDENCIES) $(EXTRA_protect_get_DEPENDENCIES) 
 	@rm -f protect_get$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(protect_get_OBJECTS) $(protect_get_LDADD) $(LIBS)
 
+protect_index$(EXEEXT): $(protect_index_OBJECTS) $(protect_index_DEPENDENCIES) $(EXTRA_protect_index_DEPENDENCIES) 
+	@rm -f protect_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(protect_index_OBJECTS) $(protect_index_LDADD) $(LIBS)
+
 put64$(EXEEXT): $(put64_OBJECTS) $(put64_DEPENDENCIES) $(EXTRA_put64_DEPENDENCIES) 
 	@rm -f put64$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put64_OBJECTS) $(put64_LDADD) $(LIBS)
@@ -10959,6 +15074,10 @@ put_bit$(EXEEXT): $(put_bit_OBJECTS) $(put_bit_DEPENDENCIES) $(EXTRA_put_bit_DEP
 	@rm -f put_bit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_bit_OBJECTS) $(put_bit_LDADD) $(LIBS)
 
+put_bit_repr$(EXEEXT): $(put_bit_repr_OBJECTS) $(put_bit_repr_DEPENDENCIES) $(EXTRA_put_bit_repr_DEPENDENCIES) 
+	@rm -f put_bit_repr$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_bit_repr_OBJECTS) $(put_bit_repr_LDADD) $(LIBS)
+
 put_bof$(EXEEXT): $(put_bof_OBJECTS) $(put_bof_DEPENDENCIES) $(EXTRA_put_bof_DEPENDENCIES) 
 	@rm -f put_bof$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_bof_OBJECTS) $(put_bof_LDADD) $(LIBS)
@@ -10967,14 +15086,30 @@ put_carray$(EXEEXT): $(put_carray_OBJECTS) $(put_carray_DEPENDENCIES) $(EXTRA_pu
 	@rm -f put_carray$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_carray_OBJECTS) $(put_carray_LDADD) $(LIBS)
 
+put_carray_bad$(EXEEXT): $(put_carray_bad_OBJECTS) $(put_carray_bad_DEPENDENCIES) $(EXTRA_put_carray_bad_DEPENDENCIES) 
+	@rm -f put_carray_bad$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_carray_bad_OBJECTS) $(put_carray_bad_LDADD) $(LIBS)
+
+put_carray_bounds$(EXEEXT): $(put_carray_bounds_OBJECTS) $(put_carray_bounds_DEPENDENCIES) $(EXTRA_put_carray_bounds_DEPENDENCIES) 
+	@rm -f put_carray_bounds$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_carray_bounds_OBJECTS) $(put_carray_bounds_LDADD) $(LIBS)
+
 put_carray_client$(EXEEXT): $(put_carray_client_OBJECTS) $(put_carray_client_DEPENDENCIES) $(EXTRA_put_carray_client_DEPENDENCIES) 
 	@rm -f put_carray_client$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_carray_client_OBJECTS) $(put_carray_client_LDADD) $(LIBS)
 
+put_carray_rdonly$(EXEEXT): $(put_carray_rdonly_OBJECTS) $(put_carray_rdonly_DEPENDENCIES) $(EXTRA_put_carray_rdonly_DEPENDENCIES) 
+	@rm -f put_carray_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_carray_rdonly_OBJECTS) $(put_carray_rdonly_LDADD) $(LIBS)
+
 put_carray_slice$(EXEEXT): $(put_carray_slice_OBJECTS) $(put_carray_slice_DEPENDENCIES) $(EXTRA_put_carray_slice_DEPENDENCIES) 
 	@rm -f put_carray_slice$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_carray_slice_OBJECTS) $(put_carray_slice_LDADD) $(LIBS)
 
+put_carray_type$(EXEEXT): $(put_carray_type_OBJECTS) $(put_carray_type_DEPENDENCIES) $(EXTRA_put_carray_type_DEPENDENCIES) 
+	@rm -f put_carray_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_carray_type_OBJECTS) $(put_carray_type_LDADD) $(LIBS)
+
 put_char$(EXEEXT): $(put_char_OBJECTS) $(put_char_DEPENDENCIES) $(EXTRA_put_char_DEPENDENCIES) 
 	@rm -f put_char$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_char_OBJECTS) $(put_char_LDADD) $(LIBS)
@@ -11103,6 +15238,10 @@ put_heres$(EXEEXT): $(put_heres_OBJECTS) $(put_heres_DEPENDENCIES) $(EXTRA_put_h
 	@rm -f put_heres$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_heres_OBJECTS) $(put_heres_LDADD) $(LIBS)
 
+put_indir$(EXEEXT): $(put_indir_OBJECTS) $(put_indir_DEPENDENCIES) $(EXTRA_put_indir_DEPENDENCIES) 
+	@rm -f put_indir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_indir_OBJECTS) $(put_indir_LDADD) $(LIBS)
+
 put_int16$(EXEEXT): $(put_int16_OBJECTS) $(put_int16_DEPENDENCIES) $(EXTRA_put_int16_DEPENDENCIES) 
 	@rm -f put_int16$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_int16_OBJECTS) $(put_int16_LDADD) $(LIBS)
@@ -11135,10 +15274,18 @@ put_lincom_noin$(EXEEXT): $(put_lincom_noin_OBJECTS) $(put_lincom_noin_DEPENDENC
 	@rm -f put_lincom_noin$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_lincom_noin_OBJECTS) $(put_lincom_noin_LDADD) $(LIBS)
 
+put_lincom_repr$(EXEEXT): $(put_lincom_repr_OBJECTS) $(put_lincom_repr_DEPENDENCIES) $(EXTRA_put_lincom_repr_DEPENDENCIES) 
+	@rm -f put_lincom_repr$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_lincom_repr_OBJECTS) $(put_lincom_repr_LDADD) $(LIBS)
+
 put_linterp$(EXEEXT): $(put_linterp_OBJECTS) $(put_linterp_DEPENDENCIES) $(EXTRA_put_linterp_DEPENDENCIES) 
 	@rm -f put_linterp$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_linterp_OBJECTS) $(put_linterp_LDADD) $(LIBS)
 
+put_linterp_cmp$(EXEEXT): $(put_linterp_cmp_OBJECTS) $(put_linterp_cmp_DEPENDENCIES) $(EXTRA_put_linterp_cmp_DEPENDENCIES) 
+	@rm -f put_linterp_cmp$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_linterp_cmp_OBJECTS) $(put_linterp_cmp_LDADD) $(LIBS)
+
 put_linterp_noin$(EXEEXT): $(put_linterp_noin_OBJECTS) $(put_linterp_noin_DEPENDENCIES) $(EXTRA_put_linterp_noin_DEPENDENCIES) 
 	@rm -f put_linterp_noin$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_linterp_noin_OBJECTS) $(put_linterp_noin_LDADD) $(LIBS)
@@ -11151,6 +15298,10 @@ put_linterp_notab$(EXEEXT): $(put_linterp_notab_OBJECTS) $(put_linterp_notab_DEP
 	@rm -f put_linterp_notab$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_linterp_notab_OBJECTS) $(put_linterp_notab_LDADD) $(LIBS)
 
+put_linterp_repr$(EXEEXT): $(put_linterp_repr_OBJECTS) $(put_linterp_repr_DEPENDENCIES) $(EXTRA_put_linterp_repr_DEPENDENCIES) 
+	@rm -f put_linterp_repr$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_linterp_repr_OBJECTS) $(put_linterp_repr_LDADD) $(LIBS)
+
 put_linterp_reverse$(EXEEXT): $(put_linterp_reverse_OBJECTS) $(put_linterp_reverse_DEPENDENCIES) $(EXTRA_put_linterp_reverse_DEPENDENCIES) 
 	@rm -f put_linterp_reverse$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_linterp_reverse_OBJECTS) $(put_linterp_reverse_LDADD) $(LIBS)
@@ -11163,10 +15314,18 @@ put_mplex_complex$(EXEEXT): $(put_mplex_complex_OBJECTS) $(put_mplex_complex_DEP
 	@rm -f put_mplex_complex$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_mplex_complex_OBJECTS) $(put_mplex_complex_LDADD) $(LIBS)
 
+put_mplex_repr$(EXEEXT): $(put_mplex_repr_OBJECTS) $(put_mplex_repr_DEPENDENCIES) $(EXTRA_put_mplex_repr_DEPENDENCIES) 
+	@rm -f put_mplex_repr$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_mplex_repr_OBJECTS) $(put_mplex_repr_LDADD) $(LIBS)
+
 put_multiply$(EXEEXT): $(put_multiply_OBJECTS) $(put_multiply_DEPENDENCIES) $(EXTRA_put_multiply_DEPENDENCIES) 
 	@rm -f put_multiply$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_multiply_OBJECTS) $(put_multiply_LDADD) $(LIBS)
 
+put_neg$(EXEEXT): $(put_neg_OBJECTS) $(put_neg_DEPENDENCIES) $(EXTRA_put_neg_DEPENDENCIES) 
+	@rm -f put_neg$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_neg_OBJECTS) $(put_neg_LDADD) $(LIBS)
+
 put_nofile$(EXEEXT): $(put_nofile_OBJECTS) $(put_nofile_DEPENDENCIES) $(EXTRA_put_nofile_DEPENDENCIES) 
 	@rm -f put_nofile$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_nofile_OBJECTS) $(put_nofile_LDADD) $(LIBS)
@@ -11187,6 +15346,10 @@ put_phase_noin$(EXEEXT): $(put_phase_noin_OBJECTS) $(put_phase_noin_DEPENDENCIES
 	@rm -f put_phase_noin$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_phase_noin_OBJECTS) $(put_phase_noin_LDADD) $(LIBS)
 
+put_phase_repr$(EXEEXT): $(put_phase_repr_OBJECTS) $(put_phase_repr_DEPENDENCIES) $(EXTRA_put_phase_repr_DEPENDENCIES) 
+	@rm -f put_phase_repr$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_phase_repr_OBJECTS) $(put_phase_repr_LDADD) $(LIBS)
+
 put_polynom1$(EXEEXT): $(put_polynom1_OBJECTS) $(put_polynom1_DEPENDENCIES) $(EXTRA_put_polynom1_DEPENDENCIES) 
 	@rm -f put_polynom1$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_polynom1_OBJECTS) $(put_polynom1_LDADD) $(LIBS)
@@ -11199,6 +15362,10 @@ put_polynom_noin$(EXEEXT): $(put_polynom_noin_OBJECTS) $(put_polynom_noin_DEPEND
 	@rm -f put_polynom_noin$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_polynom_noin_OBJECTS) $(put_polynom_noin_LDADD) $(LIBS)
 
+put_polynom_repr$(EXEEXT): $(put_polynom_repr_OBJECTS) $(put_polynom_repr_DEPENDENCIES) $(EXTRA_put_polynom_repr_DEPENDENCIES) 
+	@rm -f put_polynom_repr$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_polynom_repr_OBJECTS) $(put_polynom_repr_LDADD) $(LIBS)
+
 put_protect$(EXEEXT): $(put_protect_OBJECTS) $(put_protect_DEPENDENCIES) $(EXTRA_put_protect_DEPENDENCIES) 
 	@rm -f put_protect$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_protect_OBJECTS) $(put_protect_LDADD) $(LIBS)
@@ -11215,6 +15382,10 @@ put_recip$(EXEEXT): $(put_recip_OBJECTS) $(put_recip_DEPENDENCIES) $(EXTRA_put_r
 	@rm -f put_recip$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_recip_OBJECTS) $(put_recip_LDADD) $(LIBS)
 
+put_recip_repr$(EXEEXT): $(put_recip_repr_OBJECTS) $(put_recip_repr_DEPENDENCIES) $(EXTRA_put_recip_repr_DEPENDENCIES) 
+	@rm -f put_recip_repr$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_recip_repr_OBJECTS) $(put_recip_repr_LDADD) $(LIBS)
+
 put_recurse$(EXEEXT): $(put_recurse_OBJECTS) $(put_recurse_DEPENDENCIES) $(EXTRA_put_recurse_DEPENDENCIES) 
 	@rm -f put_recurse$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_recurse_OBJECTS) $(put_recurse_LDADD) $(LIBS)
@@ -11227,14 +15398,46 @@ put_rofs$(EXEEXT): $(put_rofs_OBJECTS) $(put_rofs_DEPENDENCIES) $(EXTRA_put_rofs
 	@rm -f put_rofs$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_rofs_OBJECTS) $(put_rofs_LDADD) $(LIBS)
 
+put_sarray$(EXEEXT): $(put_sarray_OBJECTS) $(put_sarray_DEPENDENCIES) $(EXTRA_put_sarray_DEPENDENCIES) 
+	@rm -f put_sarray$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_sarray_OBJECTS) $(put_sarray_LDADD) $(LIBS)
+
+put_sarray_bad$(EXEEXT): $(put_sarray_bad_OBJECTS) $(put_sarray_bad_DEPENDENCIES) $(EXTRA_put_sarray_bad_DEPENDENCIES) 
+	@rm -f put_sarray_bad$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_sarray_bad_OBJECTS) $(put_sarray_bad_LDADD) $(LIBS)
+
+put_sarray_bounds$(EXEEXT): $(put_sarray_bounds_OBJECTS) $(put_sarray_bounds_DEPENDENCIES) $(EXTRA_put_sarray_bounds_DEPENDENCIES) 
+	@rm -f put_sarray_bounds$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_sarray_bounds_OBJECTS) $(put_sarray_bounds_LDADD) $(LIBS)
+
+put_sarray_rdonly$(EXEEXT): $(put_sarray_rdonly_OBJECTS) $(put_sarray_rdonly_DEPENDENCIES) $(EXTRA_put_sarray_rdonly_DEPENDENCIES) 
+	@rm -f put_sarray_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_sarray_rdonly_OBJECTS) $(put_sarray_rdonly_LDADD) $(LIBS)
+
+put_sarray_slice$(EXEEXT): $(put_sarray_slice_OBJECTS) $(put_sarray_slice_DEPENDENCIES) $(EXTRA_put_sarray_slice_DEPENDENCIES) 
+	@rm -f put_sarray_slice$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_sarray_slice_OBJECTS) $(put_sarray_slice_LDADD) $(LIBS)
+
+put_sarray_type$(EXEEXT): $(put_sarray_type_OBJECTS) $(put_sarray_type_DEPENDENCIES) $(EXTRA_put_sarray_type_DEPENDENCIES) 
+	@rm -f put_sarray_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_sarray_type_OBJECTS) $(put_sarray_type_LDADD) $(LIBS)
+
 put_sbit$(EXEEXT): $(put_sbit_OBJECTS) $(put_sbit_DEPENDENCIES) $(EXTRA_put_sbit_DEPENDENCIES) 
 	@rm -f put_sbit$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_sbit_OBJECTS) $(put_sbit_LDADD) $(LIBS)
 
+put_scalar$(EXEEXT): $(put_scalar_OBJECTS) $(put_scalar_DEPENDENCIES) $(EXTRA_put_scalar_DEPENDENCIES) 
+	@rm -f put_scalar$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_scalar_OBJECTS) $(put_scalar_LDADD) $(LIBS)
+
 put_sf$(EXEEXT): $(put_sf_OBJECTS) $(put_sf_DEPENDENCIES) $(EXTRA_put_sf_DEPENDENCIES) 
 	@rm -f put_sf$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_sf_OBJECTS) $(put_sf_LDADD) $(LIBS)
 
+put_sindir$(EXEEXT): $(put_sindir_OBJECTS) $(put_sindir_DEPENDENCIES) $(EXTRA_put_sindir_DEPENDENCIES) 
+	@rm -f put_sindir$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_sindir_OBJECTS) $(put_sindir_LDADD) $(LIBS)
+
 put_ss$(EXEEXT): $(put_ss_OBJECTS) $(put_ss_DEPENDENCIES) $(EXTRA_put_ss_DEPENDENCIES) 
 	@rm -f put_ss$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_ss_OBJECTS) $(put_ss_LDADD) $(LIBS)
@@ -11247,6 +15450,10 @@ put_string_protect$(EXEEXT): $(put_string_protect_OBJECTS) $(put_string_protect_
 	@rm -f put_string_protect$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_string_protect_OBJECTS) $(put_string_protect_LDADD) $(LIBS)
 
+put_string_type$(EXEEXT): $(put_string_type_OBJECTS) $(put_string_type_DEPENDENCIES) $(EXTRA_put_string_type_DEPENDENCIES) 
+	@rm -f put_string_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(put_string_type_OBJECTS) $(put_string_type_LDADD) $(LIBS)
+
 put_sub$(EXEEXT): $(put_sub_OBJECTS) $(put_sub_DEPENDENCIES) $(EXTRA_put_sub_DEPENDENCIES) 
 	@rm -f put_sub$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(put_sub_OBJECTS) $(put_sub_LDADD) $(LIBS)
@@ -11279,10 +15486,38 @@ ref$(EXEEXT): $(ref_OBJECTS) $(ref_DEPENDENCIES) $(EXTRA_ref_DEPENDENCIES)
 	@rm -f ref$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(ref_OBJECTS) $(ref_LDADD) $(LIBS)
 
+ref_empty$(EXEEXT): $(ref_empty_OBJECTS) $(ref_empty_DEPENDENCIES) $(EXTRA_ref_empty_DEPENDENCIES) 
+	@rm -f ref_empty$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ref_empty_OBJECTS) $(ref_empty_LDADD) $(LIBS)
+
+ref_get$(EXEEXT): $(ref_get_OBJECTS) $(ref_get_DEPENDENCIES) $(EXTRA_ref_get_DEPENDENCIES) 
+	@rm -f ref_get$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ref_get_OBJECTS) $(ref_get_LDADD) $(LIBS)
+
 ref_none$(EXEEXT): $(ref_none_OBJECTS) $(ref_none_DEPENDENCIES) $(EXTRA_ref_none_DEPENDENCIES) 
 	@rm -f ref_none$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(ref_none_OBJECTS) $(ref_none_LDADD) $(LIBS)
 
+ref_set$(EXEEXT): $(ref_set_OBJECTS) $(ref_set_DEPENDENCIES) $(EXTRA_ref_set_DEPENDENCIES) 
+	@rm -f ref_set$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ref_set_OBJECTS) $(ref_set_LDADD) $(LIBS)
+
+ref_set_code$(EXEEXT): $(ref_set_code_OBJECTS) $(ref_set_code_DEPENDENCIES) $(EXTRA_ref_set_code_DEPENDENCIES) 
+	@rm -f ref_set_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ref_set_code_OBJECTS) $(ref_set_code_LDADD) $(LIBS)
+
+ref_set_prot$(EXEEXT): $(ref_set_prot_OBJECTS) $(ref_set_prot_DEPENDENCIES) $(EXTRA_ref_set_prot_DEPENDENCIES) 
+	@rm -f ref_set_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ref_set_prot_OBJECTS) $(ref_set_prot_LDADD) $(LIBS)
+
+ref_set_rdonly$(EXEEXT): $(ref_set_rdonly_OBJECTS) $(ref_set_rdonly_DEPENDENCIES) $(EXTRA_ref_set_rdonly_DEPENDENCIES) 
+	@rm -f ref_set_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ref_set_rdonly_OBJECTS) $(ref_set_rdonly_LDADD) $(LIBS)
+
+ref_set_type$(EXEEXT): $(ref_set_type_OBJECTS) $(ref_set_type_DEPENDENCIES) $(EXTRA_ref_set_type_DEPENDENCIES) 
+	@rm -f ref_set_type$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(ref_set_type_OBJECTS) $(ref_set_type_LDADD) $(LIBS)
+
 ref_two$(EXEEXT): $(ref_two_OBJECTS) $(ref_two_DEPENDENCIES) $(EXTRA_ref_two_DEPENDENCIES) 
 	@rm -f ref_two$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(ref_two_OBJECTS) $(ref_two_LDADD) $(LIBS)
@@ -11363,14 +15598,66 @@ repr_uint8$(EXEEXT): $(repr_uint8_OBJECTS) $(repr_uint8_DEPENDENCIES) $(EXTRA_re
 	@rm -f repr_uint8$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(repr_uint8_OBJECTS) $(repr_uint8_LDADD) $(LIBS)
 
+salist$(EXEEXT): $(salist_OBJECTS) $(salist_DEPENDENCIES) $(EXTRA_salist_DEPENDENCIES) 
+	@rm -f salist$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(salist_OBJECTS) $(salist_LDADD) $(LIBS)
+
+salist0$(EXEEXT): $(salist0_OBJECTS) $(salist0_DEPENDENCIES) $(EXTRA_salist0_DEPENDENCIES) 
+	@rm -f salist0$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(salist0_OBJECTS) $(salist0_LDADD) $(LIBS)
+
+salist_hidden$(EXEEXT): $(salist_hidden_OBJECTS) $(salist_hidden_DEPENDENCIES) $(EXTRA_salist_hidden_DEPENDENCIES) 
+	@rm -f salist_hidden$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(salist_hidden_OBJECTS) $(salist_hidden_LDADD) $(LIBS)
+
+salist_long$(EXEEXT): $(salist_long_OBJECTS) $(salist_long_DEPENDENCIES) $(EXTRA_salist_long_DEPENDENCIES) 
+	@rm -f salist_long$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(salist_long_OBJECTS) $(salist_long_LDADD) $(LIBS)
+
+salist_meta$(EXEEXT): $(salist_meta_OBJECTS) $(salist_meta_DEPENDENCIES) $(EXTRA_salist_meta_DEPENDENCIES) 
+	@rm -f salist_meta$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(salist_meta_OBJECTS) $(salist_meta_LDADD) $(LIBS)
+
+salist_meta0$(EXEEXT): $(salist_meta0_OBJECTS) $(salist_meta0_DEPENDENCIES) $(EXTRA_salist_meta0_DEPENDENCIES) 
+	@rm -f salist_meta0$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(salist_meta0_OBJECTS) $(salist_meta0_LDADD) $(LIBS)
+
+salist_meta_free$(EXEEXT): $(salist_meta_free_OBJECTS) $(salist_meta_free_DEPENDENCIES) $(EXTRA_salist_meta_free_DEPENDENCIES) 
+	@rm -f salist_meta_free$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(salist_meta_free_OBJECTS) $(salist_meta_free_LDADD) $(LIBS)
+
+salist_meta_hidden$(EXEEXT): $(salist_meta_hidden_OBJECTS) $(salist_meta_hidden_DEPENDENCIES) $(EXTRA_salist_meta_hidden_DEPENDENCIES) 
+	@rm -f salist_meta_hidden$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(salist_meta_hidden_OBJECTS) $(salist_meta_hidden_LDADD) $(LIBS)
+
+salist_meta_meta$(EXEEXT): $(salist_meta_meta_OBJECTS) $(salist_meta_meta_DEPENDENCIES) $(EXTRA_salist_meta_meta_DEPENDENCIES) 
+	@rm -f salist_meta_meta$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(salist_meta_meta_OBJECTS) $(salist_meta_meta_LDADD) $(LIBS)
+
+salist_meta_parent$(EXEEXT): $(salist_meta_parent_OBJECTS) $(salist_meta_parent_DEPENDENCIES) $(EXTRA_salist_meta_parent_DEPENDENCIES) 
+	@rm -f salist_meta_parent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(salist_meta_parent_OBJECTS) $(salist_meta_parent_LDADD) $(LIBS)
+
 seek64$(EXEEXT): $(seek64_OBJECTS) $(seek64_DEPENDENCIES) $(EXTRA_seek64_DEPENDENCIES) 
 	@rm -f seek64$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(seek64_OBJECTS) $(seek64_LDADD) $(LIBS)
 
+seek_arg$(EXEEXT): $(seek_arg_OBJECTS) $(seek_arg_DEPENDENCIES) $(EXTRA_seek_arg_DEPENDENCIES) 
+	@rm -f seek_arg$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(seek_arg_OBJECTS) $(seek_arg_LDADD) $(LIBS)
+
+seek_code$(EXEEXT): $(seek_code_OBJECTS) $(seek_code_DEPENDENCIES) $(EXTRA_seek_code_DEPENDENCIES) 
+	@rm -f seek_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(seek_code_OBJECTS) $(seek_code_LDADD) $(LIBS)
+
 seek_cur$(EXEEXT): $(seek_cur_OBJECTS) $(seek_cur_DEPENDENCIES) $(EXTRA_seek_cur_DEPENDENCIES) 
 	@rm -f seek_cur$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(seek_cur_OBJECTS) $(seek_cur_LDADD) $(LIBS)
 
+seek_dim$(EXEEXT): $(seek_dim_OBJECTS) $(seek_dim_DEPENDENCIES) $(EXTRA_seek_dim_DEPENDENCIES) 
+	@rm -f seek_dim$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(seek_dim_OBJECTS) $(seek_dim_LDADD) $(LIBS)
+
 seek_end$(EXEEXT): $(seek_end_OBJECTS) $(seek_end_DEPENDENCIES) $(EXTRA_seek_end_DEPENDENCIES) 
 	@rm -f seek_end$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(seek_end_OBJECTS) $(seek_end_LDADD) $(LIBS)
@@ -11391,10 +15678,18 @@ seek_index$(EXEEXT): $(seek_index_OBJECTS) $(seek_index_DEPENDENCIES) $(EXTRA_se
 	@rm -f seek_index$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(seek_index_OBJECTS) $(seek_index_LDADD) $(LIBS)
 
+seek_index_end$(EXEEXT): $(seek_index_end_OBJECTS) $(seek_index_end_DEPENDENCIES) $(EXTRA_seek_index_end_DEPENDENCIES) 
+	@rm -f seek_index_end$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(seek_index_end_OBJECTS) $(seek_index_end_LDADD) $(LIBS)
+
 seek_lincom$(EXEEXT): $(seek_lincom_OBJECTS) $(seek_lincom_DEPENDENCIES) $(EXTRA_seek_lincom_DEPENDENCIES) 
 	@rm -f seek_lincom$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(seek_lincom_OBJECTS) $(seek_lincom_LDADD) $(LIBS)
 
+seek_mplex$(EXEEXT): $(seek_mplex_OBJECTS) $(seek_mplex_DEPENDENCIES) $(EXTRA_seek_mplex_DEPENDENCIES) 
+	@rm -f seek_mplex$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(seek_mplex_OBJECTS) $(seek_mplex_LDADD) $(LIBS)
+
 seek_mult$(EXEEXT): $(seek_mult_OBJECTS) $(seek_mult_DEPENDENCIES) $(EXTRA_seek_mult_DEPENDENCIES) 
 	@rm -f seek_mult$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(seek_mult_OBJECTS) $(seek_mult_LDADD) $(LIBS)
@@ -11415,6 +15710,14 @@ seek_range2$(EXEEXT): $(seek_range2_OBJECTS) $(seek_range2_DEPENDENCIES) $(EXTRA
 	@rm -f seek_range2$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(seek_range2_OBJECTS) $(seek_range2_LDADD) $(LIBS)
 
+seek_range_end$(EXEEXT): $(seek_range_end_OBJECTS) $(seek_range_end_DEPENDENCIES) $(EXTRA_seek_range_end_DEPENDENCIES) 
+	@rm -f seek_range_end$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(seek_range_end_OBJECTS) $(seek_range_end_LDADD) $(LIBS)
+
+seek_recurse$(EXEEXT): $(seek_recurse_OBJECTS) $(seek_recurse_DEPENDENCIES) $(EXTRA_seek_recurse_DEPENDENCIES) 
+	@rm -f seek_recurse$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(seek_recurse_OBJECTS) $(seek_recurse_LDADD) $(LIBS)
+
 seek_set$(EXEEXT): $(seek_set_OBJECTS) $(seek_set_DEPENDENCIES) $(EXTRA_seek_set_DEPENDENCIES) 
 	@rm -f seek_set$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(seek_set_OBJECTS) $(seek_set_LDADD) $(LIBS)
@@ -11423,6 +15726,10 @@ seek_sub$(EXEEXT): $(seek_sub_OBJECTS) $(seek_sub_DEPENDENCIES) $(EXTRA_seek_sub
 	@rm -f seek_sub$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(seek_sub_OBJECTS) $(seek_sub_LDADD) $(LIBS)
 
+sie_err_open$(EXEEXT): $(sie_err_open_OBJECTS) $(sie_err_open_DEPENDENCIES) $(EXTRA_sie_err_open_DEPENDENCIES) 
+	@rm -f sie_err_open$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(sie_err_open_OBJECTS) $(sie_err_open_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)
 	$(AM_V_CCLD)$(LINK) $(sie_get_big_OBJECTS) $(sie_get_big_LDADD) $(LIBS)
@@ -11547,6 +15854,10 @@ spf_alias_missing$(EXEEXT): $(spf_alias_missing_OBJECTS) $(spf_alias_missing_DEP
 	@rm -f spf_alias_missing$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(spf_alias_missing_OBJECTS) $(spf_alias_missing_LDADD) $(LIBS)
 
+spf_const$(EXEEXT): $(spf_const_OBJECTS) $(spf_const_DEPENDENCIES) $(EXTRA_spf_const_DEPENDENCIES) 
+	@rm -f spf_const$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(spf_const_OBJECTS) $(spf_const_LDADD) $(LIBS)
+
 spf_divide$(EXEEXT): $(spf_divide_OBJECTS) $(spf_divide_DEPENDENCIES) $(EXTRA_spf_divide_DEPENDENCIES) 
 	@rm -f spf_divide$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(spf_divide_OBJECTS) $(spf_divide_LDADD) $(LIBS)
@@ -11595,6 +15906,10 @@ svlist_invalid$(EXEEXT): $(svlist_invalid_OBJECTS) $(svlist_invalid_DEPENDENCIES
 	@rm -f svlist_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(svlist_invalid_OBJECTS) $(svlist_invalid_LDADD) $(LIBS)
 
+svlist_long$(EXEEXT): $(svlist_long_OBJECTS) $(svlist_long_DEPENDENCIES) $(EXTRA_svlist_long_DEPENDENCIES) 
+	@rm -f svlist_long$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(svlist_long_OBJECTS) $(svlist_long_LDADD) $(LIBS)
+
 svlist_meta$(EXEEXT): $(svlist_meta_OBJECTS) $(svlist_meta_DEPENDENCIES) $(EXTRA_svlist_meta_DEPENDENCIES) 
 	@rm -f svlist_meta$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(svlist_meta_OBJECTS) $(svlist_meta_LDADD) $(LIBS)
@@ -11611,6 +15926,14 @@ svlist_meta_invalid$(EXEEXT): $(svlist_meta_invalid_OBJECTS) $(svlist_meta_inval
 	@rm -f svlist_meta_invalid$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(svlist_meta_invalid_OBJECTS) $(svlist_meta_invalid_LDADD) $(LIBS)
 
+svlist_meta_meta$(EXEEXT): $(svlist_meta_meta_OBJECTS) $(svlist_meta_meta_DEPENDENCIES) $(EXTRA_svlist_meta_meta_DEPENDENCIES) 
+	@rm -f svlist_meta_meta$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(svlist_meta_meta_OBJECTS) $(svlist_meta_meta_LDADD) $(LIBS)
+
+svlist_meta_parent$(EXEEXT): $(svlist_meta_parent_OBJECTS) $(svlist_meta_parent_DEPENDENCIES) $(EXTRA_svlist_meta_parent_DEPENDENCIES) 
+	@rm -f svlist_meta_parent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(svlist_meta_parent_OBJECTS) $(svlist_meta_parent_LDADD) $(LIBS)
+
 table$(EXEEXT): $(table_OBJECTS) $(table_DEPENDENCIES) $(EXTRA_table_DEPENDENCIES) 
 	@rm -f table$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(table_OBJECTS) $(table_LDADD) $(LIBS)
@@ -11631,9 +15954,25 @@ tell64$(EXEEXT): $(tell64_OBJECTS) $(tell64_DEPENDENCIES) $(EXTRA_tell64_DEPENDE
 	@rm -f tell64$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tell64_OBJECTS) $(tell64_LDADD) $(LIBS)
 
-tell_multidiv$(EXEEXT): $(tell_multidiv_OBJECTS) $(tell_multidiv_DEPENDENCIES) $(EXTRA_tell_multidiv_DEPENDENCIES) 
-	@rm -f tell_multidiv$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(tell_multidiv_OBJECTS) $(tell_multidiv_LDADD) $(LIBS)
+tell_code$(EXEEXT): $(tell_code_OBJECTS) $(tell_code_DEPENDENCIES) $(EXTRA_tell_code_DEPENDENCIES) 
+	@rm -f tell_code$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tell_code_OBJECTS) $(tell_code_LDADD) $(LIBS)
+
+tell_dim$(EXEEXT): $(tell_dim_OBJECTS) $(tell_dim_DEPENDENCIES) $(EXTRA_tell_dim_DEPENDENCIES) 
+	@rm -f tell_dim$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tell_dim_OBJECTS) $(tell_dim_LDADD) $(LIBS)
+
+tell_multi_div$(EXEEXT): $(tell_multi_div_OBJECTS) $(tell_multi_div_DEPENDENCIES) $(EXTRA_tell_multi_div_DEPENDENCIES) 
+	@rm -f tell_multi_div$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tell_multi_div_OBJECTS) $(tell_multi_div_LDADD) $(LIBS)
+
+tell_multi_lincom$(EXEEXT): $(tell_multi_lincom_OBJECTS) $(tell_multi_lincom_DEPENDENCIES) $(EXTRA_tell_multi_lincom_DEPENDENCIES) 
+	@rm -f tell_multi_lincom$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tell_multi_lincom_OBJECTS) $(tell_multi_lincom_LDADD) $(LIBS)
+
+tell_recurse$(EXEEXT): $(tell_recurse_OBJECTS) $(tell_recurse_DEPENDENCIES) $(EXTRA_tell_recurse_DEPENDENCIES) 
+	@rm -f tell_recurse$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tell_recurse_OBJECTS) $(tell_recurse_LDADD) $(LIBS)
 
 tell_sub$(EXEEXT): $(tell_sub_OBJECTS) $(tell_sub_DEPENDENCIES) $(EXTRA_tell_sub_DEPENDENCIES) 
 	@rm -f tell_sub$(EXEEXT)
@@ -11679,6 +16018,14 @@ unclude_del$(EXEEXT): $(unclude_del_OBJECTS) $(unclude_del_DEPENDENCIES) $(EXTRA
 	@rm -f unclude_del$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(unclude_del_OBJECTS) $(unclude_del_LDADD) $(LIBS)
 
+unclude_index$(EXEEXT): $(unclude_index_OBJECTS) $(unclude_index_DEPENDENCIES) $(EXTRA_unclude_index_DEPENDENCIES) 
+	@rm -f unclude_index$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(unclude_index_OBJECTS) $(unclude_index_LDADD) $(LIBS)
+
+unclude_keep$(EXEEXT): $(unclude_keep_OBJECTS) $(unclude_keep_DEPENDENCIES) $(EXTRA_unclude_keep_DEPENDENCIES) 
+	@rm -f unclude_keep$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(unclude_keep_OBJECTS) $(unclude_keep_LDADD) $(LIBS)
+
 unclude_move$(EXEEXT): $(unclude_move_OBJECTS) $(unclude_move_DEPENDENCIES) $(EXTRA_unclude_move_DEPENDENCIES) 
 	@rm -f unclude_move$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(unclude_move_OBJECTS) $(unclude_move_LDADD) $(LIBS)
@@ -11687,6 +16034,18 @@ unclude_open$(EXEEXT): $(unclude_open_OBJECTS) $(unclude_open_DEPENDENCIES) $(EX
 	@rm -f unclude_open$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(unclude_open_OBJECTS) $(unclude_open_LDADD) $(LIBS)
 
+unclude_prot$(EXEEXT): $(unclude_prot_OBJECTS) $(unclude_prot_DEPENDENCIES) $(EXTRA_unclude_prot_DEPENDENCIES) 
+	@rm -f unclude_prot$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(unclude_prot_OBJECTS) $(unclude_prot_LDADD) $(LIBS)
+
+unclude_rdonly$(EXEEXT): $(unclude_rdonly_OBJECTS) $(unclude_rdonly_DEPENDENCIES) $(EXTRA_unclude_rdonly_DEPENDENCIES) 
+	@rm -f unclude_rdonly$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(unclude_rdonly_OBJECTS) $(unclude_rdonly_LDADD) $(LIBS)
+
+valid_reprz$(EXEEXT): $(valid_reprz_OBJECTS) $(valid_reprz_DEPENDENCIES) $(EXTRA_valid_reprz_DEPENDENCIES) 
+	@rm -f valid_reprz$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(valid_reprz_OBJECTS) $(valid_reprz_LDADD) $(LIBS)
+
 version_0$(EXEEXT): $(version_0_OBJECTS) $(version_0_DEPENDENCIES) $(EXTRA_version_0_DEPENDENCIES) 
 	@rm -f version_0$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(version_0_OBJECTS) $(version_0_LDADD) $(LIBS)
@@ -11865,70 +16224,114 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_alias.Po at am__quote@
 @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_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_alias_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_alias_name.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_alias_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_alias_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_alias_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_amb_code7.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_bit_inaff.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_bit_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_bit_numbits.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_bit_scalars.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_carray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_carray_entry.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_carray_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_clincom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_clincom_nfields.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_const.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_const_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_cpolynom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_cpolynom_order.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_crecip.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_crecip89.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_dangle_dup.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_divide.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_divide_inaff1.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_divide_inaff2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_divide_invalid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_dot10.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_dot5.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_dot6.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_duplicate.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_format.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_indir.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@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_lincom_nfields2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_linterp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_linterp_inaff.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_linterp_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_meta.Po at am__quote@
 @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_meta_parent.Po at am__quote@
 @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_inaff.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_mplex_period.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_mplex_scalars.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_name_len.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_ns_frag.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_ns_frag2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_phase.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_phase_inaff.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_phase_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_polynom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_polynom_inaff.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_polynom_order.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_polynom_order2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_polynom_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_protect.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_raw.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_raw_include.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_raw_invalid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_raw_prot.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_raw_spf.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_raw_spf_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_raw_sub.Po at am__quote@
 @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_recip_inaff.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_resolv.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_sarray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_sarray_dup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_sarray_nil.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@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_scalar_carray.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_scalar_carray_bad.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_sindir.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_directive.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_index.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_nil.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_raw_autoenc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_raw_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_raw_unkenc.Po at am__quote@
 @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@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_string_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_string_dup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_string_entry.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_type.Po at am__quote@
 @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_inaff.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_window_op.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_list.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_list_alias.Po at am__quote@
@@ -11939,28 +16342,47 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_target.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_target_alias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_target_missing.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alloc_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alloc_callback.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alloc_clear.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alloc_entry.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alloc_tok.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_bit_bitnum.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_bit_in.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_bit_numbits.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_bit_scalar.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_clincom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_clincom_32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_clincom_nfields.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_clincom_nfields_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_clincom_null.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_const.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_const_c2r.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_const_r2c.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_const_r2r.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_const_type.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_cpolynom_null.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_cpolynom_ord.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_cpolynom_ord_code.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_crecip89_null.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_divide_in.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry.Po at am__quote@
 @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_entype.Po at am__quote@
 @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_lincom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_lincom_nfields.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_recode_recalc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_sarray.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar1.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@
@@ -11971,56 +16393,114 @@ 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_entry_scalar_amb.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_indir.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@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_lincom_nfields.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_lincom_nfields_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_lincom_offset.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_lincom_scalar.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_linterp_in.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_linterp_move.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_mplex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_mplex_in.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_mplex_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_mspec.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_phase_in.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_phase_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_polynom_coeff.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_polynom_input.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_polynom_ord.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_polynom_ord2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_polynom_ord_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_polynom_scalar.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_raw_prot.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_raw_spf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_raw_spf_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_raw_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_recip.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_recip_scalar.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_sarray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_sarray_nop.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_sbit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_scalar_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_sindir.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_spec.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_spec_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_spec_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_spec_format.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_spec_nil.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_spec_polynom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_spec_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_spec_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_window.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_window_in.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_window_op.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_window_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_add.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_complex128.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_complex64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_float32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_float64.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_complex.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_get_here.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_get_sub.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_int16.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_int32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_int64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_int8.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_nframes.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_put.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_put_here.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_seek.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_seek_far.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_sync.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_uint16.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_uint32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_uint64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_uint8.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_bit.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_bit_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_const.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_lincom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_lincom_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_phase.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_phase_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_phase_neg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bof_recurse.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_add.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_complex128.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_complex64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_del.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_enoent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_float32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_float64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_get_cont.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_get_far.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_get_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_get_get2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_get_put.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_int16.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_int32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_int64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_int8.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_move_from.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_move_to.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_nframes.Po at am__quote@
@@ -12028,11 +16508,28 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_put_back.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_put_endian.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_put_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_put_offs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_put_pad.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_put_sub.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_seek.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_seek_far.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_sync.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_uint16.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_uint32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_uint64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzip_uint8.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist0.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist_free.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist_hidden.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist_long.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist_meta0.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist_meta_free.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist_meta_hidden.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist_meta_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist_meta_parent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calist_null.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/close_bad.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/close_close.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/close_discard.Po at am__quote@
@@ -12160,23 +16657,19 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/creat_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/creat_rdonly_exists.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_array.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_array0.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_array_free.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_array_hidden.Po at am__quote@
- at 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_meta0.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_array_meta_free.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_array_null.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_long.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_meta0.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_meta_code.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_meta_parent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_null.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_alias_dangle.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_alias_target.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_bad_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_carray.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_carray_deref.Po at am__quote@
@@ -12186,12 +16679,16 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_data.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_data_enoent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_data_open.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_data_prot.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_del.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_derived.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_divide.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)/del_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_ref.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/desync.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/desync_flush.Po at am__quote@
@@ -12211,7 +16708,10 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_alias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_noalias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_parent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_parent2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_scalar.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_type.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_alter_all.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/encode_alter_open.Po at am__quote@
@@ -12221,8 +16721,14 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/encode_support.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_alter.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_alter_all.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_alter_arg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_alter_dprot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_alter_fprot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_alter_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_alter_rdonly.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_index.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@
@@ -12251,10 +16757,15 @@ distclean-compile:
 @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_bit.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof_bit_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof_const.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof_lincom_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof_phase.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof_phase_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof_phase_neg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof_recurse.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@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error_num.Po at am__quote@
@@ -12265,7 +16776,14 @@ distclean-compile:
 @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)/flac_add.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_complex128.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_complex64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_del.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_enoent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_float32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_float64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_get_big.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_get_cont.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_get_far.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_get_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_get_get2.Po at am__quote@
@@ -12273,15 +16791,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_get_int8.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_get_little.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_get_long.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_int16.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_int32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_int64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_int8.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_move_from.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_nframes.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_put_big.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_put_complex128.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_put_float64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_put_int32.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_put_little.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_put_offs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_seek.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_seek_far.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_sync.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_uint16.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_uint32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_uint64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flac_uint8.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist0.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist2.Po at am__quote@
@@ -12298,62 +16826,94 @@ distclean-compile:
 @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_all.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_amb_code.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_flush.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_hex.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_lincom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_lincom1.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_mult.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_raw_close.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_ref.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_spec.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_string.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_recurse.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_sync.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_alter_all.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_alter_dprot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_alter_fprot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_alter_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_alter_range.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_alter_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_move.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter_dotpx.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter_nons.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter_nop.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter_pns.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_dup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_ns.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_index.Po at am__quote@
 @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_ndotdots.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ndots.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns0.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns_add.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns_add0.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns_alter.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns_alter_nop.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns_alter_pdel.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns_del.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns_dot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns_dotdot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns_dotns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_ns_nsdot.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_num.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_parent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_parent_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_parent_root.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get64.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_carray_bad.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_carray_c2r.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_carray_len.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_carray_slice.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_carray_slice_bounds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_carray_slice_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_carray_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_char.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_clincom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_complex128.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_complex64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_const.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_const_bad.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_const_carray.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_const_complex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_const_repr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_const_reprz.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_cpolynom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_cpolynom1.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_cpolynom_int.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_dim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_dimin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_divide.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_divide_ccin.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_divide_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_divide_crin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_divide_crinr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_divide_rcin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_divide_s.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_dot.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_endian16.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_endian32.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_endian64.Po at am__quote@
@@ -12380,6 +16940,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_here_foffs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_heres.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_index_complex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_index_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_indir.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_indir_typein.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@
@@ -12390,6 +16953,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_lincom2s.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_lincom3.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_lincom3s.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_lincom_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_lincom_mdt.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@
@@ -12414,6 +16978,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_mplex_saved.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_ccin.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_multiply_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_multiply_crin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_multiply_crinr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_multiply_noin.Po at am__quote@
@@ -12431,11 +16996,27 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_polynom_noin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_range.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_recip.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_recip_cmpin.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_reprz.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_rofs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sarray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sarray_bad.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sarray_slice.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sarray_slice_bounds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sarray_slice_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sarray_type.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sindir.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sindir_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sindir_neg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sindir_none.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sindir_null.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sindir_reprz.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sindir_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sindir_typein.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_ss.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_string.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_type.Po at am__quote@
@@ -12457,16 +17038,23 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_zero_float.Po at am__quote@
 @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@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/global_ref.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/global_ref_empty.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/global_ref_set.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_add.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_complex128.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_complex64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_del.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_enoent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_float32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_float64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_get_cont.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_get_far.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_get_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_get_get2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_get_put.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_int16.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_int32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_int64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_int8.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_move_from.Po at am__quote@
 @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@
@@ -12476,12 +17064,17 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_put_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_put_nframes.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_put_off.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_put_offs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_put_pad.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_put_sub.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_seek.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_seek_far.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_seek_put.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_sync.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_uint16.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_uint32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_uint64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_uint8.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/header_complex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/header_off64t.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hide.Po at am__quote@
@@ -12492,22 +17085,40 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hide_unhide_bad.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_accmode.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_affix_ns.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_format.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ignore.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_include.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_invalid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ndotdots.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ndots.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_nonexistent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ns_dot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ns_dotdot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ns_dotns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ns_nil.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ns_null.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ns_prefix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_pc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_prot.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_ref_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ref_type.Po at am__quote@
 @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_domain.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index_empty.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index_one.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index_range.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index_reprz.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index_s.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index_subset.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/legacy_error.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/legacy_estring.Po at am__quote@
@@ -12519,92 +17130,183 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/legacy_nonexistent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/legacy_put.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/legacy_spf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/len_bad.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/len_carray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/len_const.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/len_sarray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/len_string.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/len_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_enoent.Po at am__quote@
 @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)/lzma_put.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_add.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_complex128.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_complex64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_del.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_float32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_float64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_get_cont.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_get_far.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_get_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_get_get2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_get_put.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_int16.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_int32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_int64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_int8.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_move_from.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_move_to.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_nframes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_offs_clear.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_put.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_put_back.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_put_endian.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_put_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_put_offs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_put_pad.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_seek.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_seek_far.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_sync.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_uint16.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_uint32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_uint64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_xz_uint8.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_alias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_alias_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_alias_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_alias_subsub.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_aliasmeta.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@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_clincom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_clincom_nfields.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_const.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_cpolynom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_cpolynom_order.Po at am__quote@
 @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@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_indir.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_lincom_nfields.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@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_parent_bad.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_phase.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_phase_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_polynom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_polynom_order.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_raw.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_recip.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_sarray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_sarray_dup.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_sbit.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_sindir.Po at am__quote@
 @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_parent.Po at am__quote@
 @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_string_dup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_subsub.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_window.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_fragment.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_pcre.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_pcre_bad.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_pcre_caseless.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_pcre_ext.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_pcre_js.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_pcre_utf8.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_regex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_regex_bad.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_regex_ext.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/match_regex_icase.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_amb_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_carray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_hex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_indir.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_mplex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_pretty.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_ref.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_repr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_repr9.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_reprz.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_sindir.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_spec.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_string.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_type4.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mflush_windop.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_affix_dup.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_affix_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_affix_updb.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_code.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_data_enc_un.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_data_endian.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_data_foffs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_data_foffs_neg.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_data_nop.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_data_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_entype.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_move.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_nop.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_nsns.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_protect.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_subdir.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_unkenc.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_affix_bad.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_dangle.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_dot10.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_dot5.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_dot5r.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_dot9.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_dup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_meta2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_move.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_move_alias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_name.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_ns2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_nsdot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_updb.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_updb_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_updb_alias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_updb_carray.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_updb_const.Po at am__quote@
 @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)/name_updb_sarray.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_bit.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_const.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_lincom.Po at am__quote@
@@ -12623,9 +17325,12 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_recip.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_recip_cmpin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_recip_cmpscal.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_recurse.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_reprz.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_sbit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native_string.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nentries_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nentries_entype.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nentries_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nentries_noalias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nentries_scalar.Po at am__quote@
@@ -12648,6 +17353,7 @@ distclean-compile:
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_parent_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_type.Po at am__quote@
 @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@
@@ -12683,8 +17389,10 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_alias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_alias_code.Po at am__quote@
 @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_loop.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_alias_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_alias_missing.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_alias_ncols.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@
@@ -12695,26 +17403,33 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_bit_scalar.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_carray_ncols.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_carray_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_const.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_const_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_divide.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_endian_bad2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_endian_big.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_endian_force.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_endian_little.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_endian_slash.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_eol.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_esc.Po at am__quote@
 @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@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_hex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_hidden.Po at am__quote@
 @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_frag.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_hidden_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_huge.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@
@@ -12722,7 +17437,17 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_affix_ref.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_dir.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_loop.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_nodir.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_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_ns2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_nsabs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_nsinh.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_nspop.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_nsrabs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_nsrainh.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_nsrinh.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_nsroot.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_prefix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_prefix_dup.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_preprefix.Po at am__quote@
@@ -12733,6 +17458,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_suffix.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_indir.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@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_lincom_ncols2.Po at am__quote@
@@ -12765,10 +17491,12 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_jump.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_malias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_ncols.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@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_mplex.Po at am__quote@
 @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_neg.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_mplex_nomax.Po at am__quote@
 @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@
@@ -12776,8 +17504,30 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_name.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_name_dot.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_name_ext.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_name_pedantic.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ncols.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns_dot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns_dotdot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns_dotdotns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns_dotns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns_include.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns_include_ns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns_ndotdots.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns_ndots.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns_nsdot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ns_nsdotdot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_abs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_dot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_hide.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_meta2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_ref.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_refabs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_root.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_nsf_sub.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_octal_zero.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_phase.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_phase_ncols.Po at am__quote@
@@ -12801,12 +17551,18 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_raw_spf.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_raw_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_recip.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_recip_ncols.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ref.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ref_nonexistent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_ref_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_sarray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_sarray_long.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_sarray_ncols.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_sbit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_scalar1.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_scalar2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_scalar_repr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_sindir.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_sort.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_string.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_string_ncols.Po at am__quote@
@@ -12829,14 +17585,23 @@ distclean-compile:
 @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_alter_all.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/protect_alter_arg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/protect_alter_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/protect_alter_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/protect_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/protect_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_bad_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_bit.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_bit_repr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_bof.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_carray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_carray_bad.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_carray_bounds.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_carray_client.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_carray_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_carray_slice.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_carray_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_char.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_clincom1.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_complex128.Po at am__quote@
@@ -12869,6 +17634,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_fs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_here.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_heres.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_indir.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@
@@ -12877,34 +17643,51 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_lincom1.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_lincom2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_lincom_noin.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_lincom_repr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_linterp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_linterp_cmp.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_linterp_noin.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_linterp_repr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_linterp_reverse.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_mplex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_mplex_complex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_mplex_repr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_multiply.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_neg.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_nofile.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@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_phase.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_phase_noin.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_phase_repr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_polynom1.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_polynom2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_polynom_noin.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_polynom_repr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_protect.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_range.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_recip.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_recip_repr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_recurse.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_repr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_rofs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_sarray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_sarray_bad.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_sarray_bounds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_sarray_rdonly.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_sarray_slice.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_sarray_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_sbit.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_sf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_sindir.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_ss.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_string.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_string_protect.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_string_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_sub.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_uint16.Po at am__quote@
@@ -12913,7 +17696,14 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_window.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_empty.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_none.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_set.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_set_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_set_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_set_rdonly.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_set_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_two.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/repr_a.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/repr_bad.Po at am__quote@
@@ -12934,21 +17724,39 @@ 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)/salist.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/salist0.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/salist_hidden.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/salist_long.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/salist_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/salist_meta0.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/salist_meta_free.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/salist_meta_hidden.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/salist_meta_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/salist_meta_parent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_arg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_cur.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_dim.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_end.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_far.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_foffs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_foffs2.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_index_end.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_lincom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_mplex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_mult.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_neg.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_phase.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_range.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_range2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_range_end.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_recurse.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_set.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_sub.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_err_open.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_get_big.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_get_header.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_get_little.Po at am__quote@
@@ -12980,6 +17788,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_alias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_alias_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_alias_missing.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_const.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@
@@ -12992,16 +17801,23 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist2.Po at am__quote@
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist_long.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist_meta0.Po at am__quote@
 @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)/svlist_meta_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist_meta_parent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tell.Po at am__quote@
 @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)/tell_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tell_dim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tell_multi_div.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tell_multi_lincom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tell_recurse.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tell_sub.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tok_arg.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tok_escape.Po at am__quote@
@@ -13013,8 +17829,13 @@ distclean-compile:
 @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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/unclude_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/unclude_keep.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/unclude_move.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/unclude_open.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/unclude_prot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/unclude_rdonly.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/valid_reprz.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/version_0.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/version_0_write.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/version_1.Po at am__quote@
diff --git a/test/add_affix.c b/test/add_affix.c
index d15b05a..a81cf98 100644
--- a/test/add_affix.c
+++ b/test/add_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2012 D. V. Wiebe
+/* Copyright (C) 2011-2012, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,19 +26,15 @@ int main(void)
   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;
+  int n, e1, e2, e3, e4, e5, r = 0;
   DIRFILE *D;
   gd_entry_t E, e;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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));
+  MAKEFORMATFILE(format, "AconstZ CONST UINT8 3\n/INCLUDE format1 A Z\n");
+  MAKEEMPTYFILE(format1, 0600);
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
 
diff --git a/test/add_alias_index.c b/test/add_alias_index.c
new file mode 100644
index 0000000..0e334f6
--- /dev/null
+++ b/test/add_alias_index.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_spec(D, "data CONST UINT8 1", 0);
+  gd_add_alias(D, "alias", "data", 1);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_alias_name.c b/test/add_alias_name.c
new file mode 100644
index 0000000..5204d24
--- /dev/null
+++ b/test/add_alias_name.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_spec(D, "data CONST UINT8 1", 0);
+  gd_add_alias(D, "al>as", "data", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_alias_ns.c b/test/add_alias_ns.c
new file mode 100644
index 0000000..b81bd51
--- /dev/null
+++ b/test/add_alias_ns.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, r = 0;
+  unsigned int n;
+  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, "ns.alias", "data", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_OK);
+
+  /* check */
+  target = gd_alias_target(D, "ns.alias");
+  CHECKS(target, "data");
+  i = gd_fragment_index(D, "ns.alias");
+  CHECKI(i, 0);
+  n = gd_naliases(D, "ns.alias");
+  CHECKU(n, 2);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_alias_prot.c b/test/add_alias_prot.c
new file mode 100644
index 0000000..bb54a7a
--- /dev/null
+++ b/test/add_alias_prot.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_spec(D, "data CONST UINT8 1", 0);
+  gd_alter_protection(D, GD_PROTECT_ALL, 0);
+  gd_add_alias(D, "alias", "data", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_alias_rdonly.c b/test/add_alias_rdonly.c
new file mode 100644
index 0000000..783a5f1
--- /dev/null
+++ b/test/add_alias_rdonly.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_VERBOSE);
+  gd_add_spec(D, "data CONST UINT8 1", 0);
+  gd_close(D);
+
+  D = gd_open(filedir, GD_RDONLY);
+  gd_add_alias(D, "alias", "data", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_bit_inaff.c b/test/add_bit_inaff.c
new file mode 100644
index 0000000..2f3a5f1
--- /dev/null
+++ b/test/add_bit_inaff.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, 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_bit(D, "AnewZ", "input", 1, 1, 1);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_carray_entry.c b/test/add_carray_entry.c
new file mode 100644
index 0000000..234c8b7
--- /dev/null
+++ b/test/add_carray_entry.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  uint8_t data[5];
+  int n, error;
+  int r = 0;
+  gd_entry_t E, e;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
+  memset(&E, 0, sizeof E);
+  E.field = "data";
+  E.field_type = GD_CARRAY_ENTRY;
+  E.EN(scalar,const_type) = GD_UINT8;
+  E.EN(scalar,array_len) = 5;
+  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_CARRAY_ENTRY);
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(scalar,const_type), GD_UINT8);
+    gd_free_entry_strings(&e);
+  }
+  n = (int)gd_array_len(D, "data");
+  CHECKI(n, 5);
+  gd_get_carray(D, "data", GD_UINT8, &data);
+  for (n = 0; n < 5; ++n)
+    CHECKIi(n, data[n], 0);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  return r;
+}
diff --git a/test/add_carray_type.c b/test/add_carray_type.c
new file mode 100644
index 0000000..5e4f50e
--- /dev/null
+++ b/test/add_carray_type.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  uint8_t val[] = {3, 4, 5, 6, 7};
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  gd_add_carray(D, "data", GD_COMPLEX128 + 1, 5, GD_UINT8, &val, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_clincom_nfields.c b/test/add_clincom_nfields.c
new file mode 100644
index 0000000..caf47b2
--- /dev/null
+++ b/test/add_clincom_nfields.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *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};
+#else
+  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
+  int error, r = 0;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  gd_add_clincom(D, "new", 22, in_fields, m, b, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_code.c b/test/add_code.c
index db73450..3efb2a9 100644
--- a/test/add_code.c
+++ b/test/add_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -28,6 +28,7 @@ int main(void)
   gd_entry_t E;
   DIRFILE *D;
 
+  memset(&E, 0, sizeof E);
   E.field =  "ne/w";
   E.field_type = GD_RAW_ENTRY;
   E.fragment_index = 0;
@@ -38,17 +39,16 @@ int main(void)
   D = gd_open(filedir, GD_RDWR | GD_CREAT);
   gd_add(D, &E);
   error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
 
   /* check */
   n = gd_nfields(D);
+  CHECKI(n, 1);
 
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(n, 1);
-  CHECKI(error, GD_E_BAD_CODE);
-
   return r;
 }
diff --git a/test/add_const_type.c b/test/add_const_type.c
new file mode 100644
index 0000000..38b7349
--- /dev/null
+++ b/test/add_const_type.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  uint8_t val = 3;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  gd_add_const(D, "data", GD_NULL, GD_UINT8, &val, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_TYPE);
+
+  gd_add_const(D, "data", GD_STRING, GD_UINT8, &val, 0);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_BAD_TYPE);
+
+  gd_add_const(D, "data", -1, GD_UINT8, &val, 0);
+  e3 = gd_error(D);
+  CHECKI(e3, GD_E_BAD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_cpolynom.c b/test/add_cpolynom.c
index 95cc15f..694956e 100644
--- a/test/add_cpolynom.c
+++ b/test/add_cpolynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,18 +18,8 @@
  * 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"
 
-#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";
@@ -39,16 +29,19 @@ int main(void)
   gd_entry_t e;
   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};
+  const double a[12] = {1, 29.03, 0.3, 12.34, 0.5, 99.55, 1.8, 45.32,
+    98.2, -17.3, 0.01, 82.11};
 #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};
+  const double complex a[6] = {1 + _Complex_I * 29.03, 0.3 + _Complex_I * 12.34,
+    0.5 + _Complex_I * 99.55, 1.8 + _Complex_I * 45.32,
+    98.2 - _Complex_I * 17.3, 0.01 + _Complex_I * 82.11};
 #endif
 
   rmdirfile();
   D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
-  gd_add_cpolynom(D, "new", 3, "in", a, 0);
+  gd_add_cpolynom(D, "new", 5, "in", a, 0);
   error = gd_error(D);
+  CHECKI(error, GD_E_OK);
 
   /* check */
   gd_entry(D, "new", &e);
@@ -58,9 +51,9 @@ int main(void)
     CHECKI(e.field_type, GD_POLYNOM_ENTRY);
     CHECKS(e.in_fields[0], "in");
     CHECKI(e.fragment_index, 0);
-    CHECKI(e.EN(polynom,poly_ord), 3);
+    CHECKI(e.EN(polynom,poly_ord), 5);
     CHECKX(e.flags, GD_EN_COMPSCAL | GD_EN_CALC);
-    for (j = 0; j < 4; ++j) {
+    for (j = 0; j <= e.EN(polynom,poly_ord); ++j) {
 #ifdef GD_NO_C99_API
       CHECKCi(j,e.EN(polynom,ca)[j], a + 2 * j);
 #else
@@ -75,6 +68,5 @@ int main(void)
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, GD_E_OK);
   return r;
 }
diff --git a/test/add_cpolynom_order.c b/test/add_cpolynom_order.c
new file mode 100644
index 0000000..3948d2f
--- /dev/null
+++ b/test/add_cpolynom_order.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  int error;
+  DIRFILE *D;
+#ifdef GD_NO_C99_API
+  const double a[12] = {1, 29.03, 0.3, 12.34, 0.5, 99.55, 1.8, 45.32,
+    98.2, -17.3, 0.01, 82.11};
+#else
+  const double complex a[6] = {1 + _Complex_I * 29.03, 0.3 + _Complex_I * 12.34,
+    0.5 + _Complex_I * 99.55, 1.8 + _Complex_I * 45.32,
+    98.2 - _Complex_I * 17.3, 0.01 + _Complex_I * 82.11};
+#endif
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_add_cpolynom(D, "new", -5, "in", a, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_divide_inaff1.c b/test/add_divide_inaff1.c
new file mode 100644
index 0000000..a4ca927
--- /dev/null
+++ b/test/add_divide_inaff1.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, 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_divide(D, "AnewZ", "in1", "Ain2Z", 1);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_divide_inaff2.c b/test/add_divide_inaff2.c
new file mode 100644
index 0000000..e1c58fa
--- /dev/null
+++ b/test/add_divide_inaff2.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, 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_divide(D, "AnewZ", "Ain1Z", "in2", 1);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_dot10.c b/test/add_dot10.c
new file mode 100644
index 0000000..3a1b099
--- /dev/null
+++ b/test/add_dot10.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  int error, r = 0;
+  DIRFILE *D;
+  gd_entry_t E, e;
+
+  rmdirfile();
+  memset(&E, 0, sizeof(E));
+  E.field = "dat.a";
+  E.field_type = GD_PHASE_ENTRY;
+  E.in_fields[0] = "INDEX";
+  E.EN(phase,shift) = 0;
+  E.scalar[0] = NULL;
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_dirfile_standards(D, 10);
+  gd_add(D, &E);
+  error = gd_error(D);
+
+  CHECKI(error, GD_E_OK);
+
+  /* check */
+  gd_entry(D, "dat.a", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_PHASE_ENTRY);
+    CHECKS(e.in_fields[0], "INDEX");
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(phase,shift), 0);
+    CHECKP(e.scalar[0]);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_dot5.c b/test/add_dot5.c
index 9a8896b..c6c9130 100644
--- a/test/add_dot5.c
+++ b/test/add_dot5.c
@@ -62,7 +62,6 @@ int main(void)
     CHECKI(e.fragment_index, 0);
     CHECKI(e.EN(phase,shift), 0);
     CHECKP(e.scalar[0]);
-    CHECKI(e.flags & GD_EN_DOTTED, GD_EN_DOTTED);
     gd_free_entry_strings(&e);
   }
 
diff --git a/test/add_duplicate.c b/test/add_duplicate.c
index 9856b7d..a3d769c 100644
--- a/test/add_duplicate.c
+++ b/test/add_duplicate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,20 +21,12 @@
 /* Add a dirfile field */
 #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 RAW UINT8 8\n";
   int r = 0;
-  int fd, error, n;
+  int error, n;
   gd_entry_t E;
   DIRFILE *D;
 
@@ -45,11 +37,9 @@ int main(void)
   E.EN(raw,data_type) = GD_UINT8;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR);
   gd_add(D, &E);
diff --git a/test/add_indir.c b/test/add_indir.c
new file mode 100644
index 0000000..1d8fc30
--- /dev/null
+++ b/test/add_indir.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 <string.h>
+#include <stdio.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_indir(D, "new", "in1", "in2", 0);
+  error = gd_error(D);
+
+  /* check */
+  gd_entry(D, "new", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_INDIR_ENTRY);
+    CHECKS(e.in_fields[0], "in1");
+    CHECKS(e.in_fields[1], "in2");
+    CHECKI(e.fragment_index, 0);
+
+    gd_free_entry_strings(&e);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  return r;
+}
diff --git a/test/add_lincom_nfields2.c b/test/add_lincom_nfields2.c
new file mode 100644
index 0000000..545480c
--- /dev/null
+++ b/test/add_lincom_nfields2.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
+  memset(&E, 0, sizeof E);
+  E.field =  "new";
+  E.field_type = GD_LINCOM_ENTRY;
+  E.fragment_index = 0;
+  E.EN(lincom,n_fields) = 0;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_add(D, &E);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_linterp_inaff.c b/test/add_linterp_inaff.c
new file mode 100644
index 0000000..b772b79
--- /dev/null
+++ b/test/add_linterp_inaff.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, 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_linterp(D, "AnewZ", "in", "table", 1);
+  error = gd_error(D);
+
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_meta_parent.c b/test/add_meta_parent.c
new file mode 100644
index 0000000..3e565c9
--- /dev/null
+++ b/test/add_meta_parent.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  memset(&E, 0, sizeof(E));
+  E.field = "data/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_add(D, &E);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_mplex_inaff.c b/test/add_mplex_inaff.c
new file mode 100644
index 0000000..937334b
--- /dev/null
+++ b/test/add_mplex_inaff.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, 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_mplex(D, "AnewZ", "in1", "Ain2Z", 1, 2, 1);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_add_mplex(D, "AnewZ", "Ain1Z", "in2", 1, 2, 1);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_mplex_period.c b/test/add_mplex_period.c
new file mode 100644
index 0000000..4c0419e
--- /dev/null
+++ b/test/add_mplex_period.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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", 3, -4, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_name_len.c b/test/add_name_len.c
new file mode 100644
index 0000000..e4a62ce
--- /dev/null
+++ b/test/add_name_len.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2008-2014, 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  memset(&E, 0, sizeof E);
+  E.field = "abcdefghijklmnopqrstuvwxyz";
+  E.field_type = GD_RAW_ENTRY;
+  E.EN(raw,spf) = 1;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  gd_dirfile_standards(D, 1);
+
+
+  e1 = gd_add(D, &E);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_ns.c b/test/add_ns.c
new file mode 100644
index 0000000..1cb6232
--- /dev/null
+++ b/test/add_ns.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2008-2014, 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+
+  E.field =  "ne.w";
+  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;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_add(D, &E);
+  error = gd_error(D);
+  CHECKI(error, GD_E_OK);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_ns_frag.c b/test/add_ns_frag.c
new file mode 100644
index 0000000..c838f2c
--- /dev/null
+++ b/test/add_ns_frag.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "#\n");
+
+  E.field =  "ns.w";
+  E.field_type = GD_CONST_ENTRY;
+  E.fragment_index = 1;
+  E.EN(scalar,const_type) = GD_UINT8;
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_add(D, &E);
+  error = gd_error(D);
+  CHECKI(error, GD_E_OK);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_ns_frag2.c b/test/add_ns_frag2.c
new file mode 100644
index 0000000..2a62ca4
--- /dev/null
+++ b/test/add_ns_frag2.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "#\n");
+
+  E.field =  "ne.w";
+  E.field_type = GD_CONST_ENTRY;
+  E.fragment_index = 1;
+  E.EN(scalar,const_type) = GD_UINT8;
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_add(D, &E);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_phase_inaff.c b/test/add_phase_inaff.c
new file mode 100644
index 0000000..35b7cf8
--- /dev/null
+++ b/test/add_phase_inaff.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, 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_phase(D, "AnewZ", "input", 0, 1);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_polynom.c b/test/add_polynom.c
index a489346..3a61196 100644
--- a/test/add_polynom.c
+++ b/test/add_polynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,18 +18,8 @@
  * 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"
 
-#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";
@@ -38,12 +28,13 @@ int main(void)
   int j, error;
   gd_entry_t e;
   DIRFILE *D;
-  const double a[4] = {1, 0.3, 0.5, 1.8};
+  const double a[6] = {1, 0.3, 0.5, 1.8, -2, 4.4};
 
   rmdirfile();
   D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
-  gd_add_polynom(D, "new", 3, "in", a, 0);
+  gd_add_polynom(D, "new", 5, "in", a, 0);
   error = gd_error(D);
+  CHECKI(error, GD_E_OK);
 
   /* check */
   gd_entry(D, "new", &e);
@@ -53,9 +44,9 @@ int main(void)
     CHECKI(e.field_type, GD_POLYNOM_ENTRY);
     CHECKS(e.in_fields[0], "in");
     CHECKI(e.fragment_index, 0);
-    CHECKI(e.EN(polynom,poly_ord), 3);
+    CHECKI(e.EN(polynom,poly_ord), 5);
     CHECKX(e.flags, GD_EN_CALC);
-    for (j = 0; j < 4; ++j)
+    for (j = 0; j <= e.EN(polynom,poly_ord); ++j)
       CHECKFi(j,e.EN(polynom,a)[j], a[j]);
     gd_free_entry_strings(&e);
   }
@@ -65,6 +56,5 @@ int main(void)
   unlink(format);
   rmdir(filedir);
   
-  CHECKI(error, GD_E_OK);
   return r;
 }
diff --git a/test/add_polynom_inaff.c b/test/add_polynom_inaff.c
new file mode 100644
index 0000000..d82a765
--- /dev/null
+++ b/test/add_polynom_inaff.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  int error;
+  DIRFILE *D;
+  const double a[6] = {1, 0.3, 0.5, 1.8, -2, 4.4};
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_include_affix(D, "format1", 0, "A", "Z", GD_CREAT);
+
+  gd_add_polynom(D, "AnewZ", 5, "in", a, 1);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+  
+  return r;
+}
diff --git a/test/add_polynom_order.c b/test/add_polynom_order.c
new file mode 100644
index 0000000..2cbe06b
--- /dev/null
+++ b/test/add_polynom_order.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  int error;
+  DIRFILE *D;
+  const double a[4] = {1, 0.3, 0.5, 1.8};
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_add_polynom(D, "new", 934, "in", a, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+  
+  return r;
+}
diff --git a/test/add_polynom_order2.c b/test/add_polynom_order2.c
new file mode 100644
index 0000000..74baeae
--- /dev/null
+++ b/test/add_polynom_order2.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  int error;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  memset(&E, 0, sizeof E);
+  E.field = "new";
+  E.field_type = GD_POLYNOM_ENTRY;
+  E.in_fields[0] = "in";
+  E.EN(polynom,poly_ord) = 1001;
+  gd_add(D, &E);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+  
+  return r;
+}
diff --git a/test/add_protect.c b/test/add_protect.c
index 051136f..d8695dd 100644
--- a/test/add_protect.c
+++ b/test/add_protect.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,19 +21,11 @@
 /* Add a dirfile field */
 #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 RAW UINT8 8\nPROTECT all\n";
-  int fd, error, n, r = 0;
+  int error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
@@ -44,11 +36,9 @@ int main(void)
   E.EN(raw,data_type) = GD_UINT8;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nPROTECT all\n");
 
   D = gd_open(filedir, GD_RDWR);
   gd_add(D, &E);
diff --git a/test/add_raw_prot.c b/test/add_raw_prot.c
new file mode 100644
index 0000000..6e0c25b
--- /dev/null
+++ b/test/add_raw_prot.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ul, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_alter_protection(D, GD_PROTECT_DATA, 0);
+  gd_add_raw(D, "data", GD_UINT8, 2, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  ul = unlink(data);
+  CHECKI(ul, -1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_raw_sub.c b/test/add_raw_sub.c
index 8a040d6..ebd4c79 100644
--- a/test/add_raw_sub.c
+++ b/test/add_raw_sub.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,6 @@
  */
 #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";
@@ -35,23 +27,16 @@ int main(void)
   const char *format = "dirfile/format";
   const char *format1 = "dirfile/sub/format1";
   const char *data = "dirfile/sub/data";
-  const char *format_data = "/INCLUDE sub/format1\n";
-  const char *format1_data = "#\n";
   gd_entry_t e;
-  int error, fd, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE sub/format1\n");
+  MAKEFORMATFILE(format1, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE | GD_UNENCODED);
   gd_add_raw(D, "data", GD_UINT8, 2, 1);
diff --git a/test/add_rdonly.c b/test/add_rdonly.c
index fc647c1..b3cb281 100644
--- a/test/add_rdonly.c
+++ b/test/add_rdonly.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,19 +21,11 @@
 /* Add a dirfile field to a read-only 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 *format_data = "data RAW UINT8 8\n";
-  int fd, error, n, r = 0;
+  int error, n, r = 0;
   DIRFILE *D;
 
   gd_entry_t E;
@@ -44,11 +36,9 @@ int main(void)
   E.EN(raw,data_type) = GD_UINT8;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDONLY);
   gd_add(D, &E);
diff --git a/test/add_recip_inaff.c b/test/add_recip_inaff.c
new file mode 100644
index 0000000..efa8d5a
--- /dev/null
+++ b/test/add_recip_inaff.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, 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_recip(D, "AnewZ", "input", 1, 1);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_sarray.c b/test/add_sarray.c
new file mode 100644
index 0000000..e77fdce
--- /dev/null
+++ b/test/add_sarray.c
@@ -0,0 +1,72 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  const char *val[] = {"q", "r", "s", "t", "u", "v"};
+  const char *data[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
+  int n, error;
+  int r = 0;
+  gd_entry_t e;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
+  gd_add_sarray(D, "data", 6, val, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_OK);
+
+  /* check */
+  gd_entry(D, "data", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_SARRAY_ENTRY);
+    CHECKI(e.fragment_index, 0);
+    gd_free_entry_strings(&e);
+  }
+  n = (int)gd_array_len(D, "data");
+  CHECKI(n, 6);
+
+  gd_get_sarray(D, "data", data);
+  for (n = 0; n < 6; ++n)
+    CHECKSi(n, data[n], val[n]);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_sarray_dup.c b/test/add_sarray_dup.c
new file mode 100644
index 0000000..3eec8a1
--- /dev/null
+++ b/test/add_sarray_dup.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *val[] = {"q", "r", "s", "t", "u", "v"};
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+
+  e1 = gd_add_sarray(D, "INDEX", 6, val, 0);
+  CHECKI(e1, GD_E_DUPLICATE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_sarray_nil.c b/test/add_sarray_nil.c
new file mode 100644
index 0000000..7a9632f
--- /dev/null
+++ b/test/add_sarray_nil.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 <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[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
+  int n, error;
+  int r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
+  E.field = "data";
+  E.field_type = GD_SARRAY_ENTRY;
+  E.EN(scalar,array_len) = 6;
+  E.fragment_index = 0;
+  gd_add(D, &E);
+  error = gd_error(D);
+  CHECKI(error, GD_E_OK);
+
+  /* check */
+  memset(&E, 0, sizeof(E));
+  gd_entry(D, "data", &E);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(E.field_type, GD_SARRAY_ENTRY);
+    CHECKI(E.fragment_index, 0);
+    gd_free_entry_strings(&E);
+  }
+  n = (int)gd_array_len(D, "data");
+  CHECKI(n, 6);
+
+  gd_get_sarray(D, "data", data);
+  for (n = 0; n < 6; ++n)
+    CHECKSi(n, data[n], "");
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_sindir.c b/test/add_sindir.c
new file mode 100644
index 0000000..fda828f
--- /dev/null
+++ b/test/add_sindir.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_sindir(D, "new", "in1", "in2", 0);
+  error = gd_error(D);
+
+  /* check */
+  gd_entry(D, "new", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_SINDIR_ENTRY);
+    CHECKS(e.in_fields[0], "in1");
+    CHECKS(e.in_fields[1], "in2");
+    CHECKI(e.fragment_index, 0);
+
+    gd_free_entry_strings(&e);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  return r;
+}
diff --git a/test/add_spec_affix.c b/test/add_spec_affix.c
new file mode 100644
index 0000000..4a244b3
--- /dev/null
+++ b/test/add_spec_affix.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 [ ]");
+  MAKEFORMATFILE(format1, "#");
+  
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_add_spec(D, "data CONST UINT8 2", 1);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  e2 = gd_validate(D, "[data]");
+  CHECKI(e2, 0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_spec_index.c b/test/add_spec_index.c
new file mode 100644
index 0000000..de6d4c5
--- /dev/null
+++ b/test/add_spec_index.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, ul, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_add_spec(D, "data RAW UINT8 2", 12);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  ul = unlink(data);
+  CHECKI(ul, -1);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/add_spec_nil.c b/test/add_spec_nil.c
new file mode 100644
index 0000000..27d2ab5
--- /dev/null
+++ b/test/add_spec_nil.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  e1 = gd_add_spec(D, "", 0);
+  CHECKI(e1, GD_E_FORMAT);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_spec_prot.c b/test/add_spec_prot.c
new file mode 100644
index 0000000..522f45e
--- /dev/null
+++ b/test/add_spec_prot.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, ul, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_alter_protection(D, GD_PROTECT_ALL, 0);
+  gd_add_spec(D, "data RAW UINT8 2", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  ul = unlink(data);
+  CHECKI(ul, -1);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/add_spec_raw_autoenc.c b/test/add_spec_raw_autoenc.c
new file mode 100644
index 0000000..a92ebbe
--- /dev/null
+++ b/test/add_spec_raw_autoenc.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, ul, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#");
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_add_spec(D, "data RAW UINT8 2", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_UNKNOWN_ENCODING);
+
+  gd_discard(D);
+
+  ul = unlink(data);
+  CHECKI(ul, -1);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/add_spec_raw_prot.c b/test/add_spec_raw_prot.c
new file mode 100644
index 0000000..ff528ae
--- /dev/null
+++ b/test/add_spec_raw_prot.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, ul, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_alter_protection(D, GD_PROTECT_DATA, 0);
+  gd_add_spec(D, "data RAW UINT8 2", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  ul = unlink(data);
+  CHECKI(ul, -1);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/add_spec_raw_unkenc.c b/test/add_spec_raw_unkenc.c
new file mode 100644
index 0000000..a92ebbe
--- /dev/null
+++ b/test/add_spec_raw_unkenc.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, ul, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#");
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_add_spec(D, "data RAW UINT8 2", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_UNKNOWN_ENCODING);
+
+  gd_discard(D);
+
+  ul = unlink(data);
+  CHECKI(ul, -1);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/add_string_affix.c b/test/add_string_affix.c
index 1d8af49..519b4e6 100644
--- a/test/add_string_affix.c
+++ b/test/add_string_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,19 +26,15 @@ int main(void)
   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;
+  int e1, e2, r = 0;
   char val[1000];
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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));
+  MAKEFORMATFILE(format, "/INCLUDE format1 A Z\n");
+  MAKEEMPTYFILE(format1, 0600);
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   gd_add_string(D, "AdataZ", "A string.", 1);
diff --git a/test/add_string_dup.c b/test/add_string_dup.c
new file mode 100644
index 0000000..a9122e0
--- /dev/null
+++ b/test/add_string_dup.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  e1 = gd_add_string(D, "INDEX", "A string.", 0);
+  CHECKI(e1, GD_E_DUPLICATE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_string_entry.c b/test/add_string_entry.c
new file mode 100644
index 0000000..3dec9d8
--- /dev/null
+++ b/test/add_string_entry.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  char val[1000];
+  gd_entry_t E, e;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
+  memset(&E, 0, sizeof E);
+  E.field = "data";
+  E.field_type = GD_STRING_ENTRY;
+  gd_add(D, &E);
+  error = gd_error(D);
+  CHECKI(error, GD_E_OK);
+
+  /* check */
+  gd_entry(D, "data", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_STRING_ENTRY);
+    CHECKI(e.fragment_index, 0);
+    gd_get_string(D, "data", 1000, val);
+    CHECKS(val, "");
+    gd_free_entry_strings(&e);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/add_window_inaff.c b/test/add_window_inaff.c
new file mode 100644
index 0000000..beff8ef
--- /dev/null
+++ b/test/add_window_inaff.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  gd_triplet_t threshold;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_include_affix(D, "format1", 0, "A", "Z", GD_CREAT);
+  threshold.r = 0;
+
+  gd_add_window(D, "AnewZ", "in1", "Ain2Z", GD_WINDOP_LE, threshold, 1);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_add_window(D, "AnewZ", "Ain1Z", "in2", GD_WINDOP_LE, threshold, 1);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alias_list.c b/test/alias_list.c
index 70ad1a4..c0c4198 100644
--- a/test/alias_list.c
+++ b/test/alias_list.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,26 +24,24 @@ 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 e, i = 0, r = 0;
   int x[256];
   DIRFILE *D;
   const char **al;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format,
+    "/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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/alias_list_alias.c b/test/alias_list_alias.c
index dbfda79..89054d4 100644
--- a/test/alias_list_alias.c
+++ b/test/alias_list_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,26 +24,24 @@ 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 e, i = 0, r = 0;
   int x[256];
   DIRFILE *D;
   const char **al;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format,
+    "/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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/alias_list_missing.c b/test/alias_list_missing.c
index b291066..b96ecaa 100644
--- a/test/alias_list_missing.c
+++ b/test/alias_list_missing.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,22 +24,20 @@ 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;
+  int e, r = 0;
   DIRFILE *D;
   const char **al;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/ALIAS e f\n"
+    "/ALIAS a b\n"
+    "/ALIAS b d\n"
+    "/ALIAS c d\n"
+    "/ALIAS d f\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
 
diff --git a/test/alias_num.c b/test/alias_num.c
index def78b8..374171d 100644
--- a/test/alias_num.c
+++ b/test/alias_num.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013, 2014 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,23 +24,21 @@ 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, r = 0;
+  int e, r = 0;
   unsigned int n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/alias_num_alias.c b/test/alias_num_alias.c
index 3c85a7a..1016ae7 100644
--- a/test/alias_num_alias.c
+++ b/test/alias_num_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013, 2014 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,23 +24,21 @@ 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, r = 0;
+  int e, r = 0;
   unsigned int n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/alias_num_missing.c b/test/alias_num_missing.c
index 4630275..6f6364b 100644
--- a/test/alias_num_missing.c
+++ b/test/alias_num_missing.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013, 2014 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,22 +24,20 @@ 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;
+  int e, r = 0;
   unsigned n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/ALIAS e f\n"
+    "/ALIAS a b\n"
+    "/ALIAS b d\n"
+    "/ALIAS c d\n"
+    "/ALIAS d f\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
 
diff --git a/test/alias_target.c b/test/alias_target.c
index e82ec9e..a872297 100644
--- a/test/alias_target.c
+++ b/test/alias_target.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,17 +24,14 @@ 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;
+  int e, r = 0;
   DIRFILE *D;
   const char *t;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/ALIAS alias target\ntarget CONST UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/alias_target_alias.c b/test/alias_target_alias.c
index d2a6140..329d501 100644
--- a/test/alias_target_alias.c
+++ b/test/alias_target_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,17 +24,14 @@ 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;
+  int e, r = 0;
   DIRFILE *D;
   const char *t;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/ALIAS alias target\n/ALIAS target next\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/alias_target_missing.c b/test/alias_target_missing.c
index 213876c..a6a9e83 100644
--- a/test/alias_target_missing.c
+++ b/test/alias_target_missing.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,17 +24,14 @@ 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;
+  int e, r = 0;
   DIRFILE *D;
   const char *t;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/ALIAS alias target\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/alloc_affix.c b/test/alloc_affix.c
new file mode 100644
index 0000000..847fbbb
--- /dev/null
+++ b/test/alloc_affix.c
@@ -0,0 +1,80 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 malloc_count = 0;
+void *malloc_ptr[2];
+
+static void *malloc_func(size_t len)
+{
+  malloc_count++;
+  if (malloc_count > 2)
+    return malloc(len);
+
+  malloc_ptr[malloc_count - 1] = malloc(len);
+  return malloc_ptr[malloc_count - 1];
+}
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  char *prefix = NULL;
+  char *suffix = NULL;
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "#");
+
+  gd_alloc_funcs(malloc_func, NULL);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  e1 = gd_fragment_affixes(D, 1, &prefix, &suffix);
+  CHECKI(e1, 0);
+
+  if (prefix == malloc_ptr[0])
+    CHECKPP(suffix, malloc_ptr[1]);
+  else {
+    CHECKPP(suffix, malloc_ptr[0]);
+    CHECKPP(prefix, malloc_ptr[1]);
+  }
+
+  CHECKI(malloc_count, 2);
+  CHECKS(prefix, "A");
+  CHECKS(suffix, "Z");
+
+  free(prefix);
+  free(suffix);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alloc_callback.c b/test/alloc_callback.c
new file mode 100644
index 0000000..a52a679
--- /dev/null
+++ b/test/alloc_callback.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+void *cb_ptr = NULL;
+int good_ptr = 0;
+
+void free_func(void *ptr)
+{
+  if (ptr == cb_ptr)
+    good_ptr = 1;
+}
+
+int callback(gd_parser_data_t *pdata, void *extra gd_unused_)
+{
+  pdata->line = cb_ptr = strdup("/VERSION 10\n");
+
+  return GD_SYNTAX_RESCAN;
+}
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  gd_alloc_funcs(NULL, free_func);
+
+  MAKEFORMATFILE(format, "Syntax error\n");
+
+  D = gd_cbopen(filedir, GD_RDONLY, callback, NULL);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  if (good_ptr)
+    free(cb_ptr);
+  else
+    CHECKI(good_ptr, 1);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alloc_clear.c b/test/alloc_clear.c
new file mode 100644
index 0000000..832f286
--- /dev/null
+++ b/test/alloc_clear.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 malloc_count = 0, mlen = 10;
+int free_count = 0;
+void **malloc_ptr = NULL;
+
+static void *malloc_func(size_t len)
+{
+  if (malloc_count == mlen) {
+    void *ptr = realloc(malloc_ptr, sizeof(void*) * (mlen *= 2));
+    if (ptr == NULL)
+      return malloc(len);
+    malloc_ptr = ptr;
+  }
+    
+  malloc_ptr[malloc_count] = malloc(len);
+  return malloc_ptr[malloc_count++];
+}
+
+static void free_func(void *ptr)
+{
+  ptr = ptr;
+  free_count++;
+
+  /* We'll free things later */
+  return;
+}
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int i, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  malloc_ptr = malloc(sizeof(void*) * mlen);
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "lincom  LINCOM  Lorem ipsum dolor\n"
+      "linterp LINTERP sit amet,\n"
+      "window  WINDOW  dolor magna EQ aliqua.\n"
+      );
+
+  gd_alloc_funcs(malloc_func, free_func);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  gd_entry(D, "lincom", &E);
+  CHECKI(malloc_count, 4);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 4);
+
+  gd_alloc_funcs(malloc_func, NULL);
+
+  gd_entry(D, "linterp", &E);
+  CHECKI(malloc_count, 7);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 4);
+
+  gd_alloc_funcs(NULL, NULL);
+
+  gd_entry(D, "window", &E);
+  CHECKI(malloc_count, 7);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 4);
+
+  for (i = 0; i < free_count; ++i)
+    free(malloc_ptr[i]);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alloc_entry.c b/test/alloc_entry.c
new file mode 100644
index 0000000..35ab0c5
--- /dev/null
+++ b/test/alloc_entry.c
@@ -0,0 +1,132 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 malloc_count = 0, mlen = 10;
+int free_count = 0;
+void **malloc_ptr = NULL;
+
+static void *malloc_func(size_t len)
+{
+  if (malloc_count == mlen) {
+    void *ptr = realloc(malloc_ptr, sizeof(void*) * (mlen *= 2));
+    if (ptr == NULL)
+      return malloc(len);
+    malloc_ptr = ptr;
+  }
+    
+  malloc_ptr[malloc_count] = malloc(len);
+  return malloc_ptr[malloc_count++];
+}
+
+static void free_func(void *ptr)
+{
+  ptr = ptr;
+  free_count++;
+
+  /* We'll free things later */
+  return;
+}
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int i, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  malloc_ptr = malloc(sizeof(void*) * mlen);
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "lincom  LINCOM  Lorem ipsum dolor\n"
+      "linterp LINTERP sit amet,\n"
+      "polynom POLYNOM consectetur adipiscing elit,\n"
+      "indir   INDIR   sed do\n"
+      "recip   RECIP   eiusmod tempor\n"
+      "sbit    SBIT    incididunt ut labore\n"
+      "raw     RAW     UINT8 et\n"
+      "window  WINDOW  dolor magna EQ aliqua.\n"
+      "mplex   MPLEX   Ut enim as minim\n"
+      );
+
+  gd_alloc_funcs(malloc_func, free_func);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  gd_entry(D, "lincom", &E);
+  CHECKI(malloc_count, 4);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 4);
+
+  gd_entry(D, "linterp", &E);
+  CHECKI(malloc_count, 7);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 7);
+
+  gd_entry(D, "polynom", &E);
+  CHECKI(malloc_count, 11);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 11);
+
+  gd_entry(D, "indir", &E);
+  CHECKI(malloc_count, 14);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 14);
+
+  gd_entry(D, "recip", &E);
+  CHECKI(malloc_count, 17);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 17);
+
+  gd_entry(D, "sbit", &E);
+  CHECKI(malloc_count, 21);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 21);
+
+  gd_entry(D, "raw", &E);
+  CHECKI(malloc_count, 23);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 23);
+
+  gd_entry(D, "window", &E);
+  CHECKI(malloc_count, 27);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 27);
+
+  gd_entry(D, "mplex", &E);
+  CHECKI(malloc_count, 32);
+  gd_free_entry_strings(&E);
+  CHECKI(free_count, 32);
+
+  for (i = 0; i < malloc_count; ++i)
+    free(malloc_ptr[i]);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alloc_tok.c b/test/alloc_tok.c
new file mode 100644
index 0000000..97ecb38
--- /dev/null
+++ b/test/alloc_tok.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 malloc_count = 0;
+
+static void *malloc_func(size_t len)
+{
+  malloc_count++;
+  return malloc(len);
+}
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *spec = "string STRING value";
+  int r = 0;
+  char *tok;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  gd_alloc_funcs(malloc_func, NULL);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_VERBOSE);
+
+  tok = gd_strtok(D, spec);
+  CHECKI(malloc_count, 1);
+  free(tok);
+
+  tok = gd_strtok(D, NULL);
+  CHECKI(malloc_count, 2);
+  free(tok);
+
+  tok = gd_strtok(D, NULL);
+  CHECKI(malloc_count, 3);
+  free(tok);
+
+  tok = gd_strtok(D, NULL);
+  CHECKI(malloc_count, 3);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_bit_bitnum.c b/test/alter_bit_bitnum.c
index a847262..2369c72 100644
--- a/test/alter_bit_bitnum.c
+++ b/test/alter_bit_bitnum.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,20 @@
 /* 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\nbit BIT data 1 1\n";
-  unsigned char data_data[256];
   unsigned char c[8];
-  int fd, i, ret, error, n, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nbit BIT data 1 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_bit(D, "bit", NULL, 2, 0);
diff --git a/test/alter_bit_in.c b/test/alter_bit_in.c
new file mode 100644
index 0000000..115f43c
--- /dev/null
+++ b/test/alter_bit_in.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, e1, r = 0;
+  gd_entry_t e;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "bit BIT data 1 1\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_alter_bit(D, "bit", "in1", 2, 0);
+  CHECKI(ret, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "bit", &e);
+  CHECKS(e.in_fields[0], "in1");
+  gd_free_entry_strings(&e);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_bit_numbits.c b/test/alter_bit_numbits.c
index ba3121f..4a0284e 100644
--- a/test/alter_bit_numbits.c
+++ b/test/alter_bit_numbits.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,20 @@
 /* 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\nbit BIT data 1 1\n";
-  unsigned char data_data[256];
   unsigned char c[8];
-  int fd, i, ret, error, n, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nbit BIT data 1 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_bit(D, "bit", NULL, -1, 2);
diff --git a/test/alter_bit_scalar.c b/test/alter_bit_scalar.c
new file mode 100644
index 0000000..0942b2b
--- /dev/null
+++ b/test/alter_bit_scalar.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "c1 CONST UINT8 1\n"
+      "c2 CONST UINT8 2\n"
+      "c3 CONST UINT8 3\n"
+      "bit BIT in1 c1 c2\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_alter_spec(D, "bit BIT in1 c2 c3", 0);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "bit", &E);
+  CHECKI(E.EN(bit,bitnum), 2);
+  CHECKI(E.EN(bit,numbits), 3);
+  CHECKS(E.scalar[0], "c2");
+  CHECKS(E.scalar[1], "c3");
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_carray_len.c b/test/alter_carray_len.c
index 9a9c452..4b8db3a 100644
--- a/test/alter_carray_len.c
+++ b/test/alter_carray_len.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,31 +21,19 @@
 /* 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 = "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;
+  int i, ret, error, n, r = 0;
   size_t z;
   DIRFILE *D;
   double d[5];
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "carray CARRAY FLOAT32 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_carray(D, "carray", GD_NULL, 5);
diff --git a/test/alter_carray_type.c b/test/alter_carray_type.c
index b2ce783..4c8f7d3 100644
--- a/test/alter_carray_type.c
+++ b/test/alter_carray_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,52 +18,46 @@
  * 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 = "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;
+  int e1, e2, e3, n, r = 0;
+  size_t i, z;
   DIRFILE *D;
   double d[7];
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "carray CARRAY FLOAT32 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  e1 = gd_alter_carray(D, "carray", GD_STRING, 0);
+  CHECKI(e1, GD_E_BAD_TYPE);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  e2 = gd_alter_carray(D, "carray", -1, 0);
+  CHECKI(e2, GD_E_BAD_TYPE);
+
+  e3 = gd_alter_carray(D, "carray", GD_UINT8, 0);
+  CHECKI(e3, 0);
 
-  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
-  ret = gd_alter_carray(D, "carray", GD_UINT8, 0);
-  error = gd_error(D);
   z = gd_array_len(D, "carray");
+  CHECKU(z, 7);
+
   n = gd_get_carray(D, "carray", GD_FLOAT64, &d);
+  CHECKI(n, 0);
+
+  for (i = 0; i < z; ++i)
+    CHECKFi(i, d[i], ((i > 3) ? 7. : 8.) - i);
 
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, 0);
-  CHECKI(n, 0);
-  CHECKI(ret, 0);
-  CHECKU(z, 7);
-  for (i = 0; i < 7; ++i)
-    CHECKFi(i, d[i], ((i > 3) ? 7. : 8.) - i);
-
   return r;
 }
diff --git a/test/alter_clincom.c b/test/alter_clincom.c
index cff94ed..14b8265 100644
--- a/test/alter_clincom.c
+++ b/test/alter_clincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,24 +20,12 @@
  */
 #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 INT32 8\nphase PHASE data 1\n"
-    "lincom LINCOM 2 data 1 0 data 1 0\n";
-  int32_t data_data[256];
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 #ifdef GD_NO_C99_API
@@ -49,18 +37,13 @@ int main(void)
 #endif
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "lincom LINCOM 2 data 1 0 data 1 0\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_clincom(D, "lincom", 0, NULL, m, b);
diff --git a/test/alter_clincom_32.c b/test/alter_clincom_32.c
new file mode 100644
index 0000000..744fc20
--- /dev/null
+++ b/test/alter_clincom_32.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int32_t c[8];
+  int i, e1, r = 0;
+  size_t n;
+  DIRFILE *D;
+  const char *in_fields[2] = {"data", "phase"};
+  const double m[4] = {2, 0, 4, 0};
+  const double b[4] = {0, 0, 2, 0};
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW INT32 8\n"
+      "phase PHASE data 1\n"
+      "lincom LINCOM 3 data 1 3 phase 2 0 data 3 1\n"
+      );
+  MAKEDATAFILE(data, int32_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_alter_clincom(D, "lincom", 2, in_fields, (void*)m, (void*)b);
+  CHECKI(e1, 0);
+  n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_INT32, c);
+  CHECKU(n, 8);
+
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i,c[i], (40 + i) * 6 + 6);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_clincom_nfields.c b/test/alter_clincom_nfields.c
new file mode 100644
index 0000000..9970d00
--- /dev/null
+++ b/test/alter_clincom_nfields.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "lincom LINCOM 1 data 1 0");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_clincom(D, "lincom", -1, NULL, NULL, NULL);
+  CHECKI(e1, GD_E_BAD_ENTRY);
+  e2 = gd_alter_clincom(D, "lincom", GD_MAX_LINCOM + 1, NULL, NULL, NULL);
+  CHECKI(e2, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_clincom_nfields_code.c b/test/alter_clincom_nfields_code.c
new file mode 100644
index 0000000..411ebb2
--- /dev/null
+++ b/test/alter_clincom_nfields_code.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  e1 = gd_alter_clincom(D, "lincom", 0, NULL, NULL, NULL);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_clincom_null.c b/test/alter_clincom_null.c
new file mode 100644
index 0000000..73cb01a
--- /dev/null
+++ b/test/alter_clincom_null.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int32_t c[8];
+  int i, e1, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW INT32 8\n"
+      "phase PHASE data 1\n"
+      "lincom LINCOM 3 data 1 3 phase 2 0 data 3 1\n"
+      );
+  MAKEDATAFILE(data, int32_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_alter_clincom(D, "lincom", 2, NULL, NULL, NULL);
+  CHECKI(e1, 0);
+  n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_INT32, c);
+  CHECKU(n, 8);
+
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i,c[i], i * 3 + 125);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_code.c b/test/alter_code.c
new file mode 100644
index 0000000..a81d381
--- /dev/null
+++ b/test/alter_code.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#");
+
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_alter_phase(D, "phase", NULL, 3);
+  error = gd_error(D);
+  CHECKI(ret,GD_E_BAD_CODE);
+  CHECKI(error,GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/alter_const.c b/test/alter_const.c
index dfd0657..c04b236 100644
--- a/test/alter_const.c
+++ b/test/alter_const.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,18 @@
 /* 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 FLOAT32 8.3\n";
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   double d;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST FLOAT32 8.3\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_const(D, "const", GD_UINT8);
diff --git a/test/alter_const_c2r.c b/test/alter_const_c2r.c
index e715292..d14866e 100644
--- a/test/alter_const_c2r.c
+++ b/test/alter_const_c2r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,18 @@
 /* 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;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   double d;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST COMPLEX128 8.3;9.4\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_const(D, "const", GD_FLOAT64);
diff --git a/test/alter_const_r2c.c b/test/alter_const_r2c.c
index accfa3f..8c3721c 100644
--- a/test/alter_const_r2c.c
+++ b/test/alter_const_r2c.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,18 @@
  */
 #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 FLOAT64 8.3\n";
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   double d;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST FLOAT64 8.3\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_const(D, "const", GD_COMPLEX128);
diff --git a/test/alter_const_r2r.c b/test/alter_const_r2r.c
index ea9489b..3f92308 100644
--- a/test/alter_const_r2r.c
+++ b/test/alter_const_r2r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,18 @@
  */
 #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 FLOAT32 8.3\n";
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   double d;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST FLOAT32 8.3\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_const(D, "const", GD_FLOAT64);
diff --git a/test/alter_const_type.c b/test/alter_const_type.c
new file mode 100644
index 0000000..4d5ef12
--- /dev/null
+++ b/test/alter_const_type.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "const CONST FLOAT32 8.3\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_const(D, "const", 255);
+  CHECKI(e1, GD_E_BAD_TYPE);
+  e2 = gd_alter_const(D, "const", GD_STRING);
+  CHECKI(e2, GD_E_BAD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_cpolynom.c b/test/alter_cpolynom.c
index 7a50012..53adc40 100644
--- a/test/alter_cpolynom.c
+++ b/test/alter_cpolynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,23 +21,11 @@
 /* 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 INT32 8\n"
-    "polynom POLYNOM data 1 2 1\n";
-  int32_t data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
   const double a[] = {2, 1, 1, 2, 1, 3};
@@ -46,22 +34,17 @@ int main(void)
   const double complex a[] = {2 + _Complex_I * 1,
     1 + _Complex_I * 2, 1 + _Complex_I * 3};
 #endif
-  int fd, i, ret, error, n, r = 0;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\n"
+    "polynom POLYNOM data 1 2 1\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_cpolynom(D, "polynom", 0, NULL, a);
diff --git a/test/alter_cpolynom_null.c b/test/alter_cpolynom_null.c
index 02f3466..574228e 100644
--- a/test/alter_cpolynom_null.c
+++ b/test/alter_cpolynom_null.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,23 +20,11 @@
  */
 #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>
-#include <math.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "data RAW INT32 8\n"
-    "polynom POLYNOM data 1;2 2;3 1;9\n";
-  int fd, i, ret, error, n, error2, r = 0;
+  int i, ret, error, n, error2, r = 0;
   gd_entry_t E;
 #ifdef GD_NO_C99_API
   const double a[2][2] = {{1, 2}, {2, 3}};
@@ -44,11 +32,12 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\n"
+    "polynom POLYNOM data 1;2 2;3 1;9\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_cpolynom(D, "polynom", 1, NULL, NULL);
diff --git a/test/alter_cpolynom_ord.c b/test/alter_cpolynom_ord.c
new file mode 100644
index 0000000..72b28a0
--- /dev/null
+++ b/test/alter_cpolynom_ord.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "polynom POLYNOM in 1 2 3");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_cpolynom(D, "polynom", -1, NULL, NULL);
+  CHECKI(e1, GD_E_BAD_ENTRY);
+
+  e2 = gd_alter_cpolynom(D, "polynom", GD_MAX_POLYORD + 1, NULL, NULL);
+  CHECKI(e2, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_cpolynom_ord_code.c b/test/alter_cpolynom_ord_code.c
new file mode 100644
index 0000000..2947b60
--- /dev/null
+++ b/test/alter_cpolynom_ord_code.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_CREAT | GD_EXCL | GD_RDWR);
+  e1 = gd_alter_cpolynom(D, "polynom", 0, NULL, NULL);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_crecip.c b/test/alter_crecip.c
index f6f6567..54b80a1 100644
--- a/test/alter_crecip.c
+++ b/test/alter_crecip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,45 +21,28 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "div RECIP data 230.\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_crecip(D, "div", "phase", v);
diff --git a/test/alter_crecip89.c b/test/alter_crecip89.c
index 39acb92..b2ecde7 100644
--- a/test/alter_crecip89.c
+++ b/test/alter_crecip89.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,41 +22,24 @@
 #define GD_C89_API
 #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 INT32 8\nphase PHASE data 1\n"
-    "div RECIP data 230.\n";
-  int32_t data_data[256];
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   double div[2] = {1093., 3290.};
   gd_entry_t E;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "div RECIP data 230.\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_crecip(D, "div", "phase", div);
diff --git a/test/alter_crecip89_null.c b/test/alter_crecip89_null.c
index e077b1a..19cf91f 100644
--- a/test/alter_crecip89_null.c
+++ b/test/alter_crecip89_null.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,23 @@
 #define GD_C89_API
 #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 INT32 8\nphase PHASE data 1\n"
-    "div RECIP data 230.\n";
-  int32_t data_data[256];
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "div RECIP data 230.\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_crecip(D, "div", "phase", NULL);
diff --git a/test/alter_crecip_zero.c b/test/alter_crecip_zero.c
index dcef1c6..8ac1070 100644
--- a/test/alter_crecip_zero.c
+++ b/test/alter_crecip_zero.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,23 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "div RECIP data 230.\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_crecip(D, "div", "phase", 0);
diff --git a/test/alter_divide.c b/test/alter_divide.c
index 68fc83a..0209755 100644
--- a/test/alter_divide.c
+++ b/test/alter_divide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,23 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "div DIVIDE data data\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_divide(D, "div", NULL, "phase");
diff --git a/test/alter_divide_in.c b/test/alter_divide_in.c
new file mode 100644
index 0000000..68d7b1a
--- /dev/null
+++ b/test/alter_divide_in.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, r = 0;
+  DIRFILE *D;
+  gd_entry_t e;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "div DIVIDE data data\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_divide(D, "div", "in0", "in1");
+  CHECKI(ret,0);
+
+  error = gd_error(D);
+  CHECKI(error,0);
+
+  gd_entry(D, "div", &e);
+  CHECKS(e.in_fields[0], "in0");
+  CHECKS(e.in_fields[1], "in1");
+  gd_free_entry_strings(&e);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_entry.c b/test/alter_entry.c
index f5f734b..272f639 100644
--- a/test/alter_entry.c
+++ b/test/alter_entry.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Test field modifying */
 #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 = "data RAW UINT8 8\n";
-  unsigned char data_data[256];
-  int fd, ret, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_entry(D, "data", &E);
diff --git a/test/alter_entry_affix.c b/test/alter_entry_affix.c
index 37d2617..962e218 100644
--- a/test/alter_entry_affix.c
+++ b/test/alter_entry_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,31 +26,17 @@ int main(void)
   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;
+  int ret, error, r = 0;
   off_t n;
   gd_entry_t E;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "/INCLUDE format1 A\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_entry(D, "Adata", &E);
diff --git a/test/alter_entry_entype.c b/test/alter_entry_entype.c
new file mode 100644
index 0000000..58577d8
--- /dev/null
+++ b/test/alter_entry_entype.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_entry(D, "data", &E);
+  E.field_type = GD_CONST_ENTRY;
+  ret = gd_alter_entry(D, "data", &E, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_FIELD_TYPE);
+  CHECKI(ret, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  E.field_type = GD_RAW_ENTRY;
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/alter_entry_hidden.c b/test/alter_entry_hidden.c
index 294bb29..13d5f52 100644
--- a/test/alter_entry_hidden.c
+++ b/test/alter_entry_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,26 +25,16 @@ 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;
+  int ret, error, r = 0;
   off_t n;
   gd_entry_t E;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_entry(D, "data", &E);
diff --git a/test/alter_entry_lincom.c b/test/alter_entry_lincom.c
index a058b91..f26448f 100644
--- a/test/alter_entry_lincom.c
+++ b/test/alter_entry_lincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Test field modifying */
 #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 = "lincom LINCOM a 1 2\n";
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM a 1 2\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
 
diff --git a/test/alter_entry_lincom_nfields.c b/test/alter_entry_lincom_nfields.c
new file mode 100644
index 0000000..20d95b8
--- /dev/null
+++ b/test/alter_entry_lincom_nfields.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "lincom LINCOM a 1 2\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  gd_entry(D, "lincom", &E);
+  E.EN(lincom,n_fields) = 4000;
+  ret = gd_alter_entry(D, "lincom", &E, 0);
+  CHECKI(ret, GD_E_BAD_ENTRY);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_entry_recode.c b/test/alter_entry_recode.c
index a71d33c..97f866b 100644
--- a/test/alter_entry_recode.c
+++ b/test/alter_entry_recode.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* 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\n";
-  unsigned char data_data[256];
   uint16_t d;
   int fd, i, ret, error, r = 0;
   off_t n;
@@ -44,18 +33,10 @@ int main(void)
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_entry(D, "data", &E);
diff --git a/test/alter_entry_recode_recalc.c b/test/alter_entry_recode_recalc.c
index 995803b..f3b2c6e 100644
--- a/test/alter_entry_recode_recalc.c
+++ b/test/alter_entry_recode_recalc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,25 +20,11 @@
  */
 #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 a\n"
-    "a CONST UINT8 8\n"
-    "b CONST UINT8 11\n";
-  unsigned char data_data[256];
   uint16_t d;
   int fd, i, ret, error, r = 0;
   off_t n;
@@ -46,18 +32,14 @@ int main(void)
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 a\n"
+    "a CONST UINT8 8\n"
+    "b CONST UINT8 11\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
 
diff --git a/test/alter_entry_sarray.c b/test/alter_entry_sarray.c
new file mode 100644
index 0000000..7a346df
--- /dev/null
+++ b/test/alter_entry_sarray.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General 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";
+  int i, n, error, r = 0;
+  const char *d[6];
+  const char *v[6] = {"a", "b", "c", "d", "", ""};
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray SARRAY a b c d\n");
+
+  E.flags = 0;
+  E.field_type = GD_SARRAY_ENTRY;
+  E.EN(scalar,array_len) = 6;
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  n = gd_alter_entry(D, "sarray", &E, 0);
+  error = gd_error(D);
+
+  CHECKI(n, 0);
+  CHECKI(error, 0);
+
+  gd_get_sarray(D, "sarray", d);
+  for (i = 0; i < 6; ++i) {
+    CHECKPNi(i, d[i]);
+    CHECKSi(i, d[i], v[i]);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_entry_scalar1.c b/test/alter_entry_scalar1.c
index d49932c..1eae367 100644
--- a/test/alter_entry_scalar1.c
+++ b/test/alter_entry_scalar1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,29 +20,18 @@
  */
 #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 = "data BIT in 3 3\n";
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in 3 3\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
 
diff --git a/test/alter_entry_scalar2a.c b/test/alter_entry_scalar2a.c
index eb3b30c..ec865b9 100644
--- a/test/alter_entry_scalar2a.c
+++ b/test/alter_entry_scalar2a.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,21 @@
 /* Test field modifying */
 #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 = "data BIT in c1 3\nc1 CONST INT64 3\n"
-    "c2 CONST INT64 11\n";
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data BIT in c1 3\nc1 CONST INT64 3\n"
+    "c2 CONST INT64 11\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_entry(D, "data", &E);
diff --git a/test/alter_entry_scalar2n.c b/test/alter_entry_scalar2n.c
index bd3a84a..e6b69ef 100644
--- a/test/alter_entry_scalar2n.c
+++ b/test/alter_entry_scalar2n.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* Test field modifying */
 #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 = "data RAW UINT8 8\nconst CONST INT64 11\n";
-  unsigned char data_data[256];
-  int fd, ret, error, n, r = 0;
+  int ret, error, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nconst CONST INT64 11\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_entry(D, "data", &E);
diff --git a/test/alter_entry_scalar3.c b/test/alter_entry_scalar3.c
index 62d5e53..9d2429d 100644
--- a/test/alter_entry_scalar3.c
+++ b/test/alter_entry_scalar3.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Test field modifying */
 #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 = "data BIT in c1 3\nc1 CONST INT64 3\n";
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in c1 3\nc1 CONST INT64 3\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_entry(D, "data", &E);
diff --git a/test/alter_entry_scalar3c.c b/test/alter_entry_scalar3c.c
index 6904199..6a35ad2 100644
--- a/test/alter_entry_scalar3c.c
+++ b/test/alter_entry_scalar3c.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2016 D. V. Wiebe
+/* Copyright (C) 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,8 +24,7 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "data RECIP in c1\nc1 CONST COMPLEX128 3.1;4.5\n";
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
 #ifdef GD_NO_C99_API
   const double d[2] = {3.1, 4.5};
 #else
@@ -35,11 +34,9 @@ int main(void)
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RECIP in c1\nc1 CONST COMPLEX128 3.1;4.5\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
 
diff --git a/test/alter_entry_scalar3i.c b/test/alter_entry_scalar3i.c
index 558d2d3..7a62944 100644
--- a/test/alter_entry_scalar3i.c
+++ b/test/alter_entry_scalar3i.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,29 +20,18 @@
  */
 #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 = "data BIT in c1 3\nc1 CONST INT64 3\n";
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in c1 3\nc1 CONST INT64 3\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
 
diff --git a/test/alter_entry_scalar3r.c b/test/alter_entry_scalar3r.c
index 3d5532d..35d0967 100644
--- a/test/alter_entry_scalar3r.c
+++ b/test/alter_entry_scalar3r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2016 D. V. Wiebe
+/* Copyright (C) 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,17 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "data RECIP in c1\nc1 CONST FLOAT64 3.1\n";
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RECIP in c1\nc1 CONST FLOAT64 3.1\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
 
diff --git a/test/alter_entry_scalar4.c b/test/alter_entry_scalar4.c
index de57af9..7d96827 100644
--- a/test/alter_entry_scalar4.c
+++ b/test/alter_entry_scalar4.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Test field modifying */
 #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 = "data BIT in 3 c1\nc1 CONST INT64 3\n";
-  int fd, ret, error, n, r = 0;
+  int ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in 3 c1\nc1 CONST INT64 3\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_entry(D, "data", &E);
diff --git a/test/alter_entry_scalar_amb.c b/test/alter_entry_scalar_amb.c
index c6194b4..7ffff6c 100644
--- a/test/alter_entry_scalar_amb.c
+++ b/test/alter_entry_scalar_amb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,29 +20,18 @@
  */
 #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 = "/VERSION 7\nphase PHASE INDEX c\n";
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/VERSION 7\nphase PHASE INDEX c\n");
 
   D = gd_open(filedir, GD_RDWR);
   gd_entry(D, "phase", &E);
@@ -50,7 +39,7 @@ int main(void)
   E.scalar[0] = "2";
   ret = gd_alter_entry(D, "phase", &E, 0);
   error = gd_error(D);
-  CHECKI(ret, -1);
+  CHECKI(ret, GD_E_BAD_CODE);
   CHECKI(error, GD_E_BAD_CODE);
 
   E.scalar[0] = NULL;
diff --git a/test/alter_index.c b/test/alter_index.c
index e67e6fe..1c44283 100644
--- a/test/alter_index.c
+++ b/test/alter_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #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";
@@ -47,13 +38,13 @@ int main(void)
   ret = gd_alter_entry(D, "INDEX", &E, 0);
   error = gd_error(D);
 
+  CHECKI(error, GD_E_BAD_FIELD_TYPE);
+  CHECKI(ret, GD_E_BAD_FIELD_TYPE);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, GD_E_BAD_FIELD_TYPE);
-  CHECKI(ret, -1);
-
   return r;
 }
diff --git a/test/alter_indir.c b/test/alter_indir.c
new file mode 100644
index 0000000..c4b7073
--- /dev/null
+++ b/test/alter_indir.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, n, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "indir INDIR data carray\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_indir(D, "indir", NULL, "darray");
+  CHECKI(ret,0);
+  error = gd_error(D);
+  CHECKI(error,0);
+
+  n = gd_entry(D, "indir", &E);
+  CHECKI(n,0);
+  CHECKS(E.in_fields[0], "data");
+  CHECKS(E.in_fields[1], "darray");
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/alter_lincom_23.c b/test/alter_lincom_23.c
index c382005..907a235 100644
--- a/test/alter_lincom_23.c
+++ b/test/alter_lincom_23.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,43 +21,26 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
   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)
-    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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "lincom LINCOM 2 data 1 0 data 1 0\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_lincom(D, "lincom", 3, in_fields, m, b);
diff --git a/test/alter_lincom_32.c b/test/alter_lincom_32.c
index c1d44a0..5bdba64 100644
--- a/test/alter_lincom_32.c
+++ b/test/alter_lincom_32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,43 +21,26 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
   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)
-    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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "lincom LINCOM 3 data 1 3 phase 2 0 data 3 1\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_lincom(D, "lincom", 2, in_fields, m, b);
diff --git a/test/alter_lincom_affix.c b/test/alter_lincom_affix.c
index 4b32a8f..f9732eb 100644
--- a/test/alter_lincom_affix.c
+++ b/test/alter_lincom_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012 D. V. Wiebe
+/* Copyright (C) 2012, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,48 +21,27 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "lincom LINCOM 2 data 1 0 data 1 0\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR);
   gd_alter_lincom(D, "AlincomZ", 0, in_fields, NULL, NULL);
diff --git a/test/alter_lincom_input.c b/test/alter_lincom_input.c
index 802d610..52bed2b 100644
--- a/test/alter_lincom_input.c
+++ b/test/alter_lincom_input.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,41 +21,24 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
   const char *in_fields[3] = {"data", "phase", 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "lincom LINCOM 2 data 1 0 data 1 0\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_lincom(D, "lincom", 0, in_fields, NULL, NULL);
diff --git a/test/alter_lincom_nfields.c b/test/alter_lincom_nfields.c
new file mode 100644
index 0000000..8fa2b39
--- /dev/null
+++ b/test/alter_lincom_nfields.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "lincom LINCOM 1 data 1 0");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_lincom(D, "lincom", -1, NULL, NULL, NULL);
+  CHECKI(e1, GD_E_BAD_ENTRY);
+  e2 = gd_alter_lincom(D, "lincom", GD_MAX_LINCOM + 1, NULL, NULL, NULL);
+  CHECKI(e2, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_lincom_nfields_code.c b/test/alter_lincom_nfields_code.c
new file mode 100644
index 0000000..7025637
--- /dev/null
+++ b/test/alter_lincom_nfields_code.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  e1 = gd_alter_lincom(D, "lincom", 0, NULL, NULL, NULL);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_lincom_offset.c b/test/alter_lincom_offset.c
index 183f029..1d3d450 100644
--- a/test/alter_lincom_offset.c
+++ b/test/alter_lincom_offset.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,42 +21,25 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
   const char *in_fields[3] = {"data", "phase", NULL};
   double b[3] = {2, 3, 0};
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "lincom LINCOM 2 data 1 0 data 1 0\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_lincom(D, "lincom", 0, in_fields, NULL, b);
diff --git a/test/alter_lincom_scalar.c b/test/alter_lincom_scalar.c
new file mode 100644
index 0000000..c854397
--- /dev/null
+++ b/test/alter_lincom_scalar.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "c1 CONST UINT8 1\n"
+      "c2 CONST UINT8 2\n"
+      "c3 CONST UINT8 3\n"
+      "lincom LINCOM in1 c1 c2 in2 c2 c3\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_alter_spec(D, "lincom LINCOM in1 c2 c3 in2 c3 4", 0);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "lincom", &E);
+  CHECKI(E.EN(lincom,m[0]), 2);
+  CHECKI(E.EN(lincom,m[1]), 3);
+  CHECKI(E.EN(lincom,b[0]), 3);
+  CHECKI(E.EN(lincom,b[1]), 4);
+  CHECKS(E.scalar[0], "c2");
+  CHECKS(E.scalar[1], "c3");
+  CHECKS(E.scalar[GD_MAX_LINCOM + 0], "c3");
+  CHECKP(E.scalar[GD_MAX_LINCOM + 1]);
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_lincom_slope.c b/test/alter_lincom_slope.c
index cd72252..c0650d1 100644
--- a/test/alter_lincom_slope.c
+++ b/test/alter_lincom_slope.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,42 +21,25 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
   const char *in_fields[3] = {"data", "phase", NULL};
   double m[3] = {2, 3, 0};
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "lincom LINCOM 2 data 1 0 data 1 0\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_lincom(D, "lincom", 0, in_fields, m, NULL);
diff --git a/test/alter_linterp.c b/test/alter_linterp.c
index 73043bd..f1addd8 100644
--- a/test/alter_linterp.c
+++ b/test/alter_linterp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* 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";
@@ -37,36 +28,18 @@ int main(void)
   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, e1, e2, e3, n, unlink_table, r = 0;
+  int i, ret, e1, e2, e3, n, unlink_table, r = 0;
   DIRFILE *D;
 
   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(table, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, tabledata, strlen(tabledata));
-  close(fd);
-
-  fd = open(table1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, table1data, strlen(table1data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\nlut LINTERP data table\n");
+  MAKEFORMATFILE(table, "0 0\n1000 5000\n");
+  MAKEFORMATFILE(table1, "0 0\n1000 10000\n");
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_getdata(D, "lut", 5, 0, 1, 0, GD_NULL, NULL);
diff --git a/test/alter_linterp_in.c b/test/alter_linterp_in.c
new file mode 100644
index 0000000..eb46110
--- /dev/null
+++ b/test/alter_linterp_in.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  gd_entry_t e;
+  int ret, e1, e2, e3, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "lut LINTERP data table\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_linterp(D, "lut", "in2", NULL, 0);
+  e1 = gd_error(D);
+  CHECKI(ret, 0);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "lut", &e);
+  e2 = gd_error(D);
+  CHECKI(e2, 0);
+  CHECKS(e.in_fields[0], "in2");
+  CHECKS(e.EN(linterp,table), "table");
+  gd_free_entry_strings(&e);
+
+  e3 = gd_close(D);
+  CHECKI(e3, 0);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_linterp_move.c b/test/alter_linterp_move.c
index ad0bb8a..7089a73 100644
--- a/test/alter_linterp_move.c
+++ b/test/alter_linterp_move.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #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";
@@ -36,35 +27,17 @@ int main(void)
   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, e1, e2, n, unlink_table, r = 0;
+  int i, ret, e1, e2, n, unlink_table, r = 0;
   DIRFILE *D;
 
   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(table, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, tabledata, strlen(tabledata));
-  close(fd);
-
-  fd = open(table1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, table1data, strlen(table1data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\nlut LINTERP data table\n");
+  MAKEFORMATFILE(table, "0 0\n1000 5000\n");
+  MAKEFORMATFILE(table1, "0 0\n1000 10000\n");
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_linterp(D, "lut", NULL, "table1", 1);
diff --git a/test/alter_mplex.c b/test/alter_mplex.c
index e9bf7de..f37f14f 100644
--- a/test/alter_mplex.c
+++ b/test/alter_mplex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,35 +26,20 @@ int main(void)
   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;
+  int 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+    "mplex MPLEX data count 1 3\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  MAKEDATAFILE(count, unsigned char, i % 3, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_mplex(D, "mplex", NULL, NULL, 2, -1);
diff --git a/test/alter_mplex_in.c b/test/alter_mplex_in.c
new file mode 100644
index 0000000..6cb13ef
--- /dev/null
+++ b/test/alter_mplex_in.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, r = 0;
+  DIRFILE *D;
+  gd_entry_t e;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "mplex MPLEX data count 1 3\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_mplex(D, "mplex", "in1", "in2", 2, -1);
+  CHECKI(ret, 0);
+  error = gd_error(D);
+  CHECKI(error, 0);
+
+  gd_entry(D, "mplex", &e);
+  CHECKS(e.in_fields[0], "in1");
+  CHECKS(e.in_fields[1], "in2");
+  gd_free_entry_strings(&e);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_mplex_scalar.c b/test/alter_mplex_scalar.c
new file mode 100644
index 0000000..927e52b
--- /dev/null
+++ b/test/alter_mplex_scalar.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+  gd_entry_t E1, E2;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "c1 CONST UINT8 1\n"
+      "c2 CONST UINT8 2\n"
+      "c3 CONST UINT8 3\n"
+      "mplex MPLEX in1 in2 c1 c2\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_alter_spec(D, "mplex MPLEX in1 in2 4 c3", 0);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "mplex", &E1);
+  CHECKF(E1.EN(mplex,count_val), 4);
+  CHECKF(E1.EN(mplex,period), 3);
+  CHECKP(E1.scalar[0]);
+  CHECKS(E1.scalar[1], "c3");
+  gd_free_entry_strings(&E1);
+
+  e2 = gd_alter_spec(D, "mplex MPLEX in1 in2 c2 5", 0);
+  CHECKI(e2, 0);
+
+  gd_entry(D, "mplex", &E2);
+  CHECKF(E2.EN(mplex,count_val), 2);
+  CHECKF(E2.EN(mplex,period), 5);
+  CHECKS(E2.scalar[0], "c2");
+  CHECKP(E2.scalar[1]);
+  gd_free_entry_strings(&E2);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_mspec.c b/test/alter_mspec.c
index d664390..a094129 100644
--- a/test/alter_mspec.c
+++ b/test/alter_mspec.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,20 @@
 /* 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\nMETA data phase PHASE data 1\n";
-  unsigned char data_data[256];
   unsigned char c[8];
-  int fd, i, ret, error, n, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nMETA data phase PHASE data 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_malter_spec(D, "phase PHASE data 2", "data", 0);
diff --git a/test/alter_mspec_affix.c b/test/alter_mspec_affix.c
index 2eb7a5e..c34487d 100644
--- a/test/alter_mspec_affix.c
+++ b/test/alter_mspec_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,30 +26,16 @@ int main(void)
   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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "/INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\nMETA data phase PHASE data 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_malter_spec(D, "phase PHASE data 2", "AdataZ", 0);
diff --git a/test/alter_multiply.c b/test/alter_multiply.c
index ae03c34..f8e599f 100644
--- a/test/alter_multiply.c
+++ b/test/alter_multiply.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,23 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "mult MULTIPLY data data\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_multiply(D, "mult", NULL, "phase");
diff --git a/test/alter_phase.c b/test/alter_phase.c
index 867ace5..e371cad 100644
--- a/test/alter_phase.c
+++ b/test/alter_phase.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,20 @@
 /* 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\nphase PHASE data 1\n";
-  unsigned char data_data[256];
   unsigned char c[8];
-  int fd, i, ret, error, n, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nphase PHASE data 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_phase(D, "phase", NULL, 2);
diff --git a/test/alter_phase_in.c b/test/alter_phase_in.c
new file mode 100644
index 0000000..4708434
--- /dev/null
+++ b/test/alter_phase_in.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, r = 0;
+  DIRFILE *D;
+  gd_entry_t e;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "phase PHASE data 1\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_phase(D, "phase", "in", 2);
+  CHECKI(ret, 0);
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+
+  gd_entry(D, "phase", &e);
+  CHECKS(e.in_fields[0], "in");
+  gd_free_entry_strings(&e);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_phase_scalar.c b/test/alter_phase_scalar.c
new file mode 100644
index 0000000..a8c4aaf
--- /dev/null
+++ b/test/alter_phase_scalar.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+  gd_entry_t E1, E2;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "c1 CONST UINT8 1\n"
+      "c2 CONST UINT8 2\n"
+      "phase PHASE in1 c1\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_alter_spec(D, "phase PHASE in1 c2", 0);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "phase", &E1);
+  CHECKF(E1.EN(phase,shift), 2);
+  CHECKS(E1.scalar[0], "c2");
+  gd_free_entry_strings(&E1);
+
+  e2 = gd_alter_spec(D, "phase PHASE in1 3", 0);
+  CHECKI(e2, 0);
+
+  gd_entry(D, "phase", &E2);
+  CHECKF(E2.EN(phase,shift), 3);
+  CHECKP(E2.scalar[0]);
+  gd_free_entry_strings(&E2);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_polynom_coeff.c b/test/alter_polynom_coeff.c
index a1e3419..6a4ae22 100644
--- a/test/alter_polynom_coeff.c
+++ b/test/alter_polynom_coeff.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,42 +21,24 @@
 /* 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>
-#include <math.h>
-
 int main(void)
 {
   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};
-  int fd, i, ret, error, n, error2, r = 0;
+  int i, ret, error, n, error2, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\n"
+    "polynom POLYNOM data 1 2 1\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_polynom(D, "polynom", 0, NULL, a);
diff --git a/test/alter_polynom_input.c b/test/alter_polynom_input.c
index f6d6558..8e69c6f 100644
--- a/test/alter_polynom_input.c
+++ b/test/alter_polynom_input.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,23 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "polynom POLYNOM data 1 2 1\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_polynom(D, "polynom", 0, "phase", NULL);
diff --git a/test/alter_polynom_ord.c b/test/alter_polynom_ord.c
index 8fcca17..8e2805a 100644
--- a/test/alter_polynom_ord.c
+++ b/test/alter_polynom_ord.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,23 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\n"
+    "polynom POLYNOM data 1 2 1\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_polynom(D, "polynom", 1, NULL, NULL);
diff --git a/test/alter_polynom_ord2.c b/test/alter_polynom_ord2.c
new file mode 100644
index 0000000..329e325
--- /dev/null
+++ b/test/alter_polynom_ord2.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "polynom POLYNOM in 1 2 3");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_polynom(D, "polynom", -1, NULL, NULL);
+  CHECKI(e1, GD_E_BAD_ENTRY);
+
+  e2 = gd_alter_polynom(D, "polynom", GD_MAX_POLYORD + 1, NULL, NULL);
+  CHECKI(e2, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_polynom_ord_code.c b/test/alter_polynom_ord_code.c
new file mode 100644
index 0000000..26c3a91
--- /dev/null
+++ b/test/alter_polynom_ord_code.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_CREAT | GD_EXCL | GD_RDWR);
+  e1 = gd_alter_polynom(D, "polynom", 0, NULL, NULL);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_polynom_scalar.c b/test/alter_polynom_scalar.c
new file mode 100644
index 0000000..39a2661
--- /dev/null
+++ b/test/alter_polynom_scalar.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "c1 CONST UINT8 1\n"
+      "c2 CONST UINT8 2\n"
+      "c3 CONST UINT8 3\n"
+      "polynom POLYNOM in1 c1 c2 c3\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_alter_spec(D, "polynom POLYNOM in1 c2 c3 4", 0);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "polynom", &E);
+  CHECKI(E.EN(polynom,a[0]), 2);
+  CHECKI(E.EN(polynom,a[1]), 3);
+  CHECKI(E.EN(polynom,a[2]), 4);
+  CHECKS(E.scalar[0], "c2");
+  CHECKS(E.scalar[1], "c3");
+  CHECKP(E.scalar[2]);
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_prot.c b/test/alter_prot.c
new file mode 100644
index 0000000..b698333
--- /dev/null
+++ b/test/alter_prot.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "phase PHASE data 1\n/PROTECT all\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_alter_phase(D, "phase", NULL, 3);
+  error = gd_error(D);
+  CHECKI(ret,GD_E_PROTECTED);
+  CHECKI(error,GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/alter_raw_prot.c b/test/alter_raw_prot.c
new file mode 100644
index 0000000..ada7f05
--- /dev/null
+++ b/test/alter_raw_prot.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/PROTECT data\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
+
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_alter_raw(D, "data", GD_NULL, 11, 1);
+  error = gd_error(D);
+  CHECKI(ret, GD_E_PROTECTED);
+  CHECKI(error, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_raw_spf.c b/test/alter_raw_spf.c
index 4f9da9f..8be7a2b 100644
--- a/test/alter_raw_spf.c
+++ b/test/alter_raw_spf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* 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\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)
-    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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_raw(D, "data", GD_NULL, 11, 1);
diff --git a/test/alter_raw_spf_type.c b/test/alter_raw_spf_type.c
new file mode 100644
index 0000000..cbea31c
--- /dev/null
+++ b/test/alter_raw_spf_type.c
@@ -0,0 +1,108 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General 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";
+
+#define N 12
+  struct {
+    const char *file;
+    const char *name;
+    int len;
+  } data[N] = {
+    { "dirfile/I08",  "I08",   100 },
+    { "dirfile/U08",  "U08",   200 },
+    { "dirfile/I16",  "I16",   300 },
+    { "dirfile/U16",  "U16",   400 },
+    { "dirfile/I32",  "I32",   500 },
+    { "dirfile/U32",  "U32",   600 },
+    { "dirfile/I64",  "I64",   700 },
+    { "dirfile/U64",  "U64",   800 },
+    { "dirfile/F32",  "F32",   900 },
+    { "dirfile/F64",  "F64",  1000 },
+    { "dirfile/C64",  "C64",  1100 },
+    { "dirfile/C128", "C128", 1200 }
+  };
+  int i, e1, r = 0;
+  off_t e2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "I08 RAW   INT8  10\n"
+      "U08 RAW  UINT8  10\n"
+      "I16 RAW   INT16 10\n"
+      "U16 RAW  UINT16 10\n"
+      "I32 RAW   INT32 10\n"
+      "U32 RAW  UINT32 10\n"
+      "I64 RAW   INT64 10\n"
+      "U64 RAW  UINT64 10\n"
+      "F32 RAW FLOAT32 10\n"
+      "F64 RAW FLOAT64 10\n"
+      "C64 RAW COMPLEX64 10\n"
+      "C128 RAW COMPLEX128 10\n"
+      );
+  MAKEDATAFILE(data[0].file, int8_t, i, data[0].len);
+  MAKEDATAFILE(data[1].file, uint8_t, i, data[1].len);
+  MAKEDATAFILE(data[2].file, int16_t, i, data[2].len);
+  MAKEDATAFILE(data[3].file, uint16_t, i, data[3].len);
+  MAKEDATAFILE(data[4].file, int32_t, i, data[4].len);
+  MAKEDATAFILE(data[5].file, uint32_t, i, data[5].len);
+  MAKEDATAFILE(data[6].file, int64_t, i, data[6].len);
+  MAKEDATAFILE(data[7].file, uint64_t, i, data[7].len);
+  MAKEDATAFILE(data[8].file, float, i, data[8].len);
+  MAKEDATAFILE(data[9].file, double, i, data[9].len);
+  MAKEDATAFILE(data[10].file, float, i, 2 * data[10].len);
+  MAKEDATAFILE(data[11].file, double, i, 2 * data[11].len);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+
+  for (i = 0; i < N; ++i) {
+    e1 = gd_alter_raw(D, data[i].name, GD_NULL, 7, 1);
+    CHECKIi(i, e1, 0);
+    e2 = gd_eof(D, data[i].name);
+    CHECKIi(i, e2, data[i].len * 7 / 10);
+  }
+
+  gd_discard(D);
+
+  for (i = 0; i < N; ++i)
+    unlink(data[i].file);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_raw_type.c b/test/alter_raw_type.c
index 1e5e2d4..e2ddde1 100644
--- a/test/alter_raw_type.c
+++ b/test/alter_raw_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,48 +18,40 @@
  * 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\n";
-  unsigned char data_data[256];
   uint16_t d;
-  int fd, i, ret, error, r = 0;
+  int fd, i, ret, e1, e2, e3, r = 0;
   off_t n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_alter_raw(D, "data", GD_STRING, 0, 1);
+  CHECKI(ret, GD_E_BAD_TYPE);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_TYPE);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  gd_alter_raw(D, "data", GD_UINT16 + 1, 0, 1);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_BAD_TYPE);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  gd_alter_raw(D, "data", GD_UINT16, 0, 1);
+  e3 = gd_error(D);
+  CHECKI(e3, 0);
 
-  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
-  ret = gd_alter_raw(D, "data", GD_UINT16, 0, 1);
-  error = gd_error(D);
   n = gd_nframes(D);
+  CHECKI(n, 32);
 
   gd_discard(D);
 
@@ -81,9 +73,5 @@ int main(void)
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, 0);
-  CHECKI(n, 32);
-  CHECKI(ret, 0);
-
   return r;
 }
diff --git a/test/alter_rdonly.c b/test/alter_rdonly.c
new file mode 100644
index 0000000..09f86c0
--- /dev/null
+++ b/test/alter_rdonly.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "phase PHASE data 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  ret = gd_alter_phase(D, "phase", NULL, 3);
+  error = gd_error(D);
+  CHECKI(ret,GD_E_ACCMODE);
+  CHECKI(error,GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/alter_recip.c b/test/alter_recip.c
index 44def49..6a7be84 100644
--- a/test/alter_recip.c
+++ b/test/alter_recip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,23 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "div RECIP data 230.\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_recip(D, "div", "phase", 1093.);
diff --git a/test/alter_recip_scalar.c b/test/alter_recip_scalar.c
new file mode 100644
index 0000000..e60b38f
--- /dev/null
+++ b/test/alter_recip_scalar.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "c1 CONST UINT8 1\n"
+      "c2 CONST UINT8 2\n"
+      "recip RECIP in1 c1\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_alter_spec(D, "recip RECIP in1 c2", 0);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "recip", &E);
+  CHECKF(E.EN(recip,dividend), 2);
+  CHECKS(E.scalar[0], "c2");
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_recip_zero.c b/test/alter_recip_zero.c
index a38fba4..554a94e 100644
--- a/test/alter_recip_zero.c
+++ b/test/alter_recip_zero.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,23 @@
 /* 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 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;
+  int i, ret, error, n, r = 0;
   DIRFILE *D;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW INT32 8\nphase PHASE data 1\n"
+    "div RECIP data 230.\n"
+  );
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_recip(D, "div", "phase", 0.);
diff --git a/test/alter_sarray.c b/test/alter_sarray.c
new file mode 100644
index 0000000..3dd983a
--- /dev/null
+++ b/test/alter_sarray.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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[] = {"a", "b", "c", "d", "e"};
+  int i, ret, error, n, r = 0;
+  size_t z;
+  DIRFILE *D;
+  const char *d[5];
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray SARRAY a b c d e f g h i j k l m n\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_sarray(D, "sarray", 5);
+  error = gd_error(D);
+  CHECKI(error, 0);
+  CHECKI(ret, 0);
+
+  z = gd_array_len(D, "sarray");
+  CHECKU(z, 5);
+
+  n = gd_get_sarray(D, "sarray", d);
+  CHECKI(n, 0);
+  for (i = 0; i < 5; ++i)
+    CHECKSi(i, d[i], data[i]);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_sarray_nop.c b/test/alter_sarray_nop.c
new file mode 100644
index 0000000..3ccbc8b
--- /dev/null
+++ b/test/alter_sarray_nop.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  size_t z;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray SARRAY a b c d e f g h i j k l m n\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  error = gd_alter_sarray(D, "sarray", 0);
+  CHECKI(error, 0);
+
+  z = gd_array_len(D, "sarray");
+  CHECKU(z, 14);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_sbit.c b/test/alter_sbit.c
new file mode 100644
index 0000000..57536f2
--- /dev/null
+++ b/test/alter_sbit.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  signed char c[8];
+  int i, error, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nsbit SBIT data 1 1\n");
+  MAKEDATAFILE(data, signed char, i, 256);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  error = gd_alter_sbit(D, "sbit", NULL, 2, 0);
+  CHECKI(error, 0);
+
+  n = gd_getdata(D, "sbit", 5, 0, 1, 0, GD_INT8, c);
+  CHECKI(n, 8);
+
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i,c[i],((i & 4) != 0) ? -1 : 0);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_scalar_affix.c b/test/alter_scalar_affix.c
index eb92011..e140b63 100644
--- a/test/alter_scalar_affix.c
+++ b/test/alter_scalar_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012 D. V. Wiebe
+/* Copyright (C) 2012, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,44 +20,22 @@
  */
 #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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\nconst CONST INT64 11\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR);
   gd_entry(D, "AdataZ", &E);
diff --git a/test/alter_sindir.c b/test/alter_sindir.c
new file mode 100644
index 0000000..45e0d4d
--- /dev/null
+++ b/test/alter_sindir.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, error, n, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sindir SINDIR data sarray\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_sindir(D, "sindir", NULL, "darray");
+  CHECKI(ret,0);
+  error = gd_error(D);
+  CHECKI(error,0);
+
+  n = gd_entry(D, "sindir", &E);
+  CHECKI(n,0);
+  CHECKS(E.in_fields[0], "data");
+  CHECKS(E.in_fields[1], "darray");
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/alter_spec.c b/test/alter_spec.c
index 06b00fe..19796d8 100644
--- a/test/alter_spec.c
+++ b/test/alter_spec.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* 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\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)
-    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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_spec(D, "data RAW UINT8 11", 1);
diff --git a/test/alter_spec_affix.c b/test/alter_spec_affix.c
index e574d9f..bc5f2cb 100644
--- a/test/alter_spec_affix.c
+++ b/test/alter_spec_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,30 +26,16 @@ int main(void)
   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;
+  int ret, error, r = 0;
   off64_t n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "/INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_spec(D, "AdataZ RAW UINT16 4\n", 0);
diff --git a/test/alter_spec_code.c b/test/alter_spec_code.c
new file mode 100644
index 0000000..2cbd2fe
--- /dev/null
+++ b/test/alter_spec_code.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  error = gd_alter_spec(D, "data RAW UINT8 1", 1);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_spec_format.c b/test/alter_spec_format.c
new file mode 100644
index 0000000..863bb6e
--- /dev/null
+++ b/test/alter_spec_format.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General 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";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  error = gd_alter_spec(D, "data RAW UINT3 11", 1);
+  CHECKI(error, GD_E_FORMAT);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_spec_meta.c b/test/alter_spec_meta.c
index 6c44432..762df09 100644
--- a/test/alter_spec_meta.c
+++ b/test/alter_spec_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,20 @@
 /* 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\nMETA data phase PHASE data 1\n";
-  unsigned char data_data[256];
   unsigned char c[8];
-  int fd, i, ret, error, n, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nMETA data phase PHASE data 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_spec(D, "data/phase PHASE data 2", 0);
diff --git a/test/alter_spec_nil.c b/test/alter_spec_nil.c
new file mode 100644
index 0000000..d31631f
--- /dev/null
+++ b/test/alter_spec_nil.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  error = gd_alter_spec(D, "", 1);
+  CHECKI(error, GD_E_FORMAT);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_spec_polynom.c b/test/alter_spec_polynom.c
index 0640d5c..8209f40 100644
--- a/test/alter_spec_polynom.c
+++ b/test/alter_spec_polynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,18 @@
  */
 #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 = "polynom POLYNOM a 3 5 7 9\n";
-  int fd, i, ret, error, r = 0;
+  int i, ret, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "polynom POLYNOM a 3 5 7 9\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_spec(D, "polynom POLYNOM b 1 2 3\n", 0);
diff --git a/test/alter_spec_prot.c b/test/alter_spec_prot.c
new file mode 100644
index 0000000..1ed8a88
--- /dev/null
+++ b/test/alter_spec_prot.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 2\n/PROTECT format");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_spec(D, "data RAW UINT8 1", 0);
+  CHECKI(e1, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_spec_rdonly.c b/test/alter_spec_rdonly.c
new file mode 100644
index 0000000..2805054
--- /dev/null
+++ b/test/alter_spec_rdonly.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 2");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_alter_spec(D, "data RAW UINT8 1", 0);
+  CHECKI(e1, GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_window.c b/test/alter_window.c
index c47e014..0df893a 100644
--- a/test/alter_window.c
+++ b/test/alter_window.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nwindow WINDOW data data LT 44\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   threshold.r = 43;
diff --git a/test/alter_window_in.c b/test/alter_window_in.c
new file mode 100644
index 0000000..c7c9ff9
--- /dev/null
+++ b/test/alter_window_in.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  gd_triplet_t threshold;
+  int e1, r = 0;
+  DIRFILE *D;
+  gd_entry_t e;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "w WINDOW in1 in2 EQ 0\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+
+  threshold.r = 4.3;
+  e1 = gd_alter_window(D, "w", "in3", "in4", GD_WINDOP_UNK, threshold);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "w", &e);
+  CHECKS(e.in_fields[0], "in3");
+  CHECKS(e.in_fields[1], "in4");
+  gd_free_entry_strings(&e);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_window_op.c b/test/alter_window_op.c
new file mode 100644
index 0000000..31f445d
--- /dev/null
+++ b/test/alter_window_op.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  gd_triplet_t threshold;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  gd_entry_t e;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "w WINDOW in1 in2 EQ 0\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+
+  threshold.r = 4.3;
+  e1 = gd_alter_window(D, "w", NULL, NULL, GD_WINDOP_GT, threshold);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "w", &e);
+  CHECKF(e.EN(window,threshold.r), 4.3);
+  gd_free_entry_strings(&e);
+
+  threshold.u = 0x1010;
+  e2 = gd_alter_window(D, "w", NULL, NULL, GD_WINDOP_SET, threshold);
+  CHECKI(e2, 0);
+
+  gd_entry(D, "w", &e);
+  CHECKF(e.EN(window,threshold.u), 0x1010);
+  gd_free_entry_strings(&e);
+
+  threshold.i = 333;
+  e3 = gd_alter_window(D, "w", NULL, NULL, GD_WINDOP_NE, threshold);
+  CHECKI(e3, 0);
+
+  gd_entry(D, "w", &e);
+  CHECKF(e.EN(window,threshold.u), 333);
+  gd_free_entry_strings(&e);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_window_scalar.c b/test/alter_window_scalar.c
new file mode 100644
index 0000000..349dd7c
--- /dev/null
+++ b/test/alter_window_scalar.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+  gd_entry_t E1, E2;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "c1 CONST UINT8 1\n"
+      "c2 CONST UINT8 2\n"
+      "window WINDOW in1 in2 EQ c1\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_alter_spec(D, "window WINDOW in1 in2 EQ c2", 0);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "window", &E1);
+  CHECKF(E1.EN(window,threshold.i), 2);
+  CHECKS(E1.scalar[0], "c2");
+  gd_free_entry_strings(&E1);
+
+  e2 = gd_alter_spec(D, "window WINDOW in1 in2 EQ 3", 0);
+  CHECKI(e2, 0);
+
+  gd_entry(D, "window", &E2);
+  CHECKF(E2.EN(window,threshold.i), 3);
+  CHECKP(E2.scalar[0]);
+  gd_free_entry_strings(&E2);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/ascii_complex128.c b/test/ascii_complex128.c
new file mode 100644
index 0000000..6432bab
--- /dev/null
+++ b/test/ascii_complex128.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_complex64.c"
diff --git a/test/ascii_complex64.c b/test/ascii_complex64.c
new file mode 100644
index 0000000..4380f0d
--- /dev/null
+++ b/test/ascii_complex64.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_complex128.c"
diff --git a/test/ascii_float32.c b/test/ascii_float32.c
new file mode 100644
index 0000000..b8735ed
--- /dev/null
+++ b/test/ascii_float32.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_float32.c"
diff --git a/test/ascii_float64.c b/test/ascii_float64.c
new file mode 100644
index 0000000..f6a2952
--- /dev/null
+++ b/test/ascii_float64.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_float64.c"
diff --git a/test/ascii_get.c b/test/ascii_get.c
index 0c416b3..70adb3e 100644
--- a/test/ascii_get.c
+++ b/test/ascii_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,32 +21,21 @@
 /* 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 <stdio.h>
-#include <errno.h>
-
 int main(void)
 {
   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;
+  int i, n, error, r = 0;
   DIRFILE *D;
   FILE* stream;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
diff --git a/test/ascii_get_complex.c b/test/ascii_get_complex.c
index 4cae9f1..244ef6d 100644
--- a/test/ascii_get_complex.c
+++ b/test/ascii_get_complex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,32 +20,21 @@
  */
 #include "test.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)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *data = "dirfile/data.txt";
-  const char *format_data = "data RAW COMPLEX128 8\n";
   double c[16];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
   FILE* stream;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
 
   stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
diff --git a/test/ascii_get_get.c b/test/ascii_get_get.c
index d028f0b..e44beee 100644
--- a/test/ascii_get_get.c
+++ b/test/ascii_get_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,32 +21,21 @@
 /* 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 <stdio.h>
-#include <errno.h>
-
 int main(void)
 {
   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;
+  int i, n, error, n2, error2, r = 0;
   DIRFILE *D;
   FILE* stream;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
diff --git a/test/ascii_get_here.c b/test/ascii_get_here.c
index 9efb45c..afbe6ee 100644
--- a/test/ascii_get_here.c
+++ b/test/ascii_get_here.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,19 +25,16 @@ int main(void)
   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, n1, n2, e1, e2, r = 0;
+  int i, n1, n2, e1, e2, r = 0;
   DIRFILE *D;
   FILE* stream;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
diff --git a/test/ascii_get_sub.c b/test/ascii_get_sub.c
index ffc226f..2890b36 100644
--- a/test/ascii_get_sub.c
+++ b/test/ascii_get_sub.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,6 @@
  */
 #include "test.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)
 {
   const char *filedir = "dirfile";
@@ -35,26 +27,19 @@ int main(void)
   const char *format = "dirfile/format";
   const char *format1 = "dirfile/sub/format1";
   const char *data = "dirfile/sub/data.txt";
-  const char *format1_data = "data RAW UINT8 8\n";
-  const char *format_data = "/INCLUDE sub/format1\n";
   unsigned char c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
   FILE* stream;
 
   memset(c, 0, 8);
   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);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE sub/format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\n");
 
   stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
diff --git a/test/ascii_int16.c b/test/ascii_int16.c
new file mode 100644
index 0000000..a8a694c
--- /dev/null
+++ b/test/ascii_int16.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_int16.c"
diff --git a/test/ascii_int32.c b/test/ascii_int32.c
new file mode 100644
index 0000000..504dc89
--- /dev/null
+++ b/test/ascii_int32.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_int32.c"
diff --git a/test/ascii_int64.c b/test/ascii_int64.c
new file mode 100644
index 0000000..3cb116b
--- /dev/null
+++ b/test/ascii_int64.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_int64.c"
diff --git a/test/ascii_int8.c b/test/ascii_int8.c
new file mode 100644
index 0000000..8fdfb3e
--- /dev/null
+++ b/test/ascii_int8.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_int8.c"
diff --git a/test/ascii_nframes.c b/test/ascii_nframes.c
index 610c4c9..617fb86 100644
--- a/test/ascii_nframes.c
+++ b/test/ascii_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,20 @@
 /* Retreiving the number of frames should succeed cleanly */
 #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.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);
+  mkdir(filedir, 0700);
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
 
   stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
diff --git a/test/ascii_put.c b/test/ascii_put.c
index 165d3ce..b5db4ad 100644
--- a/test/ascii_put.c
+++ b/test/ascii_put.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,26 @@
  */
 #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";
   const char *data = "dirfile/data.txt";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   int d, n, e1, e2;
-  int fd, i, r = 0;
+  int i, r = 0;
   struct stat buf;
   FILE* stream;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_TEXT_ENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/ascii_put_here.c b/test/ascii_put_here.c
index ee79215..ecdd9c9 100644
--- a/test/ascii_put_here.c
+++ b/test/ascii_put_here.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,26 @@
  */
 #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";
   const char *data = "dirfile/data.txt";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   int d, n1, n2, e1, e2, e3;
-  int fd, i, r = 0;
+  int i, r = 0;
   struct stat buf;
   FILE* stream;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_TEXT_ENCODED | GD_VERBOSE);
   n1 = gd_seek(D, "data", 5, 0, GD_SEEK_SET | GD_SEEK_WRITE);
diff --git a/test/ascii_seek.c b/test/ascii_seek.c
index 3c7f974..577967c 100644
--- a/test/ascii_seek.c
+++ b/test/ascii_seek.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,17 +25,14 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *data = "dirfile/data.txt";
-  const char *format_data = "data RAW UINT8 8\n";
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
   FILE* stream;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
diff --git a/test/ascii_seek_far.c b/test/ascii_seek_far.c
index be4aa77..b960c44 100644
--- a/test/ascii_seek_far.c
+++ b/test/ascii_seek_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,17 +25,14 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *data = "dirfile/data.txt";
-  const char *format_data = "data RAW UINT8 8\n";
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
   FILE* stream;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
diff --git a/test/ascii_sync.c b/test/ascii_sync.c
index 7df3fcf..acbbdb6 100644
--- a/test/ascii_sync.c
+++ b/test/ascii_sync.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,26 @@
  */
 #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";
   const char *data = "dirfile/data.txt";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   int d, n, e1, e2;
-  int fd, i, r = 0;
+  int i, r = 0;
   struct stat buf;
   FILE* stream;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_TEXT_ENCODED | GD_VERBOSE);
   gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/ascii_uint16.c b/test/ascii_uint16.c
new file mode 100644
index 0000000..c54a56f
--- /dev/null
+++ b/test/ascii_uint16.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_uint16.c"
diff --git a/test/ascii_uint32.c b/test/ascii_uint32.c
new file mode 100644
index 0000000..a12d6f5
--- /dev/null
+++ b/test/ascii_uint32.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_uint32.c"
diff --git a/test/ascii_uint64.c b/test/ascii_uint64.c
new file mode 100644
index 0000000..6d0531a
--- /dev/null
+++ b/test/ascii_uint64.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_uint64.c"
diff --git a/test/ascii_uint8.c b/test/ascii_uint8.c
new file mode 100644
index 0000000..7294fa8
--- /dev/null
+++ b/test/ascii_uint8.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define ENC_SUFFIX ".txt"
+#define GD_ENC_ENCODED GD_TEXT_ENCODED
+
+#include "enc_uint8.c"
diff --git a/test/bof.c b/test/bof.c
index 915722e..a8136a1 100644
--- a/test/bof.c
+++ b/test/bof.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,33 +20,20 @@
  */
 #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 UINT16 2\n/FRAMEOFFSET 35\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   off_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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data, strlen(data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 2\n/FRAMEOFFSET 35\n");
+  MAKEDATAFILE(data, char, data[i], (int)strlen(data));
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_bof(D, "data");
diff --git a/test/bof_bit.c b/test/bof_bit.c
index 4609552..cf26a46 100644
--- a/test/bof_bit.c
+++ b/test/bof_bit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,36 +20,24 @@
  */
 #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 UINT16 2\n"
-    "bit BIT data 1\n"
-    "/FRAMEOFFSET 35\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   off_t n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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, strlen(data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT16 2\n"
+    "bit BIT data 1\n"
+    "/FRAMEOFFSET 35\n"
+  );
+  MAKEDATAFILE(data, char, data[i], (int)strlen(data));
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_bof(D, "bit");
diff --git a/test/bof_bit_code.c b/test/bof_bit_code.c
new file mode 100644
index 0000000..8963eba
--- /dev/null
+++ b/test/bof_bit_code.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data BIT input 1 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_bof(D, "data");
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/bof_code.c b/test/bof_code.c
new file mode 100644
index 0000000..f21f3b3
--- /dev/null
+++ b/test/bof_code.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_bof(D, "data");
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/bof_const.c b/test/bof_const.c
new file mode 100644
index 0000000..35b4497
--- /dev/null
+++ b/test/bof_const.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_bof(D, "data");
+  CHECKI(e1, GD_E_DIMENSION);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/bof_index.c b/test/bof_index.c
index 26cea8a..f28ac11 100644
--- a/test/bof_index.c
+++ b/test/bof_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,33 +20,20 @@
  */
 #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 UINT16 2\n/FRAMEOFFSET 35\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   off_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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data, strlen(data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 2\n/FRAMEOFFSET 35\n");
+  MAKEDATAFILE(data, char, data[i], (int)strlen(data));
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_bof(D, "INDEX");
diff --git a/test/bof_lincom.c b/test/bof_lincom.c
index 6cae2e0..d0ce0cc 100644
--- a/test/bof_lincom.c
+++ b/test/bof_lincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,26 @@
  */
 #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 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";
-  int fd, error1, error2, error3, error4, r = 0;
+  int error1, error2, error3, error4, r = 0;
   off_t bof_data, bof_data2, bof_lincom, bof_lincom2;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "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"
+  );
+  MAKEFORMATFILE(format1, "data2 RAW UINT8 3\nFRAMEOFFSET 33\n");
 
   D = gd_open(filedir, GD_RDONLY);
   bof_data = gd_bof(D, "data");
diff --git a/test/bof_lincom_code.c b/test/bof_lincom_code.c
new file mode 100644
index 0000000..007613a
--- /dev/null
+++ b/test/bof_lincom_code.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1, e2, e3;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 1\n"
+      "lincom1 LINCOM missing 1 0 data 1 0 INDEX 1 0\n"
+      "lincom2 LINCOM INDEX 1 0 missing 1 0 data 1 0\n"
+      "lincom3 LINCOM data 1 0 INDEX 1 0 missing 1 0\n"
+      );
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_bof(D, "lincom1");
+  CHECKI(e1, GD_E_BAD_CODE);
+  e2 = gd_bof(D, "lincom2");
+  CHECKI(e2, GD_E_BAD_CODE);
+  e3 = gd_bof(D, "lincom3");
+  CHECKI(e3, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/bof_phase.c b/test/bof_phase.c
index 0879374..e43e95c 100644
--- a/test/bof_phase.c
+++ b/test/bof_phase.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,42 +20,31 @@
  */
 #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 =
+  int error1, error2, error3, error4, r = 0;
+  off_t bof_phase, bof_phase2, bof_lincom, bof_lincom2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "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"
+    "INCLUDE format1\n"
+  );
+  MAKEFORMATFILE(format1,
+    "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);
-  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);
+    "phase2 PHASE data2 -7\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   bof_phase = gd_bof(D, "phase");
diff --git a/test/bof_phase_code.c b/test/bof_phase_code.c
new file mode 100644
index 0000000..f061a3e
--- /dev/null
+++ b/test/bof_phase_code.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data PHASE missing 0\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_bof(D, "data");
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/bof_phase_neg.c b/test/bof_phase_neg.c
index 31c6aff..540814e 100644
--- a/test/bof_phase_neg.c
+++ b/test/bof_phase_neg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,42 +20,31 @@
  */
 #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 =
+  int error1, error2, error3, error4, r = 0;
+  off_t bof_phase, bof_phase2, bof_mult, bof_mult2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "data RAW UINT16 5\n"
     "phase PHASE data 3\n"
     "/FRAMEOFFSET 35\n"
     "mult MULTIPLY phase2 phase\n"
     "mult2 MULTIPLY phase phase2\n"
-    "INCLUDE format1\n";
-  const char *format1_data = "data2 RAW UINT8 3\n"
+    "INCLUDE format1\n"
+  );
+  MAKEFORMATFILE(format1,
+    "data2 RAW UINT8 3\n"
     "FRAMEOFFSET 43\n"
-    "phase2 PHASE data2 1000\n";
-  int fd, error1, error2, error3, error4, r = 0;
-  off_t bof_phase, bof_phase2, bof_mult, bof_mult2;
-  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);
+    "phase2 PHASE data2 1000\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   bof_phase = gd_bof(D, "phase");
diff --git a/test/bof_recurse.c b/test/bof_recurse.c
new file mode 100644
index 0000000..d9d3b41
--- /dev/null
+++ b/test/bof_recurse.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data PHASE data 0\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_bof(D, "data");
+  CHECKI(n, GD_E_RECURSE_LEVEL);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/bzip_add.c b/test/bzip_add.c
index a0d140f..09a617f 100644
--- a/test/bzip_add.c
+++ b/test/bzip_add.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,58 +20,15 @@
  */
 #include "test.h"
 
-int main(void)
-{
 #ifndef TEST_BZIP2
-  return 77;
-#else
-  const char *filedir = "dirfile";
-  const char *format = "dirfile/format";
-  const char *data = "dirfile/data.bz2";
-  gd_entry_t e;
-  int e1, e2, e3, unlink_data, r = 0;
-  DIRFILE *D;
-
-  rmdirfile();
-#ifdef USE_BZIP2
-  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE | GD_BZIP2_ENCODED);
-#else
-  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_BZIP2_ENCODED);
-#endif
-  gd_add_raw(D, "data", GD_UINT8, 2, 0);
-  e1 = gd_error(D);
-
-  /* check */
-  e2 = gd_entry(D, "data", &e);
-#ifdef USE_BZIP2
-  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);
+#define ENC_SKIP_TEST 1
 #endif
 
-  e3 = gd_close(D);
-  CHECKI(e3, 0);
-
-  unlink_data = unlink(data);
-
 #ifdef USE_BZIP2
-  CHECKI(unlink_data, 0);
-  CHECKI(e1, GD_E_OK);
-#else
-  CHECKI(unlink_data, -1);
-  CHECKI(e1, GD_E_UNSUPPORTED);
+#define USE_ENC 1
 #endif
 
-  unlink(format);
-  rmdir(filedir);
+#define ENC_SUFFIX ".bz2"
+#define ENC_ENCODED GD_BZIP2_ENCODED
 
-  return r;
-#endif
-}
+#include "enc_add.c"
diff --git a/test/bzip_complex128.c b/test/bzip_complex128.c
new file mode 100644
index 0000000..06e119d
--- /dev/null
+++ b/test/bzip_complex128.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_complex128.c"
diff --git a/test/bzip_complex64.c b/test/bzip_complex64.c
new file mode 100644
index 0000000..7506f96
--- /dev/null
+++ b/test/bzip_complex64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_complex64.c"
diff --git a/test/bzip_del.c b/test/bzip_del.c
new file mode 100644
index 0000000..4c438a2
--- /dev/null
+++ b/test/bzip_del.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#ifndef TEST_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#ifdef USE_BZIP2
+#define USE_ENC 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_del.c"
diff --git a/test/bzip_enoent.c b/test/bzip_enoent.c
new file mode 100644
index 0000000..6d98212
--- /dev/null
+++ b/test/bzip_enoent.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#ifndef TEST_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#ifdef USE_BZIP2
+#define USE_ENC 1
+#endif
+
+#define ENC_NAME "bzip2"
+
+#include "enc_enoent.c"
diff --git a/test/bzip_float32.c b/test/bzip_float32.c
new file mode 100644
index 0000000..944d868
--- /dev/null
+++ b/test/bzip_float32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_float32.c"
diff --git a/test/bzip_float64.c b/test/bzip_float64.c
new file mode 100644
index 0000000..e9fb77e
--- /dev/null
+++ b/test/bzip_float64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_float64.c"
diff --git a/test/bzip_get.c b/test/bzip_get.c
index 2b39026..ae70442 100644
--- a/test/bzip_get.c
+++ b/test/bzip_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* 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)
 {
 #ifndef TEST_BZIP2
@@ -39,11 +30,9 @@ int main(void)
   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];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 #ifdef USE_BZIP2
   int i;
@@ -51,18 +40,10 @@ int main(void)
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data);
diff --git a/test/bzip_get_cont.c b/test/bzip_get_cont.c
new file mode 100644
index 0000000..eff89e1
--- /dev/null
+++ b/test/bzip_get_cont.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data)
+
+#include "enc_get_cont.c"
diff --git a/test/bzip_get_far.c b/test/bzip_get_far.c
index e2b345e..df370ca 100644
--- a/test/bzip_get_far.c
+++ b/test/bzip_get_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,27 +29,17 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *bz2data = "dirfile/data.bz2";
-  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, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data);
diff --git a/test/bzip_get_get.c b/test/bzip_get_get.c
index 6149d13..0e4a0c8 100644
--- a/test/bzip_get_get.c
+++ b/test/bzip_get_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,28 +29,18 @@ int main(void)
   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];
-  int fd, i, n1, e1, e2, n2, e3, r = 0;
+  int i, n1, e1, e2, n2, e3, r = 0;
   DIRFILE *D;
 
   memset(c1, 0, 16);
   memset(c2, 0, 16);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data);
diff --git a/test/bzip_get_get2.c b/test/bzip_get_get2.c
index 42c6787..0bd993f 100644
--- a/test/bzip_get_get2.c
+++ b/test/bzip_get_get2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,28 +29,18 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *bz2data = "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];
-  int fd, i, n1, error1, n2, error2, r = 0;
+  int i, n1, error1, n2, error2, r = 0;
   DIRFILE *D;
 
   memset(c1, 0, 16);
   memset(c2, 0, 16);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data);
diff --git a/test/bzip_get_put.c b/test/bzip_get_put.c
index 246fac3..22b8d7a 100644
--- a/test/bzip_get_put.c
+++ b/test/bzip_get_put.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2014, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_bz2 = "dirfile/data.bz2";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   const unsigned char bz2data[425] = {
     0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26,
     0x53, 0x59, 0xb6, 0xb5, 0xee, 0x95, 0x00, 0x00,
@@ -96,14 +95,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   fd = open(data_bz2, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, bz2data, 425);
diff --git a/test/bzip_int16.c b/test/bzip_int16.c
new file mode 100644
index 0000000..2624f98
--- /dev/null
+++ b/test/bzip_int16.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_int16.c"
diff --git a/test/bzip_int32.c b/test/bzip_int32.c
new file mode 100644
index 0000000..637c18f
--- /dev/null
+++ b/test/bzip_int32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_int32.c"
diff --git a/test/bzip_int64.c b/test/bzip_int64.c
new file mode 100644
index 0000000..2a67422
--- /dev/null
+++ b/test/bzip_int64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_int64.c"
diff --git a/test/bzip_int8.c b/test/bzip_int8.c
new file mode 100644
index 0000000..89f2018
--- /dev/null
+++ b/test/bzip_int8.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_int8.c"
diff --git a/test/bzip_move_from.c b/test/bzip_move_from.c
index 05f4cc6..3d266c6 100644
--- a/test/bzip_move_from.c
+++ b/test/bzip_move_from.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,110 +20,17 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <inttypes.h>
-
-int main(void)
-{
 #ifndef TEST_BZIP2
-  return 77;
-#else
-  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";
-  uint16_t data_data[128];
-  int fd, ret, e1, e2, ge_ret, unlink_data, unlink_bz2data, r = 0;
-  char command[4096];
-  gd_entry_t E;
-  DIRFILE *D;
-#ifdef USE_BZIP2
-  uint16_t d;
-  int i = 0;
+#define ENC_SKIP_TEST 1
 #endif
 
-  rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = fd * 0x201;
-
-  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, 128 * sizeof(uint16_t));
-  close(fd);
-
-  /* compress */
-  snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data);
-  if (gd_system(command))
-    return 1;
-
 #ifdef USE_BZIP2
-  D = gd_open(filedir, GD_RDWR | GD_VERBOSE | GD_UNENCODED);
-#else
-  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+#define USE_ENC 1
 #endif
-  ret = gd_move(D, "data", 1, 1);
-  e1 = gd_error(D);
-  ge_ret =  gd_entry(D, "data", &E);
-  CHECKI(ge_ret, 0);
 
-  e2 = gd_close(D);
-  CHECKI(e2, 0);
+#define ENC_SUFFIX ".bz2"
+#define ENC_NAME "bzip2"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data)
 
-#ifdef USE_BZIP2
-  fd = open(data, O_RDONLY | O_BINARY);
-
-  if (fd >= 0) {
-    while (read(fd, &d, sizeof(uint16_t))) {
-      CHECKI(d, i * 0x201);
-      i++;
-    }
-    close(fd);
-  } else {
-    perror("open");
-    r = 1;
-  }
-#endif
-
-  unlink(format1);
-  unlink(format);
-  unlink_data = unlink(data);
-  unlink_bz2data = unlink(bz2data);
-  rmdir(filedir);
-
-#ifdef USE_BZIP2
-  CHECKI(ret, 0);
-  CHECKI(e1, GD_E_OK);
-  CHECKI(E.fragment_index, 1);
-  CHECKI(unlink_data, 0);
-  CHECKI(unlink_bz2data, -1);
-#else
-  CHECKI(ret, -1);
-  CHECKI(e1, GD_E_UNSUPPORTED);
-  CHECKI(E.fragment_index, 0);
-  CHECKI(unlink_data, -1);
-  CHECKI(unlink_bz2data, 0);
-#endif
-  gd_free_entry_strings(&E);
-
-  return r;
-#endif
-}
+#include "enc_move_from.c"
diff --git a/test/bzip_move_to.c b/test/bzip_move_to.c
index b6dc4ed..da4b990 100644
--- a/test/bzip_move_to.c
+++ b/test/bzip_move_to.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,7 +26,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_bz2 = "dirfile/data.bz2";
   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_BZIP2
@@ -38,14 +37,12 @@ int main(void)
   struct stat buf;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING none\n/ENDIAN little\n");
 
   fd = open(data_raw, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_in, 256);
diff --git a/test/bzip_nframes.c b/test/bzip_nframes.c
index c0f2f23..c9bde29 100644
--- a/test/bzip_nframes.c
+++ b/test/bzip_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,75 +18,18 @@
  * 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_BZIP2
-  return 77;
-#else
-  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)
-    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 */
-  snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data);
-  if (gd_system(command)) {
-    perror(BZIP2);
-    r = 1;
-  }
-
-#ifdef USE_BZIP2
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-#else
-  D = gd_open(filedir, GD_RDONLY);
+#define ENC_SKIP_TEST 1
 #endif
-  n = gd_nframes(D);
-  error = gd_error(D);
-  gd_discard(D);
-
-  unlink(gzipdata);
-  unlink(format);
-  rmdir(filedir);
 
 #ifdef USE_BZIP2
-  CHECKI(error, 0);
-  CHECKI(n, 256);
-#else
-  CHECKI(error, GD_E_UNSUPPORTED);
-  CHECKI(n, 0);
+#define USE_ENC 1
 #endif
 
-  return r;
-#endif
-}
+#define ENC_SUFFIX ".bz2"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data)
+
+#include "enc_nframes.c"
diff --git a/test/bzip_put.c b/test/bzip_put.c
index 9006025..2c8f480 100644
--- a/test/bzip_put.c
+++ b/test/bzip_put.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_bz2 = "dirfile/data.bz2";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
 #ifdef USE_BZIP2
   char command[4096];
@@ -41,14 +40,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
 #ifdef USE_BZIP2
   D = gd_open(filedir, GD_RDWR | GD_BZIP2_ENCODED | GD_VERBOSE);
diff --git a/test/bzip_put_back.c b/test/bzip_put_back.c
index 15e425f..b0019b7 100644
--- a/test/bzip_put_back.c
+++ b/test/bzip_put_back.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_bz2 = "dirfile/data.bz2";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   char command[4096];
   uint8_t d;
@@ -39,14 +38,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_BZIP2_ENCODED | GD_VERBOSE);
   n1 = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/bzip_put_endian.c b/test/bzip_put_endian.c
index 0476998..e2f0138 100644
--- a/test/bzip_put_endian.c
+++ b/test/bzip_put_endian.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,6 +20,12 @@
  */
 #include "test.h"
 
+#ifdef WORDS_BIGENDIAN
+#define ENDIAN "ENDIAN little"
+#else
+#define ENDIAN "ENDIAN big"
+#endif
+
 int main(void)
 {
 #ifndef TEST_BZIP2
@@ -29,12 +35,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_bz2 = "dirfile/data.bz2";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT16 8\n"
-#ifdef WORDS_BIGENDIAN
-  "ENDIAN little\n";
-#else
-  "ENDIAN big\n";
-#endif
   uint16_t c[8];
 #ifdef USE_BZIP2
   char command[4096];
@@ -46,14 +46,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = (uint16_t)(0x102 * i);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n" ENDIAN "\n");
 
 #ifdef USE_BZIP2
   D = gd_open(filedir, GD_RDWR | GD_BZIP2_ENCODED | GD_VERBOSE);
diff --git a/test/bzip_put_get.c b/test/bzip_put_get.c
index 1b4eb7a..5b3094e 100644
--- a/test/bzip_put_get.c
+++ b/test/bzip_put_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -28,21 +28,18 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *data = "dirfile/data.bz2";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d[8];
-  int fd, i, m, n, e1, e2, e3, unlink_data, r = 0;
+  int i, m, n, e1, e2, e3, unlink_data, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
 #ifdef USE_BZIP2
   D = gd_open(filedir, GD_RDWR | GD_BZIP2_ENCODED | GD_VERBOSE);
diff --git a/test/bzip_put_offs.c b/test/bzip_put_offs.c
new file mode 100644
index 0000000..e0fd43a
--- /dev/null
+++ b/test/bzip_put_offs.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined USE_BZIP2 || !defined TEST_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_put_offs.c"
diff --git a/test/bzip_put_pad.c b/test/bzip_put_pad.c
index 7b4e11e..cc2f5bb 100644
--- a/test/bzip_put_pad.c
+++ b/test/bzip_put_pad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_bz2 = "dirfile/data.bz2";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   char command[4096];
   uint8_t d;
@@ -39,14 +38,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_BZIP2_ENCODED | GD_VERBOSE);
   n1 = gd_putdata(D, "data", 0, 0, 1, 0, GD_UINT8, c);
diff --git a/test/bzip_put_sub.c b/test/bzip_put_sub.c
index efdbd9e..be1b46e 100644
--- a/test/bzip_put_sub.c
+++ b/test/bzip_put_sub.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -31,8 +31,6 @@ int main(void)
   const char *format1 = "dirfile/sub/format1";
   const char *data_bz2 = "dirfile/sub/data.bz2";
   const char *data = "dirfile/sub/data";
-  const char *format_data = "/INCLUDE sub/format1\n";
-  const char *format1_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   char command[4096];
   uint8_t d;
@@ -42,19 +40,14 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-  mkdir(subdir, 0777);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
   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);
-
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE sub/format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_BZIP2_ENCODED | GD_VERBOSE);
   n1 = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/bzip_seek.c b/test/bzip_seek.c
index 35975aa..627b92d 100644
--- a/test/bzip_seek.c
+++ b/test/bzip_seek.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,53 +20,17 @@
  */
 #include "test.h"
 
-int main(void)
-{
-#if !defined USE_BZIP2 || !defined TEST_BZIP2
-  return 77;
-#else
-  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 data_data[256];
-  int fd, n, error, r = 0;
-  char command[4096];
-  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 * sizeof(uint16_t));
-  close(fd);
-
-  /* compress */
-  snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data);
-  if (gd_system(command))
-    return 1;
-
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-  n = gd_seek(D, "data", 5, 0, GD_SEEK_SET);
-  error = gd_error(D);
-
-  CHECKI(n, 40);
-  CHECKI(error, 0);
+#ifndef TEST_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
 
-  gd_discard(D);
+#ifdef USE_BZIP2
+#define USE_ENC 1
+#endif
 
-  unlink(bzip2data);
-  unlink(format);
-  rmdir(filedir);
+#define ENC_SUFFIX ".bz2"
+#define ENC_NAME "bzip2"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data)
 
-  return r;
-#endif
-}
+#include "enc_seek.c"
diff --git a/test/bzip_seek_far.c b/test/bzip_seek_far.c
index 65aea84..4bdeb03 100644
--- a/test/bzip_seek_far.c
+++ b/test/bzip_seek_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,25 +29,15 @@ int main(void)
   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 data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   char command[4096];
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", BZIP2, data);
diff --git a/test/bzip_sync.c b/test/bzip_sync.c
index 1d1383e..55fad40 100644
--- a/test/bzip_sync.c
+++ b/test/bzip_sync.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_bz2 = "dirfile/data.bz2";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   char command[4096];
   uint8_t d;
@@ -39,14 +38,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_BZIP2_ENCODED | GD_VERBOSE);
   gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/bzip_uint16.c b/test/bzip_uint16.c
new file mode 100644
index 0000000..1fd9460
--- /dev/null
+++ b/test/bzip_uint16.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_uint16.c"
diff --git a/test/bzip_uint32.c b/test/bzip_uint32.c
new file mode 100644
index 0000000..0fcb111
--- /dev/null
+++ b/test/bzip_uint32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_uint32.c"
diff --git a/test/bzip_uint64.c b/test/bzip_uint64.c
new file mode 100644
index 0000000..a082460
--- /dev/null
+++ b/test/bzip_uint64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_uint64.c"
diff --git a/test/bzip_uint8.c b/test/bzip_uint8.c
new file mode 100644
index 0000000..be8f0ac
--- /dev/null
+++ b/test/bzip_uint8.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_BZIP2 || !defined USE_BZIP2
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".bz2"
+#define GD_ENC_ENCODED GD_BZIP2_ENCODED
+
+#include "enc_uint8.c"
diff --git a/test/calist.c b/test/calist.c
new file mode 100644
index 0000000..829d0d3
--- /dev/null
+++ b/test/calist.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2010-2011, 2013, 2015, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 j, error, r = 0;
+  size_t i;
+  struct uint8_carrays {
+    size_t n;
+    uint8_t *d;
+  } *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "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"
+    "data4 RAW UINT8 1\n"
+    "data4/meta CARRAY UINT8 4 8 12 16 20 24 28 32\n"
+    "/ALIAS data5 data4/meta\n"
+  );
+
+  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 (j = 0; j < 4; ++j) {
+      CHECKUi(j,field_list[j].n, (size_t)(5 + j));
+      for (i = 0; i < field_list[j].n; ++i)
+        CHECKUi(j * 1000 + i,field_list[j].d[i], (j + 1) * (i + 1));
+    }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist0.c b/test/calist0.c
new file mode 100644
index 0000000..5a3b8fe
--- /dev/null
+++ b/test/calist0.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_carray_t *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data4 RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = (gd_carray_t*)gd_carrays(D, GD_UINT8);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKU(field_list[0].n, 0);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist_free.c b/test/calist_free.c
new file mode 100644
index 0000000..01212eb
--- /dev/null
+++ b/test/calist_free.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 fd, e1, e2, r = 0;
+  size_t i;
+  struct uint8_carrays {
+    size_t n;
+    uint8_t *d;
+  } *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "data1 CARRAY UINT8 1 2 3 4 5\n"
+    "data2 CARRAY UINT8 2 4 6 8 10 12\n"
+    "data4 RAW UINT8 1\n"
+  );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  field_list = (struct uint8_carrays*)gd_carrays(D, GD_UINT8);
+  e1 = gd_error(D);
+
+  CHECKI(e1, 0);
+
+  if (!r)
+    for (fd = 0; fd < 2; ++fd) {
+      CHECKUi(fd,field_list[fd].n, (size_t)(5 + fd));
+      for (i = 0; i < field_list[fd].n; ++i)
+        CHECKUi(fd * 1000 + i,field_list[fd].d[i], (fd + 1) * (i + 1));
+    }
+
+  gd_add_spec(D, "data3 CARRAY UINT8 3 6 9 12 15 18 21", 0);
+
+  field_list = (struct uint8_carrays*)gd_carrays(D, GD_UINT8);
+  e2 = gd_error(D);
+
+  CHECKI(e2, 0);
+
+  if (!r)
+    for (fd = 0; fd < 3; ++fd) {
+      CHECKUi(fd * 2000,field_list[fd].n, (size_t)(5 + fd));
+      for (i = 0; i < field_list[fd].n; ++i)
+        CHECKUi(fd * 3000 + i,field_list[fd].d[i], (fd + 1) * (i + 1));
+    }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist_hidden.c b/test/calist_hidden.c
new file mode 100644
index 0000000..4941fa5
--- /dev/null
+++ b/test/calist_hidden.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 fd, error, r = 0;
+  size_t i;
+  struct uint8_carrays {
+    size_t n;
+    uint8_t *d;
+  } *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "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"
+  );
+
+  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_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist_long.c b/test/calist_long.c
new file mode 100644
index 0000000..798369d
--- /dev/null
+++ b/test/calist_long.c
@@ -0,0 +1,80 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 j, error, r = 0;
+  struct uint8_carrays {
+    size_t n;
+    uint8_t *d;
+  } *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data00 CARRAY UINT8 0\n"
+      "data01 CARRAY UINT8 1\n"
+      "data02 CARRAY UINT8 2\n"
+      "data03 CARRAY UINT8 3\n"
+      "data04 CARRAY UINT8 4\n"
+      "data05 CARRAY UINT8 5\n"
+      "data06 CARRAY UINT8 6\n"
+      "data07 CARRAY UINT8 7\n"
+      "data08 CARRAY UINT8 8\n"
+      "data09 CARRAY UINT8 9\n"
+      "data10 CARRAY UINT8 10\n"
+      "data11 CARRAY UINT8 11\n"
+      "data12 CARRAY UINT8 12\n"
+      "data13 CARRAY UINT8 13\n"
+      "data14 CARRAY UINT8 14\n"
+      "data15 CARRAY UINT8 15\n"
+      "data16 CARRAY UINT8 16\n"
+      "data17 CARRAY UINT8 17\n"
+      "data18 CARRAY UINT8 18\n"
+      "data19 CARRAY UINT8 19\n"
+      );
+
+  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 (j = 0; field_list[j].n; ++j) {
+      CHECKUi(j,field_list[j].n, 1);
+      CHECKUi(j,field_list[j].d[0], j);
+    }
+    CHECKI(j, 20);
+  }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist_meta.c b/test/calist_meta.c
new file mode 100644
index 0000000..b10c8af
--- /dev/null
+++ b/test/calist_meta.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2010-2011, 2013, 2015, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 j, error, r = 0;
+  size_t i;
+  struct uint8_carrays {
+    size_t n;
+    uint8_t *d;
+  } *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "data0 CARRAY UINT8 4 8 12 16 20 24 28 32\n"
+    "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"
+    "parent/data3 CARRAY UINT8 3 6 9 12 15 18 21\n"
+    "META parent data4 LINTERP UINT8 1\n"
+    "/ALIAS parent/data5 data0\n"
+  );
+
+  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 (j = 0; j < 4; ++j) {
+      CHECKUi(j,field_list[j].n, (size_t)(5 + j));
+      for (i = 0; i < field_list[j].n; ++i)
+        CHECKUi(j * 1000 + i,field_list[j].d[i], (j + 1) * (i + 1));
+    }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist_meta0.c b/test/calist_meta0.c
new file mode 100644
index 0000000..5e473da
--- /dev/null
+++ b/test/calist_meta0.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2013, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_carray_t *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "parent CARRAY UINT8 1\n"
+    "META parent data4 LINTERP UINT8 1\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = (gd_carray_t *)gd_mcarrays(D, "parent", GD_UINT8);
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+  CHECKPN(field_list);
+  CHECKI(field_list[0].n, 0);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist_meta_free.c b/test/calist_meta_free.c
new file mode 100644
index 0000000..d23d4b3
--- /dev/null
+++ b/test/calist_meta_free.c
@@ -0,0 +1,77 @@
+/* Copyright (C) 2013, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 fd, error, r = 0;
+  size_t i;
+  struct uint8_carrays {
+    size_t n;
+    uint8_t *d;
+  } *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "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"
+    "META parent data4 LINTERP UINT8 1\n"
+  );
+
+  D = gd_open(filedir, GD_RDWR | 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 + fd));
+      for (i = 0; i < field_list[fd].n; ++i)
+        CHECKUi(fd * 1000 + i,field_list[fd].d[i], (fd + 1) * (i + 1));
+    }
+
+  gd_add_spec(D, "parent/data3 CARRAY UINT8 3 6 9 12 15 18 21", 0);
+
+  field_list = (struct uint8_carrays *)gd_mcarrays(D, "parent", GD_UINT8);
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+
+  if (!r)
+    for (fd = 0; fd < 3; ++fd) {
+      CHECKUi(fd * 2000,field_list[fd].n, (size_t)(5 + fd));
+      for (i = 0; i < field_list[fd].n; ++i)
+        CHECKUi(fd * 3000 + i,field_list[fd].d[i], (fd + 1) * (i + 1));
+    }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist_meta_hidden.c b/test/calist_meta_hidden.c
new file mode 100644
index 0000000..7e3d393
--- /dev/null
+++ b/test/calist_meta_hidden.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2011, 2013, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 fd, error, r = 0;
+  size_t i;
+  struct uint8_carrays {
+    size_t n;
+    uint8_t *d;
+  } *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "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"
+  );
+
+  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_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist_meta_meta.c b/test/calist_meta_meta.c
new file mode 100644
index 0000000..f2e1ca5
--- /dev/null
+++ b/test/calist_meta_meta.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2010-2011, 2013, 2015, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const void *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "data0 CARRAY UINT8 4 8 12 16 20 24 28 32\n"
+    "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"
+    "parent/data3 CARRAY UINT8 3 6 9 12 15 18 21\n"
+    "META parent data4 LINTERP UINT8 1\n"
+    "/ALIAS parent/data5 data0\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY);
+  field_list = gd_mcarrays(D, "parent/data1", GD_UINT8);
+  CHECKP(field_list);
+
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist_meta_parent.c b/test/calist_meta_parent.c
new file mode 100644
index 0000000..f6e841b
--- /dev/null
+++ b/test/calist_meta_parent.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2010-2011, 2013, 2015, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const void *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  field_list = gd_mcarrays(D, "parent", GD_UINT8);
+  CHECKP(field_list);
+
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/calist_null.c b/test/calist_null.c
new file mode 100644
index 0000000..0b8bcbf
--- /dev/null
+++ b/test/calist_null.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2015, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 j, error, r = 0;
+  struct uint8_carrays {
+    size_t n;
+    uint8_t *d;
+  } *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "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"
+    "data4 RAW UINT8 1\n"
+    "data4/meta CARRAY UINT8 4 8 12 16 20 24 28 32\n"
+    "/ALIAS data5 data4/meta\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = (struct uint8_carrays*)gd_carrays(D, GD_NULL);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+
+  if (!r)
+    for (j = 0; j < 4; ++j) {
+      CHECKUi(j,field_list[j].n, (size_t)(5 + j));
+      CHECKPi(j,field_list[j].d);
+    }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/close_close.c b/test/close_close.c
index 3560d56..fc63665 100644
--- a/test/close_close.c
+++ b/test/close_close.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,12 +21,6 @@
 /* Closing 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>
-
 int main(void)
 {
   const char *filedir = "dirfile";
@@ -35,8 +29,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_close(D);
diff --git a/test/close_discard.c b/test/close_discard.c
index 5bc78bb..ec82cd0 100644
--- a/test/close_discard.c
+++ b/test/close_discard.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,13 +21,6 @@
 /* Closing 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 <stdio.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
@@ -37,8 +30,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   gd_add_spec(D, "data RAW UINT8 1", 0);
diff --git a/test/convert_complex128_complex64.c b/test/convert_complex128_complex64.c
index ea82149..11171f0 100644
--- a/test/convert_complex128_complex64.c
+++ b/test/convert_complex128_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,54 +18,27 @@
  * 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"
 
-#include <math.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 <math.h>
-
 int main(void)
 {
   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];
 #else
-  double complex  data_data[256];
   float complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[2 * fd] = data_data[2 * fd + 1] =  fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_complex128_float64.c b/test/convert_complex128_float64.c
index 751dbd5..dd40be8 100644
--- a/test/convert_complex128_float64.c
+++ b/test/convert_complex128_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,23 @@
 /* Attempt to read COMPLEX128 as FLOAT64 */
 #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 <math.h>
-
 int main(void)
 {
   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};
 #else
   double complex d = 8;
 #endif
-  int fd, n1, n2, error, r = 0;
+  int n1, n2, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data CONST FLOAT64 0\n");
 
   D = gd_open(filedir, GD_RDWR);
 #ifdef GD_NO_C99_API
diff --git a/test/convert_complex128_int64.c b/test/convert_complex128_int64.c
index 2e22ee1..264e5f2 100644
--- a/test/convert_complex128_int64.c
+++ b/test/convert_complex128_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,23 @@
 /* Attempt to read COMPLEX128 as INT64 */
 #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 *format_data = "data CONST INT64 0\n";
   int64_t c = 0;
 #ifdef GD_NO_C99_API
   double d[] = {8, 0};
 #else
   double complex d = 8;
 #endif
-  int fd, n1, n2, error, r = 0;
+  int n1, n2, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data CONST INT64 0\n");
 
   D = gd_open(filedir, GD_RDWR);
 #ifdef GD_NO_C99_API
diff --git a/test/convert_complex128_uint64.c b/test/convert_complex128_uint64.c
index b5954e1..00066d4 100644
--- a/test/convert_complex128_uint64.c
+++ b/test/convert_complex128_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,23 @@
 /* Attempt to read COMPLEX128 as UINT64 */
 #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 *format_data = "data CONST UINT64 0\n";
   uint64_t c = 0;
 #ifdef GD_NO_C99_API
   double d[] = {8, 0};
 #else
   double complex d = 8;
 #endif
-  int fd, n1, n2, error, r = 0;
+  int n1, n2, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data CONST UINT64 0\n");
 
   D = gd_open(filedir, GD_RDWR);
 #ifdef GD_NO_C99_API
diff --git a/test/convert_complex64_complex128.c b/test/convert_complex64_complex128.c
index d4c84d9..9926a77 100644
--- a/test/convert_complex64_complex128.c
+++ b/test/convert_complex64_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,53 +18,27 @@
  * 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"
 
-#include <math.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 COMPLEX64 8\n";
 #ifdef GD_NO_C99_API
-  float data_data[512];
   double c[16];
 #else
-  float complex  data_data[256];
   double complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[2 * fd] = data_data[2 * fd + 1] = (float)fd;
-#else
-    data_data[fd] = (float complex)fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX64 8\n");
+  MAKEDATAFILE(data, float, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_complex64_float64.c b/test/convert_complex64_float64.c
index 8702b9c..7c6018b 100644
--- a/test/convert_complex64_float64.c
+++ b/test/convert_complex64_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,23 @@
 /* Attempt to read COMPLEX64 as FLOAT64 */
 #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 <math.h>
-
 int main(void)
 {
   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};
 #else
   float complex d = 8;
 #endif
-  int fd, n1, n2, error, r = 0;
+  int n1, n2, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data CONST FLOAT64 0\n");
 
   D = gd_open(filedir, GD_RDWR);
 #ifdef GD_NO_C99_API
diff --git a/test/convert_complex64_int64.c b/test/convert_complex64_int64.c
index 0786021..77802b3 100644
--- a/test/convert_complex64_int64.c
+++ b/test/convert_complex64_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,23 @@
 /* Attempt to read COMPLEX64 as INT64 */
 #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 *format_data = "data CONST INT64 0\n";
   int64_t c = 0;
 #ifdef GD_NO_C99_API
   float d[] = {8, 0};
 #else
   float complex d = 8;
 #endif
-  int fd, n1, n2, error, r = 0;
+  int n1, n2, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data CONST INT64 0\n");
 
   D = gd_open(filedir, GD_RDWR);
 #ifdef GD_NO_C99_API
diff --git a/test/convert_complex64_uint64.c b/test/convert_complex64_uint64.c
index 23c0bed..6f75a82 100644
--- a/test/convert_complex64_uint64.c
+++ b/test/convert_complex64_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,23 @@
 /* Attempt to read COMPLEX64 as UINT64 */
 #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 *format_data = "data CONST UINT64 0\n";
   uint64_t c = 0;
 #ifdef GD_NO_C99_API
   float d[] = {8, 0};
 #else
   float complex d = 8;
 #endif
-  int fd, error, n1, n2, r = 0;
+  int error, n1, n2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data CONST UINT64 0\n");
 
   D = gd_open(filedir, GD_RDWR);
 #ifdef GD_NO_C99_API
diff --git a/test/convert_float32_complex128.c b/test/convert_float32_complex128.c
index 378954c..e8bf50e 100644
--- a/test/convert_float32_complex128.c
+++ b/test/convert_float32_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read FLOAT32 as COMPLEX128 */
 #include "test.h"
 
-#include <math.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 FLOAT32 8\n";
-  float data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
 #else
   double complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_float32_complex64.c b/test/convert_float32_complex64.c
index 100b5fc..cab1586 100644
--- a/test/convert_float32_complex64.c
+++ b/test/convert_float32_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read FLOAT32 as COMPLEX64 */
 #include "test.h"
 
-#include <math.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 FLOAT32 8\n";
-  float data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
 #else
   float complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_float32_float64.c b/test/convert_float32_float64.c
index 82d6ced..2e78f5b 100644
--- a/test/convert_float32_float64.c
+++ b/test/convert_float32_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read FLOAT32 as FLOAT64 */
 #include "test.h"
 
-#include <math.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 FLOAT32 8\n";
-  float  data_data[256];
   double c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/convert_float32_int16.c b/test/convert_float32_int16.c
index acc565e..895d972 100644
--- a/test/convert_float32_int16.c
+++ b/test/convert_float32_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT32 as INT16 */
 #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 FLOAT32 8\n";
-  float  data_data[256];
   int16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/convert_float32_int32.c b/test/convert_float32_int32.c
index eb1b11d..8580fa3 100644
--- a/test/convert_float32_int32.c
+++ b/test/convert_float32_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT32 as INT32 */
 #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 FLOAT32 8\n";
-  float  data_data[256];
   int32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/convert_float32_int64.c b/test/convert_float32_int64.c
index 3302eb8..7d744f7 100644
--- a/test/convert_float32_int64.c
+++ b/test/convert_float32_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT32 as INT64 */
 #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 FLOAT32 8\n";
-  float  data_data[256];
   int64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
diff --git a/test/convert_float32_int8.c b/test/convert_float32_int8.c
index 601f42d..ac6b37b 100644
--- a/test/convert_float32_int8.c
+++ b/test/convert_float32_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT32 as INT8 */
 #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 FLOAT32 8\n";
-  float  data_data[256];
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/convert_float32_uint16.c b/test/convert_float32_uint16.c
index 4d1d9a8..c09a7ab 100644
--- a/test/convert_float32_uint16.c
+++ b/test/convert_float32_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT32 as UINT16 */
 #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 FLOAT32 8\n";
-  float  data_data[256];
   uint16_t c[8], i;
-  int fd, error, n, r = 0;
+  int error, n, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/convert_float32_uint32.c b/test/convert_float32_uint32.c
index 859ec79..a2c7349 100644
--- a/test/convert_float32_uint32.c
+++ b/test/convert_float32_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT32 as UINT32 */
 #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 FLOAT32 8\n";
-  float  data_data[256];
   uint32_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/convert_float32_uint64.c b/test/convert_float32_uint64.c
index fe1728a..d32c4d4 100644
--- a/test/convert_float32_uint64.c
+++ b/test/convert_float32_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT32 as UINT64 */
 #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 FLOAT32 8\n";
-  float  data_data[256];
   uint64_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/convert_float32_uint8.c b/test/convert_float32_uint8.c
index 4d6e76a..6a52438 100644
--- a/test/convert_float32_uint8.c
+++ b/test/convert_float32_uint8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT32 as 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 FLOAT32 8\n";
-  float  data_data[256];
   uint8_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (float)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/convert_float64_complex128.c b/test/convert_float64_complex128.c
index 473ef7a..8bb2e6f 100644
--- a/test/convert_float64_complex128.c
+++ b/test/convert_float64_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read FLOAT64 as COMPLEX128 */
 #include "test.h"
 
-#include <math.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 FLOAT64 8\n";
-  double data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
 #else
   double complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_float64_complex64.c b/test/convert_float64_complex64.c
index 60cdacd..d452c90 100644
--- a/test/convert_float64_complex64.c
+++ b/test/convert_float64_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read FLOAT64 as COMPLEX64 */
 #include "test.h"
 
-#include <math.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 FLOAT64 8\n";
-  double data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
 #else
   float complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_float64_float32.c b/test/convert_float64_float32.c
index c6b2bf3..b7c3782 100644
--- a/test/convert_float64_float32.c
+++ b/test/convert_float64_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read FLOAT64 as FLOAT32 */
 #include "test.h"
 
-#include <math.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 FLOAT64 8\n";
-  double  data_data[256];
   float c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/convert_float64_int16.c b/test/convert_float64_int16.c
index ed54692..ee05fca 100644
--- a/test/convert_float64_int16.c
+++ b/test/convert_float64_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT64 as INT16 */
 #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 FLOAT64 8\n";
-  double  data_data[256];
   int16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/convert_float64_int32.c b/test/convert_float64_int32.c
index c3dd05b..58f395a 100644
--- a/test/convert_float64_int32.c
+++ b/test/convert_float64_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT64 as INT32 */
 #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 FLOAT64 8\n";
-  double  data_data[256];
   int32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/convert_float64_int64.c b/test/convert_float64_int64.c
index 981899f..81f93f1 100644
--- a/test/convert_float64_int64.c
+++ b/test/convert_float64_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,47 +18,32 @@
  * 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"
 
-#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 FLOAT64 8\n";
-  double  data_data[256];
   uint64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
-  memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
+  mkdir(filedir, 0700);
 
-  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(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
+  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
+  CHECKI(n, 8);
 
   error = gd_error(D);
+  CHECKI(error, 0);
+
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i,c[i], 40 + i);
 
   gd_discard(D);
 
@@ -66,10 +51,5 @@ int main(void)
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, 0);
-  CHECKI(n, 8);
-  for (i = 0; i < 8; ++i)
-    CHECKIi(i,c[i], 40 + i);
-
   return r;
 }
diff --git a/test/convert_float64_int8.c b/test/convert_float64_int8.c
index a9c6f0f..c50268f 100644
--- a/test/convert_float64_int8.c
+++ b/test/convert_float64_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT64 as INT8 */
 #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 FLOAT64 8\n";
-  double data_data[256];
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/convert_float64_uint16.c b/test/convert_float64_uint16.c
index 9079eb4..ba7d294 100644
--- a/test/convert_float64_uint16.c
+++ b/test/convert_float64_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT64 as UINT16 */
 #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 FLOAT64 8\n";
-  double data_data[256];
   uint16_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/convert_float64_uint32.c b/test/convert_float64_uint32.c
index f5c8e71..6a3e36e 100644
--- a/test/convert_float64_uint32.c
+++ b/test/convert_float64_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT64 as UINT32 */
 #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 FLOAT64 8\n";
-  double  data_data[256];
   uint32_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/convert_float64_uint64.c b/test/convert_float64_uint64.c
index c9d9865..4f1cdb2 100644
--- a/test/convert_float64_uint64.c
+++ b/test/convert_float64_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT64 as UINT64 */
 #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 FLOAT64 8\n";
-  double  data_data[256];
   uint64_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/convert_float64_uint8.c b/test/convert_float64_uint8.c
index cc019d5..7c40dfa 100644
--- a/test/convert_float64_uint8.c
+++ b/test/convert_float64_uint8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT64 as 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 FLOAT64 8\n";
-  double data_data[256];
   uint8_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/convert_int16_complex128.c b/test/convert_int16_complex128.c
index 53ec7af..c11f70c 100644
--- a/test/convert_int16_complex128.c
+++ b/test/convert_int16_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read INT16 as COMPLEX128 */
 #include "test.h"
 
-#include <math.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 INT16 8\n";
-  int16_t  data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
 #else
   double complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_int16_complex64.c b/test/convert_int16_complex64.c
index fd8fd45..cfaf845 100644
--- a/test/convert_int16_complex64.c
+++ b/test/convert_int16_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read INT16 as COMPLEX64 */
 #include "test.h"
 
-#include <math.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 INT16 8\n";
-  int16_t data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
 #else
   float complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_int16_float32.c b/test/convert_int16_float32.c
index fd7d860..7f1f7a9 100644
--- a/test/convert_int16_float32.c
+++ b/test/convert_int16_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read INT16 as FLOAT32 */
 #include "test.h"
 
-#include <math.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 INT16 8\n";
-  int16_t  data_data[256];
   float c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/convert_int16_float64.c b/test/convert_int16_float64.c
index 251342b..7d4ddb3 100644
--- a/test/convert_int16_float64.c
+++ b/test/convert_int16_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read INT16 as FLOAT64 */
 #include "test.h"
 
-#include <math.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 INT16 8\n";
-  int16_t data_data[256];
   double c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/convert_int16_int32.c b/test/convert_int16_int32.c
index a217345..0f890f0 100644
--- a/test/convert_int16_int32.c
+++ b/test/convert_int16_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT16 as INT32 */
 #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 INT16 8\n";
-  int16_t data_data[256];
   int32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/convert_int16_int64.c b/test/convert_int16_int64.c
index 3c985a6..d7068a9 100644
--- a/test/convert_int16_int64.c
+++ b/test/convert_int16_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT16 as INT64 */
 #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 INT16 8\n";
-  int16_t  data_data[256];
   int64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
diff --git a/test/convert_int16_int8.c b/test/convert_int16_int8.c
index 5ead07d..1df58a8 100644
--- a/test/convert_int16_int8.c
+++ b/test/convert_int16_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT16 as INT8 */
 #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 INT16 8\n";
-  int16_t  data_data[256];
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/convert_int16_uint16.c b/test/convert_int16_uint16.c
index 87e0923..373bb73 100644
--- a/test/convert_int16_uint16.c
+++ b/test/convert_int16_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT16 as UINT16 */
 #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 INT16 8\n";
-  int16_t  data_data[256];
   uint16_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/convert_int16_uint32.c b/test/convert_int16_uint32.c
index 275cf80..def7d2d 100644
--- a/test/convert_int16_uint32.c
+++ b/test/convert_int16_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT16 as UINT32 */
 #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 INT16 8\n";
-  int16_t  data_data[256];
   uint32_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/convert_int16_uint64.c b/test/convert_int16_uint64.c
index ed60806..22b9475 100644
--- a/test/convert_int16_uint64.c
+++ b/test/convert_int16_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT16 as UINT64 */
 #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 INT16 8\n";
-  int16_t  data_data[256];
   uint64_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/convert_int16_uint8.c b/test/convert_int16_uint8.c
index f57a696..cfe6aa1 100644
--- a/test/convert_int16_uint8.c
+++ b/test/convert_int16_uint8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT16 as 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 INT16 8\n";
-  int16_t  data_data[256];
   uint8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/convert_int32_complex128.c b/test/convert_int32_complex128.c
index dc6e8b9..85079b3 100644
--- a/test/convert_int32_complex128.c
+++ b/test/convert_int32_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read INT32 as COMPLEX128 */
 #include "test.h"
 
-#include <math.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 INT32 8\n";
-  int32_t data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
 #else
   double complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_int32_complex64.c b/test/convert_int32_complex64.c
index 0fd722a..9c16109 100644
--- a/test/convert_int32_complex64.c
+++ b/test/convert_int32_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read INT32 as COMPLEX64 */
 #include "test.h"
 
-#include <math.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 INT32 8\n";
-  int32_t  data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
 #else
   float complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_int32_float32.c b/test/convert_int32_float32.c
index 71e5aae..a641e8d 100644
--- a/test/convert_int32_float32.c
+++ b/test/convert_int32_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read INT32 as FLOAT32 */
 #include "test.h"
 
-#include <math.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 INT32 8\n";
-  int32_t  data_data[256];
   float c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/convert_int32_float64.c b/test/convert_int32_float64.c
index 4a9087f..2f753c3 100644
--- a/test/convert_int32_float64.c
+++ b/test/convert_int32_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read INT32 as FLOAT64 */
 #include "test.h"
 
-#include <math.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 INT32 8\n";
-  int32_t  data_data[256];
   double c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/convert_int32_int16.c b/test/convert_int32_int16.c
index bd58c4a..a753032 100644
--- a/test/convert_int32_int16.c
+++ b/test/convert_int32_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT32 as INT16 */
 #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 INT32 8\n";
-  int32_t  data_data[256];
   int16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/convert_int32_int64.c b/test/convert_int32_int64.c
index 96358fa..f8f1db3 100644
--- a/test/convert_int32_int64.c
+++ b/test/convert_int32_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT32 as INT64 */
 #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 INT32 8\n";
-  int32_t  data_data[256];
   int64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
diff --git a/test/convert_int32_int8.c b/test/convert_int32_int8.c
index eebe2ae..e76c568 100644
--- a/test/convert_int32_int8.c
+++ b/test/convert_int32_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT32 as INT8 */
 #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 INT32 8\n";
-  int32_t  data_data[256];
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/convert_int32_uint16.c b/test/convert_int32_uint16.c
index 5a1c9a0..31c5a86 100644
--- a/test/convert_int32_uint16.c
+++ b/test/convert_int32_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT32 as UINT16 */
 #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 INT32 8\n";
-  int32_t data_data[256];
   uint16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/convert_int32_uint32.c b/test/convert_int32_uint32.c
index 1083661..016d2a2 100644
--- a/test/convert_int32_uint32.c
+++ b/test/convert_int32_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT32 as UINT32 */
 #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 INT32 8\n";
-  int32_t data_data[256];
   uint32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/convert_int32_uint64.c b/test/convert_int32_uint64.c
index b2fc4fb..0b7157d 100644
--- a/test/convert_int32_uint64.c
+++ b/test/convert_int32_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT32 as UINT64 */
 #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 INT32 8\n";
-  int32_t data_data[256];
   uint64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/convert_int32_uint8.c b/test/convert_int32_uint8.c
index d14c40c..5f81cbd 100644
--- a/test/convert_int32_uint8.c
+++ b/test/convert_int32_uint8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT32 as 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 INT32 8\n";
-  int32_t data_data[256];
   uint8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/convert_int64_complex128.c b/test/convert_int64_complex128.c
index b95a729..da55aa7 100644
--- a/test/convert_int64_complex128.c
+++ b/test/convert_int64_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read INT64 as COMPLEX128 */
 #include "test.h"
 
-#include <math.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 INT64 8\n";
-  int64_t data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
 #else
   double complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_int64_complex64.c b/test/convert_int64_complex64.c
index be6982b..0b522da 100644
--- a/test/convert_int64_complex64.c
+++ b/test/convert_int64_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read INT64 as COMPLEX64 */
 #include "test.h"
 
-#include <math.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 INT64 8\n";
-  int64_t data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
 #else
   float complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_int64_float32.c b/test/convert_int64_float32.c
index 6a367a3..ee7e210 100644
--- a/test/convert_int64_float32.c
+++ b/test/convert_int64_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read INT64 as FLOAT32 */
 #include "test.h"
 
-#include <math.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 INT64 8\n";
-  int64_t  data_data[256];
   float c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/convert_int64_float64.c b/test/convert_int64_float64.c
index bba0c94..07fb330 100644
--- a/test/convert_int64_float64.c
+++ b/test/convert_int64_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read INT64 as FLOAT64 */
 #include "test.h"
 
-#include <math.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 INT64 8\n";
-  int64_t  data_data[256];
   double c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/convert_int64_int16.c b/test/convert_int64_int16.c
index ca695cf..da8c17a 100644
--- a/test/convert_int64_int16.c
+++ b/test/convert_int64_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT64 as INT16 */
 #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 INT64 8\n";
-  int64_t  data_data[256];
   int16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/convert_int64_int32.c b/test/convert_int64_int32.c
index 4ad74d8..5fbdb07 100644
--- a/test/convert_int64_int32.c
+++ b/test/convert_int64_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT64 as INT32 */
 #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 INT64 8\n";
-  int64_t  data_data[256];
   int32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/convert_int64_int8.c b/test/convert_int64_int8.c
index 04bd504..c05e25c 100644
--- a/test/convert_int64_int8.c
+++ b/test/convert_int64_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT64 as INT8 */
 #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 INT64 8\n";
-  int64_t  data_data[256];
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/convert_int64_uint16.c b/test/convert_int64_uint16.c
index 1941566..c61dfca 100644
--- a/test/convert_int64_uint16.c
+++ b/test/convert_int64_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT64 as UINT16 */
 #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 INT64 8\n";
-  int64_t data_data[256];
   uint16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/convert_int64_uint32.c b/test/convert_int64_uint32.c
index 1d9b8cf..09b8614 100644
--- a/test/convert_int64_uint32.c
+++ b/test/convert_int64_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT64 as UINT32 */
 #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 INT64 8\n";
-  int64_t data_data[256];
   uint32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/convert_int64_uint64.c b/test/convert_int64_uint64.c
index 98b3798..b4865e0 100644
--- a/test/convert_int64_uint64.c
+++ b/test/convert_int64_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT64 as UINT64 */
 #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 INT64 8\n";
-  int64_t data_data[256];
   uint64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/convert_int64_uint8.c b/test/convert_int64_uint8.c
index 4d0e9ee..12ec6d7 100644
--- a/test/convert_int64_uint8.c
+++ b/test/convert_int64_uint8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT64 as 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 INT64 8\n";
-  int64_t data_data[256];
   uint8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/convert_int8_complex128.c b/test/convert_int8_complex128.c
index c476511..cd2568c 100644
--- a/test/convert_int8_complex128.c
+++ b/test/convert_int8_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read INT8 as COMPLEX128 */
 #include "test.h"
 
-#include <math.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 INT8 8\n";
 #ifdef GD_NO_C99_API
   double c[16];
 #else
   double complex c[8];
 #endif
-  int8_t data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_int8_complex64.c b/test/convert_int8_complex64.c
index c3f142a..7153f06 100644
--- a/test/convert_int8_complex64.c
+++ b/test/convert_int8_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read INT8 as COMPLEX64 */
 #include "test.h"
 
-#include <math.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 INT8 8\n";
 #ifdef GD_NO_C99_API
   float c[16];
 #else
   float complex c[8];
 #endif
-  int8_t data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_int8_float32.c b/test/convert_int8_float32.c
index 8f03ca6..ad18b6b 100644
--- a/test/convert_int8_float32.c
+++ b/test/convert_int8_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read INT8 as FLOAT32 */
 #include "test.h"
 
-#include <math.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 INT8 8\n";
   float c[8];
-  int8_t data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/convert_int8_float64.c b/test/convert_int8_float64.c
index 43bd87e..89b1e02 100644
--- a/test/convert_int8_float64.c
+++ b/test/convert_int8_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read INT8 as FLOAT64 */
 #include "test.h"
 
-#include <math.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 INT8 8\n";
   double c[8];
-  int8_t data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/convert_int8_int16.c b/test/convert_int8_int16.c
index 31a61f9..212eff4 100644
--- a/test/convert_int8_int16.c
+++ b/test/convert_int8_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT8 as INT16 */
 #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 INT8 8\n";
   int16_t c[8];
-  int8_t data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/convert_int8_int32.c b/test/convert_int8_int32.c
index 0916a78..5003c2b 100644
--- a/test/convert_int8_int32.c
+++ b/test/convert_int8_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT8 as INT32 */
 #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 INT8 8\n";
   int32_t c[8];
-  int8_t data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/convert_int8_int64.c b/test/convert_int8_int64.c
index 501eda6..a23c43b 100644
--- a/test/convert_int8_int64.c
+++ b/test/convert_int8_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT8 as INT64 */
 #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 INT8 8\n";
   int64_t c[8];
-  int8_t data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
diff --git a/test/convert_int8_uint16.c b/test/convert_int8_uint16.c
index a47656b..879ec21 100644
--- a/test/convert_int8_uint16.c
+++ b/test/convert_int8_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT8 as UINT16 */
 #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 INT8 8\n";
   uint16_t c[8];
-  int8_t data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/convert_int8_uint32.c b/test/convert_int8_uint32.c
index a12c78c..9cb2b12 100644
--- a/test/convert_int8_uint32.c
+++ b/test/convert_int8_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT8 as UINT32 */
 #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 INT8 8\n";
   uint32_t c[8];
-  int8_t data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/convert_int8_uint64.c b/test/convert_int8_uint64.c
index 2f904c2..071208d 100644
--- a/test/convert_int8_uint64.c
+++ b/test/convert_int8_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT8 as UINT64 */
 #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 INT8 8\n";
   uint64_t c[8], i;
-  int8_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/convert_int8_uint8.c b/test/convert_int8_uint8.c
index a4a1fe0..c30b7fd 100644
--- a/test/convert_int8_uint8.c
+++ b/test/convert_int8_uint8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT8 as 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 INT8 8\n";
   uint8_t c[8], i;
-  int8_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (int8_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/convert_uint16_complex128.c b/test/convert_uint16_complex128.c
index 10550eb..7d96828 100644
--- a/test/convert_uint16_complex128.c
+++ b/test/convert_uint16_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read UINT16 as COMPLEX128 */
 #include "test.h"
 
-#include <math.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 UINT16 8\n";
-  uint16_t  data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
 #else
   double complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_uint16_complex64.c b/test/convert_uint16_complex64.c
index 685c28b..87f6573 100644
--- a/test/convert_uint16_complex64.c
+++ b/test/convert_uint16_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read UINT16 as COMPLEX64 */
 #include "test.h"
 
-#include <math.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 UINT16 8\n";
-  uint16_t  data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
 #else
   float complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_uint16_float32.c b/test/convert_uint16_float32.c
index fdc88bf..1f98e10 100644
--- a/test/convert_uint16_float32.c
+++ b/test/convert_uint16_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT16 as FLOAT32 */
 #include "test.h"
 
-#include <math.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 UINT16 8\n";
-  uint16_t  data_data[256];
   float c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/convert_uint16_float64.c b/test/convert_uint16_float64.c
index f4d575f..cb713a5 100644
--- a/test/convert_uint16_float64.c
+++ b/test/convert_uint16_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT16 as FLOAT64 */
 #include "test.h"
 
-#include <math.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 UINT16 8\n";
-  uint16_t  data_data[256];
   double c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/convert_uint16_int16.c b/test/convert_uint16_int16.c
index 576383c..ea64deb 100644
--- a/test/convert_uint16_int16.c
+++ b/test/convert_uint16_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT16 as INT16 */
 #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 UINT16 8\n";
-  uint16_t  data_data[256];
   int16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/convert_uint16_int32.c b/test/convert_uint16_int32.c
index dbc164b..ef90c26 100644
--- a/test/convert_uint16_int32.c
+++ b/test/convert_uint16_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT16 as INT32 */
 #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 UINT16 8\n";
-  uint16_t  data_data[256];
   int32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/convert_uint16_int64.c b/test/convert_uint16_int64.c
index d83802b..0c4ba68 100644
--- a/test/convert_uint16_int64.c
+++ b/test/convert_uint16_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT16 as INT64 */
 #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 UINT16 8\n";
-  uint16_t  data_data[256];
   int64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
diff --git a/test/convert_uint16_int8.c b/test/convert_uint16_int8.c
index b0b4c89..a77cb61 100644
--- a/test/convert_uint16_int8.c
+++ b/test/convert_uint16_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT16 as INT8 */
 #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 UINT16 8\n";
-  uint16_t  data_data[256];
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/convert_uint16_uint32.c b/test/convert_uint16_uint32.c
index cfc0558..cbae37b 100644
--- a/test/convert_uint16_uint32.c
+++ b/test/convert_uint16_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT16 as UINT32 */
 #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 UINT16 8\n";
-  uint16_t  data_data[256];
   uint32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/convert_uint16_uint64.c b/test/convert_uint16_uint64.c
index 3ec192c..1a3522a 100644
--- a/test/convert_uint16_uint64.c
+++ b/test/convert_uint16_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT16 as UINT64 */
 #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 UINT16 8\n";
-  uint16_t  data_data[256];
   uint64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/convert_uint16_uint8.c b/test/convert_uint16_uint8.c
index 01cd6ff..5ce06b6 100644
--- a/test/convert_uint16_uint8.c
+++ b/test/convert_uint16_uint8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT16 as 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 UINT16 8\n";
-  uint16_t  data_data[256];
   uint8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/convert_uint32_complex128.c b/test/convert_uint32_complex128.c
index efdb8c3..23c5a7d 100644
--- a/test/convert_uint32_complex128.c
+++ b/test/convert_uint32_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read UINT32 as COMPLEX128 */
 #include "test.h"
 
-#include <math.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 UINT32 8\n";
-  uint32_t  data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
 #else
   double complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_uint32_complex64.c b/test/convert_uint32_complex64.c
index 583cb30..07e105c 100644
--- a/test/convert_uint32_complex64.c
+++ b/test/convert_uint32_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read UINT32 as COMPLEX64 */
 #include "test.h"
 
-#include <math.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 UINT32 8\n";
-  uint32_t  data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
 #else
   float complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_uint32_float32.c b/test/convert_uint32_float32.c
index 5611b72..87f91ee 100644
--- a/test/convert_uint32_float32.c
+++ b/test/convert_uint32_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT32 as FLOAT32 */
 #include "test.h"
 
-#include <math.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 UINT32 8\n";
-  uint32_t  data_data[256];
   float c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/convert_uint32_float64.c b/test/convert_uint32_float64.c
index 833ca76..b19b889 100644
--- a/test/convert_uint32_float64.c
+++ b/test/convert_uint32_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT32 as FLOAT64 */
 #include "test.h"
 
-#include <math.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 UINT32 8\n";
-  uint32_t  data_data[256];
   double c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/convert_uint32_int16.c b/test/convert_uint32_int16.c
index 69f211b..36adad6 100644
--- a/test/convert_uint32_int16.c
+++ b/test/convert_uint32_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT32 as INT16 */
 #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 UINT32 8\n";
-  uint32_t  data_data[256];
   int16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/convert_uint32_int32.c b/test/convert_uint32_int32.c
index 6697211..a73c7b4 100644
--- a/test/convert_uint32_int32.c
+++ b/test/convert_uint32_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT32 as INT32 */
 #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 UINT32 8\n";
-  uint32_t  data_data[256];
   int32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/convert_uint32_int64.c b/test/convert_uint32_int64.c
index 8323e60..2e020cd 100644
--- a/test/convert_uint32_int64.c
+++ b/test/convert_uint32_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT32 as INT64 */
 #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 UINT32 8\n";
-  uint32_t  data_data[256];
   int64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
diff --git a/test/convert_uint32_int8.c b/test/convert_uint32_int8.c
index a8be846..5e5c562 100644
--- a/test/convert_uint32_int8.c
+++ b/test/convert_uint32_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT32 as INT8 */
 #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 UINT32 8\n";
-  uint32_t  data_data[256];
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/convert_uint32_uint16.c b/test/convert_uint32_uint16.c
index 466307f..6fefa61 100644
--- a/test/convert_uint32_uint16.c
+++ b/test/convert_uint32_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT32 as UINT16 */
 #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 UINT32 8\n";
-  uint32_t  data_data[256];
   uint16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/convert_uint32_uint64.c b/test/convert_uint32_uint64.c
index 049a480..7903727 100644
--- a/test/convert_uint32_uint64.c
+++ b/test/convert_uint32_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT32 as UINT64 */
 #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 UINT32 8\n";
-  uint32_t  data_data[256];
   uint64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/convert_uint32_uint8.c b/test/convert_uint32_uint8.c
index fd7bad4..a34ace5 100644
--- a/test/convert_uint32_uint8.c
+++ b/test/convert_uint32_uint8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT32 as 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 UINT32 8\n";
-  uint32_t  data_data[256];
   uint8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/convert_uint64_complex128.c b/test/convert_uint64_complex128.c
index a24a4c5..14f1386 100644
--- a/test/convert_uint64_complex128.c
+++ b/test/convert_uint64_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read UINT64 as COMPLEX128 */
 #include "test.h"
 
-#include <math.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 UINT64 8\n";
-  uint64_t  data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
 #else
   double complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_uint64_complex64.c b/test/convert_uint64_complex64.c
index 3c16823..5e2ea99 100644
--- a/test/convert_uint64_complex64.c
+++ b/test/convert_uint64_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read UINT64 as COMPLEX64 */
 #include "test.h"
 
-#include <math.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 UINT64 8\n";
-  uint64_t  data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
 #else
   float complex c[8];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_uint64_float32.c b/test/convert_uint64_float32.c
index 5b52d20..ded2f3c 100644
--- a/test/convert_uint64_float32.c
+++ b/test/convert_uint64_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT64 as FLOAT32 */
 #include "test.h"
 
-#include <math.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 UINT64 8\n";
-  uint64_t  data_data[256];
   float c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/convert_uint64_float64.c b/test/convert_uint64_float64.c
index ac40225..b602884 100644
--- a/test/convert_uint64_float64.c
+++ b/test/convert_uint64_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT64 as FLOAT64 */
 #include "test.h"
 
-#include <math.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 UINT64 8\n";
-  uint64_t  data_data[256];
   double c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/convert_uint64_int16.c b/test/convert_uint64_int16.c
index 5a12715..ebc1cdb 100644
--- a/test/convert_uint64_int16.c
+++ b/test/convert_uint64_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT64 as INT16 */
 #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 UINT64 8\n";
-  uint64_t  data_data[256];
   int16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/convert_uint64_int32.c b/test/convert_uint64_int32.c
index 7f77e09..2e9f40f 100644
--- a/test/convert_uint64_int32.c
+++ b/test/convert_uint64_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT64 as INT32 */
 #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 UINT64 8\n";
-  uint64_t  data_data[256];
   int32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/convert_uint64_int64.c b/test/convert_uint64_int64.c
index 6bcfb7e..259c53e 100644
--- a/test/convert_uint64_int64.c
+++ b/test/convert_uint64_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT64 as INT64 */
 #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 UINT64 8\n";
-  uint64_t  data_data[256];
   int64_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
diff --git a/test/convert_uint64_int8.c b/test/convert_uint64_int8.c
index e0bfbb1..3185c7c 100644
--- a/test/convert_uint64_int8.c
+++ b/test/convert_uint64_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT64 as INT8 */
 #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 UINT64 8\n";
-  uint64_t  data_data[256];
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/convert_uint64_uint16.c b/test/convert_uint64_uint16.c
index 627c524..19e5e44 100644
--- a/test/convert_uint64_uint16.c
+++ b/test/convert_uint64_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT64 as UINT16 */
 #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 UINT64 8\n";
-  uint64_t  data_data[256];
   uint16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/convert_uint64_uint32.c b/test/convert_uint64_uint32.c
index 4ee2c32..16f9fdd 100644
--- a/test/convert_uint64_uint32.c
+++ b/test/convert_uint64_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT64 as UINT32 */
 #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 UINT64 8\n";
-  uint64_t  data_data[256];
   uint32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/convert_uint64_uint8.c b/test/convert_uint64_uint8.c
index 3f95b8d..e83b0e7 100644
--- a/test/convert_uint64_uint8.c
+++ b/test/convert_uint64_uint8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT64 as 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 UINT64 8\n";
-  uint64_t  data_data[256];
   uint8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t , i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/convert_uint8_complex128.c b/test/convert_uint8_complex128.c
index 240247c..c9db2ce 100644
--- a/test/convert_uint8_complex128.c
+++ b/test/convert_uint8_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read UINT8 as COMPLEX128 */
 #include "test.h"
 
-#include <math.h>
-#include <stddef.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";
 #ifdef GD_NO_C99_API
   double c[16];
 #else
   double complex c[8];
 #endif
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/convert_uint8_complex64.c b/test/convert_uint8_complex64.c
index 03dd9d7..4ecda03 100644
--- a/test/convert_uint8_complex64.c
+++ b/test/convert_uint8_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,44 +21,25 @@
 /* Attempt to read UINT8 as COMPLEX64 */
 #include "test.h"
 
-#include <math.h>
-#include <stddef.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";
 #ifdef GD_NO_C99_API
   float c[16];
 #else
   float complex c[8];
 #endif
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/convert_uint8_float32.c b/test/convert_uint8_float32.c
index 17b40e8..2a0f627 100644
--- a/test/convert_uint8_float32.c
+++ b/test/convert_uint8_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT8 as FLOAT32 */
 #include "test.h"
 
-#include <math.h>
-#include <stddef.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";
   float c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/convert_uint8_float64.c b/test/convert_uint8_float64.c
index 4e3a097..7eb8322 100644
--- a/test/convert_uint8_float64.c
+++ b/test/convert_uint8_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT8 as FLOAT64 */
 #include "test.h"
 
-#include <math.h>
-#include <stddef.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";
   double c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/convert_uint8_int16.c b/test/convert_uint8_int16.c
index f804500..b0e7e2d 100644
--- a/test/convert_uint8_int16.c
+++ b/test/convert_uint8_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT8 as INT16 */
 #include "test.h"
 
-#include <stddef.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";
   int16_t c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/convert_uint8_int32.c b/test/convert_uint8_int32.c
index 2adccc7..e5e1cce 100644
--- a/test/convert_uint8_int32.c
+++ b/test/convert_uint8_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT8 as INT32 */
 #include "test.h"
 
-#include <stddef.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";
   int32_t c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/convert_uint8_int64.c b/test/convert_uint8_int64.c
index c73abab..e2b1738 100644
--- a/test/convert_uint8_int64.c
+++ b/test/convert_uint8_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT8 as INT64 */
 #include "test.h"
 
-#include <stddef.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";
   int64_t c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
diff --git a/test/convert_uint8_int8.c b/test/convert_uint8_int8.c
index c750476..555d0b9 100644
--- a/test/convert_uint8_int8.c
+++ b/test/convert_uint8_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT8 as INT8 */
 #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";
   int8_t c[8];
-  uint8_t data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/convert_uint8_uint16.c b/test/convert_uint8_uint16.c
index 51a4a83..f4e4b7d 100644
--- a/test/convert_uint8_uint16.c
+++ b/test/convert_uint8_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT8 as UINT16 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stddef.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";
   uint16_t c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/convert_uint8_uint32.c b/test/convert_uint8_uint32.c
index 01a5125..0e99a68 100644
--- a/test/convert_uint8_uint32.c
+++ b/test/convert_uint8_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT8 as UINT32 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stddef.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";
   uint32_t c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/convert_uint8_uint64.c b/test/convert_uint8_uint64.c
index 71db28a..ed67124 100644
--- a/test/convert_uint8_uint64.c
+++ b/test/convert_uint8_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT8 as UINT64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stddef.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";
   uint64_t c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/creat_excl.c b/test/creat_excl.c
index caff259..48611d9 100644
--- a/test/creat_excl.c
+++ b/test/creat_excl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,12 +21,6 @@
 /* Exclusively creating an existing dirfile should fail cleanly */
 #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";
@@ -35,8 +29,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
   error = gd_error(D);
diff --git a/test/creat_rdonly_exists.c b/test/creat_rdonly_exists.c
index 06b02be..c77fcb5 100644
--- a/test/creat_rdonly_exists.c
+++ b/test/creat_rdonly_exists.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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";
@@ -35,8 +28,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY | GD_CREAT);
   e1 = gd_error(D);
diff --git a/test/cvlist.c b/test/cvlist.c
index 757573b..417931d 100644
--- a/test/cvlist.c
+++ b/test/cvlist.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,23 @@
 /* Retreiving the list of constant values should succeed cleanly */
 #include "test.h"
 
-#include <inttypes.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 CONST UINT8 1\n"
-    "data2 CONST UINT8 2\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);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 CONST UINT8 1\n"
+    "data2 CONST UINT8 2\n"
+    "data3 CONST UINT8 3\n"
+    "data4 RAW UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = (const uint8_t *)gd_constants(D, GD_UINT8);
diff --git a/test/cvlist_array.c b/test/cvlist_array.c
deleted file mode 100644
index 6e654f9..0000000
--- a/test/cvlist_array.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Copyright (C) 2010-2011, 2013, 2015 D. V. Wiebe
- *
- ***************************************************************************
- *
- * This file is part of the GetData project.
- *
- * GetData is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * GetData is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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 <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 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"
-    "data4 RAW UINT8 1\n"
-    "data4/meta CARRAY UINT8 4 8 12 16 20 24 28 32\n"
-    "/ALIAS data5 data4/meta\n";
-  int j, error, r = 0;
-  size_t i;
-  struct uint8_carrays {
-    size_t n;
-    uint8_t *d;
-  } *field_list;
-  DIRFILE *D;
-
-  rmdirfile();
-  mkdir(filedir, 0777);
-
-  j = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(j, format_data, strlen(format_data));
-  close(j);
-
-  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 (j = 0; j < 4; ++j) {
-      CHECKUi(j,field_list[j].n, (size_t)(5 + j));
-      for (i = 0; i < field_list[j].n; ++i)
-        CHECKUi(j * 1000 + i,field_list[j].d[i], (j + 1) * (i + 1));
-    }
-
-  gd_discard(D);
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/cvlist_array0.c b/test/cvlist_array0.c
deleted file mode 100644
index 63195c5..0000000
--- a/test/cvlist_array0.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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"
-
-#include <inttypes.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 = "data4 RAW UINT8 1\n";
-  int fd, error, r = 0;
-  gd_carray_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 = (gd_carray_t*)gd_carrays(D, GD_UINT8);
-
-  error = gd_error(D);
-
-  CHECKI(error, 0);
-  CHECKU(field_list[0].n, 0);
-
-  gd_discard(D);
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/cvlist_array_free.c b/test/cvlist_array_free.c
deleted file mode 100644
index f342386..0000000
--- a/test/cvlist_array_free.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* 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"
-
-#include <inttypes.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 CARRAY UINT8 1 2 3 4 5\n"
-    "data2 CARRAY UINT8 2 4 6 8 10 12\n"
-    "data4 RAW UINT8 1\n";
-  int fd, e1, e2, 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_RDWR | GD_VERBOSE);
-  field_list = (struct uint8_carrays*)gd_carrays(D, GD_UINT8);
-  e1 = gd_error(D);
-
-  CHECKI(e1, 0);
-
-  if (!r)
-    for (fd = 0; fd < 2; ++fd) {
-      CHECKUi(fd,field_list[fd].n, (size_t)(5 + fd));
-      for (i = 0; i < field_list[fd].n; ++i)
-        CHECKUi(fd * 1000 + i,field_list[fd].d[i], (fd + 1) * (i + 1));
-    }
-
-  gd_add_spec(D, "data3 CARRAY UINT8 3 6 9 12 15 18 21", 0);
-
-  field_list = (struct uint8_carrays*)gd_carrays(D, GD_UINT8);
-  e2 = gd_error(D);
-
-  CHECKI(e2, 0);
-
-  if (!r)
-    for (fd = 0; fd < 3; ++fd) {
-      CHECKUi(fd * 2000,field_list[fd].n, (size_t)(5 + fd));
-      for (i = 0; i < field_list[fd].n; ++i)
-        CHECKUi(fd * 3000 + i,field_list[fd].d[i], (fd + 1) * (i + 1));
-    }
-
-  gd_discard(D);
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/cvlist_array_hidden.c b/test/cvlist_array_hidden.c
deleted file mode 100644
index 49e8b33..0000000
--- a/test/cvlist_array_hidden.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* 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 "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_discard(D);
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/cvlist_array_meta.c b/test/cvlist_array_meta.c
deleted file mode 100644
index 47959de..0000000
--- a/test/cvlist_array_meta.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 2010-2011, 2013, 2015 D. V. Wiebe
- *
- ***************************************************************************
- *
- * This file is part of the GetData project.
- *
- * GetData is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * GetData is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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 <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-int main(void)
-{
-  const char *filedir = "dirfile";
-  const char *format = "dirfile/format";
-  const char *format_data =
-    "data0 CARRAY UINT8 4 8 12 16 20 24 28 32\n"
-    "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"
-    "parent/data3 CARRAY UINT8 3 6 9 12 15 18 21\n"
-    "META parent data4 LINTERP UINT8 1\n"
-    "/ALIAS parent/data5 data0\n";
-  int j, r = 0;
-  size_t i, error;
-  struct uint8_carrays {
-    size_t n;
-    uint8_t *d;
-  } *field_list;
-  DIRFILE *D;
-
-  rmdirfile();
-  mkdir(filedir, 0777);
-
-  j = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(j, format_data, strlen(format_data));
-  close(j);
-
-  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 (j = 0; j < 4; ++j) {
-      CHECKUi(j,field_list[j].n, (size_t)(5 + j));
-      for (i = 0; i < field_list[j].n; ++i)
-        CHECKUi(j * 1000 + i,field_list[j].d[i], (j + 1) * (i + 1));
-    }
-
-
-  gd_discard(D);
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/cvlist_array_meta0.c b/test/cvlist_array_meta0.c
deleted file mode 100644
index 50c9547..0000000
--- a/test/cvlist_array_meta0.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 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"
-
-#include <inttypes.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 =
-    "parent CARRAY UINT8 1\n"
-    "META parent data4 LINTERP UINT8 1\n";
-  int fd, r = 0;
-  size_t error;
-  gd_carray_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 = (gd_carray_t *)gd_mcarrays(D, "parent", GD_UINT8);
-
-  error = gd_error(D);
-  CHECKI(error, 0);
-  CHECKPN(field_list);
-  CHECKI(field_list[0].n, 0);
-
-  gd_discard(D);
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/cvlist_array_meta_free.c b/test/cvlist_array_meta_free.c
deleted file mode 100644
index c12abdb..0000000
--- a/test/cvlist_array_meta_free.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* 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"
-
-#include <inttypes.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 =
-    "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"
-    "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_RDWR | 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 + fd));
-      for (i = 0; i < field_list[fd].n; ++i)
-        CHECKUi(fd * 1000 + i,field_list[fd].d[i], (fd + 1) * (i + 1));
-    }
-
-  gd_add_spec(D, "parent/data3 CARRAY UINT8 3 6 9 12 15 18 21", 0);
-
-  field_list = (struct uint8_carrays *)gd_mcarrays(D, "parent", GD_UINT8);
-
-  error = gd_error(D);
-  CHECKI(error, 0);
-
-  if (!r)
-    for (fd = 0; fd < 3; ++fd) {
-      CHECKUi(fd * 2000,field_list[fd].n, (size_t)(5 + fd));
-      for (i = 0; i < field_list[fd].n; ++i)
-        CHECKUi(fd * 3000 + i,field_list[fd].d[i], (fd + 1) * (i + 1));
-    }
-
-  gd_discard(D);
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/cvlist_array_meta_hidden.c b/test/cvlist_array_meta_hidden.c
deleted file mode 100644
index 6dce09c..0000000
--- a/test/cvlist_array_meta_hidden.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* 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 "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_discard(D);
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/cvlist_array_null.c b/test/cvlist_array_null.c
deleted file mode 100644
index bd743aa..0000000
--- a/test/cvlist_array_null.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2015 D. V. Wiebe
- *
- ***************************************************************************
- *
- * This file is part of the GetData project.
- *
- * GetData is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * GetData is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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"
-    "data3 CARRAY UINT8 3 6 9 12 15 18 21\n"
-    "data4 RAW UINT8 1\n"
-    "data4/meta CARRAY UINT8 4 8 12 16 20 24 28 32\n"
-    "/ALIAS data5 data4/meta\n";
-  int j, error, r = 0;
-  struct uint8_carrays {
-    size_t n;
-    uint8_t *d;
-  } *field_list;
-  DIRFILE *D;
-
-  rmdirfile();
-  mkdir(filedir, 0777);
-
-  j = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(j, format_data, strlen(format_data));
-  close(j);
-
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-  field_list = (struct uint8_carrays*)gd_carrays(D, GD_NULL);
-
-  error = gd_error(D);
-
-  CHECKI(error, 0);
-
-  if (!r)
-    for (j = 0; j < 4; ++j) {
-      CHECKUi(j,field_list[j].n, (size_t)(5 + j));
-      CHECKPi(j,field_list[j].d);
-    }
-
-  gd_discard(D);
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/cvlist_hidden.c b/test/cvlist_hidden.c
index fc49723..cea7781 100644
--- a/test/cvlist_hidden.c
+++ b/test/cvlist_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int i, error, r = 0;
+  const uint8_t *data;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "data1 CONST UINT8 2\n"
     "data2 CONST UINT8 4\n"
     "/HIDDEN data2\n"
@@ -32,17 +39,8 @@ int main(void)
     "/ALIAS data4 data2\n"
     "data5 CONST UINT8 5\n"
     "/ALIAS data6 data5\n"
-    "/HIDDEN data6\n";
-  int i, error, r = 0;
-  const uint8_t *data;
-  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);
+    "/HIDDEN data6\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   data = (const uint8_t *)gd_constants(D, GD_UINT8);
diff --git a/test/cvlist_long.c b/test/cvlist_long.c
new file mode 100644
index 0000000..28ba8ce
--- /dev/null
+++ b/test/cvlist_long.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 =
+    "data00 CONST UINT8 0\n"
+    "data01 CONST UINT8 1\n"
+    "data02 CONST UINT8 2\n"
+    "data03 CONST UINT8 3\n"
+    "data04 CONST UINT8 4\n"
+    "data05 CONST UINT8 5\n"
+    "data06 CONST UINT8 6\n"
+    "data07 CONST UINT8 7\n"
+    "data08 CONST UINT8 8\n"
+    "data09 CONST UINT8 9\n"
+    "data10 CONST UINT8 10\n"
+    "data11 CONST UINT8 11\n"
+    "data12 CONST UINT8 12\n"
+    "data13 CONST UINT8 13\n"
+    "data14 CONST UINT8 14\n"
+    "data15 CONST UINT8 15\n"
+    "data16 CONST UINT8 16\n"
+    "data17 CONST UINT8 17\n"
+    "data18 CONST UINT8 18\n"
+    "data19 CONST UINT8 19\n"
+    ;
+  int fd, error, r = 0;
+  const uint8_t *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  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 < 20; ++fd)
+      CHECKUi(fd,field_list[fd], fd);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/cvlist_meta.c b/test/cvlist_meta.c
index 76f5149..3fcb906 100644
--- a/test/cvlist_meta.c
+++ b/test/cvlist_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,35 +20,24 @@
  */
 #include "test.h"
 
-#include <inttypes.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 =
-    "parent CONST UINT8 1\n"
-    "META parent data1 CONST UINT8 1\n"
-    "META parent data2 CONST UINT8 2\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);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent CONST UINT8 1\n"
+    "META parent data1 CONST UINT8 1\n"
+    "META parent data2 CONST UINT8 2\n"
+    "META parent data3 CONST UINT8 3\n"
+    "META parent data4 LINTERP UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = (uint8_t *)gd_mconstants(D, "parent", GD_UINT8);
diff --git a/test/cvlist_meta0.c b/test/cvlist_meta0.c
index 0a7da23..84a9077 100644
--- a/test/cvlist_meta0.c
+++ b/test/cvlist_meta0.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,32 +20,21 @@
  */
 #include "test.h"
 
-#include <inttypes.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 =
-    "parent CONST UINT8 1\n"
-    "META parent data4 LINTERP UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   uint8_t *field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent CONST UINT8 1\n"
+    "META parent data4 LINTERP UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = (uint8_t *)gd_mconstants(D, "parent", GD_UINT8);
diff --git a/test/cvlist_meta_code.c b/test/cvlist_meta_code.c
new file mode 100644
index 0000000..0d0336f
--- /dev/null
+++ b/test/cvlist_meta_code.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  uint8_t *values;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INDEX/sub CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  values = (uint8_t *)gd_mconstants(D, "INDEX/sub", GD_UINT8);
+  CHECKP(values);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/cvlist_meta_hidden.c b/test/cvlist_meta_hidden.c
index 10eea48..51ce771 100644
--- a/test/cvlist_meta_hidden.c
+++ b/test/cvlist_meta_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,23 +24,21 @@ 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = (uint8_t *)gd_mconstants(D, "parent", GD_UINT8);
diff --git a/test/cvlist_meta_parent.c b/test/cvlist_meta_parent.c
new file mode 100644
index 0000000..baebb01
--- /dev/null
+++ b/test/cvlist_meta_parent.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const void *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  field_list = gd_mconstants(D, "parent", GD_UINT8);
+  CHECKP(field_list);
+
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/cvlist_null.c b/test/cvlist_null.c
index cd4a0e2..89788f4 100644
--- a/test/cvlist_null.c
+++ b/test/cvlist_null.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,21 +24,19 @@ 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"
-    "data3 CONST UINT8 3\n"
-    "data4 RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   const uint8_t *field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 CONST UINT8 1\n"
+    "data2 CONST UINT8 2\n"
+    "data3 CONST UINT8 3\n"
+    "data4 RAW UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   field_list = gd_constants(D, GD_NULL);
diff --git a/test/del_alias.c b/test/del_alias.c
index 9d7e3e7..438da03 100644
--- a/test/del_alias.c
+++ b/test/del_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,31 +20,21 @@
  */
 #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 =
-    "data RAW UINT8 8\n"
-    "/ALIAS alias data\n";
-  int fd, ret, error1, error2, error3, r = 0;
+  int ret, error1, error2, error3, r = 0;
   gd_entype_t t1, t2;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 8\n"
+    "/ALIAS alias data\n"
+  );
 
   D = gd_open(filedir, GD_RDWR);
   t1 = gd_entry_type(D, "alias");
diff --git a/test/del_alias_dangle.c b/test/del_alias_dangle.c
new file mode 100644
index 0000000..e937809
--- /dev/null
+++ b/test/del_alias_dangle.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, v1, v2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 1\n"
+      "/ALIAS alias data\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR);
+  v1 = gd_validate(D, "alias");
+  CHECKI(v1, 0);
+
+  e1 = gd_delete(D, "data", GD_DEL_FORCE);
+  CHECKI(e1, 0);
+
+  v2 = gd_validate(D, "alias");
+  CHECKI(v2, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/del_alias_target.c b/test/del_alias_target.c
new file mode 100644
index 0000000..ac6e2d7
--- /dev/null
+++ b/test/del_alias_target.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 1\n"
+      "/ALIAS alias data\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_delete(D, "data", 0);
+
+  CHECKI(e1, GD_E_DELETE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/del_bad_code.c b/test/del_bad_code.c
index 12cef07..726105a 100644
--- a/test/del_bad_code.c
+++ b/test/del_bad_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -34,7 +34,7 @@ int main(void)
   e1 = gd_error(D);
 
   CHECKI(e1, GD_E_BAD_CODE);
-  CHECKI(h1, -1);
+  CHECKI(h1, GD_E_BAD_CODE);
 
   gd_discard(D);
   unlink(format);
diff --git a/test/del_carray.c b/test/del_carray.c
index 4cbd1f6..3135541 100644
--- a/test/del_carray.c
+++ b/test/del_carray.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,43 +18,34 @@
  * 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"
 
-#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 = "data CARRAY UINT8 1 2 3 4\n"
-    "raw RAW UINT8 data<2>\n";
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data CARRAY UINT8 1 2 3 4\n"
+    "raw RAW UINT8 data<2>\n"
+  );
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_delete(D, "data", 0);
   error = gd_error(D);
+
+  CHECKI(error, GD_E_DELETE);
+  CHECKI(ret, GD_E_DELETE);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, GD_E_DELETE);
-  CHECKI(ret, -1);
-
   return r;
 }
diff --git a/test/del_carray_deref.c b/test/del_carray_deref.c
index cc00af5..c38597e 100644
--- a/test/del_carray_deref.c
+++ b/test/del_carray_deref.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,21 @@
 /* Attempt to delete a 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";
-  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;
+  int ret, error, r = 0;
   DIRFILE *D;
   unsigned int spf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data CARRAY UINT8 13 14 15 16 17\n"
+    "raw RAW UINT8 data<2>\n"
+  );
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_delete(D, "data", GD_DEL_DEREF);
diff --git a/test/del_const.c b/test/del_const.c
index c6e6205..6d3d828 100644
--- a/test/del_const.c
+++ b/test/del_const.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,43 +18,34 @@
  * 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"
 
-#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 = "data CONST UINT8 1\n"
-    "raw RAW UINT8 data\n";
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data CONST UINT8 1\n"
+    "raw RAW UINT8 data\n"
+  );
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_delete(D, "data", 0);
   error = gd_error(D);
+
+  CHECKI(error, GD_E_DELETE);
+  CHECKI(ret, GD_E_DELETE);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, GD_E_DELETE);
-  CHECKI(ret, -1);
-
   return r;
 }
diff --git a/test/del_const_deref.c b/test/del_const_deref.c
index 40ac08c..f5c527b 100644
--- a/test/del_const_deref.c
+++ b/test/del_const_deref.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Attempt to delete a 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";
@@ -51,7 +43,7 @@ int main(void)
   gd_entry_t entry;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data, strlen(format_data));
diff --git a/test/del_const_force.c b/test/del_const_force.c
index e170e6a..37937f3 100644
--- a/test/del_const_force.c
+++ b/test/del_const_force.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,21 @@
 /* Attempt to delete a 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";
-  const char *format_data = "data CONST UINT8 13\n"
-    "raw RAW UINT8 data\n";
-  int fd, ret, error1, error2, r = 0;
+  int ret, error1, error2, r = 0;
   DIRFILE *D;
   unsigned int spf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data CONST UINT8 13\n"
+    "raw RAW UINT8 data\n"
+  );
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_delete(D, "data", GD_DEL_FORCE);
diff --git a/test/del_data.c b/test/del_data.c
index c334524..05660ac 100644
--- a/test/del_data.c
+++ b/test/del_data.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,37 +20,20 @@
  */
 #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 = "data RAW UINT8 8\n";
   unsigned char data_data[256];
-  int fd, ret, e1, n, e2, e3, unlink_data, r = 0;
+  int ret, e1, n, e2, e3, unlink_data, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_delete(D, "data", GD_DEL_DATA);
diff --git a/test/del_data_enoent.c b/test/del_data_enoent.c
index 24bd0c2..99e02d7 100644
--- a/test/del_data_enoent.c
+++ b/test/del_data_enoent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,17 @@
  */
 #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 = "data RAW UINT8 8\n/ENCODING none\n";
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING none\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_delete(D, "data", GD_DEL_DATA);
diff --git a/test/del_data_open.c b/test/del_data_open.c
index 76808bc..377b480 100644
--- a/test/del_data_open.c
+++ b/test/del_data_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* delete an open data file */
 #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 = "data RAW UINT8 8\n";
   unsigned char data_data[256];
-  int fd, ret, e0, e1, n, e2, e3, unlink_data, r = 0;
+  int ret, e0, e1, n, e2, e3, unlink_data, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR);
   gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, data_data);
diff --git a/test/del_data_prot.c b/test/del_data_prot.c
new file mode 100644
index 0000000..f8709a8
--- /dev/null
+++ b/test/del_data_prot.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/PROTECT data\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_delete(D, "data", GD_DEL_DATA);
+  CHECKI(e1, GD_E_PROTECTED);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/del_del.c b/test/del_del.c
index 7397305..aeb5132 100644
--- a/test/del_del.c
+++ b/test/del_del.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,21 @@
  */
 #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 = "data RAW UINT8 8\n";
   unsigned char c[8];
-  unsigned char data_data[256];
   int fd, ret, e1, n, e2, e3, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_delete(D, "data", 0);
diff --git a/test/del_derived.c b/test/del_derived.c
index dccb744..1cab3da 100644
--- a/test/del_derived.c
+++ b/test/del_derived.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,42 +18,31 @@
  * 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"
 
-#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 = "data RAW UINT8 8\nlincom LINCOM 1 data 1 0\n";
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nlincom LINCOM 1 data 1 0\n");
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_delete(D, "data", 0);
   error = gd_error(D);
+
+  CHECKI(error, GD_E_DELETE);
+  CHECKI(ret, GD_E_DELETE);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, GD_E_DELETE);
-  CHECKI(ret, -1);
-
   return r;
 }
diff --git a/test/del_derived_after.c b/test/del_derived_after.c
index 444b9cd..be21fab 100644
--- a/test/del_derived_after.c
+++ b/test/del_derived_after.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,18 +24,15 @@ 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;
+  int ret, v, e1, e2, r = 0;
   size_t n;
   double c;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nlincom LINCOM 1 data 1 0\n");
 
   D = gd_open(filedir, GD_RDWR);
   /* in order to initialise the lincom's entry cache */
diff --git a/test/del_derived_force.c b/test/del_derived_force.c
index 24678d9..9eeac54 100644
--- a/test/del_derived_force.c
+++ b/test/del_derived_force.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* Attempt to delete a 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";
-  const char *format_data = "data RAW UINT8 8\nlincom LINCOM 1 data 1 0\n";
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nlincom LINCOM 1 data 1 0\n");
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_delete(D, "data", GD_DEL_FORCE);
diff --git a/test/del_divide.c b/test/del_divide.c
new file mode 100644
index 0000000..58d0764
--- /dev/null
+++ b/test/del_divide.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, r = 0;
+  double c;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 8\n"
+      "div0 DIVIDE data INDEX\n"
+      "div1 DIVIDE INDEX data\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_validate(D, "div0");
+  gd_validate(D, "div1");
+
+  e1 = gd_delete(D, "data", GD_DEL_FORCE);
+  CHECKI(e1, 0);
+
+  gd_getdata(D, "div0", 0, 0, 0, 1, GD_FLOAT64, &c);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  gd_getdata(D, "div1", 0, 0, 0, 1, GD_FLOAT64, &c);
+  e3 = gd_error(D);
+  CHECKI(e3, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/del_meta.c b/test/del_meta.c
index a1c0edf..36a441a 100644
--- a/test/del_meta.c
+++ b/test/del_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,48 +18,39 @@
  * 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"
 
-#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 = "data RAW UINT8 8\n"
+  int ret, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "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"
     "META data b CONST UINT8 4\n"
     "META data z CONST UINT8 5\n"
-    "META data l CONST UINT8 6\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);
+    "META data l CONST UINT8 6\n"
+  );
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_delete(D, "data", 0);
   error = gd_error(D);
+
+  CHECKI(error, GD_E_DELETE);
+  CHECKI(ret, GD_E_DELETE);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, GD_E_DELETE);
-  CHECKI(ret, -1);
-
   return r;
 }
diff --git a/test/del_meta_force.c b/test/del_meta_force.c
index c2848fc..a65cbd8 100644
--- a/test/del_meta_force.c
+++ b/test/del_meta_force.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,26 @@
 /* Attempt to delete a 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";
-  const char *format_data = "data RAW UINT8 8\n"
+  int ret, error, nf, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 8\n"
     "META data e STRING 1\n"
     "META data q STRING 2\n"
     "META data a STRING 3\n"
     "META data b STRING 4\n"
     "META data z STRING 5\n"
     "META data l STRING 6\n"
-    "s STRING e\n";
-  int fd, ret, error, nf, 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);
+    "s STRING e\n"
+  );
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_delete(D, "data", GD_DEL_META);
diff --git a/test/del_prot.c b/test/del_prot.c
new file mode 100644
index 0000000..f03ae9c
--- /dev/null
+++ b/test/del_prot.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/PROTECT all\ndata CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_delete(D, "data", 0);
+  CHECKI(e1, GD_E_PROTECTED);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/del_rdonly.c b/test/del_rdonly.c
new file mode 100644
index 0000000..10e345c
--- /dev/null
+++ b/test/del_rdonly.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_delete(D, "data", 0);
+  CHECKI(e1, GD_E_ACCMODE);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/del_ref.c b/test/del_ref.c
index 2ab6f0e..b60a8b6 100644
--- a/test/del_ref.c
+++ b/test/del_ref.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,43 +20,26 @@
  */
 #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 =
-    "data RAW UINT8 8\n"
-    "cata RAW UINT8 8\n"
-    "/REFERENCE data\n";
   unsigned char c[8];
-  unsigned char data_data[256];
   int fd, ret, e1, e2, r = 0;
   const char *ref1, *ref2;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 8\n"
+    "cata RAW UINT8 8\n"
+    "/REFERENCE data\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR);
   ref1 = gd_reference(D, NULL);
diff --git a/test/desync.c b/test/desync.c
index 03aa6a0..e3c9b48 100644
--- a/test/desync.c
+++ b/test/desync.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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";
@@ -34,8 +28,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   e1 = gd_error(D);
diff --git a/test/desync_flush.c b/test/desync_flush.c
index 1a94c49..a743df9 100644
--- a/test/desync_flush.c
+++ b/test/desync_flush.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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";
@@ -34,8 +28,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   e1 = gd_error(D);
diff --git a/test/desync_path.c b/test/desync_path.c
index e434abb..c3f4030 100644
--- a/test/desync_path.c
+++ b/test/desync_path.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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
@@ -41,14 +35,14 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  mkdir(dira, 0777);
-  mkdir(dirb, 0777);
+  mkdir(filedir, 0700);
+  mkdir(dira, 0700);
+  mkdir(dirb, 0700);
   symlink("a", link);
-  close(open(formata, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  MAKEEMPTYFILE(formata, 0600);
   /* ensure mtime ticks over */
   sleep(1);
-  close(open(formatb, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  MAKEEMPTYFILE(formatb, 0600);
 
   D = gd_open(link, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/desync_reopen.c b/test/desync_reopen.c
index 66e7aa4..ed38e0e 100644
--- a/test/desync_reopen.c
+++ b/test/desync_reopen.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,23 +20,16 @@
  */
 #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;
+  int e1, e2, e3, n1, n2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   e1 = gd_error(D);
@@ -45,9 +38,9 @@ int main(void)
   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);
+#undef O_EXCL
+#define O_EXCL 0
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
 
   n1 = gd_desync(D, GD_DESYNC_REOPEN);
   e2 = gd_error(D);
diff --git a/test/desync_reopen_inv.c b/test/desync_reopen_inv.c
index fd58734..65ccba4 100644
--- a/test/desync_reopen_inv.c
+++ b/test/desync_reopen_inv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,49 +20,45 @@
  */
 #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;
+  int e1, e2, e3, n1, n2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY);
   e1 = gd_error(D);
+
+  CHECKI(e1, GD_E_OK);
   
   /* 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);
+#undef O_EXCL
+#define O_EXCL 0
+  MAKEFORMATFILE(format, "bad format\n");
 
   n1 = gd_desync(D, GD_DESYNC_REOPEN);
   e2 = gd_error(D);
+
+  CHECKI(n1, GD_E_FORMAT);
+  CHECKI(e2, GD_E_FORMAT);
+
   n2 = gd_validate(D, "data");
   e3 = gd_error(D);
 
+  CHECKI(e3, GD_E_BAD_DIRFILE);
+  CHECKI(n2, GD_E_BAD_DIRFILE);
+
   gd_discard(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 f212efd..67ef16a 100644
--- a/test/dfes_bit.c
+++ b/test/dfes_bit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* Try to free the strings from a BIT 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 BIT in 3 2\n";
-  int fd, r = 0;
+  int r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in 3 2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/dfes_divide.c b/test/dfes_divide.c
index 00acec6..5e6097e 100644
--- a/test/dfes_divide.c
+++ b/test/dfes_divide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,17 @@
  */
 #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 e b\n";
-  int fd;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data DIVIDE e b\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/dfes_lincom.c b/test/dfes_lincom.c
index 232baab..bba89fa 100644
--- a/test/dfes_lincom.c
+++ b/test/dfes_lincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* Try to free the strings from a LINCOM 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 LINCOM 2 in1 2 1 in2 2 1\n";
-  int fd;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data LINCOM 2 in1 2 1 in2 2 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/dfes_linterp.c b/test/dfes_linterp.c
index 28ac940..1cee1dc 100644
--- a/test/dfes_linterp.c
+++ b/test/dfes_linterp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* Try to free the strings from a LINTERP 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 LINTERP in table\n";
-  int fd;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data LINTERP in table\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/dfes_multiply.c b/test/dfes_multiply.c
index 9443e6b..abed953 100644
--- a/test/dfes_multiply.c
+++ b/test/dfes_multiply.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* Try to free the strings from a MULTIPLY 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 MULTIPLY e b\n";
-  int fd;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data MULTIPLY e b\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/dfes_phase.c b/test/dfes_phase.c
index 0acb73c..309d121 100644
--- a/test/dfes_phase.c
+++ b/test/dfes_phase.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* Try to free the strings from a PHASE 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 PHASE in 8\n";
-  int fd;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data PHASE in 8\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/dfes_raw.c b/test/dfes_raw.c
index 7d4b351..5a2dee0 100644
--- a/test/dfes_raw.c
+++ b/test/dfes_raw.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* Try to free the strings from a RAW 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 RAW UINT8 8\n";
-  int fd;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/dfes_recip.c b/test/dfes_recip.c
index 7aef80a..a0ebe6c 100644
--- a/test/dfes_recip.c
+++ b/test/dfes_recip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,17 @@
  */
 #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 RECIP b e\ne CONST UINT8 3";
-  int fd;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RECIP b e\ne CONST UINT8 3");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/elist_alias.c b/test/elist_alias.c
index 7a7ee5b..8a1fcae 100644
--- a/test/elist_alias.c
+++ b/test/elist_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,32 +20,21 @@
  */
 #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;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+      "data1 RAW UINT8 1\n"
+      "/ALIAS data2 data1\n"
+      "/ALIAS data3 data4\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_entry_list(D, NULL, GD_ALIAS_ENTRIES, 0);
diff --git a/test/elist_hidden.c b/test/elist_hidden.c
index e920fd6..0700549 100644
--- a/test/elist_hidden.c
+++ b/test/elist_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,21 +24,18 @@ 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;
+  int i, error, r = 0;
   const char **entry_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+      "data1 RAW UINT8 1\n" 
+      "data2 RAW UINT8 1\n"
+      "/HIDDEN data2\n"
+      "data3 RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   entry_list = gd_entry_list(D, NULL, GD_ALL_ENTRIES, GD_ENTRIES_HIDDEN);
diff --git a/test/elist_noalias.c b/test/elist_noalias.c
index 29ed1ca..42bccae 100644
--- a/test/elist_noalias.c
+++ b/test/elist_noalias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,21 +24,18 @@ 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;
+  int i, error, r = 0;
   const char **entry_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+      "data1 RAW UINT8 1\n"
+      "data2 RAW UINT8 1\n"
+      "data3 RAW UINT8 1\n"
+      "/ALIAS data4 data32\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   entry_list = gd_entry_list(D, NULL, GD_ALL_ENTRIES, GD_ENTRIES_NOALIAS);
diff --git a/test/elist_parent.c b/test/elist_parent.c
new file mode 100644
index 0000000..765476d
--- /dev/null
+++ b/test/elist_parent.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDONLY | GD_CREAT);
+  field_list = gd_entry_list(D, "missing", 0, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+  CHECKP(field_list);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/elist_parent2.c b/test/elist_parent2.c
new file mode 100644
index 0000000..5b061c1
--- /dev/null
+++ b/test/elist_parent2.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INDEX/sub CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  field_list = gd_entry_list(D, "INDEX/sub", 0, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+  CHECKP(field_list);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/elist_scalar.c b/test/elist_scalar.c
index 4525551..9f22575 100644
--- a/test/elist_scalar.c
+++ b/test/elist_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,20 +24,17 @@ 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;
+  int i, error, r = 0;
   const char **entry_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 CONST UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "data3 STRING UINT8\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   entry_list = gd_entry_list(D, NULL, GD_SCALAR_ENTRIES, 0);
diff --git a/test/elist_type.c b/test/elist_type.c
new file mode 100644
index 0000000..46b6bb3
--- /dev/null
+++ b/test/elist_type.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDONLY | GD_CREAT);
+  field_list = gd_entry_list(D, NULL, 999999, 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+  CHECKP(field_list);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/enc_add.c b/test/enc_add.c
new file mode 100644
index 0000000..1df6f2a
--- /dev/null
+++ b/test/enc_add.c
@@ -0,0 +1,77 @@
+/* Copyright (C) 2014, 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  gd_entry_t e;
+  int e1, e2, e3, unlink_data, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+#ifdef USE_ENC
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE | ENC_ENCODED);
+#else
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | ENC_ENCODED);
+#endif
+  gd_add_raw(D, "data", GD_UINT8, 2, 0);
+  e1 = gd_error(D);
+
+  /* check */
+  e2 = gd_entry(D, "data", &e);
+#ifdef USE_ENC
+  CHECKI(e1, GD_E_OK);
+  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(e1, GD_E_UNSUPPORTED);
+  CHECKI(e2, GD_E_BAD_CODE);
+#endif
+
+  e3 = gd_close(D);
+  CHECKI(e3, 0);
+
+  unlink_data = unlink(data);
+
+#ifdef USE_ENC
+  CHECKI(unlink_data, 0);
+#else
+  CHECKI(unlink_data, -1);
+#endif
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_complex128.c b/test/enc_complex128.c
new file mode 100644
index 0000000..d6bf68a
--- /dev/null
+++ b/test/enc_complex128.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const double data_in[8] = { NAN, 3.3, 0, -1, -INFINITY, 4.3, 93.3, 8 };
+  double data_out[8];
+  int i = 0;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW COMPLEX128 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 4, GD_COMPLEX128, data_in);
+  CHECKI(e2, 4);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 4, GD_COMPLEX128, data_out);
+  CHECKI(e3, 4);
+
+  gd_discard(D);
+
+  /* Can't check NAN against itself */
+  CHECKNAN(data_out[0]);
+
+  if (e3 > 4)
+    e3 = 4;
+  for (i = 1; i < 2 * e3; ++i)
+    CHECKFi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_complex64.c b/test/enc_complex64.c
new file mode 100644
index 0000000..c3516a3
--- /dev/null
+++ b/test/enc_complex64.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const float data_in[8] = { (float)NAN, 3.3, 0, -1, -INFINITY, 4.3, 93.3, 8 };
+  float data_out[8];
+  int i = 0;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW COMPLEX64 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 4, GD_COMPLEX64, data_in);
+  CHECKI(e2, 4);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 4, GD_COMPLEX64, data_out);
+  CHECKI(e3, 4);
+
+  gd_discard(D);
+
+  /* Can't check NAN against itself */
+  CHECKNAN(data_out[0]);
+
+  if (e3 > 4)
+    e3 = 4;
+  for (i = 1; i < 2 * e3; ++i)
+    CHECKFi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_del.c b/test/enc_del.c
new file mode 100644
index 0000000..4729ba2
--- /dev/null
+++ b/test/enc_del.c
@@ -0,0 +1,80 @@
+/* Copyright (C) 2013, 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+/* this tests discarding OOP-writable (also temporary) RAW files */
+int main(void)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  uint8_t c[8];
+  int i, n, e1, e2, e3, unlink_data, ret, r = 0;
+  int rmdir_filedir;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+
+  for (i = 0; i < 8; ++i)
+    c[i] = (uint8_t)(40 + i);
+
+#if defined USE_GZIP
+  D = gd_open(filedir, GD_RDWR | ENC_ENCODED | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDWR | ENC_ENCODED);
+#endif
+
+  n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
+  e1 = gd_error(D);
+#ifdef USE_ENC
+  CHECKI(n, 8);
+  CHECKI(e1, GD_E_OK);
+#else
+  CHECKI(n, 0);
+  CHECKI(e1, GD_E_UNSUPPORTED);
+#endif
+
+  ret = gd_delete(D, "data", GD_DEL_DATA);
+  e2 = gd_error(D);
+
+  CHECKI(ret, 0);
+  CHECKI(e2, GD_E_OK);
+
+  e3 = gd_close(D);
+  CHECKI(e3, 0);
+
+  unlink_data = unlink(data);
+  unlink(format);
+  rmdir_filedir = rmdir(filedir);
+
+  CHECKI(unlink_data, -1);
+  CHECKI(rmdir_filedir, 0);
+
+  return r;
+#endif
+}
diff --git a/test/enc_enoent.c b/test/enc_enoent.c
new file mode 100644
index 0000000..1a20672
--- /dev/null
+++ b/test/enc_enoent.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  DIRFILE *D;
+  char *estr;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n/ENCODING " ENC_NAME "\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  gd_getdata(D, "data", 0, 0, 0, 1, GD_NULL, NULL);
+  error = gd_error(D);
+  estr = gd_error_string(D, NULL, 0);
+  
+#ifdef USE_ENC
+  CHECKI(error, GD_E_IO);
+#else
+  CHECKI(error, GD_E_UNSUPPORTED);
+#endif
+
+  CHECKPN(estr);
+  free(estr);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_float32.c b/test/enc_float32.c
new file mode 100644
index 0000000..9930113
--- /dev/null
+++ b/test/enc_float32.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  float data_out[8];
+  int i = 0;
+
+  /* The last of these is denormal.  The compiler may
+   * round it to zero */
+  const float data_in[8] = {
+    (float)NAN, 3.33e38, 0, -1, -INFINITY, 1.0877e-38, -0,
+    5.55e-45
+  };
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW FLOAT32 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 8, GD_FLOAT32, data_in);
+  CHECKI(e2, 8);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 8, GD_FLOAT32, data_out);
+  CHECKI(e3, 8);
+
+  gd_discard(D);
+
+  /* Can't check NAN against itself */
+  CHECKNAN(data_out[0]);
+
+  if (e3 > 8)
+    e3 = 8;
+  for (i = 1; i < e3; ++i)
+    CHECKFi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_float64.c b/test/enc_float64.c
new file mode 100644
index 0000000..701e92f
--- /dev/null
+++ b/test/enc_float64.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  double data_out[8];
+  int i = 0;
+
+  /* The last of these is denormal.  The compiler may
+   * round it to zero */
+  const double data_in[8] = {
+    NAN, 1.308e308, 0, -1, -INFINITY, 3.08e-308, -0, 3.23e-323
+  };
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW FLOAT64 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 8, GD_FLOAT64, data_in);
+  CHECKI(e2, 8);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 8, GD_FLOAT64, data_out);
+  CHECKI(e3, 8);
+
+  gd_discard(D);
+
+  /* Can't check NAN against itself */
+  CHECKNAN(data_out[0]);
+
+  if (e3 > 8)
+    e3 = 8;
+  for (i = 1; i < e3; ++i)
+    CHECKFi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_get_cont.c b/test/enc_get_cont.c
new file mode 100644
index 0000000..6b6d1cf
--- /dev/null
+++ b/test/enc_get_cont.c
@@ -0,0 +1,84 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ENC_SKIP_TEST
+  return 77; /* skip test */
+#else
+
+#define NF 3765
+#define SPF 20
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *encdata = "dirfile/data" ENC_SUFFIX;
+  uint32_t *c;
+  char command[4096];
+  int i, e1, e2, e3, r = 0;
+  size_t n1, n2, n3;
+  DIRFILE *D;
+
+  /* Enough space for three times NF frames */
+  c = malloc(sizeof(*c) * NF * 20 * 3);
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT32 20");
+  MAKEDATAFILE(data, uint32_t, i, NF * 10 * 20);
+
+  /* Compress */
+  ENC_COMPRESS;
+  if (gd_system(command))
+    return 1;
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n1 = gd_getdata(D, "data", 0, 0, NF, 0, GD_UINT32, c);
+  CHECKI(n1, NF * SPF);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  n2 = gd_getdata(D, "data", NF, 0, NF, 0, GD_UINT32, c + NF * SPF);
+  CHECKI(n2, NF * SPF);
+  e2 = gd_error(D);
+  CHECKI(e2, 0);
+
+  n3 = gd_getdata(D, "data", NF * 2, 0, NF, 0, GD_UINT32, c + 2 * NF * SPF);
+  CHECKI(n3, NF * SPF);
+  e3 = gd_error(D);
+  CHECKI(e3, 0);
+
+  for (i = 0; i < 3 * NF * 20; ++i)
+    CHECKIi(i,c[i], i);
+
+  gd_discard(D);
+
+  unlink(encdata);
+  unlink(format);
+  rmdir(filedir);
+
+  free(c);
+
+  return r;
+#endif
+}
diff --git a/test/enc_int16.c b/test/enc_int16.c
new file mode 100644
index 0000000..b2aa694
--- /dev/null
+++ b/test/enc_int16.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const int16_t data_in[8] = { -5, 6, -10, 100, 0, 1, -100, 3 };
+  int16_t data_out[8];
+  int i = 0;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW INT16 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 8, GD_INT16, data_in);
+  CHECKI(e2, 8);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 8, GD_INT16, data_out);
+  CHECKI(e3, 8);
+
+  gd_discard(D);
+
+  if (e3 > 8)
+    e3 = 8;
+  for (i = 0; i < e3; ++i)
+    CHECKIi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_int32.c b/test/enc_int32.c
new file mode 100644
index 0000000..f20e658
--- /dev/null
+++ b/test/enc_int32.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const int32_t data_in[8] = { -5, 6, -10, 100, 0, 1, -100, 3 };
+  int32_t data_out[8];
+  int i = 0;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW INT32 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 8, GD_INT32, data_in);
+  CHECKI(e2, 8);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 8, GD_INT32, data_out);
+  CHECKI(e3, 8);
+
+  gd_discard(D);
+
+  if (e3 > 8)
+    e3 = 8;
+  for (i = 0; i < e3; ++i)
+    CHECKIi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_int64.c b/test/enc_int64.c
new file mode 100644
index 0000000..11a32cb
--- /dev/null
+++ b/test/enc_int64.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const int64_t data_in[8] = { -5, 6, -10, 100, 0, 1, -100, 3 };
+  int64_t data_out[8];
+  int i = 0;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW INT64 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 8, GD_INT64, data_in);
+  CHECKI(e2, 8);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 8, GD_INT64, data_out);
+  CHECKI(e3, 8);
+
+  gd_discard(D);
+
+  if (e3 > 8)
+    e3 = 8;
+  for (i = 0; i < e3; ++i)
+    CHECKIi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_int8.c b/test/enc_int8.c
new file mode 100644
index 0000000..2158451
--- /dev/null
+++ b/test/enc_int8.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const int8_t data_in[8] = { -5, 6, -10, 100, 0, 1, -100, 3 };
+  int8_t data_out[8];
+  int i = 0;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW INT8 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 8, GD_INT8, data_in);
+  CHECKI(e2, 8);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 8, GD_INT8, data_out);
+  CHECKI(e3, 8);
+
+  gd_discard(D);
+
+  if (e3 > 8)
+    e3 = 8;
+  for (i = 0; i < e3; ++i)
+    CHECKIi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_move_from.c b/test/enc_move_from.c
new file mode 100644
index 0000000..957a066
--- /dev/null
+++ b/test/enc_move_from.c
@@ -0,0 +1,116 @@
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *encdata = "dirfile/data" ENC_SUFFIX;
+  char command[4096];
+  int ret, ge_ret, unlink_data, unlink_encdata, e1, e2, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+#ifdef USE_ENC
+  uint16_t d;
+  int fd, i = 0;
+#endif
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "/INCLUDE format1\ndata RAW UINT16 11\nENCODING " ENC_NAME "\n");
+  MAKEFORMATFILE(format1, "ENCODING none\n");
+  MAKEDATAFILE(data, uint16_t, i * 0x201, 128);
+
+  /* compress */
+  ENC_COMPRESS;
+  if (gd_system(command))
+    return 1;
+
+#ifdef USE_ENC
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE | GD_UNENCODED);
+#else
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+#endif
+
+  ret = gd_move(D, "data", 1, 1);
+  e1 = gd_error(D);
+
+#ifdef USE_ENC
+  CHECKI(ret, 0);
+  CHECKI(e1, 0);
+#else
+  CHECKI(ret, GD_E_UNSUPPORTED);
+  CHECKI(e1, GD_E_UNSUPPORTED);
+#endif
+
+  ge_ret =  gd_entry(D, "data", &E);
+  CHECKI(ge_ret, 0);
+  gd_free_entry_strings(&E);
+
+#ifdef USE_ENC
+  CHECKI(E.fragment_index, 1);
+#else
+  CHECKI(E.fragment_index, 0);
+#endif
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+#ifdef USE_ENC
+  fd = open(data, O_RDONLY | O_BINARY);
+
+  if (fd >= 0) {
+    while (read(fd, &d, sizeof(uint16_t))) {
+      CHECKUi(i, d, i * 0x201);
+      i++;
+    }
+    close(fd);
+  } else {
+    perror("open");
+    r = 1;
+  }
+#endif
+
+  unlink(format1);
+  unlink(format);
+  unlink_data = unlink(data);
+  unlink_encdata = unlink(encdata);
+  rmdir(filedir);
+
+#ifdef USE_ENC
+  CHECKI(unlink_data, 0);
+  CHECKI(unlink_encdata, -1);
+#else
+  CHECKI(unlink_data, -1);
+  CHECKI(unlink_encdata, 0);
+#endif
+
+  return r;
+#endif
+}
diff --git a/test/enc_nframes.c b/test/enc_nframes.c
new file mode 100644
index 0000000..4661887
--- /dev/null
+++ b/test/enc_nframes.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *encdata = "dirfile/data" ENC_SUFFIX;
+  char command[4096];
+  int error, r = 0;
+  off_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT16 1\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
+
+  /* compress */
+  ENC_COMPRESS;
+  if (gd_system(command)) {
+    perror(BZIP2);
+    r = 1;
+  }
+
+#ifdef USE_ENC
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDONLY);
+#endif
+  n = gd_nframes(D);
+  error = gd_error(D);
+
+#ifdef USE_ENC
+  CHECKI(error, 0);
+  CHECKI(n, 256);
+#else
+  CHECKI(error, GD_E_UNSUPPORTED);
+  CHECKI(n, GD_E_UNSUPPORTED);
+#endif
+
+  gd_discard(D);
+
+  unlink(encdata);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_put_offs.c b/test/enc_put_offs.c
new file mode 100644
index 0000000..9744046
--- /dev/null
+++ b/test/enc_put_offs.c
@@ -0,0 +1,90 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+int main(void)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  uint32_t c;
+  uint32_t d[100];
+  off_t nf;
+  int r = 0, e;
+  size_t n1, n2, n3;
+  unsigned i;
+  DIRFILE *D;
+
+#define NI 7
+  const off_t offs[] = { 5, 12, 15, BIG_JUMP + 10, 8, BIG_JUMP + 20,
+    BIG_JUMP + 12 };
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | ENC_ENCODED | GD_LITTLE_ENDIAN
+      | GD_VERBOSE | GD_CREAT | GD_EXCL);
+  gd_add_spec(D, "data RAW UINT32 1", 0);
+  for (i = 0; i < NI; ++i) {
+    c = offs[i];
+    n1 = gd_putdata(D, "data", offs[i], 0, 0, 1, GD_UINT32, &c);
+    CHECKIi(i, n1, 1);
+
+    e = gd_error(D);
+    CHECKIi(i, e, GD_E_OK);
+  }
+  gd_close(D);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nf = gd_nframes(D);
+  CHECKU(nf, BIG_JUMP + 21);
+
+  n2 = gd_getdata(D, "data", 0, 0, 0, 100, GD_UINT32, d);
+  CHECKI(n2, 100);
+
+  if (n2 > 100)
+    n2 = 100;
+  for (i = 0; i < n2; ++i) {
+    if (i == 5 || i == 8 || i == 12 || i == 15)
+      CHECKXi(i, d[i], i);
+    else
+      CHECKXi(i, d[i], 0);
+  }
+
+  n3 = gd_getdata(D, "data", 0, BIG_JUMP, 0, 100, GD_UINT32, d);
+  CHECKI(n3, 21);
+
+  for (i = 0; i < n3; ++i) {
+    if (i == 10 || i == 12 || i == 20)
+      CHECKXi(BIG_JUMP + i, d[i], BIG_JUMP + i);
+    else
+      CHECKXi(BIG_JUMP + i, d[i], 0);
+  }
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_seek.c b/test/enc_seek.c
new file mode 100644
index 0000000..507ff03
--- /dev/null
+++ b/test/enc_seek.c
@@ -0,0 +1,72 @@
+/* Copyright (C) 2015, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *encdata = "dirfile/data" ENC_SUFFIX;
+  char command[4096];
+  int error, r = 0;
+  off_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
+
+  /* encode */
+  ENC_COMPRESS;
+  if (gd_system(command))
+    return 1;
+
+#ifdef USE_ENC
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE | GD_LITTLE_ENDIAN);
+#else
+  D = gd_open(filedir, GD_RDONLY | GD_LITTLE_ENDIAN);
+#endif
+  n = gd_seek(D, "data", 5, 0, GD_SEEK_SET);
+  error = gd_error(D);
+
+#ifdef USE_ENC
+  CHECKI(error, 0);
+  CHECKI(n, 40);
+#else
+  CHECKI(error, GD_E_UNSUPPORTED);
+  CHECKI(n, GD_E_UNSUPPORTED);
+#endif
+
+  gd_discard(D);
+
+  unlink(encdata);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_uint16.c b/test/enc_uint16.c
new file mode 100644
index 0000000..34d4a82
--- /dev/null
+++ b/test/enc_uint16.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const uint16_t data_in[8] = { 23205, 256, 10210, 60100, 0, 1, 9250, 3 };
+  uint16_t data_out[8];
+  int i = 0;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW UINT16 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 8, GD_UINT16, data_in);
+  CHECKI(e2, 8);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 8, GD_UINT16, data_out);
+  CHECKI(e3, 8);
+
+  gd_discard(D);
+
+  if (e3 > 8)
+    e3 = 8;
+  for (i = 0; i < e3; ++i)
+    CHECKUi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_uint32.c b/test/enc_uint32.c
new file mode 100644
index 0000000..59668b1
--- /dev/null
+++ b/test/enc_uint32.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const uint32_t data_in[8] = { 205, 6, 210, 100, 0, 1, 250, 3 };
+  uint32_t data_out[8];
+  int i = 0;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW UINT32 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 8, GD_UINT32, data_in);
+  CHECKI(e2, 8);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 8, GD_UINT32, data_out);
+  CHECKI(e3, 8);
+
+  gd_discard(D);
+
+  if (e3 > 8)
+    e3 = 8;
+  for (i = 0; i < e3; ++i)
+    CHECKUi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_uint64.c b/test/enc_uint64.c
new file mode 100644
index 0000000..1f2dfbf
--- /dev/null
+++ b/test/enc_uint64.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const uint64_t data_in[8] = { 205, 6, 210, 100, 0, 1, 250, 3 };
+  uint64_t data_out[8];
+  int i = 0;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW UINT64 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 8, GD_UINT64, data_in);
+  CHECKI(e2, 8);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 8, GD_UINT64, data_out);
+  CHECKI(e3, 8);
+
+  gd_discard(D);
+
+  if (e3 > 8)
+    e3 = 8;
+  for (i = 0; i < e3; ++i)
+    CHECKUi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/enc_uint8.c b/test/enc_uint8.c
new file mode 100644
index 0000000..f5a27e5
--- /dev/null
+++ b/test/enc_uint8.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef ENC_SKIP_TEST
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data" ENC_SUFFIX;
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const uint8_t data_in[8] = { 205, 6, 210, 100, 0, 1, 250, 3 };
+  uint8_t data_out[8];
+  int i = 0;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_ENC_ENCODED
+      | GD_VERBOSE);
+
+  e1 = gd_add_spec(D, "data RAW UINT8 1", 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_putdata(D, "data", 0, 0, 0, 8, GD_UINT8, data_in);
+  CHECKI(e2, 8);
+
+  e3 = gd_getdata(D, "data", 0, 0, 0, 8, GD_UINT8, data_out);
+  CHECKI(e3, 8);
+
+  gd_discard(D);
+
+  if (e3 > 8)
+    e3 = 8;
+  for (i = 0; i < e3; ++i)
+    CHECKUi(i, data_out[i], data_in[i]);
+
+  unlink(format1);
+  unlink(format);
+  unlink(data);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/encode_alter.c b/test/encode_alter.c
index f6a70d2..5cb1bc0 100644
--- a/test/encode_alter.c
+++ b/test/encode_alter.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,25 +21,14 @@
 /* Test encoding */
 #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";
   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];
   int fd, ret, error, r = 0;
   off_t n;
@@ -47,22 +36,15 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = 0x201 * fd;
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\nENCODING none\n");
 
   fd = open(txtdata, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, txt_data, strlen(txt_data));
   close(fd);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, uint16_t, 0x201 * i, 128);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_encoding(D, GD_TEXT_ENCODED, 0, 0);
diff --git a/test/encode_alter_all.c b/test/encode_alter_all.c
index 795c21f..bf75e2f 100644
--- a/test/encode_alter_all.c
+++ b/test/encode_alter_all.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,24 @@
  */
 #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 *format1 = "dirfile/format1";
-  const char *format_data =
-    "data RAW UINT16 8\n"
-    "/ENCODING none\n"
-    "/INCLUDE format1\n";
-  const char *format1_data = "data1 RAW UINT8 8\n/ENCODING sie\n";
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   unsigned long e0, e1, e2, e3;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT16 8\n"
+    "/ENCODING none\n"
+    "/INCLUDE format1\n"
+  );
+  MAKEFORMATFILE(format1, "data1 RAW UINT8 8\n/ENCODING sie\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   e0 = gd_encoding(D, 0);
diff --git a/test/encode_alter_open.c b/test/encode_alter_open.c
index cead88d..5c2e08e 100644
--- a/test/encode_alter_open.c
+++ b/test/encode_alter_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,47 +20,29 @@
  */
 #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";
   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 c1, c2;
   int fd, ret, error, r = 0;
   off_t n1, n2;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = 0x201 * fd;
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\nENCODING none\n");
 
   fd = open(txtdata, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, txt_data, strlen(txt_data));
   close(fd);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, uint16_t, 0x201 * i, 128);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   n1 = gd_getdata(D, "data", 0, 3, 0, 1, GD_UINT16, &c1);
diff --git a/test/encode_get.c b/test/encode_get.c
index c547128..bdd3172 100644
--- a/test/encode_get.c
+++ b/test/encode_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* 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 <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\nFRAMEOFFSET 13\n";
-  unsigned char data_data[256];
-  int fd, error, r = 0;
+  int error, r = 0;
   unsigned long 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nFRAMEOFFSET 13\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_encoding(D, 0);
diff --git a/test/encode_recode.c b/test/encode_recode.c
index d5cd86c..dda0a97 100644
--- a/test/encode_recode.c
+++ b/test/encode_recode.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,41 +20,22 @@
  */
 #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";
   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, e1, e2, n, unlink_txtdata, unlink_data, r = 0;
+  int i, ret, e1, e2, n, unlink_txtdata, unlink_data, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = 0x201 * fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\nENCODING none\n");
+  MAKEDATAFILE(data, uint16_t, 0x201 * i, 128);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_encoding(D, GD_TEXT_ENCODED, 0, 1);
diff --git a/test/encode_recode_open.c b/test/encode_recode_open.c
index 5bf2351..381b85d 100644
--- a/test/encode_recode_open.c
+++ b/test/encode_recode_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,41 +20,22 @@
  */
 #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";
   const char *txtdata = "dirfile/data.txt";
-  const char *format_data = "data RAW UINT16 8\nENCODING none\n";
-  uint16_t data_data[128];
   uint16_t c1, c2;
-  int fd, ret, e1, e2, unlink_txtdata, unlink_data, r = 0;
+  int ret, e1, e2, unlink_txtdata, unlink_data, r = 0;
   DIRFILE *D;
   off_t n1, n2;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = 0x201 * fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\nENCODING none\n");
+  MAKEDATAFILE(data, uint16_t, 0x201 * i, 128);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   n1 = gd_getdata(D, "data", 0, 3, 0, 1, GD_UINT16, &c1);
diff --git a/test/encode_support.c b/test/encode_support.c
index 2c84089..11ec1f9 100644
--- a/test/encode_support.c
+++ b/test/encode_support.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,37 +24,37 @@
 #ifdef USE_SLIM
 #define GD_SLIM_MODE GD_RDONLY
 #else
-#define GD_SLIM_MODE -1
+#define GD_SLIM_MODE GD_E_UNSUPPORTED
 #endif
 
 #ifdef USE_GZIP
 #define GD_GZIP_MODE GD_RDWR
 #else
-#define GD_GZIP_MODE -1
+#define GD_GZIP_MODE GD_E_UNSUPPORTED
 #endif
 
 #ifdef USE_BZIP2
 #define GD_BZIP2_MODE GD_RDWR
 #else
-#define GD_BZIP2_MODE -1
+#define GD_BZIP2_MODE GD_E_UNSUPPORTED
 #endif
 
 #ifdef USE_LZMA
 #define GD_LZMA_MODE GD_RDWR
 #else
-#define GD_LZMA_MODE -1
+#define GD_LZMA_MODE GD_E_UNSUPPORTED
 #endif
 
 #ifdef USE_ZZIP
 #define GD_ZZIP_MODE GD_RDONLY
 #else
-#define GD_ZZIP_MODE -1
+#define GD_ZZIP_MODE GD_E_UNSUPPORTED
 #endif
 
 #ifdef USE_ZZSLIM
 #define GD_ZZSLIM_MODE GD_RDONLY
 #else
-#define GD_ZZSLIM_MODE -1
+#define GD_ZZSLIM_MODE GD_E_UNSUPPORTED
 #endif
 
 #define N 13
@@ -65,7 +65,7 @@ int main(void)
     unsigned long e;
     int v;
   } d[N] = {
-    { GD_AUTO_ENCODED,    -1 }, /* 0 */
+    { GD_AUTO_ENCODED,    GD_E_UNKNOWN_ENCODING }, /* 0 */
     { GD_UNENCODED,       GD_RDWR }, /* 1 */
     { GD_TEXT_ENCODED,    GD_RDWR }, /* 2 */
     { GD_SLIM_ENCODED,    GD_SLIM_MODE }, /* 3 */
@@ -75,9 +75,9 @@ int main(void)
     { GD_SIE_ENCODED,     GD_RDWR }, /* 7 */
     { GD_ZZIP_ENCODED,    GD_ZZIP_MODE }, /* 8 */
     { GD_ZZSLIM_ENCODED,  GD_ZZSLIM_MODE }, /* 9 */
-    { GD_ENC_UNSUPPORTED, -1 }, /* 10 */
-    { GD_ENCODING,        -1 }, /* 11 */
-    { 765,                -1 }  /* 12 */
+    { GD_ENC_UNSUPPORTED, GD_E_UNKNOWN_ENCODING }, /* 10 */
+    { GD_ENCODING,        GD_E_UNKNOWN_ENCODING }, /* 11 */
+    { 765,                GD_E_UNKNOWN_ENCODING }  /* 12 */
   };
   
   for (i = 0; i < N; ++i) {
diff --git a/test/endian_alter.c b/test/endian_alter.c
index ea631c9..409d327 100644
--- a/test/endian_alter.c
+++ b/test/endian_alter.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* 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";
-  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)
-    data_data[fd] = 0x201 * fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\nENDIAN little\n");
+  MAKEDATAFILE(data, uint16_t, 0x201 * i, 128);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_endianness(D, GD_BIG_ENDIAN, 0, 0);
diff --git a/test/endian_alter_all.c b/test/endian_alter_all.c
index 9c2e63e..a8e3576 100644
--- a/test/endian_alter_all.c
+++ b/test/endian_alter_all.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,24 @@
  */
 #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 *format1 = "dirfile/format1";
-  const char *format_data =
-    "data RAW UINT16 8\n"
-    "/ENDIAN little\n"
-    "/INCLUDE format1\n";
-  const char *format1_data = "data1 RAW UINT16 8\n/ENDIAN little arm\n";
   unsigned long e0, e1, e2, e3;
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT16 8\n"
+    "/ENDIAN little\n"
+    "/INCLUDE format1\n"
+  );
+  MAKEFORMATFILE(format1, "data1 RAW UINT16 8\n/ENDIAN little arm\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   e0 = gd_endianness(D, 0);
diff --git a/test/endian_alter_arg.c b/test/endian_alter_arg.c
new file mode 100644
index 0000000..f1e0705
--- /dev/null
+++ b/test/endian_alter_arg.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT16 8\n"
+      "/ENDIAN little\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_endianness(D, 0, 0, 0);
+  CHECKI(e1, GD_E_ARGUMENT);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/endian_alter_dprot.c b/test/endian_alter_dprot.c
new file mode 100644
index 0000000..6f635fd
--- /dev/null
+++ b/test/endian_alter_dprot.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT16 8\n"
+      "/PROTECT data\n"
+      "/ENDIAN little\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_endianness(D, GD_BIG_ENDIAN, 0, 1);
+  CHECKI(e1, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/endian_alter_fprot.c b/test/endian_alter_fprot.c
new file mode 100644
index 0000000..de9615e
--- /dev/null
+++ b/test/endian_alter_fprot.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT16 8\n"
+      "/PROTECT format\n"
+      "/ENDIAN little\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_endianness(D, GD_BIG_ENDIAN, 0, 0);
+  CHECKI(e1, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/endian_alter_index.c b/test/endian_alter_index.c
new file mode 100644
index 0000000..2080276
--- /dev/null
+++ b/test/endian_alter_index.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT16 8\n"
+      "/ENDIAN little\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_endianness(D, GD_BIG_ENDIAN, 1, 0);
+  CHECKI(e1, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/endian_alter_rdonly.c b/test/endian_alter_rdonly.c
new file mode 100644
index 0000000..fff3cc3
--- /dev/null
+++ b/test/endian_alter_rdonly.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT16 8\n"
+      "/ENDIAN little\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_alter_endianness(D, GD_BIG_ENDIAN, 0, 0);
+  CHECKI(e1, GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/endian_alter_sie.c b/test/endian_alter_sie.c
index 325169c..3919728 100644
--- a/test/endian_alter_sie.c
+++ b/test/endian_alter_sie.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* 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,
@@ -52,11 +42,9 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nENDIAN little\nENCODING sie\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_in, 3 * 9);
diff --git a/test/endian_get.c b/test/endian_get.c
index 534745f..a7a11a4 100644
--- a/test/endian_get.c
+++ b/test/endian_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* 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 <stdio.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
@@ -36,7 +28,6 @@ int main(void)
   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";
@@ -45,11 +36,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "ENDIAN little\nINCLUDE format1\n");
 
   fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data1, strlen(format_data1));
diff --git a/test/endian_index.c b/test/endian_index.c
new file mode 100644
index 0000000..b3775e4
--- /dev/null
+++ b/test/endian_index.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  unsigned long n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/ENDIAN little\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_endianness(D, -1);
+  CHECKU(n, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/endian_move.c b/test/endian_move.c
index fafff56..e84b89a 100644
--- a/test/endian_move.c
+++ b/test/endian_move.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* 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";
-  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)
-    data_data[fd] = 0x201 * fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\nENDIAN little\n");
+  MAKEDATAFILE(data, uint16_t, 0x201 * i, 128);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_endianness(D, GD_BIG_ENDIAN, 0, 1);
diff --git a/test/entry_bad_code.c b/test/entry_bad_code.c
index da36f23..7c0bed4 100644
--- a/test/entry_bad_code.c
+++ b/test/entry_bad_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,43 +18,32 @@
  * 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"
 
-#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 RAW UINT8 8\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDONLY);
 
   n = gd_entry(D, "not a field", &E);
   error = gd_error(D);
 
+  CHECKI(error, GD_E_BAD_CODE);
+  CHECKI(n, GD_E_BAD_CODE);
+
   gd_discard(D);
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, GD_E_BAD_CODE);
-  CHECKI(n, -1);
-
   return r;
 }
diff --git a/test/entry_bit.c b/test/entry_bit.c
index e165f46..a4fc671 100644
--- a/test/entry_bit.c
+++ b/test/entry_bit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Try to read BIT 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 = "data BIT in1 3 4\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in1 3 4\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_bit_scalar.c b/test/entry_bit_scalar.c
index ac5afd8..0cb68a8 100644
--- a/test/entry_bit_scalar.c
+++ b/test/entry_bit_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,32 +21,22 @@
 /* Try to read BIT 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 =
-    "bitnum CONST UINT8 3\n"
-    "numbits CONST UINT8 4\n"
-    "data BIT in1 bitnum numbits\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "bitnum CONST UINT8 3\n"
+    "numbits CONST UINT8 4\n"
+    "data BIT in1 bitnum numbits\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_divide.c b/test/entry_divide.c
index 84f2c74..15b6908 100644
--- a/test/entry_divide.c
+++ b/test/entry_divide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* 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;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data DIVIDE in1 in2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_invalid.c b/test/entry_invalid.c
index c2491a6..747506a 100644
--- a/test/entry_invalid.c
+++ b/test/entry_invalid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,16 +18,8 @@
  * 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"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
 int main(void)
 {
   DIRFILE *D = gd_open("not a dirfile", GD_RDONLY);
@@ -39,7 +31,7 @@ int main(void)
   gd_discard(D);
 
   CHECKI(error, GD_E_BAD_DIRFILE);
-  CHECKI(n, -1);
+  CHECKI(n, GD_E_BAD_DIRFILE);
 
   return r;
 }
diff --git a/test/entry_lincom.c b/test/entry_lincom.c
index ab6dac8..59c86b2 100644
--- a/test/entry_lincom.c
+++ b/test/entry_lincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Try to read LINCOM 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 LINCOM 3 in1 1 2 in2 3 4 in3 5 6\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data LINCOM 3 in1 1 2 in2 3 4 in3 5 6\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_lincom_scalar.c b/test/entry_lincom_scalar.c
index 5021f82..fb3c8d1 100644
--- a/test/entry_lincom_scalar.c
+++ b/test/entry_lincom_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,26 @@
 /* Try to read LINCOM 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>
-#include <stdio.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int n, error, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "m1 CONST FLOAT64 1\n"
     "b1 CONST FLOAT64 2\n"
     "m2 CONST FLOAT64 3\n"
     "b2 CONST FLOAT64 4\n"
     "m3 CONST FLOAT64 5\n"
     "b3 CONST FLOAT64 6\n"
-    "data LINCOM 3 in1 m1 b1 in2 m2 b2 in3 m3 b3\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);
+    "data LINCOM 3 in1 m1 b1 in2 m2 b2 in3 m3 b3\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_linterp.c b/test/entry_linterp.c
index b6c6405..0db4e53 100644
--- a/test/entry_linterp.c
+++ b/test/entry_linterp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* Try to read LINTERP 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 LINTERP in1 ../tablefile\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data LINTERP in1 ../tablefile\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_mplex.c b/test/entry_mplex.c
index 9900f56..fed550d 100644
--- a/test/entry_mplex.c
+++ b/test/entry_mplex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,17 +24,14 @@ 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;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data MPLEX in1 in2 1 2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_mplex_scalar.c b/test/entry_mplex_scalar.c
index 3ce5e1f..7b7db9c 100644
--- a/test/entry_mplex_scalar.c
+++ b/test/entry_mplex_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,20 +24,18 @@ 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;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "a CONST UINT16 1\n"
+    "b CARRAY UINT16 2 3 4 5\n"
+    "data MPLEX in1 in2 a b<3>\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_multiply.c b/test/entry_multiply.c
index 8d5bbff..12aea87 100644
--- a/test/entry_multiply.c
+++ b/test/entry_multiply.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* Try to read MULTIPLY 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 MULTIPLY in1 in2\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data MULTIPLY in1 in2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_phase.c b/test/entry_phase.c
index a3d044f..c8b7e38 100644
--- a/test/entry_phase.c
+++ b/test/entry_phase.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* Try to read PHASE 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 PHASE in1 3\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data PHASE in1 3\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_phase_scalar.c b/test/entry_phase_scalar.c
index 682ecc4..b8047da 100644
--- a/test/entry_phase_scalar.c
+++ b/test/entry_phase_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Try to read PHASE 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 = "shift CONST UINT8 3\ndata PHASE in1 shift\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "shift CONST UINT8 3\ndata PHASE in1 shift\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_polynom.c b/test/entry_polynom.c
index 0a28946..bd63ac1 100644
--- a/test/entry_polynom.c
+++ b/test/entry_polynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* 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 POLYNOM in 1 2 3 4 5\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data POLYNOM in 1 2 3 4 5\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_polynom_scalar.c b/test/entry_polynom_scalar.c
index 5ae0f89..36d2e53 100644
--- a/test/entry_polynom_scalar.c
+++ b/test/entry_polynom_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,36 +21,25 @@
 /* Try to read LINCOM 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>
-#include <stdio.h>
-
 int main(void)
 {
   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"
-    "a3 CONST FLOAT64 4\n"
-    "a4 CONST FLOAT64 5\n"
-    "data POLYNOM in a0 a1 a2 a3 a4\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "a0 CONST FLOAT64 1\n"
+    "a1 CONST FLOAT64 2\n"
+    "a2 CONST FLOAT64 3\n"
+    "a3 CONST FLOAT64 4\n"
+    "a4 CONST FLOAT64 5\n"
+    "data POLYNOM in a0 a1 a2 a3 a4\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_raw.c b/test/entry_raw.c
index 3b2b4a5..2471267 100644
--- a/test/entry_raw.c
+++ b/test/entry_raw.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* Try to read RAW 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 RAW UINT8 8\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_raw_scalar.c b/test/entry_raw_scalar.c
index 500487b..ddbc5bb 100644
--- a/test/entry_raw_scalar.c
+++ b/test/entry_raw_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Try to read RAW 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 UINT32 8\ndata RAW UINT8 const\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST UINT32 8\ndata RAW UINT8 const\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_raw_scalar_code.c b/test/entry_raw_scalar_code.c
index d0941c0..bbf8b40 100644
--- a/test/entry_raw_scalar_code.c
+++ b/test/entry_raw_scalar_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,18 @@
  */
 #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 RAW UINT8 const\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 const\n");
 
   D = gd_open(filedir, GD_RDONLY);
 
diff --git a/test/entry_raw_scalar_type.c b/test/entry_raw_scalar_type.c
index cb06ea7..f36552b 100644
--- a/test/entry_raw_scalar_type.c
+++ b/test/entry_raw_scalar_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,18 @@
  */
 #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 STRING 8\ndata RAW UINT8 const\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const STRING 8\ndata RAW UINT8 const\n");
 
   D = gd_open(filedir, GD_RDONLY);
 
diff --git a/test/entry_recip.c b/test/entry_recip.c
index 0cd2379..6cbcbbd 100644
--- a/test/entry_recip.c
+++ b/test/entry_recip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* 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;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RECIP in 2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_scalar_repr.c b/test/entry_scalar_repr.c
index 099478b..2cb5ad4 100644
--- a/test/entry_scalar_repr.c
+++ b/test/entry_scalar_repr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,22 @@
 /* Try to read LINCOM 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>
-#include <stdio.h>
-
 int main(void)
 {
   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";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_type.c b/test/entry_type.c
index 29595ef..c885b3f 100644
--- a/test/entry_type.c
+++ b/test/entry_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* Try to read entry type */
 #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 RAW UINT8 8\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   gd_entype_t n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_type_alias.c b/test/entry_type_alias.c
index aabadd7..6c1f795 100644
--- a/test/entry_type_alias.c
+++ b/test/entry_type_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ 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;
+  int error, r = 0;
   gd_entype_t n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 8\n"
+    "/ALIAS alias data\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_window.c b/test/entry_window.c
index 846754d..81ca73c 100644
--- a/test/entry_window.c
+++ b/test/entry_window.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* 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;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data WINDOW in1 in2 NE 0\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/entry_window_scalar.c b/test/entry_window_scalar.c
index c5c3a88..4e13ffb 100644
--- a/test/entry_window_scalar.c
+++ b/test/entry_window_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* 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;
+  int n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST UINT8 3\ndata WINDOW in1 in2 GE const\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/eof.c b/test/eof.c
index 116feb8..622b766 100644
--- a/test/eof.c
+++ b/test/eof.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,20 @@
  */
 #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 UINT16 1\n";
   int fd, error, r = 0;
   off_t n;
   const size_t len = strlen(data);
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 1\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
diff --git a/test/eof_bit.c b/test/eof_bit.c
index ef677c0..757ca09 100644
--- a/test/eof_bit.c
+++ b/test/eof_bit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,20 @@
  */
 #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 UINT16 1\nbit BIT data 0\n";
   int fd, error, r = 0;
   off_t n;
   const size_t len = strlen(data);
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 1\nbit BIT data 0\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
diff --git a/test/eof_bit_code.c b/test/eof_bit_code.c
new file mode 100644
index 0000000..43eb101
--- /dev/null
+++ b/test/eof_bit_code.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data BIT input 1 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_eof(D, "data");
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/eof_const.c b/test/eof_const.c
new file mode 100644
index 0000000..34da198
--- /dev/null
+++ b/test/eof_const.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_eof(D, "data");
+  CHECKI(e1, GD_E_DIMENSION);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/eof_index.c b/test/eof_index.c
index 4a57ce2..f161fb0 100644
--- a/test/eof_index.c
+++ b/test/eof_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,34 +20,25 @@
  */
 #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 UINT16 1\n"
-    "mult1 MULTIPLY data INDEX\n"
-    "mult2 MULTIPLY INDEX INDEX\n"
-    "mult3 MULTIPLY INDEX data\n";
   int fd, error0, error1, error2, error3, r = 0;
   const size_t len = strlen(data);
   off_t eof_INDEX, eof_mult1, eof_mult2, eof_mult3;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT16 1\n"
+    "mult1 MULTIPLY data INDEX\n"
+    "mult2 MULTIPLY INDEX INDEX\n"
+    "mult3 MULTIPLY INDEX data\n"
+  );
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
@@ -62,20 +53,21 @@ int main(void)
   error2 = gd_error(D);
   eof_mult3 = gd_eof(D, "mult3");
   error3 = gd_error(D);
-  gd_discard(D);
-
-  unlink(data);
-  unlink(format);
-  rmdir(filedir);
 
   CHECKI(error0, GD_E_BAD_FIELD_TYPE);
-  CHECKI(eof_INDEX, -1);
+  CHECKI(eof_INDEX, GD_E_BAD_FIELD_TYPE);
   CHECKI(error1, GD_E_OK);
   CHECKI(eof_mult1, (int)len / 2);
   CHECKI(error2, GD_E_BAD_FIELD_TYPE);
-  CHECKI(eof_mult2, -1);
+  CHECKI(eof_mult2, GD_E_BAD_FIELD_TYPE);
   CHECKI(error3, GD_E_OK);
   CHECKI(eof_mult3, (int)len / 2);
 
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
   return r;
 }
diff --git a/test/eof_lincom.c b/test/eof_lincom.c
index a9558a9..5ffcb95 100644
--- a/test/eof_lincom.c
+++ b/test/eof_lincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,35 +20,26 @@
  */
 #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 *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"
-    "lincom2 LINCOM 2 data 1. 0. data2 1. 0.\n";
   int fd, error, error2, r = 0;
   const size_t len = strlen(data);
   off_t n, m;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT16 1\n"
+    "data2 RAW UINT8 1\n"
+    "lincom LINCOM 2 data2 1. 0. data 1. 0.\n"
+    "lincom2 LINCOM 2 data 1. 0. data2 1. 0.\n"
+  );
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
diff --git a/test/eof_lincom_code.c b/test/eof_lincom_code.c
new file mode 100644
index 0000000..bc82aba
--- /dev/null
+++ b/test/eof_lincom_code.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1, e2, e3;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 1\n"
+      "lincom1 LINCOM missing 1 0 data 1 0 INDEX 1 0\n"
+      "lincom2 LINCOM INDEX 1 0 missing 1 0 data 1 0\n"
+      "lincom3 LINCOM data 1 0 INDEX 1 0 missing 1 0\n"
+      );
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_eof(D, "lincom1");
+  CHECKI(e1, GD_E_BAD_CODE);
+  e2 = gd_eof(D, "lincom2");
+  CHECKI(e2, GD_E_BAD_CODE);
+  e3 = gd_eof(D, "lincom3");
+  CHECKI(e3, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/eof_phase.c b/test/eof_phase.c
index 23f3e6f..4fdb0c4 100644
--- a/test/eof_phase.c
+++ b/test/eof_phase.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,20 @@
  */
 #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 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 1\nphase PHASE data 3");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
diff --git a/test/eof_phase_code.c b/test/eof_phase_code.c
new file mode 100644
index 0000000..5135254
--- /dev/null
+++ b/test/eof_phase_code.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data PHASE missing 0\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_eof(D, "data");
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/eof_phase_neg.c b/test/eof_phase_neg.c
index b51e168..44ef557 100644
--- a/test/eof_phase_neg.c
+++ b/test/eof_phase_neg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,20 @@
  */
 #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 UINT16 1\nphase PHASE data 1000";
   int fd, error, r = 0;
   off_t n;
   const size_t len = strlen(data);
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 1\nphase PHASE data 1000");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
diff --git a/test/eof_recurse.c b/test/eof_recurse.c
new file mode 100644
index 0000000..b046ccb
--- /dev/null
+++ b/test/eof_recurse.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data PHASE data 0\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_eof(D, "data");
+  CHECKI(n, GD_E_RECURSE_LEVEL);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/error.c b/test/error.c
index b9de485..25c9604 100644
--- a/test/error.c
+++ b/test/error.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,12 +21,6 @@
 /* attempt to obtain an error string */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <string.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
@@ -36,8 +30,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY);
   gd_error_string(D, string, 1000);
diff --git a/test/error_num.c b/test/error_num.c
index 08a884c..3f090ef 100644
--- a/test/error_num.c
+++ b/test/error_num.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,11 +20,6 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
@@ -33,8 +28,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY);
   gd_validate(D, "1");
diff --git a/test/error_short.c b/test/error_short.c
index c260ea2..4b7aed7 100644
--- a/test/error_short.c
+++ b/test/error_short.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,12 +21,6 @@
 /* a short error string should still be NULL-terminated */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <string.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
@@ -36,8 +30,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY);
   gd_error_string(D, string, 2);
diff --git a/test/error_verbose.c b/test/error_verbose.c
index 534ad36..5732ef0 100644
--- a/test/error_verbose.c
+++ b/test/error_verbose.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2014 D. V. Wiebe
+/* Copyright (C) 2012-2014, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,61 +20,83 @@
  */
 #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>
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
 
 #define DIRFILENAME "a non-existant dirfile"
 int main(void)
 {
-#if !defined HAVE_MKFIFO || !defined HAVE_WORKING_FORK || defined __CYGWIN__
+#if !defined HAVE_DUP2 || !defined HAVE_KILL || !defined HAVE_PIPE || \
+  !defined HAVE_WORKING_FORK || defined __CYGWIN__
   return 77; /* skip */
 #else
-  const char *fifo = "./dirfile";
-  int error, r = 0, status;
-  FILE *stream;
+  int r = 0, status, pipefd[2];
   pid_t pid;
-  DIRFILE *D;
 
   rmdirfile();
-  mkfifo(fifo, 0666);
 
-  /* read our standard error */
+  /* make a pipe */
+  if (pipe(pipefd)) {
+    perror("pipe");
+    exit(1);
+  }
+
+  /* fork a child to read our standard error */
   if ((pid = fork()) == 0) {
     char string[10000];
-    stream = fopen(fifo, "r");
+    FILE *stream;
+
+    /* CHILD: close the write-side of the pipe */
+    close(pipefd[1]);
+
+    /* Associate the read-side of the pipe with a stream */
+    stream = fdopen(pipefd[0], "r");
 
     fgets(string, 10000, stream);
     CHECKBOS(string, "libgetdata:");
     CHECKSS(string, DIRFILENAME);
+
+    /* Child exits */
     return r;
   }
 
-  /* retarget stderr */
-  freopen(fifo, "w", stderr);
+  /* PARENT: close the read-side of the pipe */
+  close(pipefd[0]);
+
+  /* point stderr at the write side of the pipe */
+  if (dup2(pipefd[1], STDERR_FILENO) < 0) {
+    close(pipefd[1]);
 
-  D = gd_open(DIRFILENAME, GD_RDONLY | GD_VERBOSE);
-  error = gd_error(D);
-  gd_discard(D);
+    perror("dup2");
+    kill(pid, SIGKILL);
+  } else {
+    DIRFILE *D;
+    int error;
 
-  fputs("\n", stderr);
-  fflush(stderr);
+    close(pipefd[1]);
 
-  /* restore stderr */
-  freopen("/dev/stderr", "w", stderr);
+    D = gd_open(DIRFILENAME, GD_RDONLY | GD_VERBOSE);
+    error = gd_error(D);
+    gd_discard(D);
 
-  unlink(fifo);
+    fputs("\n", stderr);
+    fflush(stderr);
 
-  CHECKI(error, GD_E_IO);
+    /* restore stderr */
+    freopen("/dev/stderr", "w", stderr);
 
-  wait(&status);
-  if (status)
+    CHECKI(error, GD_E_IO);
+  }
+
+  waitpid(pid, &status, 0);
+  if (status) {
+    printf("status=%i", status);
     r = 1;
+  }
 
   return r;
 #endif
diff --git a/test/error_verbose_prefix.c b/test/error_verbose_prefix.c
index c9b9877..909c0ec 100644
--- a/test/error_verbose_prefix.c
+++ b/test/error_verbose_prefix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,68 +20,88 @@
  */
 #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>
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
 
 int main(void)
 {
-#if !defined HAVE_MKFIFO || !defined HAVE_WORKING_FORK || defined __CYGWIN__
+#if !defined HAVE_DUP2 || !defined HAVE_KILL || !defined HAVE_PIPE || \
+  !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;
+  int r = 0, status, pipefd[2];
   pid_t pid;
-  DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
-  mkfifo(fifo, 0666);
+  mkdir(filedir, 0700);
+  MAKEFORMATFILE(format, "#");
+
+  /* make a pipe */
+  if (pipe(pipefd)) {
+    perror("pipe");
+    exit(1);
+  }
 
-  /* read our standard error */
+  /* fork a child to read our standard error */
   if ((pid = fork()) == 0) {
     char string[1024];
-    stream = fopen(fifo, "r");
+    FILE *stream;
+
+    /* CHILD: close the write-side of the pipe */
+    close(pipefd[1]);
+
+    /* Associate the read-side of the pipe with a stream */
+    stream = fdopen(pipefd[0], "r");
 
     fgets(string, 1024, stream);
     CHECKS(string, "getdata-test: libgetdata: Field not found: data\n");
     return r;
   }
 
-  /* retarget stderr */
-  freopen(fifo, "w", stderr);
+  /* PARENT: close the read-side of the pipe */
+  close(pipefd[0]);
+
+  /* point stderr at the write side of the pipe */
+  if (dup2(pipefd[1], STDERR_FILENO) < 0) {
+    close(pipefd[1]);
+    perror("dup2");
+    kill(pid, SIGKILL);
+  } else {
+    int e1, e2;
+    DIRFILE *D;
 
-  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_discard(D);
+    close(pipefd[1]);
 
-  fputs("\n", stderr);
-  fflush(stderr);
+    D = gd_open(filedir, GD_RDONLY);
+    e1 = gd_error(D);
+    CHECKI(e1, 0);
 
-  /* restore stderr */
-  freopen("/dev/stderr", "w", stderr);
+    gd_flags(D, GD_VERBOSE, 0);
+    gd_verbose_prefix(D, "getdata-test: ");
+    gd_validate(D, "data");
+
+    e2 = gd_error(D);
+    CHECKI(e2, GD_E_BAD_CODE);
+
+    gd_discard(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);
+  waitpid(pid, &status, 0);
   if (status)
     r = 1;
 
diff --git a/test/file.c b/test/file.c
index e9a427f..1142cae 100644
--- a/test/file.c
+++ b/test/file.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* Attempt to get RAW filename */
 #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, error, r = 0;
+  int error, r = 0;
   char *path;
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   path = gd_raw_filename(D, "data");
diff --git a/test/file_code.c b/test/file_code.c
index 619f7ee..c477914 100644
--- a/test/file_code.c
+++ b/test/file_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* Attempt to get RAW filename */
 #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, error, r = 0;
+  int error, r = 0;
   const char *path;
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY);
   path = gd_raw_filename(D, "bata");
diff --git a/test/file_type.c b/test/file_type.c
index eb80670..b983a4d 100644
--- a/test/file_type.c
+++ b/test/file_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* Attempt to get RAW filename */
 #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 CONST UINT8 8\n";
-  unsigned char data_data[256];
-  int fd, error, r = 0;
+  int error, r = 0;
   const char *path;
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data CONST UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY);
   path = gd_raw_filename(D, "data");
diff --git a/test/flac_add.c b/test/flac_add.c
index 52de8da..cf93c78 100644
--- a/test/flac_add.c
+++ b/test/flac_add.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,58 +20,15 @@
  */
 #include "test.h"
 
-int main(void)
-{
 #ifndef TEST_FLAC
-  return 77;
-#else
-  const char *filedir = "dirfile";
-  const char *format = "dirfile/format";
-  const char *data = "dirfile/data.flac";
-  gd_entry_t e;
-  int e1, e2, e3, unlink_data, r = 0;
-  DIRFILE *D;
-
-  rmdirfile();
-#ifdef USE_FLAC
-  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE | GD_FLAC_ENCODED);
-#else
-  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_FLAC_ENCODED);
-#endif
-  gd_add_raw(D, "data", GD_UINT8, 2, 0);
-  e1 = gd_error(D);
-
-  /* check */
-  e2 = gd_entry(D, "data", &e);
-#ifdef USE_FLAC
-  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);
+#define ENC_SKIP_TEST 1
 #endif
 
-  e3 = gd_close(D);
-  CHECKI(e3, 0);
-
-  unlink_data = unlink(data);
-
 #ifdef USE_FLAC
-  CHECKI(unlink_data, 0);
-  CHECKI(e1, GD_E_OK);
-#else
-  CHECKI(unlink_data, -1);
-  CHECKI(e1, GD_E_UNSUPPORTED);
+#define USE_ENC 1
 #endif
 
-  unlink(format);
-  rmdir(filedir);
+#define ENC_SUFFIX ".flac"
+#define ENC_ENCODED GD_FLAC_ENCODED
 
-  return r;
-#endif
-}
+#include "enc_add.c"
diff --git a/test/flac_complex128.c b/test/flac_complex128.c
new file mode 100644
index 0000000..a4dcdfe
--- /dev/null
+++ b/test/flac_complex128.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_complex128.c"
diff --git a/test/flac_complex64.c b/test/flac_complex64.c
new file mode 100644
index 0000000..1191669
--- /dev/null
+++ b/test/flac_complex64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_complex64.c"
diff --git a/test/flac_del.c b/test/flac_del.c
new file mode 100644
index 0000000..69dc74a
--- /dev/null
+++ b/test/flac_del.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#ifndef TEST_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#ifdef USE_FLAC
+#define USE_ENC 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_del.c"
diff --git a/test/flac_enoent.c b/test/flac_enoent.c
new file mode 100644
index 0000000..8825645
--- /dev/null
+++ b/test/flac_enoent.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#ifndef TEST_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#ifdef USE_FLAC
+#define USE_ENC 1
+#endif
+
+#define ENC_NAME "flac"
+
+#include "enc_enoent.c"
diff --git a/test/flac_float32.c b/test/flac_float32.c
new file mode 100644
index 0000000..cc10ce3
--- /dev/null
+++ b/test/flac_float32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_float32.c"
diff --git a/test/flac_float64.c b/test/flac_float64.c
new file mode 100644
index 0000000..2db42f0
--- /dev/null
+++ b/test/flac_float64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_float64.c"
diff --git a/test/flac_get_big.c b/test/flac_get_big.c
index c42fcb1..d581fd2 100644
--- a/test/flac_get_big.c
+++ b/test/flac_get_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,11 +29,9 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *flacdata = "dirfile/data.flac";
-  const char *format_data = "data RAW UINT16 8\n";
-  uint16_t c[8];
+  uint32_t c[8];
   char command[4096];
-  uint16_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
 #ifdef USE_FLAC
   int i;
 #endif
@@ -41,22 +39,18 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+#ifdef WORDS_BIGENDIAN
+  MAKEDATAFILE(data, uint32_t, 0x01020304LU * i, 256);
+#else
+  MAKEDATAFILE(data, uint32_t, 0x04030201LU * i, 256);
+#endif
 
   /* encode */
   snprintf(command, 4096,
-      "%s --endian=big --silent --sample-rate=1 --channels=1 --bps=16 "
+      "%s --endian=big --silent --sample-rate=1 --channels=2 --bps=16 "
       "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
       data);
   if (gd_system(command))
@@ -67,7 +61,7 @@ int main(void)
 #else
   D = gd_open(filedir, GD_RDONLY | GD_BIG_ENDIAN);
 #endif
-  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
+  n = gd_getdata(D, "data", 0, 0, 1, 0, GD_UINT32, c);
   error = gd_error(D);
 
 #ifdef USE_FLAC
@@ -75,7 +69,7 @@ int main(void)
   CHECKI(n, 8);
 
   for (i = 0; i < 8; ++i)
-    CHECKXi(i,c[i],40+i);
+    CHECKXi(i,c[i], 0x01020304LU * i);
 #else
   CHECKI(error, GD_E_UNSUPPORTED);
   CHECKI(n, 0);
diff --git a/test/flac_get_cont.c b/test/flac_get_cont.c
new file mode 100644
index 0000000..6c6d0ee
--- /dev/null
+++ b/test/flac_get_cont.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
+#else
+#define ENDIANNESS "--endian=little"
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define ENC_COMPRESS snprintf(command, 4096, \
+    "%s " ENDIANNESS " --silent --sample-rate=1 --channels=2 --bps=16 " \
+    "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC, \
+    data)
+
+#include "enc_get_cont.c"
diff --git a/test/flac_get_far.c b/test/flac_get_far.c
index c598ba2..62dcd2a 100644
--- a/test/flac_get_far.c
+++ b/test/flac_get_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,30 +29,26 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *flacdata = "dirfile/data.flac";
-  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, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
-  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);
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
+#else
+#define ENDIANNESS "--endian=little"
+#endif
 
   snprintf(command, 4096,
-      "%s --endian=little --silent --sample-rate=1 --channels=1 --bps=16 "
+      "%s " ENDIANNESS " --silent --sample-rate=1 --channels=1 --bps=16 "
       "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
       data);
   if (gd_system(command))
diff --git a/test/flac_get_get.c b/test/flac_get_get.c
index c7457e5..be1c5b5 100644
--- a/test/flac_get_get.c
+++ b/test/flac_get_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,31 +29,27 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *flacdata = "dirfile/data.flac";
-  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, e1, e2, n2, e3, r = 0;
+  int i, n1, e1, e2, n2, e3, r = 0;
   DIRFILE *D;
 
   memset(c1, 0, 16);
   memset(c2, 0, 16);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
-  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);
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
+#else
+#define ENDIANNESS "--endian=little"
+#endif
 
   snprintf(command, 4096,
-      "%s --endian=little --silent --sample-rate=1 --channels=1 --bps=16 "
+      "%s " ENDIANNESS " --silent --sample-rate=1 --channels=1 --bps=16 "
       "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
       data);
   if (gd_system(command))
diff --git a/test/flac_get_get2.c b/test/flac_get_get2.c
index cb00704..7dc5dff 100644
--- a/test/flac_get_get2.c
+++ b/test/flac_get_get2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,32 +29,28 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *flacdata = "dirfile/data.flac";
-  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;
+  int i, n1, error1, n2, error2, r = 0;
   DIRFILE *D;
 
   memset(c1, 0, 16);
   memset(c2, 0, 16);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
-  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);
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
+#else
+#define ENDIANNESS "--endian=little"
+#endif
 
   /* compress */
   snprintf(command, 4096,
-      "%s --endian=little --silent --sample-rate=1 --channels=1 --bps=16 "
+      "%s " ENDIANNESS " --silent --sample-rate=1 --channels=1 --bps=16 "
       "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
       data);
   if (gd_system(command))
diff --git a/test/flac_get_int64.c b/test/flac_get_int64.c
index c69f272..bb52f0e 100644
--- a/test/flac_get_int64.c
+++ b/test/flac_get_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 D. V. Wiebe
+/* Copyright (C) 2016, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,11 +29,9 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *flacdata = "dirfile/data.flac";
-  const char *format_data = "data RAW UINT64 8\n";
   int64_t c[8];
   char command[4096];
-  int64_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
 #ifdef USE_FLAC
   int i;
 #endif
@@ -41,33 +39,31 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t, i * 0x01020304LU, 256);
 
-  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(uint64_t));
-  close(fd);
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
+#else
+#define ENDIANNESS "--endian=little"
+#endif
 
   /* encode */
   snprintf(command, 4096,
-      "%s --endian=little --silent --sample-rate=1 --channels=4 --bps=16 "
+      "%s " ENDIANNESS " --silent --sample-rate=1 --channels=4 --bps=16 "
       "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
       data);
   if (gd_system(command))
     return 1;
 
 #ifdef USE_FLAC
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE | GD_LITTLE_ENDIAN);
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 #else
-  D = gd_open(filedir, GD_RDONLY | GD_LITTLE_ENDIAN);
+  D = gd_open(filedir, GD_RDONLY);
 #endif
-  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
+  n = gd_getdata(D, "data", 0, 0, 1, 0, GD_UINT64, c);
   error = gd_error(D);
 
 #ifdef USE_FLAC
@@ -75,7 +71,7 @@ int main(void)
   CHECKI(n, 8);
 
   for (i = 0; i < 8; ++i)
-    CHECKXi(i,c[i],40+i);
+    CHECKXi(i,c[i],0x01020304*i);
 #else
   CHECKI(error, GD_E_UNSUPPORTED);
   CHECKI(n, 0);
diff --git a/test/flac_get_int8.c b/test/flac_get_int8.c
index f5c7f6e..29cacd7 100644
--- a/test/flac_get_int8.c
+++ b/test/flac_get_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 D. V. Wiebe
+/* Copyright (C) 2016, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,11 +29,9 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *flacdata = "dirfile/data.flac";
-  const char *format_data = "data RAW UINT8 8\n";
   int8_t c[8];
   char command[4096];
-  int8_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
 #ifdef USE_FLAC
   int i;
 #endif
@@ -41,22 +39,20 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, int8_t, i, 256);
 
-  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(uint8_t));
-  close(fd);
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
+#else
+#define ENDIANNESS "--endian=little"
+#endif
 
   /* encode */
   snprintf(command, 4096,
-      "%s --endian=little --silent --sample-rate=1 --channels=1 --bps=8 "
+      "%s " ENDIANNESS " --silent --sample-rate=1 --channels=1 --bps=8 "
       "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
       data);
   if (gd_system(command))
diff --git a/test/flac_get_little.c b/test/flac_get_little.c
index 2585ee5..dff86e7 100644
--- a/test/flac_get_little.c
+++ b/test/flac_get_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,11 +29,9 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *flacdata = "dirfile/data.flac";
-  const char *format_data = "data RAW UINT16 8\n";
-  uint16_t c[8];
+  uint32_t c[8];
   char command[4096];
-  uint16_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
 #ifdef USE_FLAC
   int i;
 #endif
@@ -41,22 +39,18 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+#ifdef WORDS_BIGENDIAN
+  MAKEDATAFILE(data, uint32_t, 0x04030201LU * i, 256);
+#else
+  MAKEDATAFILE(data, uint32_t, 0x01020304LU * i, 256);
+#endif
 
   /* encode */
   snprintf(command, 4096,
-      "%s --endian=little --silent --sample-rate=1 --channels=1 --bps=16 "
+      "%s --endian=little --silent --sample-rate=1 --channels=2 --bps=16 "
       "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
       data);
   if (gd_system(command))
@@ -67,7 +61,7 @@ int main(void)
 #else
   D = gd_open(filedir, GD_RDONLY | GD_LITTLE_ENDIAN);
 #endif
-  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
+  n = gd_getdata(D, "data", 0, 0, 1, 0, GD_UINT32, c);
   error = gd_error(D);
 
 #ifdef USE_FLAC
@@ -75,7 +69,7 @@ int main(void)
   CHECKI(n, 8);
 
   for (i = 0; i < 8; ++i)
-    CHECKXi(i,c[i],40+i);
+    CHECKXi(i,c[i], 0x01020304LU * i);
 #else
   CHECKI(error, GD_E_UNSUPPORTED);
   CHECKI(n, 0);
diff --git a/test/flac_get_long.c b/test/flac_get_long.c
index 41e0d06..88fb2b5 100644
--- a/test/flac_get_long.c
+++ b/test/flac_get_long.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 D. V. Wiebe
+/* Copyright (C) 2016, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -30,31 +30,27 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *flacdata = "dirfile/data.flac";
-  const char *format_data = "data RAW UINT16 8\n";
   char command[4096];
-  uint16_t *dataw, *datar;
-  int i, fd, n, error, r = 0;
+  uint16_t *datar;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  dataw = malloc(N * sizeof(*dataw));
   datar = malloc(N * sizeof(*datar));
 
-  for (i = 0; i < N; ++i)
-    dataw[i] = i;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, N);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, dataw, N * sizeof(*dataw));
-  close(fd);
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
+#else
+#define ENDIANNESS "--endian=little"
+#endif
 
   snprintf(command, 4096,
-      "%s --endian=little --silent --sample-rate=1 --channels=1 --bps=16 "
+      "%s " ENDIANNESS " --silent --sample-rate=1 --channels=1 --bps=16 "
       "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
       data);
   if (gd_system(command))
@@ -70,12 +66,11 @@ int main(void)
   gd_discard(D);
 
   for (i = 0; i < N; ++i)
-    CHECKIi(i, datar[i], dataw[i]);
+    CHECKIi(i, datar[i], i);
 
   unlink(flacdata);
   unlink(format);
   rmdir(filedir);
-  free(dataw);
   free(datar);
 
   return r;
diff --git a/test/flac_int16.c b/test/flac_int16.c
new file mode 100644
index 0000000..a0356b9
--- /dev/null
+++ b/test/flac_int16.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_int16.c"
diff --git a/test/flac_int32.c b/test/flac_int32.c
new file mode 100644
index 0000000..a8cb25f
--- /dev/null
+++ b/test/flac_int32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_int32.c"
diff --git a/test/flac_int64.c b/test/flac_int64.c
new file mode 100644
index 0000000..afdb759
--- /dev/null
+++ b/test/flac_int64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_int64.c"
diff --git a/test/flac_int8.c b/test/flac_int8.c
new file mode 100644
index 0000000..be2e7fa
--- /dev/null
+++ b/test/flac_int8.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_int8.c"
diff --git a/test/flac_move_from.c b/test/flac_move_from.c
new file mode 100644
index 0000000..938772c
--- /dev/null
+++ b/test/flac_move_from.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#ifndef TEST_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#ifdef USE_FLAC
+#define USE_ENC 1
+#endif
+
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
+#else
+#define ENDIANNESS "--endian=little"
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define ENC_NAME "flac"
+#define ENC_COMPRESS snprintf(command, 4096, \
+    "%s " ENDIANNESS " --silent --sample-rate=1 --channels=1 --bps=16 " \
+    "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC, \
+    data)
+
+#include "enc_move_from.c"
diff --git a/test/flac_nframes.c b/test/flac_nframes.c
index 2fd1ed1..a657d65 100644
--- a/test/flac_nframes.c
+++ b/test/flac_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2016, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -19,73 +19,25 @@
  * 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 <inttypes.h>
 
-int main(void)
-{
 #ifndef TEST_FLAC
-  return 77;
-#else
-  const char *filedir = "dirfile";
-  const char *format = "dirfile/format";
-  const char *data = "dirfile/data";
-  const char *flacdata = "dirfile/data.flac";
-  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 */
-  snprintf(command, 4096,
-      "%s --endian=little --silent --sample-rate=1 --channels=1 --bps=16 "
-      "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
-      data);
-  if (gd_system(command))
-    return 1;
+#define ENC_SKIP_TEST 1
+#endif
 
 #ifdef USE_FLAC
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-#else
-  D = gd_open(filedir, GD_RDONLY);
+#define USE_ENC 1
 #endif
-  n = gd_nframes(D);
-  error = gd_error(D);
-  gd_discard(D);
-
-  unlink(flacdata);
-  unlink(format);
-  rmdir(filedir);
 
-#ifdef USE_FLAC
-  CHECKI(error, 0);
-  CHECKI(n, 256);
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
 #else
-  CHECKI(error, GD_E_UNSUPPORTED);
-  CHECKI(n, 0);
+#define ENDIANNESS "--endian=little"
 #endif
 
-  return r;
-#endif
-}
+#define ENC_SUFFIX ".flac"
+#define ENC_COMPRESS snprintf(command, 4096, \
+    "%s " ENDIANNESS " --silent --sample-rate=1 --channels=1 --bps=16 " \
+    "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC, \
+    data)
+
+#include "enc_nframes.c"
diff --git a/test/flac_put_big.c b/test/flac_put_big.c
index f873937..3c20f54 100644
--- a/test/flac_put_big.c
+++ b/test/flac_put_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015, 2016 D. V. Wiebe
+/* Copyright (C) 2015, 2016, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,11 +29,10 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_flac = "dirfile/data.flac";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT16 8\n";
-  uint16_t c[8];
+  uint32_t c[8];
 #ifdef USE_FLAC
   char command[4096];
-  uint16_t d;
+  uint32_t d;
 #endif
   struct stat buf;
   int fd, i, n, e1, e2, stat_data, unlink_data, unlink_flac, r = 0;
@@ -41,21 +40,24 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  for (i = 0; i < 8; ++i)
-    c[i] = 0x0101 * i;
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+#ifdef WORDS_BIGENDIAN
+  for (i = 0; i < 8; ++i)
+    c[i] = 0x01020304 * i;
+#else
+  for (i = 0; i < 8; ++i)
+    c[i] = 0x04030201 * i;
+#endif
 
 #ifdef USE_FLAC
   D = gd_open(filedir, GD_RDWR | GD_FLAC_ENCODED | GD_BIG_ENDIAN | GD_VERBOSE);
 #else
   D = gd_open(filedir, GD_RDWR | GD_FLAC_ENCODED | GD_BIG_ENDIAN);
 #endif
-  n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
+  n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
   e1 = gd_error(D);
 
 #ifdef USE_FLAC
@@ -88,7 +90,7 @@ int main(void)
         if (i < 40 || i > 48) {
           CHECKXi(i, d, 0);
         } else
-          CHECKXi(i, d, (i - 40) * 0x0101);
+          CHECKXi(i, d, (uint32_t)(i - 40) * 0x01020304);
         i++;
       }
       CHECKI(i, 48);
diff --git a/test/flac_put_complex128.c b/test/flac_put_complex128.c
index 020c292..907098d 100644
--- a/test/flac_put_complex128.c
+++ b/test/flac_put_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015, 2016 D. V. Wiebe
+/* Copyright (C) 2015, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -38,7 +38,7 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 16; ++i)
     c[i] = 1.234 * i;
diff --git a/test/flac_put_float64.c b/test/flac_put_float64.c
index 7a43cdc..878a498 100644
--- a/test/flac_put_float64.c
+++ b/test/flac_put_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015, 2016 D. V. Wiebe
+/* Copyright (C) 2015, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -37,7 +37,7 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = 1.234 * i;
diff --git a/test/flac_put_int32.c b/test/flac_put_int32.c
index 2525c27..86a50c1 100644
--- a/test/flac_put_int32.c
+++ b/test/flac_put_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015, 2016 D. V. Wiebe
+/* Copyright (C) 2015, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -38,7 +38,7 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = 0x01020304 * i;
diff --git a/test/flac_put_little.c b/test/flac_put_little.c
index 6fb9ac2..91c03a6 100644
--- a/test/flac_put_little.c
+++ b/test/flac_put_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015, 2016 D. V. Wiebe
+/* Copyright (C) 2015, 2016, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,11 +29,10 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_flac = "dirfile/data.flac";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT16 8\n";
-  uint16_t c[8];
+  uint32_t c[8];
 #ifdef USE_FLAC
   char command[4096];
-  uint16_t d;
+  uint32_t d;
 #endif
   struct stat buf;
   int fd, i, n, e1, e2, stat_data, unlink_data, unlink_flac, r = 0;
@@ -41,14 +40,17 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
+    
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
 
+#ifdef WORDS_BIGENDIAN
   for (i = 0; i < 8; ++i)
-    c[i] = 0x0101 * i;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+    c[i] = 0x04030201 * i;
+#else
+  for (i = 0; i < 8; ++i)
+    c[i] = 0x01020304 * i;
+#endif
 
 #ifdef USE_FLAC
   D = gd_open(filedir, GD_RDWR | GD_FLAC_ENCODED | GD_LITTLE_ENDIAN
@@ -56,7 +58,7 @@ int main(void)
 #else
   D = gd_open(filedir, GD_RDWR | GD_FLAC_ENCODED | GD_LITTLE_ENDIAN);
 #endif
-  n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
+  n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
   e1 = gd_error(D);
 
 #ifdef USE_FLAC
@@ -76,6 +78,7 @@ int main(void)
   CHECKI(stat_data, 0);
   if (stat_data)
     perror("stat");
+
   snprintf(command, 4096, "%s --silent --decode --delete-input-file "
       "--force-raw-format --sign=signed --endian=little %s --output-name=%s",
       FLAC, data_flac, data);
@@ -89,7 +92,7 @@ int main(void)
         if (i < 40 || i > 48) {
           CHECKXi(i, d, 0);
         } else
-          CHECKXi(i, d, (i - 40) * 0x0101);
+          CHECKXi(i, d, (uint32_t)(i - 40) * 0x01020304U);
         i++;
       }
       CHECKI(i, 48);
diff --git a/test/flac_put_offs.c b/test/flac_put_offs.c
new file mode 100644
index 0000000..67aaefe
--- /dev/null
+++ b/test/flac_put_offs.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined USE_FLAC || !defined TEST_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_put_offs.c"
diff --git a/test/flac_seek.c b/test/flac_seek.c
index 1f4068e..338116a 100644
--- a/test/flac_seek.c
+++ b/test/flac_seek.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2016, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,66 +20,25 @@
  */
 #include "test.h"
 
-int main(void)
-{
 #ifndef TEST_FLAC
-  return 77;
-#else
-  const char *filedir = "dirfile";
-  const char *format = "dirfile/format";
-  const char *data = "dirfile/data";
-  const char *flacdata = "dirfile/data.flac";
-  const char *format_data = "data RAW UINT16 8\n";
-  char command[4096];
-  uint16_t 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 * sizeof(uint16_t));
-  close(fd);
-
-  /* encode */
-  snprintf(command, 4096,
-      "%s --endian=little --silent --sample-rate=1 --channels=1 --bps=16 "
-      "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
-      data);
-  if (gd_system(command))
-    return 1;
+#define ENC_SKIP_TEST 1
+#endif
 
 #ifdef USE_FLAC
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE | GD_LITTLE_ENDIAN);
-#else
-  D = gd_open(filedir, GD_RDONLY | GD_LITTLE_ENDIAN);
+#define USE_ENC 1
 #endif
-  n = gd_seek(D, "data", 5, 0, GD_SEEK_SET);
-  error = gd_error(D);
 
-#ifdef USE_FLAC
-  CHECKI(error, 0);
-  CHECKI(n, 40);
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
 #else
-  CHECKI(error, GD_E_UNSUPPORTED);
-  CHECKI(n, -1);
+#define ENDIANNESS "--endian=little"
 #endif
 
-  gd_discard(D);
+#define ENC_SUFFIX ".flac"
+#define ENC_NAME "flac"
+#define ENC_COMPRESS snprintf(command, 4096, \
+    "%s " ENDIANNESS " --silent --sample-rate=1 --channels=1 --bps=16 " \
+    "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC, \
+    data)
 
-  unlink(flacdata);
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-#endif
-}
+#include "enc_seek.c"
diff --git a/test/flac_seek_far.c b/test/flac_seek_far.c
index 61a20d4..7692ed9 100644
--- a/test/flac_seek_far.c
+++ b/test/flac_seek_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,30 +29,26 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *flacdata = "dirfile/data.flac";
-  const char *format_data = "data RAW UINT16 8\n";
   char command[4096];
-  uint16_t data_data[256];
-  int fd, error, r = 0;
+  int error, r = 0;
   off_t n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
-  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);
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
+#else
+#define ENDIANNESS "--endian=little"
+#endif
 
   /* encode */
   snprintf(command, 4096,
-      "%s --endian=little --silent --sample-rate=1 --channels=1 --bps=16 "
+      "%s " ENDIANNESS " --silent --sample-rate=1 --channels=1 --bps=16 "
       "--sign=signed --delete-input-file %s >/dev/null 2>/dev/null", FLAC,
       data);
   if (gd_system(command))
@@ -67,7 +63,7 @@ int main(void)
   CHECKI(n, 256);
 #else
   CHECKI(error, GD_E_UNSUPPORTED);
-  CHECKI(n, -1);
+  CHECKI(n, GD_E_UNSUPPORTED);
 #endif
 
   gd_discard(D);
diff --git a/test/flac_sync.c b/test/flac_sync.c
index 126ca46..29986bb 100644
--- a/test/flac_sync.c
+++ b/test/flac_sync.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_flac = "dirfile/data.flac";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   char command[4096];
   uint8_t d;
@@ -39,15 +38,13 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   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_FLAC_ENCODED | GD_VERBOSE);
   gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
   n = gd_flush(D, "data");
@@ -64,9 +61,15 @@ int main(void)
   }
   CHECKI(stat_data, 0);
 
+#ifdef WORDS_BIGENDIAN
+#define ENDIANNESS "--endian=big"
+#else
+#define ENDIANNESS "--endian=little"
+#endif
+
   /* uncompress */
   snprintf(command, 4096, "%s --silent --decode --delete-input-file "
-      "--force-raw-format --sign=signed --endian=little %s --output-name=%s "
+      "--force-raw-format --sign=signed " ENDIANNESS " %s --output-name=%s "
       ">/dev/null 2>/dev/null", FLAC, data_flac, data);
   if (gd_system(command)) {
     r = 1;
diff --git a/test/flac_uint16.c b/test/flac_uint16.c
new file mode 100644
index 0000000..9269d87
--- /dev/null
+++ b/test/flac_uint16.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_uint16.c"
diff --git a/test/flac_uint32.c b/test/flac_uint32.c
new file mode 100644
index 0000000..5e406bd
--- /dev/null
+++ b/test/flac_uint32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_uint32.c"
diff --git a/test/flac_uint64.c b/test/flac_uint64.c
new file mode 100644
index 0000000..73d8533
--- /dev/null
+++ b/test/flac_uint64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_uint64.c"
diff --git a/test/flac_uint8.c b/test/flac_uint8.c
new file mode 100644
index 0000000..b1abb48
--- /dev/null
+++ b/test/flac_uint8.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_FLAC || !defined USE_FLAC
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".flac"
+#define GD_ENC_ENCODED GD_FLAC_ENCODED
+
+#include "enc_uint8.c"
diff --git a/test/flist.c b/test/flist.c
index fc9e423..95daa5a 100644
--- a/test/flist.c
+++ b/test/flist.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,32 +21,22 @@
 /* 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";
-  int fd, i, error, r = 0;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "data3 RAW UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_field_list(D);
diff --git a/test/flist0.c b/test/flist0.c
index 072ff9c..2b068b3 100644
--- a/test/flist0.c
+++ b/test/flist0.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,6 @@
  */
 #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";
@@ -37,9 +29,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_field_list_by_type(D, GD_RAW_ENTRY);
diff --git a/test/flist2.c b/test/flist2.c
index e4c7697..cf3153f 100644
--- a/test/flist2.c
+++ b/test/flist2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,32 +20,22 @@
  */
 #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";
-  int fd, i, z, error, r = 0;
+  int i, z, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "data3 RAW UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   for (z = 0; z < 2; ++z) {
diff --git a/test/flist_hidden.c b/test/flist_hidden.c
index 715895b..ffa8eb6 100644
--- a/test/flist_hidden.c
+++ b/test/flist_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,21 +24,19 @@ 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;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "/HIDDEN data2\n"
+    "data3 RAW UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_field_list(D);
diff --git a/test/flist_meta.c b/test/flist_meta.c
index 14b2807..98f8868 100644
--- a/test/flist_meta.c
+++ b/test/flist_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,23 @@
 /* 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 =
-    "parent RAW UINT8 1\n"
-    "META parent data1 LINTERP UINT8 1\n"
-    "META parent data2 LINTERP UINT8 1\n"
-    "META parent data3 LINTERP UINT8 1\n";
-  int fd, i, error, r = 0;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "META parent data1 LINTERP UINT8 1\n"
+    "META parent data2 LINTERP UINT8 1\n"
+    "META parent data3 LINTERP UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_mfield_list(D, "parent");
diff --git a/test/flist_meta2.c b/test/flist_meta2.c
index d1e174a..1a2a84b 100644
--- a/test/flist_meta2.c
+++ b/test/flist_meta2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,33 +20,23 @@
  */
 #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 =
-    "parent RAW UINT8 1\n"
-    "META parent data1 LINTERP UINT8 1\n"
-    "META parent data2 LINTERP UINT8 1\n"
-    "META parent data3 LINTERP UINT8 1\n";
-  int fd, i, z, error, r = 0;
+  int i, z, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "META parent data1 LINTERP UINT8 1\n"
+    "META parent data2 LINTERP UINT8 1\n"
+    "META parent data3 LINTERP UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   for (z = 0; z < 2; ++z) {
diff --git a/test/flist_meta_hidden.c b/test/flist_meta_hidden.c
index a8a4e38..9851cab 100644
--- a/test/flist_meta_hidden.c
+++ b/test/flist_meta_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,22 +24,20 @@ 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;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_mfield_list(D, "parent");
diff --git a/test/flist_type.c b/test/flist_type.c
index 6819edb..7320559 100644
--- a/test/flist_type.c
+++ b/test/flist_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,23 @@
 /* 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 STRING UINT8 1\n"
-    "data2 STRING UINT8 1\n"
-    "data3 STRING UINT8 1\n"
-    "data4 CONST UINT8 1\n";
-  int fd, i, error, r = 0;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 STRING UINT8 1\n"
+    "data2 STRING UINT8 1\n"
+    "data3 STRING UINT8 1\n"
+    "data4 CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_field_list_by_type(D, GD_STRING_ENTRY);
diff --git a/test/flist_type_hidden.c b/test/flist_type_hidden.c
index df74ae8..84aac58 100644
--- a/test/flist_type_hidden.c
+++ b/test/flist_type_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,22 +24,20 @@ 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;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 STRING UINT8 1\n"
+    "data2 STRING UINT8 1\n"
+    "/HIDDEN data2\n"
+    "data3 STRING UINT8 1\n"
+    "data4 CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_field_list_by_type(D, GD_STRING_ENTRY);
diff --git a/test/flist_type_meta.c b/test/flist_type_meta.c
index b5e5112..0409315 100644
--- a/test/flist_type_meta.c
+++ b/test/flist_type_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,24 @@
 /* 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 =
-    "parent STRING UINT8 1\n"
-    "META parent data1 STRING UINT8 1\n"
-    "META parent data2 STRING UINT8 1\n"
-    "META parent data3 STRING UINT8 1\n"
-    "META parent data4 CONST UINT8 1\n";
-  int fd, i, error, r = 0;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent STRING UINT8 1\n"
+    "META parent data1 STRING UINT8 1\n"
+    "META parent data2 STRING UINT8 1\n"
+    "META parent data3 STRING UINT8 1\n"
+    "META parent data4 CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_mfield_list_by_type(D, "parent", GD_STRING_ENTRY);
diff --git a/test/flist_type_meta_hidden.c b/test/flist_type_meta_hidden.c
index 9367fdc..7fc2452 100644
--- a/test/flist_type_meta_hidden.c
+++ b/test/flist_type_meta_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,23 +24,21 @@ 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;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_mfield_list_by_type(D, "parent", GD_STRING_ENTRY);
diff --git a/test/flush_all.c b/test/flush_all.c
index 47fdacc..a436fd4 100644
--- a/test/flush_all.c
+++ b/test/flush_all.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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;
   int fd, i, n, e1, e2, r = 0;
   struct stat buf;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/flush_bad_code.c b/test/flush_bad_code.c
index c4b58d4..d89cee8 100644
--- a/test/flush_bad_code.c
+++ b/test/flush_bad_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* Attempt to flush a non-existant field */
 #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 = "#\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "#\n");
 
   D = gd_open(filedir, GD_RDWR);
   gd_flush(D, "no-such-field");
diff --git a/test/flush_flush.c b/test/flush_flush.c
index 8b31ee6..6f8129c 100644
--- a/test/flush_flush.c
+++ b/test/flush_flush.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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;
   int fd, i, n, e1, e2, r = 0;
   struct stat buf;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/flush_lincom.c b/test/flush_lincom.c
index 7254ce7..ddc845a 100644
--- a/test/flush_lincom.c
+++ b/test/flush_lincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,6 @@
  */
 #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";
@@ -35,25 +27,23 @@ int main(void)
   const char *bata = "dirfile/bata";
   const char *cata = "dirfile/cata";
   const char *data = "dirfile/data";
-  const char *format_data =
-    "bata RAW UINT8 8\n"
-    "cata RAW UINT8 8\n"
-    "data RAW UINT8 8\n"
-    "lincom LINCOM bata 1 0 cata 1 0 data 1 0\n";
   uint8_t c[8], d;
   int fd, i, n, e1, e2, r = 0;
   struct stat buf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format,
+    "bata RAW UINT8 8\n"
+    "cata RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+    "lincom LINCOM bata 1 0 cata 1 0 data 1 0\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "bata", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/flush_lincom1.c b/test/flush_lincom1.c
index 054d184..3e61a9e 100644
--- a/test/flush_lincom1.c
+++ b/test/flush_lincom1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,36 +20,26 @@
  */
 #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"
-    "lincom LINCOM data 1 0\n";
   uint8_t c[8], d;
   int fd, i, n, e1, e2, r = 0;
   struct stat buf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 8\n"
+    "lincom LINCOM data 1 0\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/flush_mult.c b/test/flush_mult.c
index 8e9761b..f024154 100644
--- a/test/flush_mult.c
+++ b/test/flush_mult.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,28 @@
  */
 #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 *cata = "dirfile/cata";
   const char *data = "dirfile/data";
-  const char *format_data =
-    "cata RAW UINT8 8\n"
-    "data RAW UINT8 8\n"
-    "mult MULTIPLY cata data\n";
   uint8_t c[8], d;
   int fd, i, n, e1, e2, r = 0;
   struct stat buf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format,
+    "cata RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+    "mult MULTIPLY cata data\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/flush_raw_close.c b/test/flush_raw_close.c
index b2e51ac..0844a52 100644
--- a/test/flush_raw_close.c
+++ b/test/flush_raw_close.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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;
   int fd, i, n, e1, e2, r = 0;
   struct stat buf;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/flush_recurse.c b/test/flush_recurse.c
new file mode 100644
index 0000000..783c6b6
--- /dev/null
+++ b/test/flush_recurse.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data PHASE data 0\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_flush(D, "data");
+  CHECKI(e1, GD_E_RECURSE_LEVEL);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/flush_ref.c b/test/flush_ref.c
deleted file mode 100644
index c04e6d2..0000000
--- a/test/flush_ref.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* 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, e2, r = 0;
-  const char *r1;
-  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);
-
-  e2 = gd_close(D);
-  CHECKI(e2, 0);
-
-  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_sync.c b/test/flush_sync.c
index ceea47a..bc31cc2 100644
--- a/test/flush_sync.c
+++ b/test/flush_sync.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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;
   int fd, i, n, e1, e2, r = 0;
   struct stat buf;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/foffs_alter.c b/test/foffs_alter.c
index 6b2b86e..4cab1ee 100644
--- a/test/foffs_alter.c
+++ b/test/foffs_alter.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* Test frameoffset */
 #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 = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
-  unsigned char data_data[256];
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   off_t fo, nf;
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nFRAMEOFFSET 13\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_frameoffset(D, 16, 0, 0);
diff --git a/test/foffs_alter_all.c b/test/foffs_alter_all.c
index ec1be70..cdb0c06 100644
--- a/test/foffs_alter_all.c
+++ b/test/foffs_alter_all.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,24 @@
  */
 #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 *format_data =
-    "data RAW UINT8 8\n"
-    "/FRAMEOFFSET 13\n"
-    "/INCLUDE format1\n";
-  const char *format1_data = "data1 RAW UINT8 8\n/FRAMEOFFSET 14\n";
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   off_t o0, o1, o2, o3;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 8\n"
+    "/FRAMEOFFSET 13\n"
+    "/INCLUDE format1\n"
+  );
+  MAKEFORMATFILE(format1, "data1 RAW UINT8 8\n/FRAMEOFFSET 14\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   o0 = gd_frameoffset(D, 0);
diff --git a/test/foffs_alter_dprot.c b/test/foffs_alter_dprot.c
new file mode 100644
index 0000000..48b8d07
--- /dev/null
+++ b/test/foffs_alter_dprot.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 8\n"
+      "/FRAMEOFFSET 13\n"
+      "/PROTECT data\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_frameoffset(D, 16, 0, 1);
+  CHECKI(e1, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/foffs_alter_fprot.c b/test/foffs_alter_fprot.c
new file mode 100644
index 0000000..ae8123d
--- /dev/null
+++ b/test/foffs_alter_fprot.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 8\n"
+      "/FRAMEOFFSET 13\n"
+      "/PROTECT format\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_frameoffset(D, 16, 0, 0);
+  CHECKI(e1, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/foffs_alter_index.c b/test/foffs_alter_index.c
new file mode 100644
index 0000000..fd67d68
--- /dev/null
+++ b/test/foffs_alter_index.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 8\n"
+      "/FRAMEOFFSET 13\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_frameoffset(D, 16, 3, 0);
+  CHECKI(e1, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/foffs_alter_range.c b/test/foffs_alter_range.c
new file mode 100644
index 0000000..fd41a24
--- /dev/null
+++ b/test/foffs_alter_range.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 8\n"
+      "/FRAMEOFFSET 13\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_alter_frameoffset(D, -16, 0, 0);
+  CHECKI(e1, GD_E_RANGE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/foffs_alter_rdonly.c b/test/foffs_alter_rdonly.c
new file mode 100644
index 0000000..e973aef
--- /dev/null
+++ b/test/foffs_alter_rdonly.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 8\n"
+      "/FRAMEOFFSET 13\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_alter_frameoffset(D, 16, 0, 0);
+  CHECKI(e1, GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/foffs_get.c b/test/foffs_get.c
index 52e26b5..d81594c 100644
--- a/test/foffs_get.c
+++ b/test/foffs_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* Test 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 = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
-  unsigned char data_data[256];
-  int fd, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nFRAMEOFFSET 13\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_frameoffset(D, 0);
diff --git a/test/foffs_index.c b/test/foffs_index.c
new file mode 100644
index 0000000..e0fe81b
--- /dev/null
+++ b/test/foffs_index.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 1\n"
+      "/FRAMEOFFSET 13\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_frameoffset(D, -1);
+  CHECKI(e1, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/foffs_move.c b/test/foffs_move.c
index 6747f57..4a4ecf2 100644
--- a/test/foffs_move.c
+++ b/test/foffs_move.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* Test frameoffset */
 #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 = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
-  unsigned char data_data[256];
-  int fd, ret, error, r = 0;
+  int ret, error, r = 0;
   off_t fo, nf;
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nFRAMEOFFSET 13\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_frameoffset(D, 16, 0, 1);
diff --git a/test/fragment_affix.c b/test/fragment_affix.c
index 0d8c13f..5c88bdc 100644
--- a/test/fragment_affix.c
+++ b/test/fragment_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,23 +25,16 @@ 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;
+  int ret, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   ret = gd_fragment_affixes(D, 1, &prefix, &suffix);
diff --git a/test/fragment_affix_alter.c b/test/fragment_affix_alter.c
index 37d88e1..c3ef585 100644
--- a/test/fragment_affix_alter.c
+++ b/test/fragment_affix_alter.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,23 +25,16 @@ 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;
+  int ret, e1, e2, e3, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "B CONST UINT8 1\nINCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_alter_affixes(D, 1, "C", NULL);
diff --git a/test/fragment_affix_alter2.c b/test/fragment_affix_alter2.c
index d9f3623..2e62ea8 100644
--- a/test/fragment_affix_alter2.c
+++ b/test/fragment_affix_alter2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,26 +26,15 @@ int main(void)
   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;
+  int ret, e1, e2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "B CONST UINT8 1\nINCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "/INCLUDE format2 B Y\n");
+  MAKEFORMATFILE(format2, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_alter_affixes(D, 1, NULL, "");
diff --git a/test/fragment_affix_alter_code.c b/test/fragment_affix_alter_code.c
index 37ce2c5..78c8fab 100644
--- a/test/fragment_affix_alter_code.c
+++ b/test/fragment_affix_alter_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,33 +25,30 @@ 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 INT16 11\n";
-  int fd, ret, e1, r = 0;
+  int ret, e1, e2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "data RAW INT16 11\n");
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_alter_affixes(D, 1, NULL, ".txt");
   e1 = gd_error(D);
+
+  CHECKI(ret,GD_E_BAD_CODE);
+  CHECKI(e1,GD_E_BAD_CODE);
+
+  e2 = gd_alter_affixes(D, 1, "<", NULL);
+  CHECKI(e2, GD_E_BAD_CODE);
+
   gd_discard(D);
 
   unlink(format1);
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(ret,-1);
-  CHECKI(e1,GD_E_BAD_CODE);
-
   return r;
 }
diff --git a/test/fragment_affix_alter_dotpx.c b/test/fragment_affix_alter_dotpx.c
new file mode 100644
index 0000000..c387b2a
--- /dev/null
+++ b/test/fragment_affix_alter_dotpx.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char *prefix, *suffix;
+  const char *ns;
+  int ret, e1, e2, e3, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 NS.A Z\n");
+  MAKEFORMATFILE(format1, "B RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_affixes(D, 1, ".C", "D");
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+  CHECKI(ret,0);
+
+  e2 = gd_fragment_affixes(D, 1, &prefix, &suffix);
+  CHECKI(e2,0);
+
+  CHECKS(prefix,"C");
+  CHECKS(suffix,"D");
+
+  ns = gd_fragment_namespace(D, 1, NULL);
+  CHECKS(ns,"");
+
+  e3 = gd_validate(D, "CBD");
+  CHECKI(e3,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  free(prefix);
+  free(suffix);
+
+  return r;
+}
diff --git a/test/fragment_affix_alter_index.c b/test/fragment_affix_alter_index.c
new file mode 100644
index 0000000..7ae872a
--- /dev/null
+++ b/test/fragment_affix_alter_index.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  ret = gd_alter_affixes(D, 1, "C", NULL);
+  CHECKI(ret, GD_E_BAD_INDEX);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_affix_alter_nons.c b/test/fragment_affix_alter_nons.c
new file mode 100644
index 0000000..f913563
--- /dev/null
+++ b/test/fragment_affix_alter_nons.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char *prefix, *suffix;
+  const char *ns;
+  int ret, e1, e2, e3, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 NS.A Z\n");
+  MAKEFORMATFILE(format1, "B RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_affixes(D, 1, "C", "D");
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+  CHECKI(ret,0);
+
+  e2 = gd_fragment_affixes(D, 1, &prefix, &suffix);
+  CHECKI(e2,0);
+
+  CHECKS(prefix,"C");
+  CHECKS(suffix,"D");
+
+  ns = gd_fragment_namespace(D, 1, NULL);
+  CHECKS(ns,"NS");
+
+  e3 = gd_validate(D, "NS.CBD");
+  CHECKI(e3,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  free(prefix);
+  free(suffix);
+
+  return r;
+}
diff --git a/test/fragment_affix_alter_nop.c b/test/fragment_affix_alter_nop.c
index c37a1c2..3c254f3 100644
--- a/test/fragment_affix_alter_nop.c
+++ b/test/fragment_affix_alter_nop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,23 +25,16 @@ 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;
+  int ret, e1, e2, e3, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "B CONST UINT8 1\nINCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_alter_affixes(D, 1, "A", "Z");
diff --git a/test/fragment_affix_alter_ns.c b/test/fragment_affix_alter_ns.c
new file mode 100644
index 0000000..2843754
--- /dev/null
+++ b/test/fragment_affix_alter_ns.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char *prefix, *suffix;
+  const char *ns;
+  int ret, e1, e2, e3, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "B RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_affixes(D, 1, "NS.C", "D");
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+  CHECKI(ret,0);
+
+  e2 = gd_fragment_affixes(D, 1, &prefix, &suffix);
+  CHECKI(e2,0);
+
+  CHECKS(prefix,"C");
+  CHECKS(suffix,"D");
+
+  ns = gd_fragment_namespace(D, 1, NULL);
+  CHECKS(ns,"NS");
+
+  e3 = gd_validate(D, "NS.CBD");
+  CHECKI(e3,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  free(prefix);
+  free(suffix);
+
+  return r;
+}
diff --git a/test/fragment_affix_alter_pns.c b/test/fragment_affix_alter_pns.c
new file mode 100644
index 0000000..def2972
--- /dev/null
+++ b/test/fragment_affix_alter_pns.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char *prefix, *suffix;
+  const char *ns;
+  int ret, e1, e2, e3, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 NS0.A Z\n");
+  MAKEFORMATFILE(format1, "/INCLUDE format2 NS1.B Y\n");
+  MAKEFORMATFILE(format2, "M RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_affixes(D, 2, "NS2.C", "X");
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+  CHECKI(ret,0);
+
+  e2 = gd_fragment_affixes(D, 2, &prefix, &suffix);
+  CHECKI(e2,0);
+
+  CHECKS(prefix,"AC");
+  CHECKS(suffix,"XZ");
+
+  ns = gd_fragment_namespace(D, 2, NULL);
+  CHECKS(ns,"NS0.NS2");
+
+  e3 = gd_validate(D, "NS0.NS2.ACMXZ");
+  CHECKI(e3,0);
+
+  gd_discard(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  free(prefix);
+  free(suffix);
+
+  return r;
+}
diff --git a/test/fragment_affix_dup.c b/test/fragment_affix_dup.c
index f7e38cf..eb1d6a9 100644
--- a/test/fragment_affix_dup.c
+++ b/test/fragment_affix_dup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,42 +25,39 @@ 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;
+  int ret, e1, e2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "CdataD CONST UINT8 1\nINCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_alter_affixes(D, 1, "C", "D");
   e1 = gd_error(D);
+
+  CHECKI(ret,GD_E_DUPLICATE);
+  CHECKI(e1,GD_E_DUPLICATE);
+
   gd_fragment_affixes(D, 1, &prefix, &suffix);
   e2 = gd_error(D);
-  gd_discard(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);
 
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
   return r;
 }
diff --git a/test/fragment_affix_index.c b/test/fragment_affix_index.c
new file mode 100644
index 0000000..36a38d9
--- /dev/null
+++ b/test/fragment_affix_index.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char *prefix;
+  char *suffix;
+  int ret, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  ret = gd_fragment_affixes(D, 1, &prefix, &suffix);
+  CHECKI(ret,GD_E_BAD_INDEX);
+
+  error = gd_error(D);
+  CHECKI(error,GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_affix_ns.c b/test/fragment_affix_ns.c
new file mode 100644
index 0000000..f800059
--- /dev/null
+++ b/test/fragment_affix_ns.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int ret, error, r = 0;
+  char *prefix;
+  char *suffix;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  ret = gd_fragment_affixes(D, 1, &prefix, &suffix);
+  error = gd_error(D);
+
+  CHECKP(prefix);
+  CHECKP(suffix);
+  CHECKI(ret,0);
+  CHECKI(error,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_index.c b/test/fragment_index.c
index de3d2ca..cd5707c 100644
--- a/test/fragment_index.c
+++ b/test/fragment_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,19 @@
 /* Try to read fragment index */
 #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 = "INCLUDE format1\n";
-  const char *format1_data = "data RAW UINT8 8\n";
-  int fd, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/fragment_index_alias.c b/test/fragment_index_alias.c
index 39dab25..0eb7a3d 100644
--- a/test/fragment_index_alias.c
+++ b/test/fragment_index_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,21 +25,14 @@ 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;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "/ALIAS alias target\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/fragment_name.c b/test/fragment_name.c
index fe0454a..82069b6 100644
--- a/test/fragment_name.c
+++ b/test/fragment_name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,36 +20,21 @@
  */
 #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 *format_data = "INCLUDE format1\n";
-  const char *format1_data = "data RAW UINT8 11\n";
   const char *form0;
   const char *form1;
-  int fd, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   form0 = gd_fragmentname(D, 0);
diff --git a/test/fragment_name_oor.c b/test/fragment_name_oor.c
index 5fb8d4d..37ae027 100644
--- a/test/fragment_name_oor.c
+++ b/test/fragment_name_oor.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,36 +21,21 @@
 /* Test gd_fragmentname out-of-range handling */
 #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 *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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY);
   form0 = gd_fragmentname(D, -3000);
diff --git a/test/fragment_ndotdots.c b/test/fragment_ndotdots.c
new file mode 100644
index 0000000..ac28fcb
--- /dev/null
+++ b/test/fragment_ndotdots.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  ns = gd_fragment_namespace(D, 1, "n..s");
+  e1 = gd_error(D);
+
+  CHECKP(ns);
+  CHECKI(e1,GD_E_BAD_CODE);
+
+  e2 = gd_validate(D, "ns.data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ndots.c b/test/fragment_ndots.c
new file mode 100644
index 0000000..b37cdc4
--- /dev/null
+++ b/test/fragment_ndots.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 1, "n.s");
+  e1 = gd_error(D);
+
+  CHECKS(ns,"n.s");
+  CHECKI(e1,0);
+
+  e2 = gd_validate(D, "n.s.data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns.c b/test/fragment_ns.c
new file mode 100644
index 0000000..03645a5
--- /dev/null
+++ b/test/fragment_ns.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 1, NULL);
+  error = gd_error(D);
+
+  CHECKS(ns,"ns");
+  CHECKI(error,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns0.c b/test/fragment_ns0.c
new file mode 100644
index 0000000..7447c99
--- /dev/null
+++ b/test/fragment_ns0.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 0, NULL);
+  error = gd_error(D);
+
+  CHECKS(ns,"");
+  CHECKI(error,0);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns_add.c b/test/fragment_ns_add.c
new file mode 100644
index 0000000..a8615d1
--- /dev/null
+++ b/test/fragment_ns_add.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 1, "ns");
+  e1 = gd_error(D);
+
+  CHECKS(ns,"ns");
+  CHECKI(e1,0);
+
+  e2 = gd_validate(D, "ns.data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns_add0.c b/test/fragment_ns_add0.c
new file mode 100644
index 0000000..dcee0e2
--- /dev/null
+++ b/test/fragment_ns_add0.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  ns = gd_fragment_namespace(D, 0, "ns");
+  e1 = gd_error(D);
+
+  CHECKP(ns);
+  CHECKI(e1,GD_E_BAD_INDEX);
+
+  e2 = gd_validate(D, "data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns_alter.c b/test/fragment_ns_alter.c
new file mode 100644
index 0000000..a74d2c6
--- /dev/null
+++ b/test/fragment_ns_alter.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 1, "ns2");
+  e1 = gd_error(D);
+
+  CHECKS(ns,"ns2");
+  CHECKI(e1,0);
+
+  e2 = gd_validate(D, "ns2.data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns_alter_nop.c b/test/fragment_ns_alter_nop.c
new file mode 100644
index 0000000..b5c066b
--- /dev/null
+++ b/test/fragment_ns_alter_nop.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 1, "ns");
+  e1 = gd_error(D);
+
+  CHECKS(ns,"ns");
+  CHECKI(e1,0);
+
+  e2 = gd_validate(D, "ns.data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns_alter_pdel.c b/test/fragment_ns_alter_pdel.c
new file mode 100644
index 0000000..8a2e620
--- /dev/null
+++ b/test/fragment_ns_alter_pdel.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns0.\n");
+  MAKEFORMATFILE(format1, "INCLUDE format2 ns1.\n");
+  MAKEFORMATFILE(format2, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 2, "");
+  e1 = gd_error(D);
+
+  CHECKS(ns,"ns0");
+  CHECKI(e1,0);
+
+  e2 = gd_validate(D, "ns0.data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns_del.c b/test/fragment_ns_del.c
new file mode 100644
index 0000000..fb766db
--- /dev/null
+++ b/test/fragment_ns_del.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 1, "");
+  e1 = gd_error(D);
+
+  CHECKS(ns,"");
+  CHECKI(e1,0);
+
+  e2 = gd_validate(D, "data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns_dot.c b/test/fragment_ns_dot.c
new file mode 100644
index 0000000..e3bf3a7
--- /dev/null
+++ b/test/fragment_ns_dot.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 1, ".");
+  e1 = gd_error(D);
+
+  CHECKS(ns,"");
+  CHECKI(e1,0);
+
+  e2 = gd_validate(D, "data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns_dotdot.c b/test/fragment_ns_dotdot.c
new file mode 100644
index 0000000..e97ded2
--- /dev/null
+++ b/test/fragment_ns_dotdot.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  ns = gd_fragment_namespace(D, 1, "..");
+  e1 = gd_error(D);
+
+  CHECKP(ns);
+  CHECKI(e1,GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns_dotns.c b/test/fragment_ns_dotns.c
new file mode 100644
index 0000000..0296e63
--- /dev/null
+++ b/test/fragment_ns_dotns.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 1, ".ns");
+  e1 = gd_error(D);
+
+  CHECKS(ns,"ns");
+  CHECKI(e1,0);
+
+  e2 = gd_validate(D, "ns.data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_ns_nsdot.c b/test/fragment_ns_nsdot.c
new file mode 100644
index 0000000..ac2fc60
--- /dev/null
+++ b/test/fragment_ns_nsdot.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  const char *ns;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ns = gd_fragment_namespace(D, 1, "ns.");
+  e1 = gd_error(D);
+
+  CHECKS(ns,"ns");
+  CHECKI(e1,0);
+
+  e2 = gd_validate(D, "ns.data");
+  CHECKI(e2,0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_num.c b/test/fragment_num.c
index 89b1848..64b7353 100644
--- a/test/fragment_num.c
+++ b/test/fragment_num.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,21 +25,14 @@ 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;
+  int nfragments, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfragments = gd_nfragments(D);
diff --git a/test/fragment_parent.c b/test/fragment_parent.c
index 0da18ae..2d06a1a 100644
--- a/test/fragment_parent.c
+++ b/test/fragment_parent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,26 +26,15 @@ int main(void)
   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;
+  int parent, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "/INCLUDE format1\na CONST UINT8 1\n");
+  MAKEFORMATFILE(format1, "b CONST UINT8 11\n/INCLUDE format2 UINT8 11");
+  MAKEFORMATFILE(format2, "c CONST UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   parent = gd_parent_fragment(D, 2);
diff --git a/test/fragment_parent_index.c b/test/fragment_parent_index.c
new file mode 100644
index 0000000..bfa815e
--- /dev/null
+++ b/test/fragment_parent_index.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 parent, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  parent = gd_parent_fragment(D, 1);
+  CHECKI(parent, GD_E_BAD_INDEX);
+
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/fragment_parent_root.c b/test/fragment_parent_root.c
new file mode 100644
index 0000000..dd11a34
--- /dev/null
+++ b/test/fragment_parent_root.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 parent, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  parent = gd_parent_fragment(D, 0);
+  CHECKI(parent, GD_E_BAD_INDEX);
+
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get64.c b/test/get64.c
index 9492a35..22ad891 100644
--- a/test/get64.c
+++ b/test/get64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -23,38 +23,21 @@
 
 #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, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata64(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/get_affix.c b/test/get_affix.c
index b24a23d..c33de83 100644
--- a/test/get_affix.c
+++ b/test/get_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,44 +20,22 @@
  */
 #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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "phase PHASE data -2\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "AphaseZ", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_bad_code.c b/test/get_bad_code.c
index 01f55fa..7179f10 100644
--- a/test/get_bad_code.c
+++ b/test/get_bad_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Attempt to read a non-existant field */
 #include "test.h"
 
-#include <stdio.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 = "#\n";
   unsigned char c = 0;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "#\n");
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "no-such-field", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_bit.c b/test/get_bit.c
index a84d727..0a2d600 100644
--- a/test/get_bit.c
+++ b/test/get_bit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* Attempt to read BIT */
 #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 = "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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "bit BIT data 1 3\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "bit", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_carray.c b/test/get_carray.c
index 6255fde..0437103 100644
--- a/test/get_carray.c
+++ b/test/get_carray.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,31 +21,20 @@
 /* Attempt to read constant */
 #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 = "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;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n");
 
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  D = gd_open(filedir, GD_RDONLY);
   n = gd_get_carray(D, "carray", GD_FLOAT64, c);
   error = gd_error(D);
 
diff --git a/test/get_carray_bad.c b/test/get_carray_bad.c
new file mode 100644
index 0000000..743a93c
--- /dev/null
+++ b/test/get_carray_bad.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double c[7];
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_get_carray(D, "carray", GD_FLOAT64, c);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_carray_c2r.c b/test/get_carray_c2r.c
index fcee2a6..b5b4a06 100644
--- a/test/get_carray_c2r.c
+++ b/test/get_carray_c2r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,29 +20,18 @@
  */
 #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 = "carray CARRAY COMPLEX128 8.3;7.2 6.1;5.0 3.9;2.8 1.7;0.6\n";
   double c[4];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "carray CARRAY COMPLEX128 8.3;7.2 6.1;5.0 3.9;2.8 1.7;0.6\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_get_carray(D, "carray", GD_FLOAT64, c);
diff --git a/test/get_carray_len.c b/test/get_carray_len.c
deleted file mode 100644
index f24f2b0..0000000
--- a/test/get_carray_len.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright (C) 2010-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
- */
-/* Attempt to read constant */
-#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 = "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);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
-
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-  n = gd_array_len(D, "carray");
-  error = gd_error(D);
-
-  gd_discard(D);
-
-  unlink(format);
-  rmdir(filedir);
-
-  CHECKI(error, 0);
-  CHECKI(n, 7);
-
-  return r;
-}
diff --git a/test/get_carray_slice.c b/test/get_carray_slice.c
index 1065492..179a439 100644
--- a/test/get_carray_slice.c
+++ b/test/get_carray_slice.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Attempt to read constant */
 #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 = "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;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_get_carray_slice(D, "carray", 2, 4, GD_FLOAT64, c);
diff --git a/test/get_carray_slice_bounds.c b/test/get_carray_slice_bounds.c
new file mode 100644
index 0000000..2bd6fbe
--- /dev/null
+++ b/test/get_carray_slice_bounds.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double c[4];
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "carray CARRAY FLOAT64 0 1 2 3 4 5 6 7 8 9 10 11\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_get_carray_slice(D, "carray", 2, 40, GD_FLOAT64, c);
+  CHECKI(e1, GD_E_BOUNDS);
+
+  e2 = gd_get_carray_slice(D, "carray", 40, 2, GD_FLOAT64, c);
+  CHECKI(e2, GD_E_BOUNDS);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_carray_slice_type.c b/test/get_carray_slice_type.c
new file mode 100644
index 0000000..e4f0965
--- /dev/null
+++ b/test/get_carray_slice_type.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double c[7];
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray SARRAY a b c d e f g h i j k l m\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_get_carray_slice(D, "sarray", GD_FLOAT64, 0, 7, c);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_carray_type.c b/test/get_carray_type.c
new file mode 100644
index 0000000..5d374a2
--- /dev/null
+++ b/test/get_carray_type.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double c[7];
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray SARRAY a b c d e f g h i j k l m\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_get_carray(D, "sarray", GD_FLOAT64, c);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_char.c b/test/get_char.c
index 5e45464..abe52b5 100644
--- a/test/get_char.c
+++ b/test/get_char.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* Attempt to use a old-style type character should fail 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 *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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "data", 5, 0, 1, 0, (gd_type_t)'c', c);
diff --git a/test/get_clincom.c b/test/get_clincom.c
index d0b391f..8bbc50e 100644
--- a/test/get_clincom.c
+++ b/test/get_clincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,20 +21,11 @@
 /* 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>
-#include <stdio.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 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};
@@ -42,23 +33,15 @@ int main(void)
   double complex c = 0;
   const double complex v = 13 + _Complex_I * 22;
 #endif
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 2 data 2;3 3;2 data 0;1 0\ndata RAW UINT8 1\n");
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_COMPLEX128, &c);
diff --git a/test/get_complex128.c b/test/get_complex128.c
index b8d634d..82bf30a 100644
--- a/test/get_complex128.c
+++ b/test/get_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,52 +18,27 @@
  * 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"
 
-#include <math.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 COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double c[16];
-  double data_data[256];
 #else
   double complex c[8];
-  double complex data_data[128];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[2 * fd] = data_data[2 * fd + 1] = 1.5 * fd;
-#else
-    data_data[fd] = (double complex)(1.5 * (1 + _Complex_I) * fd);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, (i / 2) * 1.5, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/get_complex64.c b/test/get_complex64.c
index cbcd754..3fce2d9 100644
--- a/test/get_complex64.c
+++ b/test/get_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,52 +18,27 @@
  * 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"
 
-#include <math.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 COMPLEX64 8\n";
 #ifdef GD_NO_C99_API
   float c[16];
-  float data_data[256];
 #else
   float complex c[8];
-  float complex data_data[128];
 #endif
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[2 * fd] = data_data[2 * fd + 1] = 1.5 * fd;
-#else
-    data_data[fd] = (float complex)(1.5 * (1 + _Complex_I) * fd);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX64 8\n");
+  MAKEDATAFILE(data, float, (i / 2) * 1.5, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/get_const.c b/test/get_const.c
index dbfd0b2..b734198 100644
--- a/test/get_const.c
+++ b/test/get_const.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Attempt to read constant */
 #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 = "const CONST FLOAT64 8.3\n";
   double c;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST FLOAT64 8.3\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_get_constant(D, "const", GD_FLOAT64, &c);
diff --git a/test/get_const_bad.c b/test/get_const_bad.c
new file mode 100644
index 0000000..d7a7669
--- /dev/null
+++ b/test/get_const_bad.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double c;
+  int n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  n = gd_get_constant(D, "const", GD_FLOAT64, &c);
+  error = gd_error(D);
+
+  CHECKI(error, GD_E_BAD_CODE);
+  CHECKI(n, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/get_const_carray.c b/test/get_const_carray.c
index f2182e8..1654f8e 100644
--- a/test/get_const_carray.c
+++ b/test/get_const_carray.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,26 +20,18 @@
  */
 #include "test.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 *format_data =
-    "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
   double c;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_get_constant(D, "carray", GD_FLOAT64, &c);
diff --git a/test/get_const_complex.c b/test/get_const_complex.c
index 0a8f1c7..40e5f8a 100644
--- a/test/get_const_complex.c
+++ b/test/get_const_complex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,19 +21,10 @@
 /* Attempt to read complex constant */
 #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 = "const CONST COMPLEX128 8.3;9.2\n";
 #ifdef GD_NO_C99_API
   double c[2];
   const double v[2] = {8.3, 9.2};
@@ -41,15 +32,13 @@ int main(void)
   double complex c;
   const double complex v = 8.3 + _Complex_I * 9.2;
 #endif
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST COMPLEX128 8.3;9.2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 #ifdef GD_NO_C99_API
diff --git a/test/get_const_repr.c b/test/get_const_repr.c
index e4f9cf1..1fc078d 100644
--- a/test/get_const_repr.c
+++ b/test/get_const_repr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Attempt to read constant with repr */
 #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 = "const CONST COMPLEX128 8.3;9.2\n";
   double c;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST COMPLEX128 8.3;9.2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_get_constant(D, "const.m", GD_FLOAT64, &c);
diff --git a/test/get_const_reprz.c b/test/get_const_reprz.c
new file mode 100644
index 0000000..d451e03
--- /dev/null
+++ b/test/get_const_reprz.c
@@ -0,0 +1,80 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, e4, r1, r2, r3, r4, r = 0;
+  double c1[2], c2[2], c3[2], c4[2];
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "code CONST UINT64 1\n"
+      "code.r CONST COMPLEX128 2;3\n"
+      "more.r CONST COMPLEX64 4;5\n"
+      );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  /* Real part of "code" */
+  r1 = gd_get_constant(D, "code.r", GD_COMPLEX128, c1);
+  e1 = gd_error(D);
+  CHECKU(r1, 0);
+  CHECKI(e1, 0);
+  CHECKF(c1[0], 1);
+  CHECKF(c1[1], 0);
+
+  /* All of code.r */
+  r2 = gd_get_constant(D, "code.r.z", GD_COMPLEX128, c2);
+  e2 = gd_error(D);
+  CHECKU(r2, 0);
+  CHECKI(e2, 0);
+  CHECKF(c2[0], 2);
+  CHECKF(c2[1], 3);
+
+  /* Real part of code.r */
+  r3 = gd_get_constant(D, "code.r.r", GD_COMPLEX128, c3);
+  e3 = gd_error(D);
+  CHECKU(r3, 0);
+  CHECKI(e3, 0);
+  CHECKF(c3[0], 2);
+  CHECKF(c3[1], 0);
+
+  /* All of more.r */
+  r4 = gd_get_constant(D, "more.r", GD_COMPLEX128, c4);
+  e4 = gd_error(D);
+  CHECKU(r4, 0);
+  CHECKI(e4, 0);
+  CHECKF(c4[0], 4);
+  CHECKF(c4[1], 5);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_cpolynom.c b/test/get_cpolynom.c
index 8d790b6..57a7b6a 100644
--- a/test/get_cpolynom.c
+++ b/test/get_cpolynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,20 +21,11 @@
 /* Attempt to read POLYNOM */
 #include "test.h"
 
-#include <stdio.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 = "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};
@@ -42,23 +33,15 @@ int main(void)
   double complex c = 0;
   const double complex v = 13 + _Complex_I * 47;
 #endif
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "polynom POLYNOM data 3;2 2;4 0;1\ndata RAW UINT8 1\n");
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "polynom", 5, 0, 1, 0, GD_COMPLEX128, &c);
diff --git a/test/get_cpolynom1.c b/test/get_cpolynom1.c
index ef4e0b7..5bc5262 100644
--- a/test/get_cpolynom1.c
+++ b/test/get_cpolynom1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,21 @@
  */
 #include "test.h"
 
-#include <stdio.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 = "polynom POLYNOM data 3;2 2;4\ndata RAW UINT8 1\n";
   double c[16];
-  unsigned char data_data[256];
-  int i, fd, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "polynom POLYNOM data 3;2 2;4\ndata RAW UINT8 1\n");
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "polynom", 5, 0, 8, 0, GD_COMPLEX128, &c);
diff --git a/test/get_cpolynom_int.c b/test/get_cpolynom_int.c
index 1c1e513..f6c71b3 100644
--- a/test/get_cpolynom_int.c
+++ b/test/get_cpolynom_int.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,21 @@
  */
 #include "test.h"
 
-#include <stdio.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 = "polynom POLYNOM data 3;2 2;4 0;1\ndata RAW UINT8 1\n";
   int32_t c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "polynom POLYNOM data 3;2 2;4 0;1\ndata RAW UINT8 1\n");
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "polynom.r", 5, 0, 8, 0, GD_INT32, &c);
diff --git a/test/get_dim.c b/test/get_dim.c
index 91f5dab..8bbb93b 100644
--- a/test/get_dim.c
+++ b/test/get_dim.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data CONST UINT8 8\n");
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_NULL, NULL);
diff --git a/test/get_dimin.c b/test/get_dimin.c
new file mode 100644
index 0000000..3506ebe
--- /dev/null
+++ b/test/get_dimin.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  unsigned char c;
+  int e1, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "lincom LINCOM data 1 0\ndata CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, &c);
+  CHECKU(n, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_DIMENSION);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_divide.c b/test/get_divide.c
index f171360..5829be3 100644
--- a/test/get_divide.c
+++ b/test/get_divide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,23 @@
 /* Attempt to read DIVIDE */
 #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 =
-    "div DIVIDE data INDEX\n"
-    "data RAW UINT8 1\n";
   double c = 0;
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)(fd + 2);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "div DIVIDE data INDEX\n"
+    "data RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, (i + 2), 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "div", 5, 0, 1, 0, GD_FLOAT64, &c);
diff --git a/test/get_divide_ccin.c b/test/get_divide_ccin.c
index e06f1f6..566ded9 100644
--- a/test/get_divide_ccin.c
+++ b/test/get_divide_ccin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,29 @@
  */
 #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 =
-    "div DIVIDE data phase\n"
-    "phase PHASE data 1\n"
-    "data RAW COMPLEX128 1\n";
   double c[16];
   double data_data[512];
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 256; ++i) {
     data_data[i * 2] = (double)i;
     data_data[i * 2 + 1] = (double)i / 256.;
   }
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format,
+    "div DIVIDE data phase\n"
+    "phase PHASE data 1\n"
+    "data RAW COMPLEX128 1\n"
+  );
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, data_data, 512 * sizeof(double));
diff --git a/test/get_divide_code.c b/test/get_divide_code.c
new file mode 100644
index 0000000..1589a7c
--- /dev/null
+++ b/test/get_divide_code.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double c[16];
+  int e1, e2, r = 0;
+  size_t n1, n2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "div1 DIVIDE data missing\n"
+      "div2 DIVIDE missing data\n"
+      "data RAW COMPLEX128 1\n"
+      );
+  MAKEDATAFILE(data, double, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n1 = gd_getdata(D, "div1", 5, 0, 1, 0, GD_COMPLEX128, c);
+  CHECKU(n1, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  n2 = gd_getdata(D, "div2", 5, 0, 1, 0, GD_COMPLEX128, c);
+  CHECKU(n2, 0);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_divide_crin.c b/test/get_divide_crin.c
index abba583..6986e84 100644
--- a/test/get_divide_crin.c
+++ b/test/get_divide_crin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,29 @@
  */
 #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 =
-    "div DIVIDE data phase\n"
-    "phase PHASE data.r 1\n"
-    "data RAW COMPLEX128 1\n";
   double c[16];
   double data_data[512];
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 256; ++i) {
     data_data[i * 2] = (double)i;
     data_data[i * 2 + 1] = (double)i / 256.;
   }
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format,
+    "div DIVIDE data phase\n"
+    "phase PHASE data.r 1\n"
+    "data RAW COMPLEX128 1\n"
+  );
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, data_data, 512 * sizeof(double));
diff --git a/test/get_divide_crinr.c b/test/get_divide_crinr.c
index 887f4b3..d371a9f 100644
--- a/test/get_divide_crinr.c
+++ b/test/get_divide_crinr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,29 @@
  */
 #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 =
-    "div DIVIDE data phase\n"
-    "phase PHASE data.r 1\n"
-    "data RAW COMPLEX128 1\n";
   double c[8];
   double data_data[512];
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 256; ++i) {
     data_data[i * 2] = (double)i;
     data_data[i * 2 + 1] = (double)i / 256.;
   }
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format,
+    "div DIVIDE data phase\n"
+    "phase PHASE data.r 1\n"
+    "data RAW COMPLEX128 1\n"
+  );
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, data_data, 512 * sizeof(double));
diff --git a/test/get_divide_rcin.c b/test/get_divide_rcin.c
index c605a88..868c3eb 100644
--- a/test/get_divide_rcin.c
+++ b/test/get_divide_rcin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,29 @@
  */
 #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 =
-    "div DIVIDE data.r phase\n"
-    "phase PHASE data 1\n"
-    "data RAW COMPLEX128 1\n";
   double c[16];
   double data_data[512];
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 256; ++i) {
     data_data[i * 2] = (double)i;
     data_data[i * 2 + 1] = (double)i / 256.;
   }
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format,
+    "div DIVIDE data.r phase\n"
+    "phase PHASE data 1\n"
+    "data RAW COMPLEX128 1\n"
+  );
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, data_data, 512 * sizeof(double));
diff --git a/test/get_divide_s.c b/test/get_divide_s.c
index 96c6e7e..f93f1ea 100644
--- a/test/get_divide_s.c
+++ b/test/get_divide_s.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,23 @@
  */
 #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 =
-    "div DIVIDE data phase\n"
-    "phase PHASE data 128\n"
-    "data RAW UINT8 1\n";
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "div DIVIDE data phase\n"
+    "phase PHASE data 128\n"
+    "data RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "div", 0, 0, 1000, 0, GD_NULL, NULL);
diff --git a/test/get_dot.c b/test/get_dot.c
new file mode 100644
index 0000000..095ed34
--- /dev/null
+++ b/test/get_dot.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  unsigned char c[8];
+  int i, n, error, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, ".data", 5, 0, 1, 0, GD_UINT8, c);
+  error = gd_error(D);
+
+  gd_discard(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_endian16.c b/test/get_endian16.c
index 8e1ba0b..88314c8 100644
--- a/test/get_endian16.c
+++ b/test/get_endian16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* Attempt to read UINT16 with the opposite endianness */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
 static int BigEndian(void)
 {
   union {
@@ -47,27 +38,21 @@ int main(void)
   const char *data = "dirfile/data";
   char format_data[1000];
   uint16_t c = 0;
-  uint16_t data_data[128];
   const int big_endian = BigEndian();
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   sprintf(format_data, "data RAW UINT16 1\nENDIAN %s\n", (big_endian)
       ? "little" : "big");
 
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = (uint16_t)(fd * (0x0201));
-
   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, 128 * sizeof(uint16_t));
-  close(fd);
+  MAKEDATAFILE(data, uint16_t, (i * (0x0201)), 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, &c);
diff --git a/test/get_endian32.c b/test/get_endian32.c
index 3275a58..43c01b3 100644
--- a/test/get_endian32.c
+++ b/test/get_endian32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* Attempt to read UINT32 with the opposite endianness */
 #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>
-
 static int BigEndian(void)
 {
   union {
@@ -47,27 +38,21 @@ int main(void)
   const char *data = "dirfile/data";
   char format_data[1000];
   uint32_t c = 0;
-  uint32_t data_data[128];
   const int big_endian = BigEndian();
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   sprintf(format_data, "data RAW UINT32 1\nENDIAN %s\n", (big_endian)
       ? "little" : "big");
 
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = fd * (0x020201);
-
   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, 128 * sizeof(uint32_t));
-  close(fd);
+  MAKEDATAFILE(data, uint32_t, i * (0x020201), 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, &c);
diff --git a/test/get_endian64.c b/test/get_endian64.c
index 85a5f4a..a5e086d 100644
--- a/test/get_endian64.c
+++ b/test/get_endian64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* Attempt to read UINT64 with the opposite endianness */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
 static int BigEndian(void)
 {
   union {
@@ -47,27 +38,21 @@ int main(void)
   const char *data = "dirfile/data";
   char format_data[1000];
   uint64_t c = 0;
-  uint64_t data_data[128];
   const int big_endian = BigEndian();
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   sprintf(format_data, "data RAW UINT64 1\nENDIAN %s\n", (big_endian)
       ? "little" : "big");
 
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = fd * (0x020100000201);
-
   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, 128 * sizeof(uint64_t));
-  close(fd);
+  MAKEDATAFILE(data, uint64_t, i * (0x020100000201), 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, &c);
diff --git a/test/get_endian8.c b/test/get_endian8.c
index 8d522ad..5b518ab 100644
--- a/test/get_endian8.c
+++ b/test/get_endian8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* Attempt to read UINT8 with the opposite endianness */
 #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>
-
 static int BigEndian(void)
 {
   union {
@@ -47,27 +38,21 @@ int main(void)
   const char *data = "dirfile/data";
   char format_data[1000];
   uint8_t c = 0;
-  uint8_t data_data[128];
   const int big_endian = BigEndian();
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   sprintf(format_data, "data RAW UINT8 1\nENDIAN %s\n", (big_endian)
       ? "little" : "big");
 
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = (uint8_t)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, 128 * sizeof(uint8_t));
-  close(fd);
+  MAKEDATAFILE(data, uint8_t, i, 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_endian_complex128_arm.c b/test/get_endian_complex128_arm.c
index d710f70..a3cc87e 100644
--- a/test/get_endian_complex128_arm.c
+++ b/test/get_endian_complex128_arm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read arm-endian COMPLEX128 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <math.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 = "data RAW COMPLEX128 1\nENDIAN little arm\n";
 #ifdef GD_NO_C99_API
   double u[20];
   double v[20][2];
@@ -178,7 +167,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
 #ifdef GD_NO_C99_API
   v[0][0] = 1.5;
@@ -193,9 +182,7 @@ int main(void)
     v[i] = v[i - 1] * 2.25;
 #endif
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\nENDIAN little arm\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 64 * 16 * sizeof(unsigned char));
diff --git a/test/get_endian_complex128_big.c b/test/get_endian_complex128_big.c
index 8ad09e7..8334b8e 100644
--- a/test/get_endian_complex128_big.c
+++ b/test/get_endian_complex128_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read big-endian COMPLEX128 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <math.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 = "data RAW COMPLEX128 1\nENDIAN big\n";
 #ifdef GD_NO_C99_API
   double u[20];
   double v[20][2];
@@ -178,7 +167,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
 #ifdef GD_NO_C99_API
   v[0][0] = 1.5;
@@ -193,9 +182,7 @@ int main(void)
     v[i] = v[i - 1] * 2.25;
 #endif
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\nENDIAN big\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 64 * 16 * sizeof(unsigned char));
diff --git a/test/get_endian_complex128_little.c b/test/get_endian_complex128_little.c
index ba1133b..f3d4246 100644
--- a/test/get_endian_complex128_little.c
+++ b/test/get_endian_complex128_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read little-endian COMPLEX128 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <math.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 = "data RAW COMPLEX128 1\nENDIAN little\n";
 #ifdef GD_NO_C99_API
   double u[20];
   double v[20][2];
@@ -178,7 +167,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
 #ifdef GD_NO_C99_API
   v[0][0] = 1.5;
@@ -193,9 +182,7 @@ int main(void)
     v[i] = v[i - 1] * 2.25;
 #endif
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\nENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 64 * 16 * sizeof(unsigned char));
diff --git a/test/get_endian_complex64_arm.c b/test/get_endian_complex64_arm.c
index 59e5dda..c9c63bf 100644
--- a/test/get_endian_complex64_arm.c
+++ b/test/get_endian_complex64_arm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read arm-endian COMPLEX64 (which is just little endian) */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <math.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 = "data RAW COMPLEX64 1\nENDIAN little arm\n";
 #ifdef GD_NO_C99_API
   float u[20];
   float v[20][2];
@@ -114,7 +103,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
 #ifdef GD_NO_C99_API
   v[0][0] = 1.5;
@@ -129,9 +118,7 @@ int main(void)
     v[i] = v[i - 1] * 2.25;
 #endif
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX64 1\nENDIAN little arm\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 64 * 8 * sizeof(unsigned char));
diff --git a/test/get_endian_complex64_big.c b/test/get_endian_complex64_big.c
index 9236e92..6db19fc 100644
--- a/test/get_endian_complex64_big.c
+++ b/test/get_endian_complex64_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read big-endian COMPLEX64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <math.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 = "data RAW COMPLEX64 1\nENDIAN big\n";
 #ifdef GD_NO_C99_API
   float u[20];
   float v[20][2];
@@ -114,7 +103,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
 #ifdef GD_NO_C99_API
   v[0][0] = 1.5;
@@ -129,9 +118,7 @@ int main(void)
     v[i] = v[i - 1] * 2.25;
 #endif
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX64 1\nENDIAN big\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 64 * 8 * sizeof(unsigned char));
diff --git a/test/get_endian_complex64_little.c b/test/get_endian_complex64_little.c
index ec3b438..b69ca77 100644
--- a/test/get_endian_complex64_little.c
+++ b/test/get_endian_complex64_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read little-endian COMPLEX64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <math.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 = "data RAW COMPLEX64 1\nENDIAN little\n";
 #ifdef GD_NO_C99_API
   float u[20];
   float v[20][2];
@@ -114,7 +103,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
 #ifdef GD_NO_C99_API
   v[0][0] = 1.5;
@@ -129,9 +118,7 @@ int main(void)
     v[i] = v[i - 1] * 2.25;
 #endif
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX64 1\nENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 64 * 8 * sizeof(unsigned char));
diff --git a/test/get_endian_float32_arm.c b/test/get_endian_float32_arm.c
index bd2e6ed..c444369 100644
--- a/test/get_endian_float32_arm.c
+++ b/test/get_endian_float32_arm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read arm-endian FLOAT32 (which is just little endian) */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <math.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 FLOAT32 1\nENDIAN little arm\n";
   float u[10];
   float v[20];
   const unsigned char data_data[128 * 4] = {
@@ -109,15 +98,13 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   v[0] = 1.5;
   for (i = 1; i < 20; ++i)
     v[i] = v[i - 1] * 1.5;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 1\nENDIAN little arm\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 128 * sizeof(float));
diff --git a/test/get_endian_float32_big.c b/test/get_endian_float32_big.c
index 16ff95a..e3c0294 100644
--- a/test/get_endian_float32_big.c
+++ b/test/get_endian_float32_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read big-endian FLOAT32 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <math.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 FLOAT32 1\nENDIAN big\n";
   float u[10];
   float v[20];
   const unsigned char data_data[128 * 4] = {
@@ -109,15 +98,13 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   v[0] = 1.5;
   for (i = 1; i < 20; ++i)
     v[i] = v[i - 1] * 1.5;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 1\nENDIAN big\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 128 * sizeof(float));
diff --git a/test/get_endian_float32_little.c b/test/get_endian_float32_little.c
index c12b7e5..c7090ab 100644
--- a/test/get_endian_float32_little.c
+++ b/test/get_endian_float32_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read little-endian FLOAT32 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <math.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 = "data RAW FLOAT32 1\nENDIAN little\n";
   float u[10];
   float v[20];
   const unsigned char data_data[128 * 4] = {
@@ -109,15 +98,13 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   v[0] = 1.5;
   for (i = 1; i < 20; ++i)
     v[i] = v[i - 1] * 1.5;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 1\nENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 128 * sizeof(float));
diff --git a/test/get_endian_float64_arm.c b/test/get_endian_float64_arm.c
index 59acb29..9690d03 100644
--- a/test/get_endian_float64_arm.c
+++ b/test/get_endian_float64_arm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read arm-endian FLOAT64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <math.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 = "data RAW FLOAT64 1\nENDIAN little arm\n";
   double u[10];
   double v[20];
   const unsigned char data_data[128 * 8] = {
@@ -173,15 +162,13 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   v[0] = 1.5;
   for (i = 1; i < 20; ++i)
     v[i] = v[i - 1] * 1.5;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\nENDIAN little arm\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 128 * sizeof(double));
diff --git a/test/get_endian_float64_big.c b/test/get_endian_float64_big.c
index f085642..2933eb2 100644
--- a/test/get_endian_float64_big.c
+++ b/test/get_endian_float64_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read big-endian FLOAT64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <math.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 = "data RAW FLOAT64 1\nENDIAN big\n";
   double u[10];
   double v[20];
   const unsigned char data_data[128 * 8] = {
@@ -173,15 +162,13 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   v[0] = 1.5;
   for (i = 1; i < 20; ++i)
     v[i] = v[i - 1] * 1.5;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\nENDIAN big\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 128 * sizeof(double));
diff --git a/test/get_endian_float64_little.c b/test/get_endian_float64_little.c
index b689eed..753fece 100644
--- a/test/get_endian_float64_little.c
+++ b/test/get_endian_float64_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,22 +21,11 @@
 /* Attempt to read little-endian FLOAT64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <math.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 = "data RAW FLOAT64 1\nENDIAN little\n";
   double u[10];
   double v[20];
   const unsigned char data_data[128 * 8] = {
@@ -173,15 +162,13 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   v[0] = 1.5;
   for (i = 1; i < 20; ++i)
     v[i] = v[i - 1] * 1.5;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\nENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 128 * sizeof(double));
diff --git a/test/get_ff.c b/test/get_ff.c
index 5ad011c..cee84b3 100644
--- a/test/get_ff.c
+++ b/test/get_ff.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* 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, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/get_float32.c b/test/get_float32.c
index ebcdde2..611dde5 100644
--- a/test/get_float32.c
+++ b/test/get_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT32 */
 #include "test.h"
 
-#include <math.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 FLOAT32 8\n";
   float c[8];
-  float data_data[128];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = (float)(1.5 * fd);
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 128 * sizeof(float));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
+  MAKEDATAFILE(data, float, (1.5 * i), 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/get_float64.c b/test/get_float64.c
index 1960d18..579dd90 100644
--- a/test/get_float64.c
+++ b/test/get_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read FLOAT64 */
 #include "test.h"
 
-#include <math.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 FLOAT64 8\n";
   double c[8];
-  double data_data[128];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = 1.5 * fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 128 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double, 1.5 * i, 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/get_foffs.c b/test/get_foffs.c
index a487017..fa070cd 100644
--- a/test/get_foffs.c
+++ b/test/get_foffs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* Attempt to read UINT8 with a 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 1\ndata RAW UINT8 1\n";
   unsigned char c;
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "FRAMEOFFSET 1\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_foffs2.c b/test/get_foffs2.c
index 2b63c6c..3ecf07b 100644
--- a/test/get_foffs2.c
+++ b/test/get_foffs2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,37 +20,20 @@
  */
 #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 1\n";
   unsigned char c1[5], c2[5];
-  unsigned char data_data[256];
-  int i, fd, n1, n2, e1, e2, r = 0;
+  int i, n1, n2, e1, e2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (i = 0; i < 256; ++i)
-    data_data[i] = (unsigned char)i;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "FRAMEOFFSET 2\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n1 = gd_getdata(D, "data", 0, 0, 5, 0, GD_UINT8, c1);
diff --git a/test/get_fs.c b/test/get_fs.c
index 0270f9c..9e4ecc0 100644
--- a/test/get_fs.c
+++ b/test/get_fs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* 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, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 0, 8, GD_UINT8, c);
diff --git a/test/get_here.c b/test/get_here.c
index 3035a69..8fe78b9 100644
--- a/test/get_here.c
+++ b/test/get_here.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek(D, "data", 5, 0, GD_SEEK_SET);
diff --git a/test/get_here_foffs.c b/test/get_here_foffs.c
index 44ccd80..c2df65b 100644
--- a/test/get_here_foffs.c
+++ b/test/get_here_foffs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "FRAMEOFFSET 2\ndata RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_seek(D, "data", 0, 4, GD_SEEK_SET);
diff --git a/test/get_heres.c b/test/get_heres.c
index 30ea057..5ab230a 100644
--- a/test/get_heres.c
+++ b/test/get_heres.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek(D, "data", 5, 0, GD_SEEK_SET);
diff --git a/test/get_index_complex.c b/test/get_index_complex.c
index baac290..3e289ba 100644
--- a/test/get_index_complex.c
+++ b/test/get_index_complex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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";
@@ -37,9 +30,9 @@ int main(void)
 
   memset(c, 0, 16 * sizeof(double));
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "INDEX", 5, 0, 8, 0, GD_COMPLEX128, c);
diff --git a/test/get_index_type.c b/test/get_index_type.c
new file mode 100644
index 0000000..3f98a71
--- /dev/null
+++ b/test/get_index_type.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define CHECK_INDEX_TYPE(o,t,v,C) \
+  do { \
+    n = gd_getdata(D, "INDEX", 0, o, 0, 8, t, v); \
+    CHECKUi(o, n, 8); \
+    for (i = 0; i < 8; ++i) \
+      C(o + i, v[i], o + i); \
+  } while(0)
+
+#define CHECK_INDEX_CTYPE(o,t,v,C) \
+  do { \
+    n = gd_getdata(D, "INDEX", 0, o, 0, 8, t, v); \
+    CHECKUi(o, n, 8); \
+    for (i = 0; i < 8; ++i) { \
+      CHECKFi(o + i, v[i * 2], o + i); \
+      CHECKFi(o + i, v[i * 2 + 1], 0); \
+    } \
+  } while(0)
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int r = 0;
+  int8_t     i8[8];
+  int16_t   i16[8];
+  int32_t   i32[8];
+  int64_t   i64[8];
+  uint8_t    u8[8];
+  uint16_t  u16[8];
+  uint32_t  u32[8];
+  uint64_t  u64[8];
+  float     f32[8];
+  double    f64[8];
+  float    c64[16];
+  double  c128[16];
+  size_t i, n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEEMPTYFILE(format, 0600);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  CHECK_INDEX_TYPE(    0,       GD_INT8,   i8, CHECKIi);
+  CHECK_INDEX_TYPE(  100,      GD_UINT8,   u8, CHECKUi);
+  CHECK_INDEX_TYPE(  200,      GD_INT16,  i16, CHECKIi);
+  CHECK_INDEX_TYPE(  300,     GD_UINT16,  u16, CHECKUi);
+  CHECK_INDEX_TYPE(  400,      GD_INT32,  i32, CHECKIi);
+  CHECK_INDEX_TYPE(  500,     GD_UINT32,  u32, CHECKUi);
+  CHECK_INDEX_TYPE(  600,      GD_INT64,  i64, CHECKIi);
+  CHECK_INDEX_TYPE(  700,     GD_UINT64,  u64, CHECKUi);
+  CHECK_INDEX_TYPE(  800,    GD_FLOAT32,  f32, CHECKFi);
+  CHECK_INDEX_TYPE(  900,    GD_FLOAT64,  f64, CHECKFi);
+  CHECK_INDEX_CTYPE(1000,  GD_COMPLEX64,  c64, CHECKRi);
+  CHECK_INDEX_CTYPE(1100, GD_COMPLEX128, c128, CHECKRi);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_indir.c b/test/get_indir.c
new file mode 100644
index 0000000..c9d7032
--- /dev/null
+++ b/test/get_indir.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int32_t c[8];
+  int32_t val[8] = {23, 33, 14, 24, 34, 0, 0, 0};
+  int i, n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "indir INDIR data carray\n"
+    "carray CARRAY INT32 10 20 30 11 21 31 12 22 32 13 23 33 14 24 34\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, (i + 2), 256);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "indir", 1, 0, 1, 0, GD_INT32, &c);
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], val[i]);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_indir_typein.c b/test/get_indir_typein.c
new file mode 100644
index 0000000..eb23c33
--- /dev/null
+++ b/test/get_indir_typein.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int32_t c[8];
+  int e1, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "indir INDIR data carray\n"
+    "carray CONST INT32 10\n"
+    "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, int32_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_getdata(D, "indir", 1, 0, 1, 0, GD_INT32, &c);
+  CHECKU(n, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_int16.c b/test/get_int16.c
index cbedea7..a760a9e 100644
--- a/test/get_int16.c
+++ b/test/get_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT16 */
 #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 INT16 8\n";
   int16_t c[8];
-  int16_t data_data[64];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 64; ++fd)
-    data_data[fd] = (int16_t)(fd * (0x0201) * (2 * (fd % 2) - 1));
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 64 * sizeof(int16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
+  MAKEDATAFILE(data, int16_t, (i * (0x0201) * (2 * (i % 2) - 1)), 64);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/get_int32.c b/test/get_int32.c
index 422f3fe..002bac9 100644
--- a/test/get_int32.c
+++ b/test/get_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT32 */
 #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 INT32 8\n";
   int32_t c[8];
-  int32_t data_data[64];
-  int fd, i, n, error, r = 0;
+  int 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 * (0x02000001) * (2 * (fd % 2) - 1);
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 64 * sizeof(int32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
+  MAKEDATAFILE(data, int32_t, i * (0x02000001) * (2 * (i % 2) - 1), 64);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/get_int64.c b/test/get_int64.c
index 72cb029..060d23d 100644
--- a/test/get_int64.c
+++ b/test/get_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read INT64 */
 #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 INT64 8\n";
   int64_t c[8];
-  int64_t data_data[64];
-  int fd, i, n, error, r = 0;
+  int 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 * (0x0200000000000001) * (2 * (fd % 2) - 1);
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 64 * sizeof(int64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
+  MAKEDATAFILE(data, int64_t, i * (0x0200000000000001) * (2 * (i % 2) - 1), 64);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/get_int8.c b/test/get_int8.c
index aee4ecc..1394fdf 100644
--- a/test/get_int8.c
+++ b/test/get_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* Attempt to read INT8 */
 #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 INT8 8\n";
   signed char c[8];
-  signed char data_data[128];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = (signed char)(fd * (2 * (fd % 2) - 1));
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 128);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
+  MAKEDATAFILE(data, signed char, (i * (2 * (i % 2) - 1)), 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/get_lincom1.c b/test/get_lincom1.c
index 210e968..e369356 100644
--- a/test/get_lincom1.c
+++ b/test/get_lincom1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* Attempt to read LINCOM1 */
 #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 1 data 2 3\ndata RAW UINT8 1\n";
   unsigned char c = 0;
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 1 data 2 3\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_lincom2.c b/test/get_lincom2.c
index 5fdb517..adf00fe 100644
--- a/test/get_lincom2.c
+++ b/test/get_lincom2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* 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 *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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 2 data 2 3 data 1 0\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_lincom2s.c b/test/get_lincom2s.c
index 8fd5328..d72da32 100644
--- a/test/get_lincom2s.c
+++ b/test/get_lincom2s.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,23 @@
  */
 #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 data 1 0 phase 1 0\n"
-    "phase PHASE data 128\n"
-    "data RAW UINT8 1\n";
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "lincom LINCOM data 1 0 phase 1 0\n"
+    "phase PHASE data 128\n"
+    "data RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "lincom", 0, 0, 1000, 0, GD_NULL, NULL);
diff --git a/test/get_lincom3.c b/test/get_lincom3.c
index d7d07f1..f620573 100644
--- a/test/get_lincom3.c
+++ b/test/get_lincom3.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* 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 *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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 3 data 2 3 data 1 0 data 10 4\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_lincom3s.c b/test/get_lincom3s.c
index b929a6f..c47195e 100644
--- a/test/get_lincom3s.c
+++ b/test/get_lincom3s.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,23 @@
  */
 #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 data 1 0 data 1 0 phase 1 0\n"
-    "phase PHASE data 128\n"
-    "data RAW UINT8 1\n";
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "lincom LINCOM data 1 0 data 1 0 phase 1 0\n"
+    "phase PHASE data 128\n"
+    "data RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "lincom", 0, 0, 1000, 0, GD_NULL, NULL);
diff --git a/test/get_lincom_code.c b/test/get_lincom_code.c
new file mode 100644
index 0000000..666dc63
--- /dev/null
+++ b/test/get_lincom_code.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  uint8_t c = 0;
+  int e1, e2, e3, r = 0;
+  size_t n1, n2, n3;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 1\n"
+      "lincom1 LINCOM missing 0;1 0 data 1 0 INDEX 1 0\n"
+      "lincom2 LINCOM INDEX 0;1 0 missing 1 0 data 1 0\n"
+      "lincom3 LINCOM data 0;1 0 INDEX 1 0 missing 1 0\n"
+      );
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  n1 = gd_getdata(D, "lincom1", 5, 0, 1, 0, GD_UINT8, &c);
+  CHECKU(n1, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  n2 = gd_getdata(D, "lincom2", 5, 0, 1, 0, GD_UINT8, &c);
+  CHECKU(n2, 0);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  n3 = gd_getdata(D, "lincom3", 5, 0, 1, 0, GD_UINT8, &c);
+  CHECKU(n3, 0);
+  e3 = gd_error(D);
+  CHECKI(e3, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_lincom_mdt.c b/test/get_lincom_mdt.c
index e4d61d0..2112239 100644
--- a/test/get_lincom_mdt.c
+++ b/test/get_lincom_mdt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,37 +20,20 @@
  */
 #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 1 data 1 0\ndata RAW UINT8 1\n";
   unsigned char c = 0;
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 1 data 1 0\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_lincom_noin.c b/test/get_lincom_noin.c
index dfb21a4..d391d5b 100644
--- a/test/get_lincom_noin.c
+++ b/test/get_lincom_noin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* Attempt to read LINCOM1 */
 #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 = "lincom LINCOM 1 data 2 3\n";
   unsigned char c = 0;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 1 data 2 3\n");
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_lincom_non.c b/test/get_lincom_non.c
index 0e7670e..3d3b389 100644
--- a/test/get_lincom_non.c
+++ b/test/get_lincom_non.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* 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 *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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM data 2 3 data 1 0\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_lincom_null.c b/test/get_lincom_null.c
index 1fdc92c..1bc3dac 100644
--- a/test/get_lincom_null.c
+++ b/test/get_lincom_null.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,36 +20,19 @@
  */
 #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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 2 data 2 3 data 1 0\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "lincom", 5, 0, 10, 0, GD_NULL, NULL);
diff --git a/test/get_lincom_spf.c b/test/get_lincom_spf.c
index be4a211..0412a00 100644
--- a/test/get_lincom_spf.c
+++ b/test/get_lincom_spf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,49 +18,30 @@
  * 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;
+  int 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "lincom LINCOM 2 data 2 3 cata 1 0\n"
+    "data RAW UINT8 2\n"
+    "cata RAW UINT8 3\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  MAKEDATAFILE(cata, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "lincom", 5, 0, 5, 0, GD_UINT8, &c);
diff --git a/test/get_linterp.c b/test/get_linterp.c
index a1e2a9c..6e15a41 100644
--- a/test/get_linterp.c
+++ b/test/get_linterp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,22 @@
 /* Attempt to read LINTERP */
 #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 *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;
+  int i, n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 64; ++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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 64);
-  close(fd);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 64);
 
   t = fopen(table, "wt");
   for (i = 0; i < 2 * GD_LUT_CHUNK; ++i)
diff --git a/test/get_linterp1.c b/test/get_linterp1.c
index 1f53501..a304961 100644
--- a/test/get_linterp1.c
+++ b/test/get_linterp1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,40 +20,22 @@
  */
 #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 *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;
+  int n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 64; ++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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 64);
-  close(fd);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 64);
 
   t = fopen(table, "wt");
   fputs("0 0\n", t);
diff --git a/test/get_linterp_abs.c b/test/get_linterp_abs.c
index 62083b2..caa28e1 100644
--- a/test/get_linterp_abs.c
+++ b/test/get_linterp_abs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -23,14 +23,6 @@
  * garbage collection in _GD_ReleaseDir */
 #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)
 {
 #if defined GD_NO_GETCWD
@@ -44,7 +36,6 @@ int main(void)
   const char *format_data1 = "linterp LINTERP data ";
   const char *format_data2 = "/dirfile/lut/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;
@@ -52,8 +43,8 @@ int main(void)
   char *ptr, *cwd = NULL;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  mkdir(lutdir, 0777);
+  mkdir(filedir, 0700);
+  mkdir(lutdir, 0700);
 
   gdtest_getcwd(ptr, cwd, cwd_size);
 
@@ -63,12 +54,7 @@ int main(void)
   write(fd, format_data2, strlen(format_data2));
   close(fd);
 
-  for (fd = 0; fd < 64; ++fd)
-    data_data[fd] = (unsigned char)fd;
-
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 64);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 64);
 
   t = fopen(table, "wt");
   for (i = 0; i < 30; ++i)
diff --git a/test/get_linterp_complex.c b/test/get_linterp_complex.c
index da7dbc7..78207ca 100644
--- a/test/get_linterp_complex.c
+++ b/test/get_linterp_complex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,40 +20,22 @@
  */
 #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 *table = "dirfile/table";
-  const char *format_data = "linterp LINTERP data ./table\ndata RAW UINT8 1\n";
   double c[2];
-  unsigned char data_data[64];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 64; ++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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 64);
-  close(fd);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 64);
 
   t = fopen(table, "wt");
   for (i = 0; i < 10; ++i)
diff --git a/test/get_linterp_empty.c b/test/get_linterp_empty.c
index 56ab6f9..bccf6dd 100644
--- a/test/get_linterp_empty.c
+++ b/test/get_linterp_empty.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,42 +20,25 @@
  */
 #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 *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, n1, error1, n2, error2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 64; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\ndata RAW UINT8 1\n");
 
   fd = open(table, O_CREAT | O_EXCL | O_WRONLY, 0666);
   close(fd);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 64);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 64);
 
   D = gd_open(filedir, GD_RDONLY);
   n1 = gd_getdata(D, "linterp", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_linterp_nodir.c b/test/get_linterp_nodir.c
index 706bb0b..3ba02db 100644
--- a/test/get_linterp_nodir.c
+++ b/test/get_linterp_nodir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 D. V. Wiebe
+/* Copyright (C) 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,26 +26,17 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *table = "dirfile/table";
-  const char *format_data =
-    "linterp LINTERP data ./somewhere/table\n"
-    "data RAW UINT8 1\n";
-  unsigned char data_data[64];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 64; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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, 64);
-  close(fd);
+  MAKEFORMATFILE(format,
+    "linterp LINTERP data ./somewhere/table\n"
+    "data RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 64);
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "linterp", 5, 0, 1, 0, GD_NULL, NULL);
diff --git a/test/get_linterp_noin.c b/test/get_linterp_noin.c
index 2a1f842..726b96d 100644
--- a/test/get_linterp_noin.c
+++ b/test/get_linterp_noin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,31 +21,20 @@
 /* Attempt to read LINTERP */
 #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 *table = "dirfile/table";
-  const char *format_data = "linterp LINTERP data ./table\n";
   unsigned char c = 0;
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\n");
 
   t = fopen(table, "wt");
   for (i = 0; i < 10; ++i)
diff --git a/test/get_linterp_notab.c b/test/get_linterp_notab.c
index 2059787..2b319d9 100644
--- a/test/get_linterp_notab.c
+++ b/test/get_linterp_notab.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* Attempt to read LINTERP */
 #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 = "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;
+  int n1, error1, n2, error2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 64; ++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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 64);
-  close(fd);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 64);
 
   D = gd_open(filedir, GD_RDONLY);
   n1 = gd_getdata(D, "linterp", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_linterp_sort.c b/test/get_linterp_sort.c
index 573ea24..b450103 100644
--- a/test/get_linterp_sort.c
+++ b/test/get_linterp_sort.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,22 @@
 /* Attempt to read LINTERP */
 #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 *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;
+  int n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 64; ++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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 64);
-  close(fd);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 64);
 
   t = fopen(table, "wt");
   fprintf(t, "%s", "100 600\n2 4\n50 100\n0 0\n7 14\n");
diff --git a/test/get_mplex.c b/test/get_mplex.c
index 91ea4f3..e0f4025 100644
--- a/test/get_mplex.c
+++ b/test/get_mplex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,35 +26,20 @@ int main(void)
   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;
+  int 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "mplex MPLEX data count 1 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  MAKEDATAFILE(count, unsigned char, i % 3, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "mplex", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_mplex_bof.c b/test/get_mplex_bof.c
index bf90d0e..87ac76a 100644
--- a/test/get_mplex_bof.c
+++ b/test/get_mplex_bof.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,35 +26,20 @@ int main(void)
   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;
+  int 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "mplex MPLEX data count 2 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  MAKEDATAFILE(count, unsigned char, i % 3, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "mplex", 0, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_mplex_complex.c b/test/get_mplex_complex.c
index 083b174..fb5bb11 100644
--- a/test/get_mplex_complex.c
+++ b/test/get_mplex_complex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,10 +26,6 @@ int main(void)
   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 COMPLEX128 8\n";
   double c[16];
   unsigned char count_data[256];
   double data_data[512];
@@ -37,11 +33,13 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "mplex MPLEX data count 1 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW COMPLEX128 8\n"
+  );
 
   for (fd = 0; fd < 256; ++fd) {
     count_data[fd] = (unsigned char)(fd % 3);
diff --git a/test/get_mplex_lb.c b/test/get_mplex_lb.c
index ddffcfc..4d8a378 100644
--- a/test/get_mplex_lb.c
+++ b/test/get_mplex_lb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,35 +26,20 @@ int main(void)
   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;
+  int 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "mplex MPLEX data count 2 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  MAKEDATAFILE(count, unsigned char, i % 3, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "mplex", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_mplex_lball.c b/test/get_mplex_lball.c
index e821079..c3c7e24 100644
--- a/test/get_mplex_lball.c
+++ b/test/get_mplex_lball.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,37 +26,20 @@ int main(void)
   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;
+  int 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "mplex MPLEX data count 7 8\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i ? i : 111, 256);
+  MAKEDATAFILE(count, unsigned char, i ? i % 3 : 7, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   gd_mplex_lookback(D, GD_LOOKBACK_ALL);
diff --git a/test/get_mplex_nolb.c b/test/get_mplex_nolb.c
index 68f2129..014fb5d 100644
--- a/test/get_mplex_nolb.c
+++ b/test/get_mplex_nolb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,35 +26,20 @@ int main(void)
   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;
+  int 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "mplex MPLEX data count 2 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  MAKEDATAFILE(count, unsigned char, i % 3, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   gd_mplex_lookback(D, 0);
diff --git a/test/get_mplex_s.c b/test/get_mplex_s.c
index a7a23d7..a18a52d 100644
--- a/test/get_mplex_s.c
+++ b/test/get_mplex_s.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,31 +26,19 @@ int main(void)
   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 data_data[256];
-  int fd, n, error, r = 0;
+  int 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);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
-
-  fd = open(count, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 128);
-  close(fd);
+  MAKEFORMATFILE(format,
+    "mplex MPLEX data count 1 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  MAKEDATAFILE(count, unsigned char, i, 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "mplex", 0, 0, 0, 256, GD_NULL, NULL);
diff --git a/test/get_mplex_saved.c b/test/get_mplex_saved.c
index 9ce8d98..293ba92 100644
--- a/test/get_mplex_saved.c
+++ b/test/get_mplex_saved.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,35 +26,20 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
   const char *count = "dirfile/count";
-  const char *format_data =
-    "mplex MPLEX data count 0 3\n"
-    "count RAW UINT8 8\n"
-    "data RAW UINT8 8\n";
   unsigned char c[8], d[8];
-  unsigned char data_data[256];
-  int fd, n1, n2, i, e1, e2, r = 0;
+  int n1, n2, 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "mplex MPLEX data count 0 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  MAKEDATAFILE(count, unsigned char, i % 3, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n1 = gd_getdata(D, "mplex", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_multiply.c b/test/get_multiply.c
index bd1ad8c..c04083a 100644
--- a/test/get_multiply.c
+++ b/test/get_multiply.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* Attempt to read MULTIPLY */
 #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 = "mult MULTIPLY data data\ndata RAW UINT8 1\n";
   unsigned char c = 0;
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "mult MULTIPLY data data\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "mult", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_multiply_ccin.c b/test/get_multiply_ccin.c
index 1aa268e..f82d2c9 100644
--- a/test/get_multiply_ccin.c
+++ b/test/get_multiply_ccin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,25 @@
 /* Attempt to read MULTIPLY */
 #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 = "mult MULTIPLY data data\ndata RAW COMPLEX128 1\n";
   double c[16];
   double data_data[512];
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 256; ++i) {
     data_data[i * 2] = (double)i;
     data_data[i * 2 + 1] = (double)i / 256.;
   }
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format, "mult MULTIPLY data data\ndata RAW COMPLEX128 1\n");
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, data_data, 512 * sizeof(double));
diff --git a/test/get_multiply_code.c b/test/get_multiply_code.c
new file mode 100644
index 0000000..7c53cb7
--- /dev/null
+++ b/test/get_multiply_code.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double c[16];
+  int e1, e2, r = 0;
+  size_t n1, n2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "mult1 MULTIPLY data missing\n"
+      "mult2 MULTIPLY missing data\n"
+      "data RAW COMPLEX128 1\n"
+      );
+  MAKEDATAFILE(data, double, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n1 = gd_getdata(D, "mult1", 5, 0, 1, 0, GD_COMPLEX128, c);
+  CHECKU(n1, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  n2 = gd_getdata(D, "mult2", 5, 0, 1, 0, GD_COMPLEX128, c);
+  CHECKU(n2, 0);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_multiply_crin.c b/test/get_multiply_crin.c
index 8252fec..29ab6a4 100644
--- a/test/get_multiply_crin.c
+++ b/test/get_multiply_crin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,25 @@
 /* Attempt to read MULTIPLY */
 #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 = "mult MULTIPLY data INDEX\ndata RAW COMPLEX128 1\n";
   double c[16];
   double data_data[512];
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 256; ++i) {
     data_data[i * 2] = (double)i;
     data_data[i * 2 + 1] = (double)i / 256.;
   }
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format, "mult MULTIPLY data INDEX\ndata RAW COMPLEX128 1\n");
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, data_data, 512 * sizeof(double));
diff --git a/test/get_multiply_crinr.c b/test/get_multiply_crinr.c
index ec5c706..c519e6b 100644
--- a/test/get_multiply_crinr.c
+++ b/test/get_multiply_crinr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,25 @@
 /* Attempt to read MULTIPLY */
 #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 = "mult MULTIPLY data INDEX\ndata RAW COMPLEX128 1\n";
   double c[8];
   double data_data[512];
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 256; ++i) {
     data_data[i * 2] = (double)i;
     data_data[i * 2 + 1] = (double)i / 256.;
   }
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format, "mult MULTIPLY data INDEX\ndata RAW COMPLEX128 1\n");
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, data_data, 512 * sizeof(double));
diff --git a/test/get_multiply_noin.c b/test/get_multiply_noin.c
index 4e464c9..672fb42 100644
--- a/test/get_multiply_noin.c
+++ b/test/get_multiply_noin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* Attempt to read MULTIPLY */
 #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 = "mult MULTIPLY data data\n";
   unsigned char c = 0;
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "mult MULTIPLY data data\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "mult", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_multiply_rcin.c b/test/get_multiply_rcin.c
index be49d1a..c78b44f 100644
--- a/test/get_multiply_rcin.c
+++ b/test/get_multiply_rcin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,25 @@
 /* Attempt to read MULTIPLY */
 #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 = "mult MULTIPLY INDEX data\ndata RAW COMPLEX128 1\n";
   double c[16];
   double data_data[512];
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 256; ++i) {
     data_data[i * 2] = (double)i;
     data_data[i * 2 + 1] = (double)i / 256.;
   }
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format, "mult MULTIPLY INDEX data\ndata RAW COMPLEX128 1\n");
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, data_data, 512 * sizeof(double));
diff --git a/test/get_multiply_s.c b/test/get_multiply_s.c
index 9e2c914..ce15ea2 100644
--- a/test/get_multiply_s.c
+++ b/test/get_multiply_s.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,23 @@
  */
 #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 =
-    "mult MULTIPLY data phase\n"
-    "phase PHASE data 128\n"
-    "data RAW UINT8 1\n";
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "mult MULTIPLY data phase\n"
+    "phase PHASE data 128\n"
+    "data RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "mult", 0, 0, 1000, 0, GD_NULL, NULL);
diff --git a/test/get_neg.c b/test/get_neg.c
index cfe2bc4..d47b202 100644
--- a/test/get_neg.c
+++ b/test/get_neg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 *format_data = "data RAW UINT8 8\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "data", -5, 0, 1, 0, GD_NULL, NULL);
diff --git a/test/get_none.c b/test/get_none.c
index 7b82032..9a241ff 100644
--- a/test/get_none.c
+++ b/test/get_none.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,36 +20,19 @@
  */
 #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, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 0, 0, GD_UINT8, NULL);
diff --git a/test/get_nonexistent.c b/test/get_nonexistent.c
index c47b354..3c5f176 100644
--- a/test/get_nonexistent.c
+++ b/test/get_nonexistent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,19 @@
 /* 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 *format_data = "data RAW UINT8 1\n";
   unsigned char c[8];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/get_null.c b/test/get_null.c
index 675a765..674a537 100644
--- a/test/get_null.c
+++ b/test/get_null.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,36 +21,19 @@
 /* Attempt to read returning GD_NULL */
 #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, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_NULL, NULL);
diff --git a/test/get_off64.c b/test/get_off64.c
index 433eecf..b1412a0 100644
--- a/test/get_off64.c
+++ b/test/get_off64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -27,13 +27,6 @@
 
 #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)
 {
 #ifdef SKIP_TEST
@@ -42,26 +35,16 @@ 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, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/get_phase.c b/test/get_phase.c
index 602e237..dbe05b3 100644
--- a/test/get_phase.c
+++ b/test/get_phase.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* Attempt to read PHASE */
 #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 = "phase PHASE data -2\ndata RAW UINT8 1\n";
   unsigned char c = 0;
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "phase PHASE data -2\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "phase", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_phase_affix.c b/test/get_phase_affix.c
index c171f6a..c9b8bf4 100644
--- a/test/get_phase_affix.c
+++ b/test/get_phase_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,33 +26,20 @@ int main(void)
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "/INCLUDE format1 pre post\n");
+  MAKEFORMATFILE(format1,
+    "shift CONST INT32 -2\n"
+    "phase PHASE data shift\n"
+    "data RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "prephasepost", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_polynom.c b/test/get_polynom.c
index 48688cb..c6431e2 100644
--- a/test/get_polynom.c
+++ b/test/get_polynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* Attempt to read POLYNOM */
 #include "test.h"
 
-#include <stdio.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 = "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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "polynom POLYNOM data 3 2 1\ndata RAW UINT8 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "polynom", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_polynom_cmpin.c b/test/get_polynom_cmpin.c
index ac38bf2..66c44f2 100644
--- a/test/get_polynom_cmpin.c
+++ b/test/get_polynom_cmpin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,22 +20,11 @@
  */
 #include "test.h"
 
-#include <stdio.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 =
-    "polynom POLYNOM data 3 2 1\n"
-    "data RAW COMPLEX128 1\n";
   double c[16];
   double data_data[512];
   int i, fd, n, error, r = 0;
@@ -43,16 +32,17 @@ int main(void)
 
   memset(c, 0, sizeof(double) * 16);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (fd = 0; fd < 256; ++fd) {
     data_data[2 * fd] = (double)fd;
     data_data[2 * fd + 1] = fd / 256.;
   }
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "polynom POLYNOM data 3 2 1\n"
+    "data RAW COMPLEX128 1\n"
+  );
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 512 * sizeof(double));
diff --git a/test/get_polynom_noin.c b/test/get_polynom_noin.c
index bb4f9f0..64f0b6a 100644
--- a/test/get_polynom_noin.c
+++ b/test/get_polynom_noin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* Attempt to read POLYNOM */
 #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 = "polynom POLYNOM data 2 3\n";
   unsigned char c = 0;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "polynom POLYNOM data 2 3\n");
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_range.c b/test/get_range.c
index 4ecc5c0..892096a 100644
--- a/test/get_range.c
+++ b/test/get_range.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,24 +25,14 @@ 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, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata64(D, "data", GD_INT64_MAX, GD_INT64_MAX, 1, 0, GD_NULL, NULL);
diff --git a/test/get_recip.c b/test/get_recip.c
index bb2c72e..f91251d 100644
--- a/test/get_recip.c
+++ b/test/get_recip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,23 @@
 /* Attempt to read DIVIDE */
 #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 =
-    "div RECIP data 2.\n"
-    "data RAW UINT8 1\n";
   double c = 0;
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)(fd + 2);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "div RECIP data 2.\n"
+    "data RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, (i + 2), 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "div", 5, 0, 1, 0, GD_FLOAT64, &c);
diff --git a/test/get_recip_cmpin.c b/test/get_recip_cmpin.c
new file mode 100644
index 0000000..e2ee105
--- /dev/null
+++ b/test/get_recip_cmpin.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double d1[2], d2[2];
+  int r = 0;
+  size_t n1, n2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "div RECIP data 2.\n"
+    "cdiv RECIP data 3;4\n"
+    "data RAW COMPLEX128 1\n");
+
+  MAKEDATAFILE(data, double, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n1 = gd_getdata(D, "div", 5, 0, 1, 0, GD_COMPLEX128, d1);
+  CHECKU(n1, 1);
+
+  /* a / (c + id) = ac / (cc + dd) - i ad / (cc + dd) */
+  CHECKF(d1[0], 2 * 10. / (10. * 10 + 11. * 11));
+  CHECKF(d1[1], -2 * 11. / (10. * 10 + 11. * 11));
+
+  n2 = gd_getdata(D, "cdiv", 10, 0, 1, 0, GD_COMPLEX128, d2);
+  CHECKU(n2, 1);
+
+  /* (a + ib) / (c + id) = (ac - bd) / (cc + dd) + i (bc - ad) / (cc + dd) */
+  CHECKF(d2[0], (3 * 20. + 4 * 21.) / (20. * 20 + 21. * 21));
+  CHECKF(d2[1], (4 * 20. - 3 * 21.) / (20. * 20 + 21. * 21));
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_recip_const.c b/test/get_recip_const.c
index 6bcc45a..beb6922 100644
--- a/test/get_recip_const.c
+++ b/test/get_recip_const.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,24 @@
 /* Attempt to read DIVIDE */
 #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 =
-    "div RECIP data const\n"
-    "const CONST FLOAT64 2.\n"
-    "data RAW UINT8 1\n";
   double c = 0;
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)(fd + 2);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "div RECIP data const\n"
+    "const CONST FLOAT64 2.\n"
+    "data RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, (i + 2), 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "div", 5, 0, 1, 0, GD_FLOAT64, &c);
diff --git a/test/get_recurse.c b/test/get_recurse.c
index 77d576f..8329fb1 100644
--- a/test/get_recurse.c
+++ b/test/get_recurse.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,21 @@
 /* Attempting to resove a recursively defined field should fail 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 *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;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "in1 RAW UINT8 11\n"
+    "lincom LINCOM 2 lincom 1 0 in1 1 0\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/get_reprz.c b/test/get_reprz.c
new file mode 100644
index 0000000..7102d21
--- /dev/null
+++ b/test/get_reprz.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *code = "dirfile/code";
+  int e1, e2, e3, e4, r1, r2, r3, r4, r = 0;
+  double c1[2], c2[2], c3[2], c4[2];
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "code RAW COMPLEX128 1\n"
+      "code.r PHASE code 10\n"
+      "more.r PHASE code 20\n"
+      );
+  MAKEDATAFILE(code, double, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  /* Real part of "code" */
+  r1 = gd_getdata(D, "code.r", 0, 2, 0, 1, GD_COMPLEX128, c1);
+  e1 = gd_error(D);
+  CHECKU(r1, 1);
+  CHECKI(e1, 0);
+  CHECKF(c1[0], 4);
+  CHECKF(c1[1], 0);
+
+  /* All of code.r */
+  r2 = gd_getdata(D, "code.r.z", 0, 2, 0, 1, GD_COMPLEX128, c2);
+  e2 = gd_error(D);
+  CHECKU(r2, 1);
+  CHECKI(e2, 0);
+  CHECKF(c2[0], 24);
+  CHECKF(c2[1], 25);
+
+  /* Real part of code.r */
+  r3 = gd_getdata(D, "code.r.r", 0, 2, 0, 1, GD_COMPLEX128, c3);
+  e3 = gd_error(D);
+  CHECKU(r3, 1);
+  CHECKI(e3, 0);
+  CHECKF(c3[0], 24);
+  CHECKF(c3[1], 0);
+
+  /* All of more.r */
+  r4 = gd_getdata(D, "more.r", 0, 2, 0, 1, GD_COMPLEX128, c4);
+  e4 = gd_error(D);
+  CHECKU(r4, 1);
+  CHECKI(e4, 0);
+  CHECKF(c4[0], 44);
+  CHECKF(c4[1], 45);
+
+  gd_discard(D);
+
+  unlink(code);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_rofs.c b/test/get_rofs.c
index b544d2b..35eb80c 100644
--- a/test/get_rofs.c
+++ b/test/get_rofs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
-  chmod(data, 0555);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  chmod(data, 0500);
 
   /* ensure filesystem honours read-onlyness */
   if ((fd = open(data, O_RDWR)) >= 0 || errno != EACCES) {
diff --git a/test/get_sarray.c b/test/get_sarray.c
new file mode 100644
index 0000000..324f5a6
--- /dev/null
+++ b/test/get_sarray.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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[13];
+  int i, n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  memset(data, 0, sizeof(data));
+
+  MAKEFORMATFILE(format, "sarray SARRAY a b c d e f g h i j k l m\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_get_sarray(D, "sarray", data);
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKI(n, 0);
+  for (i = 0; i < 13; ++i) {
+    CHECKPNi(i, data[i]);
+    CHECKXi(i, data[i][0], 'a' + i);
+    CHECKXi(i, data[i][1], 0);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sarray_bad.c b/test/get_sarray_bad.c
new file mode 100644
index 0000000..8d742ea
--- /dev/null
+++ b/test/get_sarray_bad.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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[13];
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_get_sarray(D, "sarray", data);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sarray_slice.c b/test/get_sarray_slice.c
new file mode 100644
index 0000000..5936377
--- /dev/null
+++ b/test/get_sarray_slice.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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[5];
+  int i, n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  memset(data, 0, sizeof(data));
+
+  MAKEFORMATFILE(format, "sarray SARRAY a b c d e f g h i j k l m\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_get_sarray_slice(D, "sarray", 4, 5, data);
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKI(n, 0);
+  for (i = 0; i < 5; ++i) {
+    CHECKPNi(i, data[i]);
+    CHECKXi(i, data[i][0], 'e' + i);
+    CHECKXi(i, data[i][1], 0);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sarray_slice_bounds.c b/test/get_sarray_slice_bounds.c
new file mode 100644
index 0000000..ceedf0f
--- /dev/null
+++ b/test/get_sarray_slice_bounds.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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[5];
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray SARRAY 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_get_sarray_slice(D, "sarray", 4, 50, data);
+  CHECKI(e1, GD_E_BOUNDS);
+
+  e2 = gd_get_sarray_slice(D, "sarray", 40, 5, data);
+  CHECKI(e2, GD_E_BOUNDS);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sarray_slice_type.c b/test/get_sarray_slice_type.c
new file mode 100644
index 0000000..60256ce
--- /dev/null
+++ b/test/get_sarray_slice_type.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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[13];
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_get_sarray_slice(D, "carray", 0, 13, data);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sarray_type.c b/test/get_sarray_type.c
new file mode 100644
index 0000000..a58f6bf
--- /dev/null
+++ b/test/get_sarray_type.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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[13];
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_get_sarray(D, "carray", data);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sbit.c b/test/get_sbit.c
index e047b52..fdb02a8 100644
--- a/test/get_sbit.c
+++ b/test/get_sbit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,20 @@
 /* Attempt to read SBIT */
 #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";
-  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)
-    data_data[fd] = 0x0101 * (uint16_t)fd;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "bit SBIT data 7 4\ndata RAW UINT16 1\n");
+  MAKEDATAFILE(data, uint16_t, 0x0101 * (uint16_t)i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "bit", 5, 0, 10, 0, GD_INT16, c);
diff --git a/test/get_sf.c b/test/get_sf.c
index f4554fb..dd63adc 100644
--- a/test/get_sf.c
+++ b/test/get_sf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* 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, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 0, 40, 1, 0, GD_UINT8, c);
diff --git a/test/get_sindir.c b/test/get_sindir.c
new file mode 100644
index 0000000..ce063ee
--- /dev/null
+++ b/test/get_sindir.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *c[8];
+  int i, n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "sindir SINDIR data sarray\n"
+    "sarray SARRAY a b c d e f g h i j k l m n o\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, (i + 2), 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_getdata(D, "sindir", 1, 0, 1, 0, GD_STRING, c);
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i) {
+    if (i < 5) {
+      CHECKPNi(i, c[i]);
+      CHECKXi(i, c[i][0], 'k' + i);
+    } else {
+      CHECKPi(i, c[i]);
+    }
+  }
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sindir_code.c b/test/get_sindir_code.c
new file mode 100644
index 0000000..f2abf94
--- /dev/null
+++ b/test/get_sindir_code.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *c[8];
+  int e1, e2, r = 0;
+  size_t n1, n2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "sindir1 SINDIR missing sarray\n"
+    "sindir2 SINDIR data missing\n"
+    "sarray SARRAY a b c d e f g h i j k l m n o\n"
+    "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n1 = gd_getdata(D, "sindir1", 0, 1, 0, 1, GD_STRING, c);
+  CHECKU(n1, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  n2 = gd_getdata(D, "sindir2", 0, 1, 0, 1, GD_STRING, c);
+  CHECKU(n2, 0);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sindir_neg.c b/test/get_sindir_neg.c
new file mode 100644
index 0000000..e4bc4dd
--- /dev/null
+++ b/test/get_sindir_neg.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *c[8];
+  int e1, r = 0;
+  size_t n1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "sindir SINDIR data sarray\n"
+    "sarray SARRAY a b c d e f g h i j k l m n o\n"
+    "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n1 = gd_getdata(D, "sindir", 0, -10, 0, 1, GD_STRING, c);
+  CHECKU(n1, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_RANGE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sindir_none.c b/test/get_sindir_none.c
new file mode 100644
index 0000000..c4a9e87
--- /dev/null
+++ b/test/get_sindir_none.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "sindir SINDIR data sarray\n"
+    "sarray SARRAY a b c d e f g h i j k l m n o\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, (i + 2), 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_getdata(D, "sindir", 1, 0, 0, 0, GD_STRING, NULL);
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKI(n, 0);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sindir_null.c b/test/get_sindir_null.c
new file mode 100644
index 0000000..3d2badb
--- /dev/null
+++ b/test/get_sindir_null.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "sindir SINDIR data sarray\n"
+    "sarray SARRAY a b c d e f g h i j k l m n o\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, (i + 2), 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_getdata(D, "sindir", 1, 0, 1, 0, GD_NULL, NULL);
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sindir_reprz.c b/test/get_sindir_reprz.c
new file mode 100644
index 0000000..cbdf9be
--- /dev/null
+++ b/test/get_sindir_reprz.c
@@ -0,0 +1,85 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *dati[8], *datz[8], *datzz[8];
+  int i, e1, e2, e3, r = 0;
+  size_t n1, n2, n3;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  /* Because representation .i is not allowed on SARRAYs, "sarray.i" here ends
+   * up being interpreted as the field called "i" in the namespace "sarray".
+   * "sarray.z", however, is interpreted as the field "sarray" with the
+   * do-nothing representation suffix ".z".  So, to get the field "z" in the
+   * "sarray" namespace, we must write it as "sarray.z.z".  Craziness.
+   */
+  MAKEFORMATFILE(format,
+    "sindir+i  SINDIR data sarray.i\n"
+    "sindir+z  SINDIR data sarray.z\n"
+    "sindir+zz SINDIR data sarray.z.z\n"
+    "sarray   SARRAY a b c d e f g h i j k l m\n"
+    "sarray.i SARRAY A B C D E F G H I J K L M\n"
+    "sarray.z SARRAY 0 1 2 3 4 5 6 7 8 9 : ; <\n"
+    "data RAW UINT8 8\n");
+
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n1 = gd_getdata(D, "sindir+i", 0, 0, 1, 0, GD_STRING, dati);
+  CHECKU(n1, 8);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  for (i = 0; i < 8; ++i)
+    CHECKXi(i, dati[i][0], 'A' + i);
+
+  n2 = gd_getdata(D, "sindir+z", 0, 0, 1, 0, GD_STRING, datz);
+  CHECKU(n2, 8);
+  e2 = gd_error(D);
+  CHECKI(e2, 0);
+
+  for (i = 0; i < 8; ++i)
+    CHECKXi(i, datz[i][0], 'a' + i);
+
+  n3 = gd_getdata(D, "sindir+zz", 0, 0, 1, 0, GD_STRING, datzz);
+  CHECKU(n3, 8);
+  e3 = gd_error(D);
+  CHECKI(e3, 0);
+
+  for (i = 0; i < 8; ++i)
+    CHECKXi(i, datzz[i][0], '0' + i);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sindir_type.c b/test/get_sindir_type.c
new file mode 100644
index 0000000..c110527
--- /dev/null
+++ b/test/get_sindir_type.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *c[8];
+  int n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "sindir SINDIR data sarray\n"
+    "sarray SARRAY a b c d e f g h i j k l m n o\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, (i + 2), 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_getdata(D, "sindir", 1, 0, 1, 0, GD_INT64, c);
+  error = gd_error(D);
+
+  CHECKI(error, GD_E_BAD_TYPE);
+  CHECKI(n, 0);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_sindir_typein.c b/test/get_sindir_typein.c
new file mode 100644
index 0000000..cdb2b7d
--- /dev/null
+++ b/test/get_sindir_typein.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *c[8];
+  int e1, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "sindir SINDIR data sarray\n"
+    "sarray STRING a\n"
+    "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_getdata(D, "sindir", 1, 0, 1, 0, GD_STRING, c);
+  CHECKU(n, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/get_ss.c b/test/get_ss.c
index 8670825..940c8ee 100644
--- a/test/get_ss.c
+++ b/test/get_ss.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* 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, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 0, 40, 0, 8, GD_UINT8, c);
diff --git a/test/get_string.c b/test/get_string.c
index 2b33715..383e3be 100644
--- a/test/get_string.c
+++ b/test/get_string.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2014, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,29 +20,18 @@
  */
 #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 = "string STRING String\\ data\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   char s[1000];
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "string STRING String\\ data\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_get_string(D, "string", 1000, s);
diff --git a/test/get_type.c b/test/get_type.c
index cb61fb4..e640838 100644
--- a/test/get_type.c
+++ b/test/get_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* 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, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UNKNOWN, c);
diff --git a/test/get_uint16.c b/test/get_uint16.c
index 10fd094..7077855 100644
--- a/test/get_uint16.c
+++ b/test/get_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read UINT16 */
 #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 UINT16 8\n";
   uint16_t c[8], i;
-  uint16_t data_data[128];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = (uint16_t)(fd * (0x0201));
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 128 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, (i * (0x0201)), 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/get_uint32.c b/test/get_uint32.c
index 12e23ae..50c12cc 100644
--- a/test/get_uint32.c
+++ b/test/get_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT32 */
 #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 UINT32 8\n";
   uint32_t c[8], i;
-  uint32_t data_data[128];
-  int fd, n, error, r = 0;
-  unsigned j;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (j = 0; j < 128; ++j)
-    data_data[j] = j * (0x02000001U);
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 128 * sizeof(uint32_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
+  MAKEDATAFILE(data, uint32_t, i * (0x02000001U), 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/get_uint64.c b/test/get_uint64.c
index e963962..fa21ce8 100644
--- a/test/get_uint64.c
+++ b/test/get_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,21 @@
 /* Attempt to read UINT64 */
 #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 UINT64 8\n";
   uint64_t c[8];
-  uint64_t data_data[128];
-  int fd, i, n, error, r = 0;
-  unsigned j;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (j = 0; j < 128; ++j)
-    data_data[j] = j * (0x0200000000000001U);
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 128 * sizeof(uint64_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
+  MAKEDATAFILE(data, uint64_t, i * (0x0200000000000001U), 128);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/get_window.c b/test/get_window.c
index 7352736..89c22a5 100644
--- a/test/get_window.c
+++ b/test/get_window.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "window WINDOW data data EQ 44\ndata RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_window_clr.c b/test/get_window_clr.c
index 23359bc..ffd5ec0 100644
--- a/test/get_window_clr.c
+++ b/test/get_window_clr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "window WINDOW data data CLR 0x2\ndata RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_window_complex.c b/test/get_window_complex.c
index f59fa4e..4fe1162 100644
--- a/test/get_window_complex.c
+++ b/test/get_window_complex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,38 +20,28 @@
  */
 #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.r EQ 44\n"
-    "data RAW COMPLEX128 8\n";
   double c[16];
   double data_data[512];
   int fd, n, i, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (fd = 0; fd < 256; ++fd) {
     data_data[2 * fd] = (double)fd;
     data_data[2 * fd + 1] = (double)fd / 256.;
   }
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "window WINDOW data data.r EQ 44\n"
+    "data RAW COMPLEX128 8\n"
+  );
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 512 * sizeof(double));
diff --git a/test/get_window_ge.c b/test/get_window_ge.c
index 253fddc..f85736e 100644
--- a/test/get_window_ge.c
+++ b/test/get_window_ge.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "window WINDOW data data GE 44\ndata RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_window_gt.c b/test/get_window_gt.c
index 9f35251..80a235f 100644
--- a/test/get_window_gt.c
+++ b/test/get_window_gt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "window WINDOW data data GT 44\ndata RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_window_le.c b/test/get_window_le.c
index f65c27a..d49c071 100644
--- a/test/get_window_le.c
+++ b/test/get_window_le.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "window WINDOW data data LE 44\ndata RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_window_lt.c b/test/get_window_lt.c
index 05bc6d8..7493ae2 100644
--- a/test/get_window_lt.c
+++ b/test/get_window_lt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "window WINDOW data data LT 44\ndata RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_window_ne.c b/test/get_window_ne.c
index 4b4b184..51bfade 100644
--- a/test/get_window_ne.c
+++ b/test/get_window_ne.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "window WINDOW data data NE 44\ndata RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_window_s.c b/test/get_window_s.c
index 96cd16b..3997b2d 100644
--- a/test/get_window_s.c
+++ b/test/get_window_s.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,23 @@
  */
 #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 =
-    "win WINDOW data phase EQ 0\n"
-    "phase PHASE data 128\n"
-    "data RAW UINT8 1\n";
-  unsigned char data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "win WINDOW data phase EQ 0\n"
+    "phase PHASE data 128\n"
+    "data RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "win", 0, 0, 1000, 0, GD_NULL, NULL);
diff --git a/test/get_window_set.c b/test/get_window_set.c
index 20b5913..282ae23 100644
--- a/test/get_window_set.c
+++ b/test/get_window_set.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "window WINDOW data data SET 2\ndata RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/get_zero.c b/test/get_zero.c
index 834e17a..d9c2275 100644
--- a/test/get_zero.c
+++ b/test/get_zero.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Attempt to read from before the BOF */
 #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 = "/FRAMEOFFSET 100\ndata RAW UINT8 8\n";
   unsigned char c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "/FRAMEOFFSET 100\ndata RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/get_zero_complex.c b/test/get_zero_complex.c
index e7c44ad..10a39d3 100644
--- a/test/get_zero_complex.c
+++ b/test/get_zero_complex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,21 @@
  */
 #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 = "/FRAMEOFFSET 100\ndata RAW COMPLEX128 8\n";
   double c[16];
-  double data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 16 * sizeof(double));
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd / 256.;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "/FRAMEOFFSET 100\ndata RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 256., 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/get_zero_float.c b/test/get_zero_float.c
index adc0cdb..9a7396c 100644
--- a/test/get_zero_float.c
+++ b/test/get_zero_float.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,39 +20,21 @@
  */
 #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 = "/FRAMEOFFSET 100\ndata RAW FLOAT64 8\n";
   double c[8];
-  double data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8 * sizeof(double));
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = fd / 256.;
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "/FRAMEOFFSET 100\ndata RAW FLOAT64 8\n");
+  MAKEDATAFILE(data, double, i / 256., 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/global_flags.c b/test/global_flags.c
index 104c7cd..adcf6fa 100644
--- a/test/global_flags.c
+++ b/test/global_flags.c
@@ -1,4 +1,4 @@
-/* Copyright (C) :e2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) :e2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #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";
@@ -47,9 +38,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY | GD_PRETTY_PRINT);
   n[0] = gd_flags(D, 0, 0);
diff --git a/test/global_name.c b/test/global_name.c
index fbaaa32..4f50ed9 100644
--- a/test/global_name.c
+++ b/test/global_name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2013 D. V. Wiebe
+/* Copyright (C) 2008-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,18 @@
  */
 #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";
-  const char *format_data = "data1 CONST UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   const char *name;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data1 CONST UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   name = gd_dirfilename(D);
diff --git a/test/global_ref.c b/test/global_ref.c
deleted file mode 100644
index e87321d..0000000
--- a/test/global_ref.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (C) 2008-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 "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";
-  const char *format_data = "data RAW 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);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
-
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-  ref = gd_reference(D, NULL);
-  error = gd_error(D);
-  CHECKS(ref, "data");
-  CHECKI(error, 0);
-
-  gd_discard(D);
-
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/global_ref_empty.c b/test/global_ref_empty.c
deleted file mode 100644
index 0430ace..0000000
--- a/test/global_ref_empty.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright (C) 2008-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
- */
-/* Global metadata check */
-#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";
-  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);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
-
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-  ref = gd_reference(D, NULL);
-  error = gd_error(D);
-  gd_discard(D);
-
-  unlink(format);
-  rmdir(filedir);
-
-  CHECKI(error, GD_E_OK);
-  CHECKP(ref);
-
-  return r;
-}
diff --git a/test/global_ref_set.c b/test/global_ref_set.c
deleted file mode 100644
index 5277c4a..0000000
--- a/test/global_ref_set.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (C) 2008-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 "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";
-  const char *format_data = "data1 RAW UINT8 1\n"
-                            "data2 RAW 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);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
-
-  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
-
-  ref = gd_reference(D, "data2");
-  error = gd_error(D);
-  CHECKI(error, GD_E_OK);
-  CHECKS(ref, "data2");
-
-  gd_discard(D);
-
-  unlink(format);
-  rmdir(filedir);
-
-  return r;
-}
diff --git a/test/gzip_add.c b/test/gzip_add.c
index 8315dfb..2159cf0 100644
--- a/test/gzip_add.c
+++ b/test/gzip_add.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,66 +20,15 @@
  */
 #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, e3, 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);
+#define ENC_SKIP_TEST 1
 #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);
+#define USE_ENC 1
 #endif
 
-  e3 = gd_close(D);
-  CHECKI(e3, 0);
+#define ENC_SUFFIX ".gz"
+#define ENC_ENCODED GD_GZIP_ENCODED
 
-  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
-}
+#include "enc_add.c"
diff --git a/test/gzip_complex128.c b/test/gzip_complex128.c
new file mode 100644
index 0000000..1c9487e
--- /dev/null
+++ b/test/gzip_complex128.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_complex128.c"
diff --git a/test/gzip_complex64.c b/test/gzip_complex64.c
new file mode 100644
index 0000000..81eee6b
--- /dev/null
+++ b/test/gzip_complex64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_complex64.c"
diff --git a/test/gzip_del.c b/test/gzip_del.c
index b59e429..2f3494b 100644
--- a/test/gzip_del.c
+++ b/test/gzip_del.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2014 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,67 +20,15 @@
  */
 #include "test.h"
 
-/* this tests discarding OOP-writable (also temporary) RAW files */
-int main(void)
-{
-#if !(defined 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];
-  int fd, i, n, e1, e2, e3, unlink_data, ret, r = 0;
-  int rmdir_filedir;
-  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);
-
-#if defined 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);
-#if defined USE_GZIP
-  CHECKI(n, 8);
-  CHECKI(e1, GD_E_OK);
-#else
-  CHECKI(n, 0);
-  CHECKI(e1, GD_E_UNSUPPORTED);
+#ifndef TEST_GZIP
+#define ENC_SKIP_TEST 1
 #endif
 
-  ret = gd_delete(D, "data", GD_DEL_DATA);
-  e2 = gd_error(D);
-#if defined USE_GZIP
-  CHECKI(ret, 0);
-  CHECKI(e2, GD_E_OK);
-#else
-  CHECKI(ret, -1);
-  CHECKI(e2, GD_E_UNSUPPORTED);
+#ifdef USE_GZIP
+#define USE_ENC 1
 #endif
 
-  e3 = gd_close(D);
-  CHECKI(e3, 0);
-
-  unlink_data = unlink(data);
-  unlink(format);
-  rmdir_filedir = rmdir(filedir);
+#define ENC_SUFFIX ".gz"
+#define ENC_ENCODED GD_GZIP_ENCODED
 
-  CHECKI(unlink_data, -1);
-  CHECKI(rmdir_filedir, 0);
-
-  return r;
-#endif
-}
+#include "enc_del.c"
diff --git a/test/gzip_enoent.c b/test/gzip_enoent.c
new file mode 100644
index 0000000..98f19f8
--- /dev/null
+++ b/test/gzip_enoent.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#ifndef TEST_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#ifdef USE_GZIP
+#define USE_ENC 1
+#endif
+
+#define ENC_NAME "gzip"
+
+#include "enc_enoent.c"
diff --git a/test/gzip_float32.c b/test/gzip_float32.c
new file mode 100644
index 0000000..916441b
--- /dev/null
+++ b/test/gzip_float32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_float32.c"
diff --git a/test/gzip_float64.c b/test/gzip_float64.c
new file mode 100644
index 0000000..dc65368
--- /dev/null
+++ b/test/gzip_float64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_float64.c"
diff --git a/test/gzip_get.c b/test/gzip_get.c
index e469d15..56dd701 100644
--- a/test/gzip_get.c
+++ b/test/gzip_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* 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)
 {
 #ifndef TEST_GZIP
@@ -39,11 +30,9 @@ int main(void)
   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];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 #ifdef USE_GZIP
   int i;
@@ -51,18 +40,10 @@ int main(void)
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data);
diff --git a/test/gzip_get_cont.c b/test/gzip_get_cont.c
new file mode 100644
index 0000000..5c002ce
--- /dev/null
+++ b/test/gzip_get_cont.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data)
+
+#include "enc_get_cont.c"
diff --git a/test/gzip_get_far.c b/test/gzip_get_far.c
index 3622ba4..3c69b10 100644
--- a/test/gzip_get_far.c
+++ b/test/gzip_get_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,27 +29,17 @@ int main(void)
   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];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data);
diff --git a/test/gzip_get_get.c b/test/gzip_get_get.c
index 0818f6b..6aff6b6 100644
--- a/test/gzip_get_get.c
+++ b/test/gzip_get_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #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
@@ -38,28 +29,18 @@ int main(void)
   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, e1, e2, n2, e3, r = 0;
+  int i, n1, e1, e2, n2, e3, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data);
diff --git a/test/gzip_get_get2.c b/test/gzip_get_get2.c
index 4e3fe3f..08807ab 100644
--- a/test/gzip_get_get2.c
+++ b/test/gzip_get_get2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* 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
@@ -39,28 +30,18 @@ int main(void)
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data);
diff --git a/test/gzip_get_put.c b/test/gzip_get_put.c
index 6456aea..4efa503 100644
--- a/test/gzip_get_put.c
+++ b/test/gzip_get_put.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* 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
@@ -39,7 +30,6 @@ int main(void)
   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,
@@ -87,14 +77,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   fd = open(data_gz, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, gzdata, 279);
diff --git a/test/gzip_int16.c b/test/gzip_int16.c
new file mode 100644
index 0000000..f0bf160
--- /dev/null
+++ b/test/gzip_int16.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_int16.c"
diff --git a/test/gzip_int32.c b/test/gzip_int32.c
new file mode 100644
index 0000000..d3b03d3
--- /dev/null
+++ b/test/gzip_int32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_int32.c"
diff --git a/test/gzip_int64.c b/test/gzip_int64.c
new file mode 100644
index 0000000..dbdbdba
--- /dev/null
+++ b/test/gzip_int64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_int64.c"
diff --git a/test/gzip_int8.c b/test/gzip_int8.c
new file mode 100644
index 0000000..48a0962
--- /dev/null
+++ b/test/gzip_int8.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_int8.c"
diff --git a/test/gzip_move_from.c b/test/gzip_move_from.c
index bfb385d..db5273d 100644
--- a/test/gzip_move_from.c
+++ b/test/gzip_move_from.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,111 +20,17 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <inttypes.h>
-
-int main(void)
-{
 #ifndef TEST_GZIP
-  return 77;
-#else
-  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";
-  uint16_t data_data[128];
-  char command[4096];
-  int fd, ret, ge_ret, unlink_data, unlink_gzdata, e1, e2, r = 0;
-  DIRFILE *D;
-  gd_entry_t E;
-#ifdef USE_GZIP
-  uint16_t d;
-  int i = 0;
-#endif
-
-  rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = fd * 0x201;
-
-  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, 128 * sizeof(uint16_t));
-  close(fd);
-
-  /* compress */
-  snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data);
-  if (gd_system(command))
-    return 1;
-
-#ifdef USE_GZIP
-  D = gd_open(filedir, GD_RDWR | GD_VERBOSE | GD_UNENCODED);
-#else
-  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+#define ENC_SKIP_TEST 1
 #endif
-  ret = gd_move(D, "data", 1, 1);
-  e1 = gd_error(D);
-
-  ge_ret =  gd_entry(D, "data", &E);
-  CHECKI(ge_ret, 0);
-
-  e2 = gd_close(D);
-  CHECKI(e2, 0);
 
 #ifdef USE_GZIP
-  fd = open(data, O_RDONLY | O_BINARY);
-
-  if (fd >= 0) {
-    while (read(fd, &d, sizeof(uint16_t))) {
-      CHECKUi(i, d, i * 0x201);
-      i++;
-    }
-    close(fd);
-  } else {
-    perror("open");
-    r = 1;
-  }
+#define USE_ENC 1
 #endif
 
-  unlink(format1);
-  unlink(format);
-  unlink_data = unlink(data);
-  unlink_gzdata = unlink(gzdata);
-  rmdir(filedir);
+#define ENC_SUFFIX ".gz"
+#define ENC_NAME "gzip"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data)
 
-#ifdef USE_GZIP
-  CHECKI(ret, 0);
-  CHECKI(e1, 0);
-  CHECKI(E.fragment_index, 1);
-  CHECKI(unlink_data, 0);
-  CHECKI(unlink_gzdata, -1);
-#else
-  CHECKI(ret, -1);
-  CHECKI(e1, GD_E_UNSUPPORTED);
-  CHECKI(E.fragment_index, 0);
-  CHECKI(unlink_data, -1);
-  CHECKI(unlink_gzdata, 0);
-#endif
-  gd_free_entry_strings(&E);
-
-  return r;
-#endif
-}
+#include "enc_move_from.c"
diff --git a/test/gzip_move_to.c b/test/gzip_move_to.c
index 9f17e9c..87583b4 100644
--- a/test/gzip_move_to.c
+++ b/test/gzip_move_to.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,18 +20,12 @@
  */
 #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
@@ -43,14 +37,12 @@ int main(void)
   struct stat buf;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING none\n/ENDIAN little\n");
 
   fd = open(data_raw, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_in, 256);
diff --git a/test/gzip_nframes.c b/test/gzip_nframes.c
index b360050..bf35c13 100644
--- a/test/gzip_nframes.c
+++ b/test/gzip_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,72 +18,18 @@
  * 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_GZIP
-  return 77;
-#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 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 */
-  snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data);
-  if (gd_system(command))
-    return 1;
-
-#ifdef USE_GZIP
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-#else
-  D = gd_open(filedir, GD_RDONLY);
+#define ENC_SKIP_TEST 1
 #endif
-  n = gd_nframes(D);
-  error = gd_error(D);
-  gd_discard(D);
-
-  unlink(gzipdata);
-  unlink(format);
-  rmdir(filedir);
 
 #ifdef USE_GZIP
-  CHECKI(error, 0);
-  CHECKI(n, 256);
-#else
-  CHECKI(error, GD_E_UNSUPPORTED);
-  CHECKI(n, 0);
+#define USE_ENC 1
 #endif
 
-  return r;
-#endif
-}
+#define ENC_SUFFIX ".gz"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data)
+
+#include "enc_nframes.c"
diff --git a/test/gzip_put.c b/test/gzip_put.c
index e1f8ef8..ba0d2f5 100644
--- a/test/gzip_put.c
+++ b/test/gzip_put.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #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
@@ -38,7 +29,6 @@ int main(void)
   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];
@@ -50,14 +40,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
 #ifdef USE_GZIP
   D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
diff --git a/test/gzip_put_back.c b/test/gzip_put_back.c
index ed21b59..b32762d 100644
--- a/test/gzip_put_back.c
+++ b/test/gzip_put_back.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #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)
 {
 #if ! (defined TEST_GZIP) || ! (defined USE_GZIP)
@@ -38,7 +29,6 @@ int main(void)
   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];
   char command[4096];
   uint8_t d;
@@ -48,14 +38,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
   n1 = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/gzip_put_endian.c b/test/gzip_put_endian.c
index 13199ca..e9da6a2 100644
--- a/test/gzip_put_endian.c
+++ b/test/gzip_put_endian.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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>
+#ifdef WORDS_BIGENDIAN
+#define ENDIAN "ENDIAN little"
+#else
+#define ENDIAN "ENDIAN big"
+#endif
 
 int main(void)
 {
@@ -38,12 +35,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_gz = "dirfile/data.gz";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT16 8\n"
-#ifdef WORDS_BIGENDIAN
-  "ENDIAN little\n";
-#else
-  "ENDIAN big\n";
-#endif
   uint16_t c[8];
 #ifdef USE_GZIP
   char command[4096];
@@ -55,14 +46,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = (uint16_t)(0x102 * i);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n" ENDIAN "\n");
 
 #ifdef USE_GZIP
   D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
diff --git a/test/gzip_put_get.c b/test/gzip_put_get.c
index b7a0988..732169d 100644
--- a/test/gzip_put_get.c
+++ b/test/gzip_put_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #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
@@ -37,21 +28,18 @@ int main(void)
   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, e3, unlink_data, r = 0;
+  int i, m, n, e1, e2, e3, unlink_data, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
 #ifdef USE_GZIP
   D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
diff --git a/test/gzip_put_offs.c b/test/gzip_put_offs.c
new file mode 100644
index 0000000..e19a151
--- /dev/null
+++ b/test/gzip_put_offs.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined USE_GZIP || !defined TEST_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_put_offs.c"
diff --git a/test/gzip_put_pad.c b/test/gzip_put_pad.c
index 64d2af7..b2dd44f 100644
--- a/test/gzip_put_pad.c
+++ b/test/gzip_put_pad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   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];
   char command[4096];
   uint8_t d;
@@ -39,14 +38,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
   n1 = gd_putdata(D, "data", 0, 0, 1, 0, GD_UINT8, c);
diff --git a/test/gzip_put_sub.c b/test/gzip_put_sub.c
index b5f3676..afe94af 100644
--- a/test/gzip_put_sub.c
+++ b/test/gzip_put_sub.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #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)
 {
 #if ! (defined TEST_GZIP) || ! (defined USE_GZIP)
@@ -40,8 +31,6 @@ int main(void)
   const char *format1 = "dirfile/sub/format1";
   const char *data_gz = "dirfile/sub/data.gz";
   const char *data = "dirfile/sub/data";
-  const char *format_data = "/INCLUDE sub/format1\n";
-  const char *format1_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   char command[4096];
   uint8_t d;
@@ -51,19 +40,14 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-  mkdir(subdir, 0777);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
   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);
-
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE sub/format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
   n1 = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/gzip_seek.c b/test/gzip_seek.c
index 5cf3479..bf6cc4c 100644
--- a/test/gzip_seek.c
+++ b/test/gzip_seek.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,63 +20,17 @@
  */
 #include "test.h"
 
-int main(void)
-{
 #ifndef TEST_GZIP
-  return 77;
-#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";
-  char command[4096];
-  uint16_t 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 * sizeof(uint16_t));
-  close(fd);
-
-  /* compress */
-  snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data);
-  if (gd_system(command))
-    return 1;
-
-#ifdef USE_GZIP
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-#else
-  D = gd_open(filedir, GD_RDONLY);
+#define ENC_SKIP_TEST 1
 #endif
-  n = gd_seek(D, "data", 5, 0, GD_SEEK_SET);
-  error = gd_error(D);
-
-  gd_discard(D);
-
-  unlink(gzipdata);
-  unlink(format);
-  rmdir(filedir);
 
 #ifdef USE_GZIP
-  CHECKI(error, 0);
-  CHECKI(n, 40);
-#else
-  CHECKI(error, GD_E_UNSUPPORTED);
-  CHECKI(n, -1);
+#define USE_ENC 1
 #endif
 
-  return r;
-#endif
-}
+#define ENC_SUFFIX ".gz"
+#define ENC_NAME "gzip"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data)
+
+#include "enc_seek.c"
diff --git a/test/gzip_seek_far.c b/test/gzip_seek_far.c
index 6f8ed9e..4f3e389 100644
--- a/test/gzip_seek_far.c
+++ b/test/gzip_seek_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,26 +29,16 @@ int main(void)
   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";
   char command[4096];
-  uint16_t data_data[256];
-  int fd, error, r = 0;
+  int error, r = 0;
   off_t n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data);
@@ -77,7 +67,7 @@ int main(void)
     CHECKI(n, 4000);
 #else
   CHECKI(error, GD_E_UNSUPPORTED);
-  CHECKI(n, -1);
+  CHECKI(n, GD_E_UNSUPPORTED);
 #endif
 
   return r;
diff --git a/test/gzip_sync.c b/test/gzip_sync.c
index 1a8df0b..de3b4a8 100644
--- a/test/gzip_sync.c
+++ b/test/gzip_sync.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #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)
 {
 #if !defined TEST_GZIP || !defined USE_GZIP
@@ -38,7 +29,6 @@ int main(void)
   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];
   char command[4096];
   uint8_t d;
@@ -48,14 +38,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
   gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/gzip_uint16.c b/test/gzip_uint16.c
new file mode 100644
index 0000000..d98362f
--- /dev/null
+++ b/test/gzip_uint16.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_uint16.c"
diff --git a/test/gzip_uint32.c b/test/gzip_uint32.c
new file mode 100644
index 0000000..038e5fd
--- /dev/null
+++ b/test/gzip_uint32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_uint32.c"
diff --git a/test/gzip_uint64.c b/test/gzip_uint64.c
new file mode 100644
index 0000000..d26b8de
--- /dev/null
+++ b/test/gzip_uint64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_uint64.c"
diff --git a/test/gzip_uint8.c b/test/gzip_uint8.c
new file mode 100644
index 0000000..fa63b2e
--- /dev/null
+++ b/test/gzip_uint8.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_GZIP || !defined USE_GZIP
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".gz"
+#define GD_ENC_ENCODED GD_GZIP_ENCODED
+
+#include "enc_uint8.c"
diff --git a/test/header_complex.c b/test/header_complex.c
index 3fc07ba..a800f75 100644
--- a/test/header_complex.c
+++ b/test/header_complex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,32 +22,19 @@
 #define GD_C89_API
 #include "test.h"
 
-#include <math.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 =
-    "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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM data 3.3;4.4 5.5;6.6 data 7.7;8.8 9.9;1.1\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_entry(D, "lincom", &E);
diff --git a/test/header_off64t.c b/test/header_off64t.c
index 809a1e0..bde551c 100644
--- a/test/header_off64t.c
+++ b/test/header_off64t.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -27,17 +27,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "/FRAMEOFFSET 0x123456789\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   uint64_t fo;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/FRAMEOFFSET 0x123456789\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   fo = gd_frameoffset(D, 0);
diff --git a/test/hide.c b/test/hide.c
index 86b5777..2cc61f8 100644
--- a/test/hide.c
+++ b/test/hide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,16 +24,13 @@ 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;
+  int n, h, m, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   n = gd_nfields(D);
diff --git a/test/hide_bad.c b/test/hide_bad.c
old mode 100755
new mode 100644
index f0d3338..5d28b50
--- a/test/hide_bad.c
+++ b/test/hide_bad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -34,7 +34,7 @@ int main(void)
   e1 = gd_error(D);
 
   CHECKI(e1, GD_E_BAD_CODE);
-  CHECKI(h1, -1);
+  CHECKI(h1, GD_E_BAD_CODE);
 
   gd_discard(D);
   unlink(format);
diff --git a/test/hide_hidden.c b/test/hide_hidden.c
index 2357107..c28c963 100644
--- a/test/hide_hidden.c
+++ b/test/hide_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ 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;
+  int h1, h2, e1, e2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 8\n"
+    "hata RAW UINT8 8\n"
+    "/HIDDEN hata\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   h1 = gd_hidden(D, "data");
diff --git a/test/hide_hidden_bad.c b/test/hide_hidden_bad.c
old mode 100755
new mode 100644
index 44f9f41..8335267
--- a/test/hide_hidden_bad.c
+++ b/test/hide_hidden_bad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -34,7 +34,7 @@ int main(void)
   e1 = gd_error(D);
 
   CHECKI(e1, GD_E_BAD_CODE);
-  CHECKI(h1, -1);
+  CHECKI(h1, GD_E_BAD_CODE);
 
   gd_discard(D);
   unlink(format);
diff --git a/test/hide_unhide.c b/test/hide_unhide.c
index b7dda53..a1c2630 100644
--- a/test/hide_unhide.c
+++ b/test/hide_unhide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,16 +24,13 @@ 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;
+  int n, h, m, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/HIDDEN data\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   n = gd_nfields(D);
diff --git a/test/hide_unhide_bad.c b/test/hide_unhide_bad.c
old mode 100755
new mode 100644
index 21bbcab..cf778a7
--- a/test/hide_unhide_bad.c
+++ b/test/hide_unhide_bad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -34,7 +34,7 @@ int main(void)
   e1 = gd_error(D);
 
   CHECKI(e1, GD_E_BAD_CODE);
-  CHECKI(h1, -1);
+  CHECKI(h1, GD_E_BAD_CODE);
 
   gd_discard(D);
   unlink(format);
diff --git a/test/include_accmode.c b/test/include_accmode.c
index 1a72b18..9178d90 100644
--- a/test/include_accmode.c
+++ b/test/include_accmode.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,13 +21,6 @@
 /* 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";
@@ -36,7 +29,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   close(fd);
diff --git a/test/include_affix.c b/test/include_affix.c
index 881cca1..eadaa67 100644
--- a/test/include_affix.c
+++ b/test/include_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,22 +25,15 @@ 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;
+  int error, r = 0;
   unsigned int spf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_include_affix(D, "format1", 0, "A", "Z", 0);
diff --git a/test/include_affix_ns.c b/test/include_affix_ns.c
new file mode 100644
index 0000000..f0c305e
--- /dev/null
+++ b/test/include_affix_ns.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0, v;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_include_affix(D, "format1", 0, "ns.", NULL, 0);
+  error = gd_error(D);
+  CHECKI(error, 0);
+  v = gd_validate(D, "ns.data");
+  CHECKI(v, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_auto.c b/test/include_auto.c
index 6801dbd..274186d 100644
--- a/test/include_auto.c
+++ b/test/include_auto.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,36 +20,21 @@
  */
 #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 *format_data = "#\n";
-  const char *format1_data = "data RAW UINT8 11\n";
-  int fd, error1, error2, r = 0;
+  int error1, error2, r = 0;
   const char *reference;
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_include(D, "format1", 0, GD_VERBOSE);
diff --git a/test/include_cb.c b/test/include_cb.c
index dbe1ffc..3f50739 100644
--- a/test/include_cb.c
+++ b/test/include_cb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* 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 saw_callback = 0;
 int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
 {
@@ -42,21 +34,14 @@ 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 ROW UINT8 11\n";
-  int fd, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data ROW UINT8 11\n");
 
   D = gd_cbopen(filedir, GD_RDWR, callback, NULL);
   gd_include(D, "format1", 0, 0);
diff --git a/test/include_creat.c b/test/include_creat.c
index 7e89228..eac9a94 100644
--- a/test/include_creat.c
+++ b/test/include_creat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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";
@@ -36,7 +29,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   close(fd);
diff --git a/test/include_format.c b/test/include_format.c
new file mode 100644
index 0000000..11cb118
--- /dev/null
+++ b/test/include_format.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, e3, e4, e5, r = 0;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "remaining CONST UINT8 1\n");
+  
+  MAKEFORMATFILE(format1,
+      "one CONST UINT8 1\n"
+      "before CONST UINT8 1\n"
+      "syntax error\n"
+      "after CONST UINT8 1\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_include(D, "format1", 0, 0);
+  CHECKI(e1, GD_E_FORMAT);
+
+  e2 = gd_validate(D, "BEFORE");
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  e3 = gd_validate(D, "before");
+  CHECKI(e3, GD_E_BAD_CODE);
+
+  e4 = gd_validate(D, "afer");
+  CHECKI(e4, GD_E_BAD_CODE);
+
+  e5 = gd_validate(D, "remaining");
+  CHECKI(e5, 0);
+
+  n = gd_nfields(D);
+  CHECKU(n, 2);
+  
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_ignore.c b/test/include_ignore.c
index cb816a6..513574a 100644
--- a/test/include_ignore.c
+++ b/test/include_ignore.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,36 +20,21 @@
  */
 #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 *format_data = "data1 RAW UINT8 1\n";
-  const char *format1_data = "data RAW UINT8 11\nREFERENCE data\n";
-  int fd, error1, error2, r = 0;
+  int error1, error2, r = 0;
   const char *reference;
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data1 RAW UINT8 1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\nREFERENCE data\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_include(D, "format1", 0, GD_IGNORE_REFS | GD_VERBOSE);
diff --git a/test/include_include.c b/test/include_include.c
index dd9e926..8b499cd 100644
--- a/test/include_include.c
+++ b/test/include_include.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,20 @@
 /* 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 = "#\n";
-  const char *format1_data = "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_include(D, "format1", 0, 0);
diff --git a/test/include_index.c b/test/include_index.c
index c0c50fd..42594f9 100644
--- a/test/include_index.c
+++ b/test/include_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "#\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "#\n");
 
   D = gd_open(filedir, GD_RDWR);
   gd_include(D, "format1", 1, 0);
diff --git a/test/include_invalid.c b/test/include_invalid.c
index 2b71fde..fc31cbd 100644
--- a/test/include_invalid.c
+++ b/test/include_invalid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 *format1 = "dirfile/format1";
-  const char *format1_data = "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY);
   gd_include(D, "format1", 0, 0);
diff --git a/test/include_ndotdots.c b/test/include_ndotdots.c
new file mode 100644
index 0000000..2f4325e
--- /dev/null
+++ b/test/include_ndotdots.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  error = gd_include_ns(D, "format1", 0, "n..s", 0);
+  CHECKI(error, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_ndots.c b/test/include_ndots.c
new file mode 100644
index 0000000..ba4c7a0
--- /dev/null
+++ b/test/include_ndots.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0, v;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_include_ns(D, "format1", 0, "n.s", 0);
+  error = gd_error(D);
+  CHECKI(error, 0);
+  v = gd_validate(D, "n.s.data");
+  CHECKI(v, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_nonexistent.c b/test/include_nonexistent.c
index 172b7ba..89d9276 100644
--- a/test/include_nonexistent.c
+++ b/test/include_nonexistent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 = "#\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "#\n");
 
   D = gd_open(filedir, GD_RDWR);
   gd_include(D, "format1", 0, 0);
diff --git a/test/include_ns.c b/test/include_ns.c
new file mode 100644
index 0000000..a5b4ee0
--- /dev/null
+++ b/test/include_ns.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0, v;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_include_ns(D, "format1", 0, "ns", 0);
+  error = gd_error(D);
+  CHECKI(error, 0);
+  v = gd_validate(D, "ns.data");
+  CHECKI(v, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_ns_dot.c b/test/include_ns_dot.c
new file mode 100644
index 0000000..6a9f0d4
--- /dev/null
+++ b/test/include_ns_dot.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0, v;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_include_ns(D, "format1", 0, "ns.", 0);
+  error = gd_error(D);
+  CHECKI(error, 0);
+  v = gd_validate(D, "ns.data");
+  CHECKI(v, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_ns_dotdot.c b/test/include_ns_dotdot.c
new file mode 100644
index 0000000..8c74dd5
--- /dev/null
+++ b/test/include_ns_dotdot.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  gd_include_ns(D, "format1", 0, "..", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_ns_dotns.c b/test/include_ns_dotns.c
new file mode 100644
index 0000000..3d9d281
--- /dev/null
+++ b/test/include_ns_dotns.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2014, 2016, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0, v;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 ns1.\n");
+  MAKEFORMATFILE(format1, "#");
+  MAKEFORMATFILE(format2, "data CONST UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_include_ns(D, "format2", 1, ".ns2", 0);
+  error = gd_error(D);
+  CHECKI(error, 0);
+  v = gd_validate(D, "ns1.ns2.data");
+  CHECKI(v, 0);
+  gd_discard(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_ns_nil.c b/test/include_ns_nil.c
new file mode 100644
index 0000000..81adb8c
--- /dev/null
+++ b/test/include_ns_nil.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0, v;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_include_ns(D, "format1", 0, "", 0);
+  error = gd_error(D);
+  CHECKI(error, 0);
+  v = gd_validate(D, "data");
+  CHECKI(v, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_ns_null.c b/test/include_ns_null.c
new file mode 100644
index 0000000..e6993b2
--- /dev/null
+++ b/test/include_ns_null.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0, v;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_include_ns(D, "format1", 0, NULL, 0);
+  error = gd_error(D);
+  CHECKI(error, 0);
+  v = gd_validate(D, "data");
+  CHECKI(v, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_ns_prefix.c b/test/include_ns_prefix.c
new file mode 100644
index 0000000..32d2712
--- /dev/null
+++ b/test/include_ns_prefix.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *ns;
+  char *prefix, *suffix;
+  int e1, e2, r = 0, v;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_include_affix(D, "format1", 0, "ns.a", NULL, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  ns = gd_fragment_namespace(D, 1, NULL);
+  CHECKS(ns,"ns");
+
+  gd_fragment_affixes(D, 1, &prefix, &suffix);
+  e2 = gd_error(D);
+  CHECKI(e2, 0);
+  CHECKS(prefix, "a");
+  CHECKP(suffix);
+  free(prefix);
+
+  v = gd_validate(D, "ns.adata");
+  CHECKI(v, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_pc.c b/test/include_pc.c
index dac0315..4f0968c 100644
--- a/test/include_pc.c
+++ b/test/include_pc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* 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 saw_callback = 0;
 int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
 {
@@ -42,21 +34,14 @@ int main(void)
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data PAW UINT8 1\n");
+  MAKEFORMATFILE(format1, "data ROW UINT8 11\n");
 
   D = gd_cbopen(filedir, GD_RDWR, callback, NULL);
   gd_parser_callback(D, NULL, NULL);
diff --git a/test/include_prot.c b/test/include_prot.c
new file mode 100644
index 0000000..8bd090b
--- /dev/null
+++ b/test/include_prot.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/PROTECT all\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_include_affix(D, "format1", 0, "A", "Z", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/include_ref.c b/test/include_ref.c
index 2e7746a..dcad585 100644
--- a/test/include_ref.c
+++ b/test/include_ref.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,36 +20,21 @@
  */
 #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 *format_data = "data1 RAW UINT8 1\n";
-  const char *format1_data = "data RAW UINT8 11\nREFERENCE data\n";
-  int fd, error1, error2, r = 0;
+  int error1, error2, r = 0;
   const char *reference;
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data1 RAW UINT8 1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\nREFERENCE data\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_include(D, "format1", 0, GD_VERBOSE);
diff --git a/test/include_ref_code.c b/test/include_ref_code.c
new file mode 100644
index 0000000..83e40c4
--- /dev/null
+++ b/test/include_ref_code.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, e3, e4, e5, r = 0;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "remaining CONST UINT8 1\n");
+  
+  MAKEFORMATFILE(format1,
+      "one CONST UINT8 1\n"
+      "before CONST UINT8 1\n"
+      "after CONST UINT8 1\n"
+      "/REFERENCE missing\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_include(D, "format1", 0, 0);
+  CHECKI(e1, GD_E_BAD_REFERENCE);
+
+  e2 = gd_validate(D, "BEFORE");
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  e3 = gd_validate(D, "before");
+  CHECKI(e3, GD_E_BAD_CODE);
+
+  e4 = gd_validate(D, "afer");
+  CHECKI(e4, GD_E_BAD_CODE);
+
+  e5 = gd_validate(D, "remaining");
+  CHECKI(e5, 0);
+
+  n = gd_nfields(D);
+  CHECKU(n, 2);
+  
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_ref_type.c b/test/include_ref_type.c
new file mode 100644
index 0000000..7b36fc7
--- /dev/null
+++ b/test/include_ref_type.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, e3, e4, e5, r = 0;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "remaining CONST UINT8 1\n");
+  
+  MAKEFORMATFILE(format1,
+      "one CONST UINT8 1\n"
+      "before CONST UINT8 1\n"
+      "after CONST UINT8 1\n"
+      "/REFERENCE before\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_include(D, "format1", 0, 0);
+  CHECKI(e1, GD_E_BAD_REFERENCE);
+
+  e2 = gd_validate(D, "BEFORE");
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  e3 = gd_validate(D, "before");
+  CHECKI(e3, GD_E_BAD_CODE);
+
+  e4 = gd_validate(D, "afer");
+  CHECKI(e4, GD_E_BAD_CODE);
+
+  e5 = gd_validate(D, "remaining");
+  CHECKI(e5, 0);
+
+  n = gd_nfields(D);
+  CHECKU(n, 2);
+  
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_sub.c b/test/include_sub.c
index ff63103..0e2cc91 100644
--- a/test/include_sub.c
+++ b/test/include_sub.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,40 +21,22 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format2_data, strlen(format2_data));
-  close(fd);
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\nINCLUDE format2");
+  MAKEFORMATFILE(format2, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
 
diff --git a/test/include_syntax.c b/test/include_syntax.c
index 52b0e89..a53be83 100644
--- a/test/include_syntax.c
+++ b/test/include_syntax.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,19 @@
 /* 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 *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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "#\n");
+  MAKEFORMATFILE(format1, "data ROW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR);
   gd_include(D, "format1", 0, 0);
diff --git a/test/index_domain.c b/test/index_domain.c
index 6ed8b72..47f3ad1 100644
--- a/test/index_domain.c
+++ b/test/index_domain.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,22 @@
 /* Frameindex look-up */
 #include "test.h"
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <math.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 FLOAT64 1\n";
   double d[1000], f1;
   int i, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 1000; ++i)
     d[i] = 0;
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\n");
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, d, sizeof(double));
diff --git a/test/index_empty.c b/test/index_empty.c
new file mode 100644
index 0000000..9cee76c
--- /dev/null
+++ b/test/index_empty.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double f1;
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  gd_add_raw(D, "data", GD_UINT8, 1, 0);
+  f1 = gd_framenum_subset(D, "data", 1.09, 0, 1000);
+  CHECKNAN(f1);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_DOMAIN);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/index_index.c b/test/index_index.c
index e89a579..858269e 100644
--- a/test/index_index.c
+++ b/test/index_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* Frameindex look-up */
 #include "test.h"
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <math.h>
-#include <errno.h>
-
 #define F(x) sqrt(((x) + 600.) / 500.)
 /* inverse of F(x) via linear interpolation between x and x+1 */
 #define G(x,y) (x + ((y - F(x)) / (F(x+1) - F(x))))
@@ -38,20 +29,17 @@ int main(void)
   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, f4;
   int i, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 1000; ++i)
     d[i] = F(i);
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\n");
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, d, 1000 * sizeof(double));
diff --git a/test/index_one.c b/test/index_one.c
new file mode 100644
index 0000000..e40aae1
--- /dev/null
+++ b/test/index_one.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double f1;
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
+  MAKEDATAFILE(data, uint8_t, 10, 1);
+
+  D = gd_open(filedir, GD_RDONLY);
+  f1 = gd_framenum(D, "data", 1.09);
+  CHECKNAN(f1);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_DOMAIN);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/index_range.c b/test/index_range.c
index a6d39e2..29809da 100644
--- a/test/index_range.c
+++ b/test/index_range.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,22 @@
 /* Frameindex look-up */
 #include "test.h"
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <math.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 FLOAT64 1\n";
   double d[1000], f1;
   int i, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 1000; ++i)
     d[i] = 0;
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\n");
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, d, 1000 * sizeof(double));
diff --git a/test/index_reprz.c b/test/index_reprz.c
new file mode 100644
index 0000000..1cad342
--- /dev/null
+++ b/test/index_reprz.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *code = "dirfile/code";
+  int e1, e2, e3, e4, r = 0;
+  double c1, c2, c3, c4;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "code RAW COMPLEX128 1\n"
+      "code.i PHASE code 10\n"
+      "more.r PHASE code 20\n"
+      );
+  MAKEDATAFILE(code, double, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  /* Imaginary part of code */
+  c1 = gd_framenum(D, "code.i", 43.5);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+  CHECKF(c1, 43.5 / 2 - 0.5);
+
+  /* All of code.i */
+  c2 = gd_framenum(D, "code.i.z", 43.5);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_DOMAIN);
+  CHECKNAN(c2);
+
+  /* Real part of code.i */
+  c3 = gd_framenum(D, "code.i.r", 43.5);
+  e3 = gd_error(D);
+  CHECKI(e3, 0);
+  CHECKF(c3, 43.5 / 2 - 10);
+
+  /* All of more.r */
+  c4 = gd_framenum(D, "more.r", 43.5);
+  e4 = gd_error(D);
+  CHECKI(e4, GD_E_DOMAIN);
+  CHECKNAN(c4);
+
+  gd_discard(D);
+
+  unlink(code);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/index_s.c b/test/index_s.c
index 3e09088..c215112 100644
--- a/test/index_s.c
+++ b/test/index_s.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <math.h>
-#include <errno.h>
-
 #define F(x) sqrt(((x) + 600.) / 500.)
 /* inverse of F(x) via linear interpolation between x and x+1 */
 #define G(x,y) (x + ((y - F(x)) / (F(x+1) - F(x))))
@@ -37,20 +28,17 @@ int main(void)
   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);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 1000; ++i)
     d[i] = F(i);
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\n");
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, d, 1000 * sizeof(double));
diff --git a/test/index_scalar.c b/test/index_scalar.c
new file mode 100644
index 0000000..37f838f
--- /dev/null
+++ b/test/index_scalar.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  double f1;
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data CONST UINT8 1");
+
+  D = gd_open(filedir, GD_RDONLY);
+  f1 = gd_framenum(D, "data", 1.09);
+  CHECKNAN(f1);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_DIMENSION);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/index_subset.c b/test/index_subset.c
index 9af2fa6..ff919c0 100644
--- a/test/index_subset.c
+++ b/test/index_subset.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <math.h>
-#include <errno.h>
-
 #define F(x) sqrt(((x) + 600.) / 500.)
 /* inverse of F(x) via linear interpolation between x and x+1 */
 #define G(x,y) (x + ((y - F(x)) / (F(x+1) - F(x))))
@@ -37,20 +28,17 @@ int main(void)
   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);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 1000; ++i)
     d[i] = F(i);
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\n");
 
   i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(i, d, 1000 * sizeof(double));
diff --git a/test/legacy_error.c b/test/legacy_error.c
index 47e887c..bbf9f94 100644
--- a/test/legacy_error.c
+++ b/test/legacy_error.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2014 D. V. Wiebe
+/* Copyright (C) 2013, 2014, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,8 +20,6 @@
  */
 #include "test.h"
 
-#include <string.h>
-
 #define DIRFILENAME "a non-existant dirfile"
 int main(void)
 {
@@ -36,7 +34,7 @@ int main(void)
   GetDataErrorString(string, 1000);
 
   CHECKI(n, 0);
-  CHECKI(error, GD_E_IO);
+  CHECKI(error, -GD_E_IO);
   CHECKSS(string, DIRFILENAME);
 
   return r;
diff --git a/test/legacy_estring.c b/test/legacy_estring.c
index b87ebd1..313694e 100644
--- a/test/legacy_estring.c
+++ b/test/legacy_estring.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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)
 {
 #ifndef GD_LEGACY_API
@@ -35,25 +28,15 @@ 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, n, error, r = 0;
+  int i, n, error, r = 0;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   n = GetData(filedir, "data", 5, 0, 1, 0, 'c', c, &error);
 
diff --git a/test/legacy_format.c b/test/legacy_format.c
index b46bc60..1af935c 100644
--- a/test/legacy_format.c
+++ b/test/legacy_format.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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)
 {
 #ifndef GD_LEGACY_API
@@ -34,7 +27,15 @@ int main(void)
 #else
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int i, error = 0, r = 0;
+  double three = 3.;
+  int *three_ptr = (void*)(&three);
+  struct FormatType *f;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "bit BIT raw 5 6\n"
     "const CONST UINT8 1\n"
     "carray CARRAY UINT8 1 2 3\n"
@@ -49,18 +50,8 @@ int main(void)
     "recip RECIP sbit 3\n"
     "sbit SBIT raw 7 8\n"
     "window WINDOW raw phase LE 3\n"
-    "/FRAMEOFFSET 12\n";
-  int fd, i, error = 0, r = 0;
-  double three = 3.;
-  int *three_ptr = (void*)(&three);
-  struct FormatType *f;
-
-  rmdirfile();
-  mkdir(filedir, 0777);
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+    "/FRAMEOFFSET 12\n"
+  );
 
   f = GetFormat(filedir, &error);
   CHECKI(error, 0);
@@ -83,27 +74,27 @@ int main(void)
   CHECKI(f->rawEntries[0].samples_per_frame, 8);
 
   CHECKI(f->n_lincom, 3);
-  CHECKS(f->lincomEntries[0].field, "lincom");
-  CHECKI(f->lincomEntries[0].n_fields, 3);
-  CHECKS(f->lincomEntries[0].in_fields[0], "raw");
-  CHECKS(f->lincomEntries[0].in_fields[1], "phase");
-  CHECKS(f->lincomEntries[0].in_fields[2], "div");
+  CHECKS(f->lincomEntries[0].field, "recip");
+  CHECKI(f->lincomEntries[0].n_fields, 1);
+  CHECKS(f->lincomEntries[0].in_fields[0], "sbit");
+  CHECKF(f->lincomEntries[0].m[0], 3);
+  CHECKF(f->lincomEntries[0].b[0], 0);
+
+  CHECKS(f->lincomEntries[1].field, "lincom");
+  CHECKI(f->lincomEntries[1].n_fields, 3);
+  CHECKS(f->lincomEntries[1].in_fields[0], "raw");
+  CHECKS(f->lincomEntries[1].in_fields[1], "phase");
+  CHECKS(f->lincomEntries[1].in_fields[2], "div");
   for (i = 0; i < 3; ++i) {
-    CHECKFi(i, f->lincomEntries[0].m[i], i * 2. + 1);
-    CHECKFi(i, f->lincomEntries[0].b[i], i * 2. + 2);
+    CHECKFi(i, f->lincomEntries[1].m[i], i * 2. + 1);
+    CHECKFi(i, f->lincomEntries[1].b[i], i * 2. + 2);
   }
 
-  CHECKS(f->lincomEntries[1].field, "polynom");
-  CHECKI(f->lincomEntries[1].n_fields, 1);
-  CHECKS(f->lincomEntries[1].in_fields[0], "raw");
-  CHECKF(f->lincomEntries[1].m[0], 9);
-  CHECKF(f->lincomEntries[1].b[0], 8);
-
-  CHECKS(f->lincomEntries[2].field, "recip");
+  CHECKS(f->lincomEntries[2].field, "polynom");
   CHECKI(f->lincomEntries[2].n_fields, 1);
-  CHECKS(f->lincomEntries[2].in_fields[0], "sbit");
-  CHECKF(f->lincomEntries[2].m[0], 3);
-  CHECKF(f->lincomEntries[2].b[0], 0);
+  CHECKS(f->lincomEntries[2].in_fields[0], "raw");
+  CHECKF(f->lincomEntries[2].m[0], 9);
+  CHECKF(f->lincomEntries[2].b[0], 8);
 
   CHECKI(f->n_linterp, 1);
   CHECKS(f->linterpEntries[0].field, "linterp");
diff --git a/test/legacy_get.c b/test/legacy_get.c
index 017ca6d..b235241 100644
--- a/test/legacy_get.c
+++ b/test/legacy_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,13 +21,6 @@
 /* Attempt to read UINT8 via the legacy interface */
 #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)
 {
 #ifndef GD_LEGACY_API
@@ -36,25 +29,15 @@ 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, n, error, r = 0;
+  int i, n, error, r = 0;
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   n = GetData(filedir, "data", 5, 0, 1, 0, 'c', c, &error);
 
diff --git a/test/legacy_get_put.c b/test/legacy_get_put.c
index 33bb05d..6c087af 100644
--- a/test/legacy_get_put.c
+++ b/test/legacy_get_put.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,14 +22,6 @@
  * closing and then re-opening the legacy dirfile */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
 int main(void)
 {
 #ifndef GD_LEGACY_API
@@ -38,28 +30,18 @@ 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];
-  unsigned char data_data[256];
-  int fd, i, get_error, put_error, n, r = 0;
+  int i, get_error, put_error, n, r = 0;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = (uint8_t)(40 + i);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   GetData(filedir, "data", 5, 0, 1, 0, 'c', c, &get_error);
   n = PutData(filedir, "data", 5, 0, 1, 0, 'c', c, &put_error);
diff --git a/test/legacy_get_rofs.c b/test/legacy_get_rofs.c
index 7efbe3e..e890b25 100644
--- a/test/legacy_get_rofs.c
+++ b/test/legacy_get_rofs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,13 +21,6 @@
 /* Attempt to read UINT8 from a read-only filesystem via the legacy interface */
 #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)
 {
 #ifndef GD_LEGACY_API
@@ -36,28 +29,22 @@ 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, n, error, r = 0;
+  int i, n, error, r = 0;
 
   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, 0444);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0444);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  chmod(format, 0400);
+  chmod(data, 0400);
 
   n = GetData(filedir, "data", 5, 0, 1, 0, 'c', c, &error);
 
+  chmod(format, 0600);
+  chmod(data, 0600);
   unlink(data);
   unlink(format);
   rmdir(filedir);
diff --git a/test/legacy_nframes.c b/test/legacy_nframes.c
index 5447eaf..75c2997 100644
--- a/test/legacy_nframes.c
+++ b/test/legacy_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,13 +21,6 @@
 /* Retreiving the number of frames via the legacy API 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)
 {
 #ifndef GD_LEGACY_API
@@ -36,17 +29,14 @@ int main(void)
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
diff --git a/test/legacy_nonexistent.c b/test/legacy_nonexistent.c
index db7bf37..2aeeb2e 100644
--- a/test/legacy_nonexistent.c
+++ b/test/legacy_nonexistent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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)
 {
 #ifndef GD_LEGACY_API
@@ -36,7 +29,7 @@ int main(void)
   size_t n = GetNFrames("no such dirfile", &error, NULL);
 
   CHECKI(n,0);
-  CHECKI(error, GD_E_IO);
+  CHECKI(error, -GD_E_IO);
 
   return r;
 #endif
diff --git a/test/legacy_put.c b/test/legacy_put.c
index 8782620..5079f87 100644
--- a/test/legacy_put.c
+++ b/test/legacy_put.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Attempt to write UINT8 via the legacy interface*/
 #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)
 {
 #ifndef GD_LEGACY_API
@@ -37,20 +29,17 @@ 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;
   int fd, i, n, error, r = 0;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   n = PutData(filedir, "data", 5, 0, 1, 0, 'c', c, &error);
 
diff --git a/test/legacy_spf.c b/test/legacy_spf.c
index 32e616e..1a2b240 100644
--- a/test/legacy_spf.c
+++ b/test/legacy_spf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,13 +22,6 @@
  * 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)
 {
 #ifndef GD_LEGACY_API
@@ -36,16 +29,13 @@ int main(void)
 #else
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   unsigned int spf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 11\n");
 
   spf = GetSamplesPerFrame(filedir, "data", &error);
 
diff --git a/test/len_bad.c b/test/len_bad.c
new file mode 100644
index 0000000..b32c172
--- /dev/null
+++ b/test/len_bad.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_array_len(D, "carray");
+  CHECKU(n, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/len_carray.c b/test/len_carray.c
new file mode 100644
index 0000000..278cb60
--- /dev/null
+++ b/test/len_carray.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_array_len(D, "carray");
+  error = gd_error(D);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 7);
+
+  return r;
+}
diff --git a/test/len_const.c b/test/len_const.c
new file mode 100644
index 0000000..1e7124b
--- /dev/null
+++ b/test/len_const.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "const CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_array_len(D, "const");
+  CHECKU(n, 1);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/len_sarray.c b/test/len_sarray.c
new file mode 100644
index 0000000..62e1a9d
--- /dev/null
+++ b/test/len_sarray.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray SARRAY a b c d e f g h i j k l m\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_array_len(D, "sarray");
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKI(n, 13);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/len_string.c b/test/len_string.c
new file mode 100644
index 0000000..a6ff993
--- /dev/null
+++ b/test/len_string.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "string STRING value\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_array_len(D, "string");
+  CHECKU(n, 1);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/len_type.c b/test/len_type.c
new file mode 100644
index 0000000..e87eeee
--- /dev/null
+++ b/test/len_type.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_array_len(D, "INDEX");
+  CHECKU(n, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/lzma_enoent.c b/test/lzma_enoent.c
new file mode 100644
index 0000000..954ecec
--- /dev/null
+++ b/test/lzma_enoent.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#ifndef TEST_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#ifdef USE_LZMA
+#define USE_ENC 1
+#endif
+
+#define ENC_NAME "lzma"
+
+#include "enc_enoent.c"
diff --git a/test/lzma_get.c b/test/lzma_get.c
index f64160e..84502c9 100644
--- a/test/lzma_get.c
+++ b/test/lzma_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -28,30 +28,20 @@ int main(void)
   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];
 #ifdef USE_LZMA
   int i;
 #endif
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -F lzma -f %s > /dev/null", XZ, data);
diff --git a/test/lzma_nframes.c b/test/lzma_nframes.c
index 8bbe275..7e539a5 100644
--- a/test/lzma_nframes.c
+++ b/test/lzma_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,73 +18,18 @@
  * 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_LZMA
-  return 77;
-#else
-  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)
-    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 */
-  snprintf(command, 4096, "%s -F lzma -f %s > /dev/null", XZ, data);
-  if (gd_system(command))
-    return 1;
-
-#ifdef USE_LZMA
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-#else
-  D = gd_open(filedir, GD_RDONLY);
+#define ENC_SKIP_TEST 1
 #endif
-  n = gd_nframes(D);
-  error = gd_error(D);
-  gd_discard(D);
-
-  unlink(xzdata);
-  unlink(format);
-  rmdir(filedir);
 
 #ifdef USE_LZMA
-  CHECKI(error, 0);
-  CHECKI(n, 256);
-#else
-  CHECKI(error, GD_E_UNSUPPORTED);
-  CHECKI(n, 0);
+#define USE_ENC 1
 #endif
 
-  return r;
-#endif
-}
+#define ENC_SUFFIX ".lzma"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -F lzma -f %s > /dev/null", XZ, data)
+
+#include "enc_nframes.c"
diff --git a/test/lzma_put.c b/test/lzma_put.c
index f017db5..11ee154 100644
--- a/test/lzma_put.c
+++ b/test/lzma_put.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,26 +29,16 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_lzma = "dirfile/data.lzma";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8] = {40, 41, 42, 43, 44, 45, 46, 47};
-  uint8_t data_data[256];
   char command[4096];
-  int fd, n, e1, e2, r = 0;
+  int n, e1, e2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (uint8_t)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(uint8_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -F lzma -f %s > /dev/null", XZ, data);
diff --git a/test/lzma_xz_add.c b/test/lzma_xz_add.c
index f6646ca..f76c058 100644
--- a/test/lzma_xz_add.c
+++ b/test/lzma_xz_add.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,58 +20,15 @@
  */
 #include "test.h"
 
-int main(void)
-{
 #ifndef TEST_LZMA
-  return 77;
-#else
-  const char *filedir = "dirfile";
-  const char *format = "dirfile/format";
-  const char *data = "dirfile/data.xz";
-  gd_entry_t e;
-  int e1, e2, e3, unlink_data, r = 0;
-  DIRFILE *D;
-
-  rmdirfile();
-#ifdef USE_LZMA
-  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE | GD_LZMA_ENCODED);
-#else
-  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_LZMA_ENCODED);
-#endif
-  gd_add_raw(D, "data", GD_UINT8, 2, 0);
-  e1 = gd_error(D);
-
-  /* check */
-  e2 = gd_entry(D, "data", &e);
-#ifdef USE_LZMA
-  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);
+#define ENC_SKIP_TEST 1
 #endif
 
-  e3 = gd_close(D);
-  CHECKI(e3, 0);
-
-  unlink_data = unlink(data);
-
 #ifdef USE_LZMA
-  CHECKI(unlink_data, 0);
-  CHECKI(e1, GD_E_OK);
-#else
-  CHECKI(unlink_data, -1);
-  CHECKI(e1, GD_E_UNSUPPORTED);
+#define USE_ENC 1
 #endif
 
-  unlink(format);
-  rmdir(filedir);
+#define ENC_SUFFIX ".xz"
+#define ENC_ENCODED GD_LZMA_ENCODED
 
-  return r;
-#endif
-}
+#include "enc_add.c"
diff --git a/test/lzma_xz_complex128.c b/test/lzma_xz_complex128.c
new file mode 100644
index 0000000..ee72dd7
--- /dev/null
+++ b/test/lzma_xz_complex128.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_complex128.c"
diff --git a/test/lzma_xz_complex64.c b/test/lzma_xz_complex64.c
new file mode 100644
index 0000000..db5ef11
--- /dev/null
+++ b/test/lzma_xz_complex64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_complex64.c"
diff --git a/test/lzma_xz_del.c b/test/lzma_xz_del.c
new file mode 100644
index 0000000..477b176
--- /dev/null
+++ b/test/lzma_xz_del.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#ifndef TEST_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#ifdef USE_LZMA
+#define USE_ENC 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_del.c"
diff --git a/test/lzma_xz_float32.c b/test/lzma_xz_float32.c
new file mode 100644
index 0000000..91450aa
--- /dev/null
+++ b/test/lzma_xz_float32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_float32.c"
diff --git a/test/lzma_xz_float64.c b/test/lzma_xz_float64.c
new file mode 100644
index 0000000..e0fc5bf
--- /dev/null
+++ b/test/lzma_xz_float64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_float64.c"
diff --git a/test/lzma_xz_get.c b/test/lzma_xz_get.c
index b67a445..0c2f58f 100644
--- a/test/lzma_xz_get.c
+++ b/test/lzma_xz_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,30 +29,20 @@ int main(void)
   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] = {0, 0, 0, 0, 0, 0, 0, 0};
   char command[4096];
-  uint16_t data_data[256];
 #ifdef USE_LZMA
   int i;
 #endif
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data);
diff --git a/test/lzma_xz_get_cont.c b/test/lzma_xz_get_cont.c
new file mode 100644
index 0000000..fb12e51
--- /dev/null
+++ b/test/lzma_xz_get_cont.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data)
+
+#include "enc_get_cont.c"
diff --git a/test/lzma_xz_get_far.c b/test/lzma_xz_get_far.c
index 9ffd921..0a62216 100644
--- a/test/lzma_xz_get_far.c
+++ b/test/lzma_xz_get_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,27 +29,17 @@ int main(void)
   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, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data);
diff --git a/test/lzma_xz_get_get.c b/test/lzma_xz_get_get.c
index c345210..822d885 100644
--- a/test/lzma_xz_get_get.c
+++ b/test/lzma_xz_get_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,28 +29,18 @@ int main(void)
   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 c1[8], c2[8];
   char command[4096];
-  uint16_t data_data[256];
-  int fd, i, n1, e1, e2, n2, e3, r = 0;
+  int i, n1, e1, e2, n2, e3, r = 0;
   DIRFILE *D;
 
   memset(c1, 0, 16);
   memset(c2, 0, 16);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data);
diff --git a/test/lzma_xz_get_get2.c b/test/lzma_xz_get_get2.c
index 55bc185..53ddc6b 100644
--- a/test/lzma_xz_get_get2.c
+++ b/test/lzma_xz_get_get2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,28 +29,18 @@ int main(void)
   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 c1[8], c2[8];
   char command[4096];
-  uint16_t data_data[256];
-  int fd, i, n1, error1, n2, error2, r = 0;
+  int i, n1, error1, n2, error2, r = 0;
   DIRFILE *D;
 
   memset(c1, 0, 16);
   memset(c2, 0, 16);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data);
diff --git a/test/lzma_xz_get_put.c b/test/lzma_xz_get_put.c
index cd53002..c1b28cf 100644
--- a/test/lzma_xz_get_put.c
+++ b/test/lzma_xz_get_put.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2014, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_xz = "dirfile/data.xz";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   const unsigned char xzdata[300] = {
     0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04,
     0xe6, 0xd6, 0xb4, 0x46, 0x02, 0x00, 0x21, 0x01,
@@ -79,14 +78,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   fd = open(data_xz, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, xzdata, 300);
diff --git a/test/lzma_xz_int16.c b/test/lzma_xz_int16.c
new file mode 100644
index 0000000..79d94ae
--- /dev/null
+++ b/test/lzma_xz_int16.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_int16.c"
diff --git a/test/lzma_xz_int32.c b/test/lzma_xz_int32.c
new file mode 100644
index 0000000..4c37654
--- /dev/null
+++ b/test/lzma_xz_int32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_int32.c"
diff --git a/test/lzma_xz_int64.c b/test/lzma_xz_int64.c
new file mode 100644
index 0000000..e9651ea
--- /dev/null
+++ b/test/lzma_xz_int64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_int64.c"
diff --git a/test/lzma_xz_int8.c b/test/lzma_xz_int8.c
new file mode 100644
index 0000000..8b277a4
--- /dev/null
+++ b/test/lzma_xz_int8.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_int8.c"
diff --git a/test/lzma_xz_move_from.c b/test/lzma_xz_move_from.c
new file mode 100644
index 0000000..f0a8a1e
--- /dev/null
+++ b/test/lzma_xz_move_from.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#ifndef TEST_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#ifdef USE_LZMA
+#define USE_ENC 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define ENC_NAME "lzma"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data)
+
+#include "enc_move_from.c"
diff --git a/test/lzma_xz_move_to.c b/test/lzma_xz_move_to.c
index 4eb62bf..4dbc631 100644
--- a/test/lzma_xz_move_to.c
+++ b/test/lzma_xz_move_to.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,7 +26,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_xz = "dirfile/data.xz";
   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_LZMA
@@ -38,14 +37,12 @@ int main(void)
   struct stat buf;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING none\n/ENDIAN little\n");
 
   fd = open(data_raw, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_in, 256);
diff --git a/test/lzma_xz_nframes.c b/test/lzma_xz_nframes.c
index bc6f592..42af9d1 100644
--- a/test/lzma_xz_nframes.c
+++ b/test/lzma_xz_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,73 +18,18 @@
  * 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 "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_LZMA
-  return 77;
-#else
-  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)
-    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 */
-  snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data);
-  if (gd_system(command))
-    return 1;
-
-#ifdef USE_LZMA
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-#else
-  D = gd_open(filedir, GD_RDONLY);
+#define ENC_SKIP_TEST 1
 #endif
-  n = gd_nframes(D);
-  error = gd_error(D);
-  gd_discard(D);
-
-  unlink(xzdata);
-  unlink(format);
-  rmdir(filedir);
 
 #ifdef USE_LZMA
-  CHECKI(error,0);
-  CHECKI(n,256);
-#else
-  CHECKI(error,GD_E_UNSUPPORTED);
-  CHECKI(n,0);
+#define USE_ENC 1
 #endif
 
-  return r;
-#endif
-}
+#define ENC_SUFFIX ".xz"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data)
+
+#include "enc_nframes.c"
diff --git a/test/lzma_xz_offs_clear.c b/test/lzma_xz_offs_clear.c
new file mode 100644
index 0000000..cad52c8
--- /dev/null
+++ b/test/lzma_xz_offs_clear.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_LZMA || !defined TEST_LZMA || defined NO_LARGE_TESTS
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.xz";
+  uint32_t c = 3;
+  int r = 0, e;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_LZMA_ENCODED | GD_LITTLE_ENDIAN
+      | GD_VERBOSE | GD_CREAT | GD_EXCL);
+  gd_add_spec(D, "data RAW UINT32 1", 0);
+  gd_putdata(D, "data", 2000000, 0, 0, 1, GD_UINT32, &c);
+  e = gd_error(D);
+  CHECKIi(0, e, GD_E_OK);
+  gd_close(D);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_putdata(D, "data", 800000, 0, 0, 1, GD_UINT32, &c);
+  e = gd_error(D);
+  CHECKIi(1, e, GD_E_OK);
+  gd_putdata(D, "data", 100000, 0, 0, 1, GD_UINT32, &c);
+  e = gd_error(D);
+  CHECKIi(1, e, GD_E_OK);
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/lzma_xz_put.c b/test/lzma_xz_put.c
index d5d664a..22a4de4 100644
--- a/test/lzma_xz_put.c
+++ b/test/lzma_xz_put.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_xz = "dirfile/data.xz";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
 #ifdef USE_LZMA
   char command[4096];
@@ -41,14 +40,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
 #ifdef USE_LZMA
   D = gd_open(filedir, GD_RDWR | GD_LZMA_ENCODED | GD_VERBOSE);
diff --git a/test/lzma_xz_put_back.c b/test/lzma_xz_put_back.c
index a0bab71..9fa5f54 100644
--- a/test/lzma_xz_put_back.c
+++ b/test/lzma_xz_put_back.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_xz = "dirfile/data.xz";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   char command[4096];
   uint8_t d;
@@ -39,14 +38,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_LZMA_ENCODED | GD_VERBOSE);
   n1 = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/lzma_xz_put_endian.c b/test/lzma_xz_put_endian.c
index fcdcaed..02bcebc 100644
--- a/test/lzma_xz_put_endian.c
+++ b/test/lzma_xz_put_endian.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,6 +20,12 @@
  */
 #include "test.h"
 
+#ifdef WORDS_BIGENDIAN
+#define ENDIAN "ENDIAN little"
+#else
+#define ENDIAN "ENDIAN big"
+#endif
+
 int main(void)
 {
 #ifndef TEST_LZMA
@@ -29,12 +35,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_xz = "dirfile/data.xz";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT16 8\n"
-#ifdef WORDS_BIGENDIAN
-  "ENDIAN little\n";
-#else
-  "ENDIAN big\n";
-#endif
   uint16_t c[8];
 #ifdef USE_LZMA
   char command[4096];
@@ -46,14 +46,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = (uint16_t)(0x102 * i);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n" ENDIAN "\n");
 
 #ifdef USE_LZMA
   D = gd_open(filedir, GD_RDWR | GD_LZMA_ENCODED | GD_VERBOSE);
diff --git a/test/lzma_xz_put_get.c b/test/lzma_xz_put_get.c
index 1cbe07c..5a92c05 100644
--- a/test/lzma_xz_put_get.c
+++ b/test/lzma_xz_put_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -28,21 +28,18 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *data = "dirfile/data.xz";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d[8];
-  int fd, i, m, n, e1, e2, e3, unlink_data, r = 0;
+  int i, m, n, e1, e2, e3, unlink_data, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
 #ifdef USE_LZMA
   D = gd_open(filedir, GD_RDWR | GD_LZMA_ENCODED | GD_VERBOSE);
diff --git a/test/lzma_xz_put_offs.c b/test/lzma_xz_put_offs.c
new file mode 100644
index 0000000..9e807ed
--- /dev/null
+++ b/test/lzma_xz_put_offs.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined USE_LZMA || !defined TEST_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_put_offs.c"
diff --git a/test/lzma_xz_put_pad.c b/test/lzma_xz_put_pad.c
index c1c57fc..c08434f 100644
--- a/test/lzma_xz_put_pad.c
+++ b/test/lzma_xz_put_pad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_xz = "dirfile/data.xz";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   char command[4096];
   uint8_t d;
@@ -39,14 +38,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_LZMA_ENCODED | GD_VERBOSE);
   n1 = gd_putdata(D, "data", 0, 0, 1, 0, GD_UINT8, c);
diff --git a/test/lzma_xz_seek.c b/test/lzma_xz_seek.c
index 01cfbc6..7e42fc2 100644
--- a/test/lzma_xz_seek.c
+++ b/test/lzma_xz_seek.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,52 +20,17 @@
  */
 #include "test.h"
 
-int main(void)
-{
-#if !defined TEST_LZMA || !defined USE_LZMA
-  return 77;
-#else
-  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";
-  char command[4096];
-  uint16_t 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 * sizeof(uint16_t));
-  close(fd);
-
-  snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data);
-  if (gd_system(command))
-    return 1;
-
-  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-  n = gd_seek(D, "data", 5, 0, GD_SEEK_SET);
-  CHECKI(n,40);
-
-  error = gd_error(D);
-  CHECKI(error,0);
+#ifndef TEST_LZMA
+#define ENC_SKIP_TEST 1
+#endif
 
-  gd_discard(D);
+#ifdef USE_LZMA
+#define USE_ENC 1
+#endif
 
-  unlink(xzdata);
-  unlink(format);
-  rmdir(filedir);
+#define ENC_SUFFIX ".xz"
+#define ENC_NAME "lzma"
+#define ENC_COMPRESS \
+  snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data)
 
-  return r;
-#endif
-}
+#include "enc_seek.c"
diff --git a/test/lzma_xz_seek_far.c b/test/lzma_xz_seek_far.c
index bd1c5e1..26c47c6 100644
--- a/test/lzma_xz_seek_far.c
+++ b/test/lzma_xz_seek_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,25 +29,15 @@ int main(void)
   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";
   char command[4096];
-  uint16_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   snprintf(command, 4096, "%s -f %s > /dev/null", XZ, data);
   if (gd_system(command))
diff --git a/test/lzma_xz_sync.c b/test/lzma_xz_sync.c
index 1290a38..1c52592 100644
--- a/test/lzma_xz_sync.c
+++ b/test/lzma_xz_sync.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,7 +29,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *data_xz = "dirfile/data.xz";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   char command[4096];
   uint8_t d;
@@ -39,14 +38,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_LZMA_ENCODED | GD_VERBOSE);
   gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/lzma_xz_uint16.c b/test/lzma_xz_uint16.c
new file mode 100644
index 0000000..3e9ff0c
--- /dev/null
+++ b/test/lzma_xz_uint16.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_uint16.c"
diff --git a/test/lzma_xz_uint32.c b/test/lzma_xz_uint32.c
new file mode 100644
index 0000000..ef76e12
--- /dev/null
+++ b/test/lzma_xz_uint32.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_uint32.c"
diff --git a/test/lzma_xz_uint64.c b/test/lzma_xz_uint64.c
new file mode 100644
index 0000000..7a112b8
--- /dev/null
+++ b/test/lzma_xz_uint64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_uint64.c"
diff --git a/test/lzma_xz_uint8.c b/test/lzma_xz_uint8.c
new file mode 100644
index 0000000..9326043
--- /dev/null
+++ b/test/lzma_xz_uint8.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#if !defined TEST_LZMA || !defined USE_LZMA
+#define ENC_SKIP_TEST 1
+#endif
+
+#define ENC_SUFFIX ".xz"
+#define GD_ENC_ENCODED GD_LZMA_ENCODED
+
+#include "enc_uint8.c"
diff --git a/test/madd_affix.c b/test/madd_affix.c
index 0fcefa2..3caf4b3 100644
--- a/test/madd_affix.c
+++ b/test/madd_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,13 +26,12 @@ int main(void)
   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;
+  int e1, e2, e3, r = 0;
   DIRFILE *D;
   gd_entry_t E, e;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   memset(&E, 0, sizeof(E));
   E.field = "AdataZ";
@@ -42,11 +41,8 @@ int main(void)
   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));
+  MAKEFORMATFILE(format, "/INCLUDE format1 A Z\n");
+  MAKEEMPTYFILE(format1, 0600);
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   gd_add(D, &E);
diff --git a/test/madd_alias_alias.c b/test/madd_alias_alias.c
new file mode 100644
index 0000000..16b774d
--- /dev/null
+++ b/test/madd_alias_alias.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  gd_add_raw(D, "data", GD_UINT8, 1, 0);
+  gd_madd_alias(D, "data", "alias", "data");
+  gd_madd_alias(D, "data/alias", "alias", "data");
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_alias_subsub.c b/test/madd_alias_subsub.c
new file mode 100644
index 0000000..80531ad
--- /dev/null
+++ b/test/madd_alias_subsub.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  gd_add_raw(D, "data", GD_UINT8, 1, 0);
+  gd_madd_spec(D, "const CONST UINT8 1", "data");
+  gd_madd_alias(D, "data/const", "alias", "data");
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_aliasmeta.c b/test/madd_aliasmeta.c
new file mode 100644
index 0000000..5286cbf
--- /dev/null
+++ b/test/madd_aliasmeta.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_phase(D, "new", "in", 3, 0);
+  gd_add_alias(D, "alias", "new", 0);
+  gd_madd_phase(D, "alias", "data", "in", 0);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_clincom_nfields.c b/test/madd_clincom_nfields.c
new file mode 100644
index 0000000..8055570
--- /dev/null
+++ b/test/madd_clincom_nfields.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  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}};
+#else
+  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;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  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);
+#else
+  gd_madd_clincom(D, "new", "meta", -2, in_fields, m, b);
+#endif
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_cpolynom_order.c b/test/madd_cpolynom_order.c
new file mode 100644
index 0000000..905d2b7
--- /dev/null
+++ b/test/madd_cpolynom_order.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+#ifdef GD_NO_C99_API
+  const double a[4][2] = {{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
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_add_phase(D, "new", "in", 3, 0);
+#ifdef GD_NO_C99_API
+  gd_madd_cpolynom(D, "new", "meta", 33, "in", (const double *)a);
+#else
+  gd_madd_cpolynom(D, "new", "meta", 33, "in", a);
+#endif
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_indir.c b/test/madd_indir.c
new file mode 100644
index 0000000..37777a5
--- /dev/null
+++ b/test/madd_indir.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, ge_error, r = 0;
+  gd_entry_t e;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add_phase(D, "new", "in", 3, 0);
+  gd_madd_indir(D, "new", "meta", "in1", "in2");
+  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_INDIR_ENTRY);
+    CHECKS(e.in_fields[0], "in1");
+    CHECKS(e.in_fields[1], "in2");
+    CHECKI(e.fragment_index, 0);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  return r;
+}
diff --git a/test/madd_lincom_nfields.c b/test/madd_lincom_nfields.c
new file mode 100644
index 0000000..52ca5f2
--- /dev/null
+++ b/test/madd_lincom_nfields.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char *in_fields[2] = {"in1", "in2"};
+  const double m[2] = {1, 0.3};
+  const double b[2] = {0, 0.9};
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_add_phase(D, "new", "in", 3, 0);
+  gd_madd_lincom(D, "new", "meta", 22, in_fields, m, b);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_parent_bad.c b/test/madd_parent_bad.c
new file mode 100644
index 0000000..bee8d71
--- /dev/null
+++ b/test/madd_parent_bad.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, r = 0;
+  DIRFILE *D;
+
+  gd_entry_t E;
+  memset(&E, 0, sizeof(E));
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  E.field = "data";
+  E.fragment_index = 0;
+  E.field_type = GD_CONST_ENTRY;
+  E.EN(scalar,const_type) = GD_UINT8;
+
+  gd_madd(D, &E, "data");
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_polynom_order.c b/test/madd_polynom_order.c
new file mode 100644
index 0000000..8a9e017
--- /dev/null
+++ b/test/madd_polynom_order.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char *in_field = "in";
+  const double a[4] = {1, 0.3, 0.5, 1.8};
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_add_phase(D, "new", "in", 3, 0);
+  gd_madd_polynom(D, "new", "meta", -3, in_field, a);
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_raw.c b/test/madd_raw.c
new file mode 100644
index 0000000..07b54c8
--- /dev/null
+++ b/test/madd_raw.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, r = 0;
+  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_add(D, &E);
+  gd_madd(D, &E, "data");
+  error = gd_error(D);
+
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_sarray.c b/test/madd_sarray.c
new file mode 100644
index 0000000..2899f4b
--- /dev/null
+++ b/test/madd_sarray.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  const char *val[] = {"q", "r", "s", "t", "u", "v"};
+  const char *data[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
+  int n, error;
+  int r = 0;
+  gd_entry_t e;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add_phase(D, "new", "in", 3, 0);
+  gd_madd_sarray(D, "new", "data", 6, val);
+  error = gd_error(D);
+  CHECKI(error, GD_E_OK);
+
+  /* check */
+  gd_entry(D, "new/data", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_SARRAY_ENTRY);
+    gd_free_entry_strings(&e);
+  }
+  n = (int)gd_array_len(D, "new/data");
+  CHECKI(n, 6);
+
+  gd_get_sarray(D, "new/data", data);
+  for (n = 0; n < 6; ++n)
+    CHECKSi(n, data[n], val[n]);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_sarray_dup.c b/test/madd_sarray_dup.c
new file mode 100644
index 0000000..6e5cd7d
--- /dev/null
+++ b/test/madd_sarray_dup.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *val[] = {"q", "r", "s", "t", "u", "v"};
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+
+  e1 = gd_madd_sarray(D, "INDEX", "data", 6, val);
+  CHECKI(e1, 0);
+
+  e2 = gd_madd_sarray(D, "INDEX", "data", 6, val);
+  CHECKI(e2, GD_E_DUPLICATE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_sindir.c b/test/madd_sindir.c
new file mode 100644
index 0000000..b913b02
--- /dev/null
+++ b/test/madd_sindir.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, ge_error, r = 0;
+  gd_entry_t e;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add_phase(D, "new", "in", 3, 0);
+  gd_madd_sindir(D, "new", "meta", "in1", "in2");
+  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_SINDIR_ENTRY);
+    CHECKS(e.in_fields[0], "in1");
+    CHECKS(e.in_fields[1], "in2");
+    CHECKI(e.fragment_index, 0);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  return r;
+}
diff --git a/test/madd_spec_parent.c b/test/madd_spec_parent.c
new file mode 100644
index 0000000..9823f0a
--- /dev/null
+++ b/test/madd_spec_parent.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  e1 = gd_madd_spec(D, "meta CONST UINT8 2", "parent");
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_string_dup.c b/test/madd_string_dup.c
new file mode 100644
index 0000000..35a6e56
--- /dev/null
+++ b/test/madd_string_dup.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  e1 = gd_madd_string(D, "INDEX", "meta", "A string.");
+  CHECKI(e1, 0);
+  e2 = gd_madd_string(D, "INDEX", "meta", "Another string.");
+  CHECKI(e2, GD_E_DUPLICATE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/madd_subsub.c b/test/madd_subsub.c
new file mode 100644
index 0000000..c504de8
--- /dev/null
+++ b/test/madd_subsub.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, r = 0;
+  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_add(D, &E);
+  E.field_type = GD_CONST_ENTRY;
+  E.EN(scalar,const_type) = GD_UINT8;
+  gd_madd(D, &E, "data");
+  gd_madd(D, &E, "data/data");
+  error = gd_error(D);
+
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/match_fragment.c b/test/match_fragment.c
new file mode 100644
index 0000000..3d85373
--- /dev/null
+++ b/test/match_fragment.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2011, 2013, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0;
+  unsigned int n;
+  const char **entry_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data1 RAW UINT8 1\n"
+      "data2 RAW UINT8 1\n"
+      "/HIDDEN data2\n"
+      "/INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data3 RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_match_entries(D, NULL, 1, GD_ALL_ENTRIES, 0, &entry_list);
+
+  CHECKPN(entry_list);
+  CHECKU(n, 1);
+  CHECKP(entry_list[1]);
+  CHECKS(entry_list[0], "data3");
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/match_pcre.c b/test/match_pcre.c
new file mode 100644
index 0000000..a34fd94
--- /dev/null
+++ b/test/match_pcre.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef GD_NO_PCRE
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char **entry_list;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "ae CONST UINT8 1\n"
+      "abe CONST UINT8 1\n"
+      "abet CONST UINT8 1\n"
+      "ade CONST UINT8 1\n"
+      "ape CONST UINT8 1\n"
+      "abbe CONST UINT8 1\n"
+      "ate CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_match_entries(D, "a[bcd]*e$", GD_ALL_FRAGMENTS, GD_ALL_ENTRIES,
+      GD_REGEX_PCRE, &entry_list);
+
+  CHECKU(n, 4);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(entry_list);
+  CHECKS(entry_list[0], "ae");
+  CHECKS(entry_list[1], "abe");
+  CHECKS(entry_list[2], "ade");
+  CHECKS(entry_list[3], "abbe");
+  CHECKP(entry_list[4]);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/match_pcre_bad.c b/test/match_pcre_bad.c
new file mode 100644
index 0000000..95dead7
--- /dev/null
+++ b/test/match_pcre_bad.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef GD_NO_PCRE
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char **entry_list;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "ue CONST UINT8 1\n"
+      "ube CONST UINT8 1\n"
+      "ubet CONST UINT8 1\n"
+      "ude CONST UINT8 1\n"
+      "upe CONST UINT8 1\n"
+      "ubbe CONST UINT8 1\n"
+      "ute CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  /* In non-Javascript-compat PCRE, '\u' results in a compile-time error */
+  n = gd_match_entries(D, "\\u", GD_ALL_FRAGMENTS, GD_ALL_ENTRIES,
+      GD_REGEX_PCRE, &entry_list);
+
+  CHECKU(n, 0);
+
+  error = gd_error(D);
+
+  CHECKI(error, GD_E_ARGUMENT);
+  CHECKP(entry_list);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/match_pcre_caseless.c b/test/match_pcre_caseless.c
new file mode 100644
index 0000000..d74f33b
--- /dev/null
+++ b/test/match_pcre_caseless.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef GD_NO_PCRE
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char **entry_list;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "ae CONST UINT8 1\n"
+      "Abe CONST UINT8 1\n"
+      "aBEt CONST UINT8 1\n"
+      "adE CONST UINT8 1\n"
+      "ape CONST UINT8 1\n"
+      "ABbe CONST UINT8 1\n"
+      "aTe CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_match_entries(D, "a[bcd]*e$", GD_ALL_FRAGMENTS, GD_ALL_ENTRIES,
+      GD_REGEX_PCRE | GD_REGEX_CASELESS, &entry_list);
+
+  CHECKU(n, 4);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(entry_list);
+  CHECKS(entry_list[0], "ae");
+  CHECKS(entry_list[1], "Abe");
+  CHECKS(entry_list[2], "adE");
+  CHECKS(entry_list[3], "ABbe");
+  CHECKP(entry_list[4]);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/match_pcre_ext.c b/test/match_pcre_ext.c
new file mode 100644
index 0000000..c97dc9a
--- /dev/null
+++ b/test/match_pcre_ext.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef GD_NO_PCRE
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char **entry_list;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "ae CONST UINT8 1\n"
+      "abe CONST UINT8 1\n"
+      "abet CONST UINT8 1\n"
+      "ade CONST UINT8 1\n"
+      "ape CONST UINT8 1\n"
+      "abbe CONST UINT8 1\n"
+      "ate CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_match_entries(D, "a[bcd]*# This is a comment\ne$", GD_ALL_FRAGMENTS,
+      GD_ALL_ENTRIES, GD_REGEX_PCRE | GD_REGEX_EXTENDED, &entry_list);
+
+  CHECKU(n, 4);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(entry_list);
+  CHECKS(entry_list[0], "ae");
+  CHECKS(entry_list[1], "abe");
+  CHECKS(entry_list[2], "ade");
+  CHECKS(entry_list[3], "abbe");
+  CHECKP(entry_list[4]);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/match_pcre_js.c b/test/match_pcre_js.c
new file mode 100644
index 0000000..09a309d
--- /dev/null
+++ b/test/match_pcre_js.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef GD_NO_PCRE
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char **entry_list;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "ue CONST UINT8 1\n"
+      "ube CONST UINT8 1\n"
+      "ubet CONST UINT8 1\n"
+      "ude CONST UINT8 1\n"
+      "upe CONST UINT8 1\n"
+      "ubbe CONST UINT8 1\n"
+      "ute CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  /* In Javascript-compat mode, "\u" matches a simple "u" */
+  n = gd_match_entries(D, "\\u[bcd]*e$", GD_ALL_FRAGMENTS, GD_ALL_ENTRIES,
+      GD_REGEX_PCRE | GD_REGEX_JAVASCRIPT, &entry_list);
+
+  CHECKU(n, 4);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(entry_list);
+  CHECKS(entry_list[0], "ue");
+  CHECKS(entry_list[1], "ube");
+  CHECKS(entry_list[2], "ude");
+  CHECKS(entry_list[3], "ubbe");
+  CHECKP(entry_list[4]);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/match_pcre_utf8.c b/test/match_pcre_utf8.c
new file mode 100644
index 0000000..3d240a4
--- /dev/null
+++ b/test/match_pcre_utf8.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef GD_NO_PCRE
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char **entry_list;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "a\"\\u2029\"b CONST UINT8 1\n"
+      "a\"\\u85\"b CONST UINT8 2\n"
+      "a\" \"b CONST UINT8 3\n"
+      );
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_match_entries(D, "a\\Rb", GD_ALL_FRAGMENTS, GD_ALL_ENTRIES,
+      GD_REGEX_PCRE | GD_REGEX_UNICODE, &entry_list);
+  error = gd_error(D);
+
+  if (error == GD_E_ARGUMENT) { /* No utf-8 support in PCRE */
+    CHECKU(n, 0);
+    CHECKP(entry_list);
+  } else {
+    CHECKI(error, 0);
+    CHECKU(n, 2);
+    CHECKPN(entry_list);
+    CHECKS(entry_list[0], "a\xC2\x85""b");
+    CHECKS(entry_list[1], "a\xe2\x80\xa9""b");
+    CHECKP(entry_list[2]);
+  }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/match_regex.c b/test/match_regex.c
new file mode 100644
index 0000000..62c8151
--- /dev/null
+++ b/test/match_regex.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef GD_NO_REGEX
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char **entry_list;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "ae CONST UINT8 1\n"
+      "abe CONST UINT8 1\n"
+      "abet CONST UINT8 1\n"
+      "ade CONST UINT8 1\n"
+      "ape CONST UINT8 1\n"
+      "abbe CONST UINT8 1\n"
+      "ate CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_match_entries(D, "a[bcd]*e$", GD_ALL_FRAGMENTS, GD_ALL_ENTRIES, 0,
+      &entry_list);
+
+  CHECKU(n, 4);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(entry_list);
+  CHECKS(entry_list[0], "ae");
+  CHECKS(entry_list[1], "abe");
+  CHECKS(entry_list[2], "ade");
+  CHECKS(entry_list[3], "abbe");
+  CHECKP(entry_list[4]);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/match_regex_bad.c b/test/match_regex_bad.c
new file mode 100644
index 0000000..7caa093
--- /dev/null
+++ b/test/match_regex_bad.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef GD_NO_REGEX
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char **entry_list;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "ae CONST UINT8 1\n"
+      "abe CONST UINT8 1\n"
+      "abet CONST UINT8 1\n"
+      "ade CONST UINT8 1\n"
+      "ape CONST UINT8 1\n"
+      "abbe CONST UINT8 1\n"
+      "ate CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_match_entries(D, "\\)", GD_ALL_FRAGMENTS, GD_ALL_ENTRIES, 0,
+      &entry_list);
+  CHECKU(n, 0);
+
+  error = gd_error(D);
+
+  CHECKI(error, GD_E_ARGUMENT);
+
+  CHECKP(entry_list);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/match_regex_ext.c b/test/match_regex_ext.c
new file mode 100644
index 0000000..8e5bd82
--- /dev/null
+++ b/test/match_regex_ext.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef GD_NO_REGEX
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char **entry_list;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "ae CONST UINT8 1\n"
+      "abe CONST UINT8 1\n"
+      "abet CONST UINT8 1\n"
+      "ade CONST UINT8 1\n"
+      "ape CONST UINT8 1\n"
+      "abbe CONST UINT8 1\n"
+      "ate CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_match_entries(D, "b{2}", GD_ALL_FRAGMENTS, GD_ALL_ENTRIES,
+      GD_REGEX_EXTENDED, &entry_list);
+
+  CHECKU(n, 1);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(entry_list);
+  CHECKS(entry_list[0], "abbe");
+  CHECKP(entry_list[1]);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/match_regex_icase.c b/test/match_regex_icase.c
new file mode 100644
index 0000000..6f29240
--- /dev/null
+++ b/test/match_regex_icase.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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)
+{
+#ifdef GD_NO_REGEX
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char **entry_list;
+  unsigned int n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "ae CONST UINT8 1\n"
+      "Abe CONST UINT8 1\n"
+      "aBEt CONST UINT8 1\n"
+      "adE CONST UINT8 1\n"
+      "ape CONST UINT8 1\n"
+      "ABbe CONST UINT8 1\n"
+      "aTe CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_match_entries(D, "a[bcd]*e$", GD_ALL_FRAGMENTS, GD_ALL_ENTRIES,
+      GD_REGEX_ICASE, &entry_list);
+
+  CHECKU(n, 4);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(entry_list);
+  CHECKS(entry_list[0], "ae");
+  CHECKS(entry_list[1], "Abe");
+  CHECKS(entry_list[2], "adE");
+  CHECKS(entry_list[3], "ABbe");
+  CHECKP(entry_list[4]);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/flush_meta.c b/test/mflush.c
similarity index 100%
rename from test/flush_meta.c
rename to test/mflush.c
diff --git a/test/mflush_affix.c b/test/mflush_affix.c
new file mode 100644
index 0000000..0489aba
--- /dev/null
+++ b/test/mflush_affix.c
@@ -0,0 +1,95 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, e3, e4, e5, e6, e7, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 [ ]\n");
+  MAKEFORMATFILE(format1,
+      "aaaa CONST UINT8 1\n"
+      "aaaa/sub CONST UINT8 2\n"
+      "/ALIAS cccc aaaa\n"
+      "/HIDDEN aaaa/sub\n"
+      "dddd BIT in aaaa cccc/sub\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+
+  e1 = gd_rewrite_fragment(D, 1);
+  CHECKI(e1, 0);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  e3 = gd_entry(D, "[aaaa]", &E);
+  if (e3)
+    CHECKI(e3, 0);
+  else
+    gd_free_entry_strings(&E);
+
+  e4 = gd_entry(D, "[aaaa]/sub", &E);
+  if (e4)
+    CHECKI(e4, 0);
+  else
+    gd_free_entry_strings(&E);
+
+  e5 = gd_entry(D, "[cccc]", &E);
+  if (e5)
+    CHECKI(e5, 0);
+  else {
+    CHECKS(E.field, "[aaaa]");
+    gd_free_entry_strings(&E);
+  }
+
+  e6 = gd_hidden(D, "[aaaa]/sub");
+  CHECKI(e6, 1);
+
+  e7 = gd_entry(D, "[dddd]", &E);
+  if (e7)
+    CHECKI(e7, 0);
+  else {
+    CHECKS(E.scalar[0], "[aaaa]");
+    CHECKS(E.scalar[1], "[cccc]/sub");
+    CHECKI(E.EN(bit,bitnum), 1);
+    CHECKI(E.EN(bit,numbits), 2);
+    gd_free_entry_strings(&E);
+  }
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/flush_amb_code.c b/test/mflush_amb_code.c
similarity index 100%
rename from test/flush_amb_code.c
rename to test/mflush_amb_code.c
diff --git a/test/mflush_carray.c b/test/mflush_carray.c
new file mode 100644
index 0000000..f17c37e
--- /dev/null
+++ b/test/mflush_carray.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  unsigned e3;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+
+  gd_add_spec(D, "carray CARRAY UINT8 1 2 3 4", 0);
+  gd_add_spec(D, "data RAW UINT8 carray<2>", 0);
+
+  e1 = gd_metaflush(D);
+  CHECKI(e1, GD_E_OK);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  e3 = gd_spf(D, "data");
+  CHECKI(e3, 3);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/flush_hex.c b/test/mflush_hex.c
similarity index 100%
rename from test/flush_hex.c
rename to test/mflush_hex.c
diff --git a/test/mflush_indir.c b/test/mflush_indir.c
new file mode 100644
index 0000000..998b4da
--- /dev/null
+++ b/test/mflush_indir.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+
+  gd_add_spec(D, "indir INDIR A B", 0);
+
+  e1 = gd_metaflush(D);
+  CHECKI(e1, GD_E_OK);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  e3 = gd_entry(D, "indir", &E);
+  if (e3)
+    CHECKI(e3, 0);
+  else {
+    CHECKI(E.field_type, GD_INDIR_ENTRY);
+    CHECKS(E.in_fields[0], "A");
+    CHECKS(E.in_fields[1], "B");
+    gd_free_entry_strings(&E);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/mflush_mplex.c b/test/mflush_mplex.c
new file mode 100644
index 0000000..6c6f327
--- /dev/null
+++ b/test/mflush_mplex.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+
+  gd_add_spec(D, "mplex MPLEX A B 1 2", 0);
+
+  e1 = gd_metaflush(D);
+  CHECKI(e1, GD_E_OK);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  e3 = gd_entry(D, "mplex", &E);
+  if (e3)
+    CHECKI(e3, 0);
+  else {
+    CHECKI(E.field_type, GD_MPLEX_ENTRY);
+    CHECKS(E.in_fields[0], "A");
+    CHECKS(E.in_fields[1], "B");
+    CHECKI(E.EN(mplex,count_val), 1);
+    CHECKI(E.EN(mplex,period), 2);
+    gd_free_entry_strings(&E);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/mflush_ns.c b/test/mflush_ns.c
new file mode 100644
index 0000000..8f24b66
--- /dev/null
+++ b/test/mflush_ns.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, e3, e4, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 NS.");
+  MAKEFORMATFILE(format1, "ns2.data CONST UINT8 1");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_validate(D, "NS.ns2.data");
+  CHECKI(e1, 0);
+
+  e2 = gd_rewrite_fragment(D, GD_ALL_FRAGMENTS);
+  CHECKI(e2, GD_E_OK);
+
+  e3 = gd_close(D);
+  CHECKI(e3, 0);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e4 = gd_validate(D, "NS.ns2.data");
+  CHECKI(e4, 0);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/mflush_pretty.c b/test/mflush_pretty.c
new file mode 100644
index 0000000..0008157
--- /dev/null
+++ b/test/mflush_pretty.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_PRETTY_PRINT |
+      GD_VERBOSE);
+  gd_add_spec(D, "s1 CONST UINT8 1", 0);
+  gd_add_spec(D, "s2 CONST UINT8 1", 0);
+  gd_add_spec(D, "s3 CONST UINT8 1", 0);
+  gd_add_spec(D,
+      "loooooooooooooooooooooooooooooooooooooooooooong CONST UINT8 1", 0);
+
+  e1 = gd_metaflush(D);
+  CHECKI(e1, GD_E_OK);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e3 = gd_validate(D, "loooooooooooooooooooooooooooooooooooooooooooong");
+  CHECKI(e3, 0);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/mflush_prot.c b/test/mflush_prot.c
new file mode 100644
index 0000000..23ff957
--- /dev/null
+++ b/test/mflush_prot.c
@@ -0,0 +1,78 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_VERBOSE);
+  e1 = gd_alter_protection(D, GD_PROTECT_DATA, 0);
+  CHECKI(e1, 0);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e3 = gd_protection(D, 0);
+  CHECKI(e3, GD_PROTECT_DATA);
+
+  e4 = gd_alter_protection(D, GD_PROTECT_ALL, 0);
+  CHECKI(e4, 0);
+
+  e5 = gd_close(D);
+  CHECKI(e5, 0);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e6 = gd_protection(D, 0);
+  CHECKI(e6, GD_PROTECT_ALL);
+
+  e7 = gd_alter_protection(D, GD_PROTECT_FORMAT, 0);
+  CHECKI(e7, 0);
+
+  e8 = gd_close(D);
+  CHECKI(e8, 0);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e9 = gd_protection(D, 0);
+  CHECKI(e9, GD_PROTECT_FORMAT);
+
+  e10 = gd_alter_protection(D, GD_PROTECT_NONE, 0);
+  CHECKI(e10, 0);
+
+  e11 = gd_close(D);
+  CHECKI(e11, 0);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e12 = gd_protection(D, 0);
+  CHECKI(e12, GD_PROTECT_NONE);
+  
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/mflush_ref.c b/test/mflush_ref.c
new file mode 100644
index 0000000..0b5a93b
--- /dev/null
+++ b/test/mflush_ref.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *subdir = "dirfile/sub";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/sub/format";
+  int e1, e2, r = 0;
+  const char *r1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\nREFERENCE data\n");
+  MAKEFORMATFILE(format1, "mata RAW UINT8 11\nREFERENCE mata\n");
+
+  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);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  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/mflush_repr.c b/test/mflush_repr.c
new file mode 100644
index 0000000..87be1c2
--- /dev/null
+++ b/test/mflush_repr.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, e4, e5, r = 0;
+  gd_type_t t1;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_add_spec(D, "real LINCOM data.r 1 0", 0);
+  CHECKI(e1, 0);
+  e2 = gd_add_spec(D, "complex LINCOM data.z 1 0", 0);
+  CHECKI(e2, 0);
+
+  e3 = gd_close(D);
+  CHECKI(e3, 0);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  t1 = gd_native_type(D, "real");
+  CHECKI(t1, GD_FLOAT64);
+  t1 = gd_native_type(D, "complex");
+  CHECKI(t1, GD_COMPLEX128);
+
+  e4 = gd_entry(D, "real", &E);
+  CHECKI(e4, 0);
+  CHECKS(E.in_fields[0], "data.r");
+  gd_free_entry_strings(&E);
+
+  e5 = gd_entry(D, "complex", &E);
+  CHECKI(e5, 0);
+  CHECKS(E.in_fields[0], "data");
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/mflush_repr9.c b/test/mflush_repr9.c
new file mode 100644
index 0000000..0422df0
--- /dev/null
+++ b/test/mflush_repr9.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, e4, e5, e6, r = 0;
+  DIRFILE *D;
+  gd_entry_t E1, E2;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_VERBOSE);
+  e1 = gd_add_spec(D, "i LINCOM r.r 1 0 q/r 1 0 r/q 1 0", 0);
+  CHECKI(e1, 0);
+  e2 = gd_add_spec(D, "z LINCOM m.z 1 0 q/m.z 1 0 m/q.z 1 0", 0);
+  CHECKI(e2, 0);
+
+  e3 = gd_dirfile_standards(D, 9);
+  CHECKI(e3, 9);
+
+  e4 = gd_close(D);
+  CHECKI(e4, 0);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  e5 = gd_entry(D, "i", &E1);
+  if (e5)
+    CHECKI(e5, 0);
+  else {
+    CHECKS(E1.in_fields[0], "r.r");
+    CHECKS(E1.in_fields[1], "q/r");
+    CHECKS(E1.in_fields[2], "r/q");
+    gd_free_entry_strings(&E1);
+  }
+
+  e6 = gd_entry(D, "z", &E2);
+  if (e6)
+    CHECKI(e6, 0);
+  else {
+    CHECKS(E2.in_fields[0], "m.z");
+    CHECKS(E2.in_fields[1], "q/m.z");
+    CHECKS(E2.in_fields[2], "m/q.z");
+    gd_free_entry_strings(&E2);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/mflush_reprz.c b/test/mflush_reprz.c
new file mode 100644
index 0000000..0e1a33c
--- /dev/null
+++ b/test/mflush_reprz.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, e4, e5, r = 0;
+  DIRFILE *D;
+  gd_entry_t E1, E2;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_VERBOSE);
+  e1 = gd_add_spec(D, "i LINCOM r 1 0 q/r 1 0 r/q 1 0", 0);
+  CHECKI(e1, 0);
+  e2 = gd_add_spec(D, "z LINCOM m.z 1 0 q/m.z 1 0 m/q.z 1 0", 0);
+  CHECKI(e2, 0);
+
+  e3 = gd_close(D);
+  CHECKI(e3, 0);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  e4 = gd_entry(D, "i", &E1);
+  if (e4)
+    CHECKI(e4, 0);
+  else {
+    CHECKS(E1.in_fields[0], "r.z");
+    CHECKS(E1.in_fields[1], "q/r.z");
+    CHECKS(E1.in_fields[2], "r/q");
+    gd_free_entry_strings(&E1);
+  }
+
+  e5 = gd_entry(D, "z", &E2);
+  if (e5)
+    CHECKI(e5, 0);
+  else {
+    CHECKS(E2.in_fields[0], "m.z");
+    CHECKS(E2.in_fields[1], "q/m.z");
+    CHECKS(E2.in_fields[2], "m/q");
+    gd_free_entry_strings(&E2);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/mflush_sindir.c b/test/mflush_sindir.c
new file mode 100644
index 0000000..fb1aa88
--- /dev/null
+++ b/test/mflush_sindir.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+
+  gd_add_spec(D, "sindir SINDIR A B", 0);
+
+  e1 = gd_metaflush(D);
+  CHECKI(e1, GD_E_OK);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  e3 = gd_entry(D, "sindir", &E);
+  if (e3)
+    CHECKI(e3, 0);
+  else {
+    CHECKI(E.field_type, GD_SINDIR_ENTRY);
+    CHECKS(E.in_fields[0], "A");
+    CHECKS(E.in_fields[1], "B");
+    gd_free_entry_strings(&E);
+  }
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/flush_spec.c b/test/mflush_spec.c
similarity index 100%
rename from test/flush_spec.c
rename to test/mflush_spec.c
diff --git a/test/flush_string.c b/test/mflush_string.c
similarity index 100%
rename from test/flush_string.c
rename to test/mflush_string.c
diff --git a/test/mflush_type.c b/test/mflush_type.c
new file mode 100644
index 0000000..9bcd976
--- /dev/null
+++ b/test/mflush_type.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  gd_type_t t;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+
+  gd_add_raw(D, "i08", GD_INT8, 1, 0);
+  gd_add_raw(D, "i16", GD_INT16, 1, 0);
+  gd_add_raw(D, "i32", GD_INT32, 1, 0);
+  gd_add_raw(D, "i64", GD_INT64, 1, 0);
+  gd_add_raw(D, "u08", GD_UINT8, 1, 0);
+  gd_add_raw(D, "u16", GD_UINT16, 1, 0);
+  gd_add_raw(D, "u32", GD_UINT32, 1, 0);
+  gd_add_raw(D, "u64", GD_UINT64, 1, 0);
+  gd_add_raw(D, "f32", GD_FLOAT32, 1, 0);
+  gd_add_raw(D, "f64", GD_FLOAT64, 1, 0);
+  gd_add_raw(D, "c64", GD_COMPLEX64, 1, 0);
+  gd_add_raw(D, "c28", GD_COMPLEX128, 1, 0);
+
+  e1 = gd_metaflush(D);
+  CHECKI(e1, GD_E_OK);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  t = gd_native_type(D, "i08"); CHECKIi(0, t, GD_INT8);
+  t = gd_native_type(D, "i16"); CHECKIi(1, t, GD_INT16);
+  t = gd_native_type(D, "i32"); CHECKIi(2, t, GD_INT32);
+  t = gd_native_type(D, "i64"); CHECKIi(3, t, GD_INT64);
+  t = gd_native_type(D, "u08"); CHECKIi(4, t, GD_UINT8);
+  t = gd_native_type(D, "u16"); CHECKIi(5, t, GD_UINT16);
+  t = gd_native_type(D, "u32"); CHECKIi(6, t, GD_UINT32);
+  t = gd_native_type(D, "u64"); CHECKIi(7, t, GD_UINT64);
+  t = gd_native_type(D, "f32"); CHECKIi(8, t, GD_FLOAT32);
+  t = gd_native_type(D, "f64"); CHECKIi(9, t, GD_FLOAT64);
+  t = gd_native_type(D, "c64"); CHECKIi(10, t, GD_COMPLEX64);
+  t = gd_native_type(D, "c28"); CHECKIi(11, t, GD_COMPLEX128);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/mflush_type4.c b/test/mflush_type4.c
new file mode 100644
index 0000000..370bc96
--- /dev/null
+++ b/test/mflush_type4.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, r = 0;
+  gd_type_t t;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+
+  gd_add_raw(D, "i16", GD_INT16, 1, 0);
+  gd_add_raw(D, "i32", GD_INT32, 1, 0);
+  gd_add_raw(D, "u08", GD_UINT8, 1, 0);
+  gd_add_raw(D, "u16", GD_UINT16, 1, 0);
+  gd_add_raw(D, "u32", GD_UINT32, 1, 0);
+  gd_add_raw(D, "f32", GD_FLOAT32, 1, 0);
+  gd_add_raw(D, "f64", GD_FLOAT64, 1, 0);
+
+  e1 = gd_dirfile_standards(D, 4);
+  CHECKI(e1, 4);
+
+  e2 = gd_metaflush(D);
+  CHECKI(e2, GD_E_OK);
+
+  e3 = gd_close(D);
+  CHECKI(e3, 0);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  t = gd_native_type(D, "i16"); CHECKIi(1, t, GD_INT16);
+  t = gd_native_type(D, "i32"); CHECKIi(2, t, GD_INT32);
+  t = gd_native_type(D, "u08"); CHECKIi(4, t, GD_UINT8);
+  t = gd_native_type(D, "u16"); CHECKIi(5, t, GD_UINT16);
+  t = gd_native_type(D, "u32"); CHECKIi(6, t, GD_UINT32);
+  t = gd_native_type(D, "f32"); CHECKIi(8, t, GD_FLOAT32);
+  t = gd_native_type(D, "f64"); CHECKIi(9, t, GD_FLOAT64);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/mflush_windop.c b/test/mflush_windop.c
new file mode 100644
index 0000000..4de5a48
--- /dev/null
+++ b/test/mflush_windop.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+#define CHECKOP(i,f,v) \
+  if (0 == gd_entry(D, f, &E)) { \
+    CHECKIi(i, E.EN(window,windop), v); \
+    gd_free_entry_strings(&E); \
+  }
+  
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int e1, e2, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+
+  gd_add_spec(D, "eq  WINDOW a b EQ  0", 0);
+  gd_add_spec(D, "ge  WINDOW a b GE  0", 0);
+  gd_add_spec(D, "gt  WINDOW a b GT  0", 0);
+  gd_add_spec(D, "le  WINDOW a b LE  0", 0);
+  gd_add_spec(D, "lt  WINDOW a b LT  0", 0);
+  gd_add_spec(D, "ne  WINDOW a b NE  0", 0);
+  gd_add_spec(D, "set WINDOW a b SET 0", 0);
+  gd_add_spec(D, "clr WINDOW a b CLR 0", 0);
+
+  e1 = gd_metaflush(D);
+  CHECKI(e1, GD_E_OK);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  CHECKOP(0, "eq",  GD_WINDOP_EQ );
+  CHECKOP(0, "ge",  GD_WINDOP_GE );
+  CHECKOP(0, "gt",  GD_WINDOP_GT );
+  CHECKOP(0, "le",  GD_WINDOP_LE );
+  CHECKOP(0, "lt",  GD_WINDOP_LT );
+  CHECKOP(0, "ne",  GD_WINDOP_NE );
+  CHECKOP(0, "set", GD_WINDOP_SET);
+  CHECKOP(0, "clr", GD_WINDOP_CLR);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/move_affix.c b/test/move_affix.c
index 8f71b87..4813158 100644
--- a/test/move_affix.c
+++ b/test/move_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,29 +26,19 @@ int main(void)
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "INCLUDE format1 A B\n"
+    "INCLUDE format2 C D\n"
+  );
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+  MAKEFORMATFILE(format2, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   ret = gd_move(D, "AdataB", 2, 0);
diff --git a/test/move_affix_dup.c b/test/move_affix_dup.c
index a58bfb5..4c62c52 100644
--- a/test/move_affix_dup.c
+++ b/test/move_affix_dup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,35 +25,30 @@ 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "INCLUDE format1 A B\n"
+    "INCLUDE format1 C D\n"
+  );
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   ret = gd_move(D, "AdataB", 2, 0);
   error = gd_error(D);
+
+  CHECKI(ret, GD_E_DUPLICATE);
+  CHECKI(error, GD_E_DUPLICATE);
+
   gd_discard(D);
 
   unlink(format1);
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(ret, -1);
-  CHECKI(error, GD_E_DUPLICATE);
-
   return r;
 }
diff --git a/test/move_affix_meta.c b/test/move_affix_meta.c
index 52f013c..639a121 100644
--- a/test/move_affix_meta.c
+++ b/test/move_affix_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,40 +20,26 @@
  */
 #include "test.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)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *format1 = "dirfile/format1";
-  const char *format_data =
-    "INCLUDE format1 A Z\n"
-    "data RAW UINT8 11\n"
-    "data/meta1 CONST UINT8 1\n"
-    "data/meta2 CONST UINT8 2\n"
-    "/ALIAS data/meta3 data/meta2\n";
-  const char *format1_data = "#\n";
-  int fd, ret, e1, e2, e3, e4, e5, r = 0;
+  int ret, e1, e2, e3, e4, e5, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "INCLUDE format1 A Z\n"
+    "data RAW UINT8 11\n"
+    "data/meta1 CONST UINT8 1\n"
+    "data/meta2 CONST UINT8 2\n"
+    "/ALIAS data/meta3 data/meta2\n"
+  );
+  MAKEFORMATFILE(format1, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   ret = gd_move(D, "data", 1, 0);
diff --git a/test/move_affix_updb.c b/test/move_affix_updb.c
index dfaf0e1..da33289 100644
--- a/test/move_affix_updb.c
+++ b/test/move_affix_updb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,34 +26,25 @@ int main(void)
   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"
-    "phase PHASE AdataB 0\n"
-    "/ALIAS alias AdataB\n";
-  const char *format1_data =
-    "data RAW UINT8 11\n"
-    "data/meta CONST UINT8 1\n";
-  const char *format2_data = "#\n";
-  int fd, r1, r2, r3, e1, e2, e3, r = 0;
+  int r1, r2, r3, e1, e2, e3, r = 0;
   const char *s1;
   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);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "INCLUDE format1 A B\n"
+    "INCLUDE format2 C D\n"
+    "phase PHASE AdataB 0\n"
+    "/ALIAS alias AdataB\n"
+  );
+  MAKEFORMATFILE(format1,
+    "data RAW UINT8 11\n"
+    "data/meta CONST UINT8 1\n"
+  );
+  MAKEFORMATFILE(format2, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
 
diff --git a/test/move_alias.c b/test/move_alias.c
index ca12805..dc8a939 100644
--- a/test/move_alias.c
+++ b/test/move_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,24 +25,18 @@ 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "INCLUDE format1\n"
+    "/ALIAS alias data\n"
+    "data RAW UINT8 11\n"
+  );
+  MAKEFORMATFILE(format1, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   ret = gd_move(D, "alias", 1, 0);
diff --git a/test/move_code.c b/test/move_code.c
new file mode 100644
index 0000000..4cc34c9
--- /dev/null
+++ b/test/move_code.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1\ndata RAW UINT8 11");
+  MAKEFORMATFILE(format1, "#\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  error = gd_move(D, "um", 1, 0);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/move_data_enc_ar.c b/test/move_data_enc_ar.c
index 86601bc..4174e29 100644
--- a/test/move_data_enc_ar.c
+++ b/test/move_data_enc_ar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* Test move */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <inttypes.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
@@ -37,9 +28,6 @@ int main(void)
   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";
   int r = 0;
   uint16_t d;
   int fd, i, ret, e1, e2, ge_ret, unlink_data, unlink_txtdata;
@@ -48,15 +36,10 @@ int main(void)
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1\ndata RAW UINT16 11\nENCODING text\n");
+  MAKEFORMATFILE(format1, "ENCODING none\n");
 
   stream = fopen(txtdata, "w");
   for (i = 0; i < 128; ++i)
diff --git a/test/move_data_enc_ra.c b/test/move_data_enc_ra.c
index 388ec74..a5ef7bb 100644
--- a/test/move_data_enc_ra.c
+++ b/test/move_data_enc_ra.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <inttypes.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
@@ -36,34 +27,20 @@ int main(void)
   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;
   char line[100];
-  int fd, i, ret, e1, e2, ge_ret, unlink_data, unlink_txtdata;
+  int i, ret, e1, e2, ge_ret, unlink_data, unlink_txtdata;
   FILE* stream;
   gd_entry_t E;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = fd * 0x201;
-
-  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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1\ndata RAW UINT16 11");
+  MAKEFORMATFILE(format1, "ENCODING text\n");
+  MAKEDATAFILE(data, uint16_t, i * 0x201, 128);
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   ret = gd_move(D, "data", 1, GD_REN_DATA);
diff --git a/test/move_data_enc_un.c b/test/move_data_enc_un.c
new file mode 100644
index 0000000..711dea3
--- /dev/null
+++ b/test/move_data_enc_un.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, unlink_data, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1\ndata RAW UINT16 11");
+  MAKEFORMATFILE(format1, "ENCODING slim\n");
+  MAKEDATAFILE(data, uint16_t, i * 0x201, 128);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  e1 = gd_move(D, "data", 1, GD_REN_DATA);
+  CHECKI(e1, GD_E_UNSUPPORTED);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  unlink_data = unlink(data);
+  rmdir(filedir);
+
+  CHECKI(unlink_data, 0);
+
+  return r;
+}
diff --git a/test/move_data_endian.c b/test/move_data_endian.c
index 3b73158..6c73e65 100644
--- a/test/move_data_endian.c
+++ b/test/move_data_endian.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,49 +20,27 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <inttypes.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\ndata RAW UINT16 11";
-#ifdef WORDS_BIGENDIAN
-  const char *format1_data = "ENDIAN little\n";
-#else
-  const char *format1_data = "ENDIAN big\n";
-#endif
-  uint16_t d, data_data[128];
+  uint16_t d;
   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)
-    data_data[fd] = fd * 0x201;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "/INCLUDE format1\ndata RAW UINT16 11");
+#ifdef WORDS_BIGENDIAN
+  MAKEFORMATFILE(format1, "ENDIAN little\n");
+#else
+  MAKEFORMATFILE(format1, "ENDIAN big\n");
+#endif
+  MAKEDATAFILE(data, uint16_t, i * 0x201, 128);
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   ret = gd_move(D, "data", 1, GD_REN_DATA);
diff --git a/test/move_data_foffs.c b/test/move_data_foffs.c
index 364ec68..a59b560 100644
--- a/test/move_data_foffs.c
+++ b/test/move_data_foffs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,49 +18,27 @@
  * 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"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <inttypes.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\ndata RAW UINT8 11";
-  const char *format1_data = "FRAMEOFFSET 1\n";
-  uint8_t d, data_data[256];
+  uint8_t d;
   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)
-    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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1\ndata RAW UINT8 11");
+  MAKEFORMATFILE(format1, "FRAMEOFFSET 1\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, uint8_t, i, 256);
 
   ret = gd_move(D, "data", 1, GD_REN_DATA);
   error = gd_error(D);
diff --git a/test/move_data_foffs_neg.c b/test/move_data_foffs_neg.c
index 239caba..9f77bc0 100644
--- a/test/move_data_foffs_neg.c
+++ b/test/move_data_foffs_neg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,49 +20,29 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <inttypes.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\n"
-    "data RAW UINT8 11\n"
-    "/FRAMEOFFSET 1\n";
-  const char *format1_data = "FRAMEOFFSET 0\n";
-  uint8_t d, data_data[256];
+  uint8_t d;
   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)
-    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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/INCLUDE format1\n"
+    "data RAW UINT8 11\n"
+    "/FRAMEOFFSET 1\n"
+  );
+  MAKEFORMATFILE(format1, "FRAMEOFFSET 0\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
 
   ret = gd_move(D, "data", 1, GD_REN_DATA);
   error = gd_error(D);
diff --git a/test/move_data_nop.c b/test/move_data_nop.c
index f11b024..58ae071 100644
--- a/test/move_data_nop.c
+++ b/test/move_data_nop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,45 +20,24 @@
  */
 #include "test.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)
 {
   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;
+  int ret, error, ge_ret, r = 0;
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1\ndata RAW UINT8 11");
+  MAKEFORMATFILE(format1, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   ret = gd_move(D, "data", 1, GD_REN_DATA);
   error = gd_error(D);
diff --git a/test/move_data_prot.c b/test/move_data_prot.c
new file mode 100644
index 0000000..8985a21
--- /dev/null
+++ b/test/move_data_prot.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *txtdata = "dirfile/data.txt";
+  int r = 0;
+  int e1, unlink_data, unlink_txtdata;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1\ndata RAW UINT16 11");
+  MAKEFORMATFILE(format1, "/PROTECT data\n/ENCODING text\n");
+  MAKEDATAFILE(data, uint16_t, i * 0x201, 128);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  e1 = gd_move(D, "data", 1, GD_REN_DATA);
+  CHECKI(e1, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  unlink_data = unlink(data);
+  unlink_txtdata = unlink(txtdata);
+  rmdir(filedir);
+
+  CHECKI(unlink_data, 0);
+  CHECKI(unlink_txtdata, -1);
+
+  return r;
+}
diff --git a/test/move_entype.c b/test/move_entype.c
new file mode 100644
index 0000000..b4883ae
--- /dev/null
+++ b/test/move_entype.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "#\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  error = gd_move(D, "INDEX", 1, 0);
+  CHECKI(error, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/move_index.c b/test/move_index.c
index 716c072..1f55328 100644
--- a/test/move_index.c
+++ b/test/move_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,54 +18,41 @@
  * 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"
 
-#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)
 {
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE format1\ndata RAW UINT8 11");
+  MAKEFORMATFILE(format1, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   ret = gd_move(D, "data", 2, 0);
   error = gd_error(D);
+
+  CHECKI(ret, GD_E_BAD_INDEX);
+  CHECKI(error, GD_E_BAD_INDEX);
+
   ge_ret =  gd_entry(D, "data", &E);
+
+  CHECKI(ge_ret, 0);
+  CHECKI(E.fragment_index, 0);
+  gd_free_entry_strings(&E);
+
   gd_discard(D);
 
   unlink(format1);
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(ret, -1);
-  CHECKI(error, GD_E_BAD_INDEX);
-  CHECKI(ge_ret, 0);
-  CHECKI(E.fragment_index, 0);
-  gd_free_entry_strings(&E);
-
   return r;
 }
diff --git a/test/move_meta.c b/test/move_meta.c
index 1b16835..d81f1a4 100644
--- a/test/move_meta.c
+++ b/test/move_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,36 +21,23 @@
 /* Test move */
 #include "test.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)
 {
   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";
-  int fd, ret, error, ge_ret, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "INCLUDE format1\ndata RAW UINT8 11\n"
+    "data/meta CONST UINT8 11\n"
+  );
+  MAKEFORMATFILE(format1, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   ret = gd_move(D, "data", 1, 0);
diff --git a/test/move_move.c b/test/move_move.c
index e4c5c9a..07c5eb2 100644
--- a/test/move_move.c
+++ b/test/move_move.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,20 @@
 /* Test move */
 #include "test.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)
 {
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE format1\ndata RAW UINT8 11");
+  MAKEFORMATFILE(format1, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   ret = gd_move(D, "data", 1, 0);
diff --git a/test/move_nop.c b/test/move_nop.c
new file mode 100644
index 0000000..cd53f44
--- /dev/null
+++ b/test/move_nop.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 11");
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  error = gd_move(D, "data", 0, 0);
+  CHECKI(error, GD_E_OK);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/move_ns.c b/test/move_ns.c
new file mode 100644
index 0000000..cfb6e1b
--- /dev/null
+++ b/test/move_ns.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+ 
+  MAKEFORMATFILE(format, "/INCLUDE format1 ns.\ndata RAW UINT8 11\n");
+  MAKEFORMATFILE(format1, "#\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
+  e1 = gd_move(D, "data", 1, 0);
+  CHECKI(e1, 0);
+  e2 = gd_validate(D, "ns.data");
+  CHECKI(e2, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/move_nsns.c b/test/move_nsns.c
new file mode 100644
index 0000000..aaf7c6d
--- /dev/null
+++ b/test/move_nsns.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 ns1.\n/INCLUDE format2 ns2.\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+  MAKEFORMATFILE(format2, "#\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
+  e1 = gd_move(D, "ns1.data", 2, 0);
+  CHECKI(e1, 0);
+  e2 = gd_validate(D, "ns2.data");
+  CHECKI(e2, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/move_protect.c b/test/move_protect.c
index 44c9001..04db0fe 100644
--- a/test/move_protect.c
+++ b/test/move_protect.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,38 +18,22 @@
  * 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"
 
-#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)
 {
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE format1\ndata RAW UINT8 11");
+  MAKEFORMATFILE(format1, "/PROTECT all\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   ret = gd_move(D, "data", 1, 0);
@@ -61,7 +45,7 @@ int main(void)
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(ret, -1);
+  CHECKI(ret, GD_E_PROTECTED);
   CHECKI(error, GD_E_PROTECTED);
   CHECKI(ge_ret, 0);
   CHECKI(E.fragment_index, 0);
diff --git a/test/move_rdonly.c b/test/move_rdonly.c
new file mode 100644
index 0000000..5b69280
--- /dev/null
+++ b/test/move_rdonly.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1\ndata RAW UINT8 11");
+  MAKEFORMATFILE(format1, "#\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_UNENCODED);
+  error = gd_move(D, "data", 1, 0);
+  CHECKI(error, GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/move_subdir.c b/test/move_subdir.c
index e316309..8866b44 100644
--- a/test/move_subdir.c
+++ b/test/move_subdir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,6 @@
  */
 #include "test.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)
 {
   const char *filedir = "dirfile";
@@ -36,27 +28,17 @@ int main(void)
   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, e1, e2, ge_ret, unlink_data, unlink_new_data, r = 0;
+  int ret, e1, e2, ge_ret, unlink_data, unlink_new_data, r = 0;
   gd_entry_t E;
   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);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE subdir/format1\ndata RAW UINT8 11\n");
+  MAKEFORMATFILE(format1, "#\n");
+  MAKEFORMATFILE(data, "INCLUDE subdir/format1\ndata RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   ret = gd_move(D, "data", 1, GD_REN_DATA);
diff --git a/test/move_unkenc.c b/test/move_unkenc.c
new file mode 100644
index 0000000..4326749
--- /dev/null
+++ b/test/move_unkenc.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/ENCODING none\ndata RAW UINT8 1\n/INCLUDE format1");
+  MAKEFORMATFILE(format1, "/ENCODING something");
+  MAKEDATAFILE(data, uint8_t, i, 100);
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_move(D, "data", 1, GD_REN_DATA);
+  CHECKI(e1, GD_E_UNKNOWN_ENCODING);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/name_affix.c b/test/name_affix.c
index f7b54af..75dae32 100644
--- a/test/name_affix.c
+++ b/test/name_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,27 +25,20 @@ 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, r1, r2, e1, e2, e3, r = 0;
+  int r1, r2, e1, e2, e3, r = 0;
   gd_entype_t type;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "/INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR);
   r1 = gd_rename(D, "AdataZ", "BdataY", 0);
   e1 = gd_error(D);
-  CHECKI(r1, -1);
+  CHECKI(r1, GD_E_BAD_CODE);
   CHECKI(e1, GD_E_BAD_CODE);
 
   r2 = gd_rename(D, "AdataZ", "AzataZ", 0);
diff --git a/test/name_affix_bad.c b/test/name_affix_bad.c
index c670506..445bc1f 100644
--- a/test/name_affix_bad.c
+++ b/test/name_affix_bad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,21 +25,14 @@ 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;
+  int ret, e1, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "/INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_rename(D, "AdataZ", "zata", 0);
@@ -52,7 +45,7 @@ int main(void)
   rmdir(filedir);
 
   CHECKI(e1,GD_E_BAD_CODE);
-  CHECKI(ret,-1);
+  CHECKI(ret,GD_E_BAD_CODE);
 
   return r;
 }
diff --git a/test/name_alias.c b/test/name_alias.c
index 5123424..4c714d7 100644
--- a/test/name_alias.c
+++ b/test/name_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,37 +20,18 @@
  */
 #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, e7, unlink_data, unlink_zata, r = 0;
+  int ret, e0, e1, e2, e3, e4, e5, e6, e7, unlink_data, unlink_zata, r = 0;
   const char **fl;
 #define NFIELDS 10
   const char *field_list[NFIELDS] = {
-    "INDEX", "aata", "bata", "cata", "early", "earlya", "eata", "late", "latea",
-    "zata"
+    "aata", "bata", "cata", "eata", "late", "zata", "INDEX", "early", "latea",
+    "earlya"
   };
   char *s1, *s2, *s3, *s4;
   const char *s5, *s6;
@@ -59,18 +40,19 @@ int main(void)
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "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");
+  MAKEDATAFILE(data, uint8_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR);
   gd_validate(D, "early");
diff --git a/test/name_code.c b/test/name_code.c
new file mode 100644
index 0000000..f6fe80f
--- /dev/null
+++ b/test/name_code.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  e1 = gd_rename(D, "data", "zata", 0);
+  CHECKI(e1,GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/name_dangle.c b/test/name_dangle.c
index 5cc7534..df8c678 100644
--- a/test/name_dangle.c
+++ b/test/name_dangle.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2013 D. V. Wiebe
+/* Copyright (C) 2008-2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,34 +20,17 @@
  */
 #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 MULTIPLY data data\n"
-    "/ALIAS earlya data\n"
-    "late PHASE data 0\n"
-    "/ALIAS latea 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, e1, e2, e3, e4, e5, e6, unlink_data, unlink_zata, r = 0;
+  int ret, e1, e2, e3, e4, e5, e6, unlink_data, unlink_zata, r = 0;
   const char **fl;
 #define NFIELDS 6
   const char *field_list[NFIELDS] = {
-    "INDEX", "cata", "early", "eata", "late", "zata"
+    "cata", "eata", "late", "zata", "INDEX", "early"
   };
   char *s1, *s4;
   const char *s3, *s6;
@@ -56,18 +39,18 @@ int main(void)
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "early MULTIPLY data data\n"
+    "/ALIAS earlya data\n"
+    "late PHASE data 0\n"
+    "/ALIAS latea data\n"
+    "cata RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+    "eata RAW UINT8 8\n"
+    );
+  MAKEDATAFILE(data, uint8_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR);
 
diff --git a/test/name_dot10.c b/test/name_dot10.c
new file mode 100644
index 0000000..65b019d
--- /dev/null
+++ b/test/name_dot10.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r1, e1, r = 0;
+  DIRFILE *D;
+  gd_entry_t E1;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  /* In DSV 10 and later, this gives the field the name "ata" and puts it in the
+   * namespace "d" */
+  gd_dirfile_standards(D, 10);
+  r1 = gd_rename(D, "data", "d.ata", 0);
+  e1 = gd_error(D);
+  CHECKI(r1,0);
+  CHECKI(e1,0);
+  if (gd_entry(D, "d.ata", &E1) == 0)
+    gd_free_entry_strings(&E1);
+  else
+    r = 1;
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/name_dot5.c b/test/name_dot5.c
index c3e5c18..348516e 100644
--- a/test/name_dot5.c
+++ b/test/name_dot5.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,29 +20,18 @@
  */
 #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 = "data RAW UINT8 8\n";
-  int fd, r1, e1, r = 0;
+  int r1, e1, r = 0;
   DIRFILE *D;
   gd_entry_t E1;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR);
 
@@ -53,10 +42,9 @@ int main(void)
   CHECKI(r1,0);
   CHECKI(e1,0);
 
-  if (gd_entry(D, "d.ata", &E1) == 0) {
-    CHECKI(E1.flags & GD_EN_DOTTED, GD_EN_DOTTED);
+  if (gd_entry(D, "d.ata", &E1) == 0)
     gd_free_entry_strings(&E1);
-  } else
+  else
     r = 1;
 
   gd_discard(D);
diff --git a/test/name_dot5r.c b/test/name_dot5r.c
index 9010553..95862b8 100644
--- a/test/name_dot5r.c
+++ b/test/name_dot5r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,36 +20,24 @@
  */
 #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 = "/VERSION 5\nda.ta RAW UINT8 8\n";
-  int fd, r1, e1, r = 0;
+  int r1, e1, r = 0;
   DIRFILE *D;
   gd_entry_t E1, E2;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/VERSION 5\nda.ta RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR);
 
-  if (gd_entry(D, "da.ta", &E1) == 0) {
-    CHECKI(E1.flags & GD_EN_DOTTED, GD_EN_DOTTED);
+  if (gd_entry(D, "da.ta", &E1) == 0)
     gd_free_entry_strings(&E1);
-  } else
+  else
     r = 1;
 
   /* This should always work */
@@ -58,10 +46,9 @@ int main(void)
   CHECKI(r1,0);
   CHECKI(e1,0);
 
-  if (gd_entry(D, "data", &E2) == 0) {
-    CHECKI(E2.flags & GD_EN_DOTTED, 0);
+  if (gd_entry(D, "data", &E2) == 0)
     gd_free_entry_strings(&E2);
-  } else
+  else
     r = 1;
 
   gd_discard(D);
diff --git a/test/name_dot9.c b/test/name_dot9.c
index decd8d3..35ac223 100644
--- a/test/name_dot9.c
+++ b/test/name_dot9.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,17 @@
  */
 #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 = "data RAW UINT8 8\n";
-  int fd, r1, e1, r = 0;
+  int r1, e1, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR);
 
@@ -49,7 +38,7 @@ int main(void)
   gd_dirfile_standards(D, 9);
   r1 = gd_rename(D, "data", "d.ata", 0);
   e1 = gd_error(D);
-  CHECKI(r1,-1);
+  CHECKI(r1,GD_E_BAD_CODE);
   CHECKI(e1,GD_E_BAD_CODE);
 
   gd_discard(D);
diff --git a/test/name_dup.c b/test/name_dup.c
index 2ba07d3..8658482 100644
--- a/test/name_dup.c
+++ b/test/name_dup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,16 +24,13 @@ 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;
+  int ret, e1, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nzata RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDWR);
   ret = gd_rename(D, "data", "zata", 0);
@@ -45,7 +42,7 @@ int main(void)
   rmdir(filedir);
 
   CHECKI(e1,GD_E_DUPLICATE);
-  CHECKI(ret,-1);
+  CHECKI(ret,GD_E_DUPLICATE);
 
   return r;
 }
diff --git a/test/name_index.c b/test/name_index.c
new file mode 100644
index 0000000..06b5c36
--- /dev/null
+++ b/test/name_index.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  e1 = gd_rename(D, "INDEX", "index", 0);
+  CHECKI(e1,GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/name_meta.c b/test/name_meta.c
index dd7c712..caf7467 100644
--- a/test/name_meta.c
+++ b/test/name_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2013 D. V. Wiebe
+/* Copyright (C) 2008-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,34 +20,24 @@
  */
 #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 =
-    "data CONST UINT8 8\n"
-    "data/meta1 CONST UINT8 8\n"
-    "data/meta2 CONST UINT8 8\n"
-    "/ALIAS data/meta3 data\n"
-    "/ALIAS data/meta4 data/meta2\n";
-  int fd, ret, e1, e2, e3, e4, e5, e6, r = 0;
+  int ret, e1, e2, e3, e4, e5, e6, r = 0;
   DIRFILE *D;
   const char *s1, *s2;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data CONST UINT8 8\n"
+    "data/meta1 CONST UINT8 8\n"
+    "data/meta2 CONST UINT8 8\n"
+    "/ALIAS data/meta3 data\n"
+    "/ALIAS data/meta4 data/meta2\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_rename(D, "data", "zata", 0);
diff --git a/test/name_meta2.c b/test/name_meta2.c
new file mode 100644
index 0000000..76be1a6
--- /dev/null
+++ b/test/name_meta2.c
@@ -0,0 +1,120 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, e1, e2, e3, e4, e5, e6, r = 0;
+  const char **fl;
+#define NFIELDS 7
+  const char *field_list[NFIELDS] = {
+    "early", "earlya", "late", "latea", "cata", "zata", "eata"
+  };
+  char *s1, *s2, *s5;
+  const char *s3, *s4, *s6;
+  unsigned nf, i;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "parent/early MULTIPLY parent/data parent/data\n"
+    "/ALIAS parent/earlya parent/data\n"
+    "parent/late PHASE parent/data 0\n"
+    "/ALIAS parent/latea parent/data\n"
+    "parent/cata PHASE parent 0\n"
+    "parent/data PHASE parent 0\n"
+    "parent/eata PHASE parent 0\n"
+  );
+
+  D = gd_open(filedir, GD_RDWR);
+
+  /* force-resolve the early entries */
+  gd_validate(D, "parent/early");
+  gd_validate(D, "parent/earlya");
+
+  ret = gd_rename(D, "parent/data", "zata", 0);
+  e1 = gd_error(D);
+  CHECKI(ret,0);
+  CHECKI(e1,0);
+
+  gd_spf(D, "parent/early");
+  e2 = gd_error(D);
+  CHECKI(e2,GD_E_BAD_CODE);
+
+  gd_spf(D, "parent/late");
+  e3 = gd_error(D);
+  CHECKI(e3,GD_E_BAD_CODE);
+
+  nf = gd_nmfields(D, "parent");
+  CHECKI(nf, NFIELDS);
+  if (nf > NFIELDS)
+    nf = NFIELDS;
+
+  fl = gd_mfield_list(D, "parent");
+  for (i = 0; i < nf; ++i)
+    CHECKSi(i, fl[i], field_list[i]);
+
+  memset(&E, 0, sizeof E);
+  gd_entry(D, "parent/early", &E);
+  s1 = E.in_fields[0];
+  CHECKS(s1, "parent/data");
+  gd_free_entry_strings(&E);
+
+  memset(&E, 0, sizeof E);
+  gd_entry(D, "parent/earlya", &E);
+  e4 = gd_error(D);
+  s2 = E.field;
+  s3 = gd_alias_target(D, "parent/earlya");
+  CHECKI(e4,0);
+  CHECKS(s2, "parent/zata");
+  CHECKS(s3, "parent/zata");
+  gd_free_entry_strings(&E);
+
+  memset(&E, 0, sizeof E);
+  gd_entry(D, "parent/late", &E);
+  s4 = E.in_fields[0];
+  CHECKS(s4, "parent/data");
+  gd_free_entry_strings(&E);
+
+  memset(&E, 0, sizeof E);
+  gd_entry(D, "parent/latea", &E);
+  e5 = gd_error(D);
+  s5 = E.field;
+  s6 = gd_alias_target(D, "parent/earlya");
+  CHECKI(e5,0);
+  CHECKS(s5, "parent/zata");
+  CHECKS(s6, "parent/zata");
+  gd_free_entry_strings(&E);
+
+  e6 = gd_close(D);
+  CHECKI(e6, 0);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/name_move.c b/test/name_move.c
index 9987a30..60678fb 100644
--- a/test/name_move.c
+++ b/test/name_move.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,31 +26,21 @@ int main(void)
   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, e1, e2, unlink_data, unlink_zata, r = 0;
+  int ret, e1, e2, unlink_data, unlink_zata, r = 0;
   const char **fl;
 #define NFIELDS 4
   const char *field_list[NFIELDS] = {
-    "INDEX", "cata", "eata", "zata"
+    "cata", "eata", "zata", "INDEX"
   };
   unsigned i, nf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+      "cata RAW UINT8 8\ndata RAW UINT8 8\neata RAW UINT8 8\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_rename(D, "data", "zata", GD_REN_DATA);
diff --git a/test/name_move_alias.c b/test/name_move_alias.c
index 22d02c5..59e2e7b 100644
--- a/test/name_move_alias.c
+++ b/test/name_move_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,31 +26,21 @@ int main(void)
   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, e1, e2, unlink_data, unlink_zata, r = 0;
+  int ret, e1, e2, unlink_data, unlink_zata, r = 0;
   unsigned i, nf;
   const char **fl;
 #define NFIELDS 4
   const char *field_list[NFIELDS] = {
-    "INDEX", "cata", "eata", "zata"
+    "cata", "eata", "zata", "INDEX"
   };
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+      "cata RAW UINT8 8\n/ALIAS data cata\neata RAW UINT8 8\n");
+  MAKEDATAFILE(data, uint8_t, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_rename(D, "data", "zata", GD_REN_DATA);
diff --git a/test/name_name.c b/test/name_name.c
index 9a2d2e9..6b61bdb 100644
--- a/test/name_name.c
+++ b/test/name_name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2013 D. V. Wiebe
+/* Copyright (C) 2008-2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,34 +20,17 @@
  */
 #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 MULTIPLY data data\n"
-    "/ALIAS earlya data\n"
-    "late PHASE data 0\n"
-    "/ALIAS latea 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, e1, e2, e3, e4, e5, e6, unlink_data, unlink_zata, r = 0;
+  int ret, e1, e2, e3, e4, e5, e6, unlink_data, unlink_zata, r = 0;
   const char **fl;
 #define NFIELDS 8
   const char *field_list[NFIELDS] = {
-    "INDEX", "cata", "early", "earlya", "eata", "late", "latea", "zata"
+    "cata", "eata", "late", "zata", "INDEX", "early", "latea", "earlya"
   };
   char *s1, *s2, *s5;
   const char *s3, *s4, *s6;
@@ -56,18 +39,18 @@ int main(void)
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "early MULTIPLY data data\n"
+    "/ALIAS earlya data\n"
+    "late PHASE data 0\n"
+    "/ALIAS latea data\n"
+    "cata RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+    "eata RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR);
 
diff --git a/test/name_ns.c b/test/name_ns.c
new file mode 100644
index 0000000..b4691b2
--- /dev/null
+++ b/test/name_ns.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2008-2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  gd_rename(D, "ns.data", "ns.zata", 0);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/name_ns2.c b/test/name_ns2.c
new file mode 100644
index 0000000..0edff34
--- /dev/null
+++ b/test/name_ns2.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2008-2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  gd_rename(D, "ns.data", "ns2.zata", 0);
+  e1 = gd_error(D);
+  CHECKI(e1,GD_E_BAD_CODE);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/name_nsdot.c b/test/name_nsdot.c
new file mode 100644
index 0000000..af00930
--- /dev/null
+++ b/test/name_nsdot.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 ns.\n");
+  MAKEFORMATFILE(format1, "data CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  gd_rename(D, "ns.data", ".ns.zata", 0);
+  e1 = gd_error(D);
+  CHECKI(e1,GD_E_BAD_CODE);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/name_prot.c b/test/name_prot.c
new file mode 100644
index 0000000..a64b89f
--- /dev/null
+++ b/test/name_prot.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n/PROTECT all\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  e1 = gd_rename(D, "data", "zata", 0);
+  CHECKI(e1,GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/name_rdonly.c b/test/name_rdonly.c
new file mode 100644
index 0000000..011910c
--- /dev/null
+++ b/test/name_rdonly.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  e1 = gd_rename(D, "data", "zata", 0);
+  CHECKI(e1,GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/name_updb.c b/test/name_updb.c
index 6d9e8e8..9e927d1 100644
--- a/test/name_updb.c
+++ b/test/name_updb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2014 D. V. Wiebe
+/* Copyright (C) 2011-2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,25 +24,23 @@ 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"
-    "lincom LINCOM data 1 0 INDEX 1 0 data 1 0\n"
-    "phase PHASE data2 0\n";
-  int fd, e1, e2, e3, e4, e5, e6, r = 0;
+  int e1, e2, e3, e4, e5, e6, r = 0;
   char *s1, *s2, *s4, *s5, *s6, *s7;
   const char *s3;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "early PHASE data 0\n"
+    "late PHASE data 0\n"
+    "/ALIAS bata data\n"
+    "data RAW UINT8 8\n"
+    "lincom LINCOM data 1 0 INDEX 1 0 data 1 0\n"
+    "phase PHASE data2 0\n"
+  );
 
   D = gd_open(filedir, GD_RDWR);
   gd_validate(D, "early");
diff --git a/test/name_updb_affix.c b/test/name_updb_affix.c
index a58ac38..f99e4b2 100644
--- a/test/name_updb_affix.c
+++ b/test/name_updb_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,26 +25,20 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *format1 = "dirfile/format1";
-  const char *format_data =
-    "data RAW UINT8 8\n"
-    "AphaseZ PHASE data 0\n"
-    "AphaseZ/meta CONST UINT8 3\n"
-    "/INCLUDE format1 A Z\n";
-  const char *format1_data = "bit BIT phase phase/meta 1\n";
-  int fd, r1, r2, r3, e1, e2, e3, e4, e5, e6, r = 0;
+  int r1, r2, r3, e1, e2, e3, e4, e5, e6, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 8\n"
+    "AphaseZ PHASE data 0\n"
+    "AphaseZ/meta CONST UINT8 3\n"
+    "/INCLUDE format1 A Z\n"
+  );
+  MAKEFORMATFILE(format1, "bit BIT phase phase/meta 1\n");
 
   D = gd_open(filedir, GD_RDWR);
 
@@ -61,7 +55,7 @@ int main(void)
 
   r1 = gd_rename(D, "AphaseZ", "zata", GD_REN_UPDB);
   e3 = gd_error(D);
-  CHECKI(r1, -1);
+  CHECKI(r1, GD_E_BAD_CODE);
   CHECKI(e3, GD_E_BAD_CODE);
 
   r2 = gd_rename(D, "AphaseZ", "zata", GD_REN_UPDB | GD_REN_FORCE);
diff --git a/test/name_updb_alias.c b/test/name_updb_alias.c
index 816b4d5..5edf5d9 100644
--- a/test/name_updb_alias.c
+++ b/test/name_updb_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,15 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = 
+  int e0, e1, e2, e3, e4, e5, e6, r = 0;
+  const char *s1, *s2, *s3, *s4, *s5, *s6;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "early  PHASE cata 0\n"
     "earlya PHASE data 0\n"
     "/ALIAS aata cata\n"
@@ -32,18 +40,8 @@ int main(void)
     "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;
-  const 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);
+    "/ALIAS data cata\n"
+  );
 
   D = gd_open(filedir, GD_RDWR);
   gd_validate(D, "early");
diff --git a/test/name_updb_carray.c b/test/name_updb_carray.c
index 119100f..ec8fd9e 100644
--- a/test/name_updb_carray.c
+++ b/test/name_updb_carray.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,20 +24,19 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = 
-    "phase PHASE INDEX data<3>\n"
-    "data CARRAY UINT8 8 9 10 11 12\n"
-    "lincom LINCOM INDEX data data<1>\n";
-  int fd, e1, e2, e3, r = 0;
+  int e1, e2, e3, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "phase PHASE INDEX data<3>\n"
+    "data CARRAY UINT8 8 9 10 11 12\n"
+    "indir INDIR INDEX data\n"
+    "lincom LINCOM INDEX data data<1>\n"
+    );
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
 
@@ -61,6 +60,10 @@ int main(void)
   CHECKI(E.scalar_ind[GD_MAX_LINCOM], 1);
   gd_free_entry_strings(&E);
 
+  gd_entry(D, "indir", &E);
+  CHECKS(E.in_fields[1], "zata");
+  gd_free_entry_strings(&E);
+
   gd_discard(D);
 
   unlink(format);
diff --git a/test/name_updb_const.c b/test/name_updb_const.c
index 420f39c..d160a8e 100644
--- a/test/name_updb_const.c
+++ b/test/name_updb_const.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2013 D. V. Wiebe
+/* Copyright (C) 2011-2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,41 +24,40 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = 
-    "early RAW UINT8 c\n"
-    "late LINCOM early c 0\n"
-    "/ALIAS b c\n"
-    "c CONST UINT8 2\n";
-  int fd, e1, e2, e3, r = 0;
-  const char *s1, *s2, *s3;
+  int e1, e2, e3, r = 0;
+  const char *s3;
   DIRFILE *D;
   gd_entry_t E;
 
   memset(&E, 0, sizeof(E));
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "early RAW UINT8 c\n"
+    "late LINCOM early c 0\n"
+    "polynom POLYNOM INDEX 1 c 1\n"
+    "/ALIAS b c\n"
+    "c CONST UINT8 2\n"
+    );
 
   D = gd_open(filedir, GD_RDWR);
   gd_validate(D, "early");
+
   gd_rename(D, "c", "d", GD_REN_UPDB);
   e1 = gd_error(D);
+  CHECKI(e1,0);
+
   gd_spf(D, "early");
   e2 = gd_error(D);
+  CHECKI(e2,0);
 
   gd_entry(D, "early", &E);
-  s1 = E.scalar[0];
-  CHECKI(e1,0);
-  CHECKS(s1, "d");
+  CHECKSi(1, E.scalar[0], "d");
   gd_free_entry_strings(&E);
 
   gd_entry(D, "late", &E);
-  s2 = E.scalar[0];
-  CHECKI(e2,0);
-  CHECKS(s2, "d");
+  CHECKSi(2, E.scalar[0], "d");
   gd_free_entry_strings(&E);
 
   gd_entry(D, "b", &E);
@@ -68,6 +67,10 @@ int main(void)
   CHECKS(s3, "d");
   gd_free_entry_strings(&E);
 
+  gd_entry(D, "polynom", &E);
+  CHECKS(E.scalar[1], "d");
+  gd_free_entry_strings(&E);
+
   gd_discard(D);
 
   unlink(format);
diff --git a/test/name_updb_const_alias.c b/test/name_updb_const_alias.c
index 34bb2e9..3381a03 100644
--- a/test/name_updb_const_alias.c
+++ b/test/name_updb_const_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,23 +24,21 @@ 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;
+  int e1, e2, e3, e4, r = 0;
   const char *s1, *s2, *s3;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "early RAW UINT8 c\n"
+    "late RAW UINT8 c\n"
+    "/ALIAS b c\n"
+    "e CONST UINT8 2\n"
+    "/ALIAS c e\n"
+  );
 
   D = gd_open(filedir, GD_RDWR);
   gd_validate(D, "early");
diff --git a/test/name_updb_sarray.c b/test/name_updb_sarray.c
new file mode 100644
index 0000000..515cbf3
--- /dev/null
+++ b/test/name_updb_sarray.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "data SARRAY UINT8 8 9 10 11 12\n"
+    "sindir SINDIR index data\n"
+  );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+
+  gd_rename(D, "data", "zata", GD_REN_UPDB);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  gd_entry(D, "sindir", &E);
+  e2 = gd_error(D);
+  CHECKI(e2, 0);
+  CHECKS(E.in_fields[0], "index");
+  CHECKS(E.in_fields[1], "zata");
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/native_bit.c b/test/native_bit.c
index 22abf86..3364b26 100644
--- a/test/native_bit.c
+++ b/test/native_bit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "bit BIT data 1\n"
-    "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "bit BIT data 1\n"
+    "data RAW UINT8 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_code.c b/test/native_code.c
new file mode 100644
index 0000000..bc85593
--- /dev/null
+++ b/test/native_code.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+  gd_type_t t1;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+
+  t1 = gd_native_type(D, "missing");
+  e1 = gd_error(D);
+  CHECKU(t1, GD_UNKNOWN);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/native_const.c b/test/native_const.c
index 526fd2b..ef818cb 100644
--- a/test/native_const.c
+++ b/test/native_const.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2014 D. V. Wiebe
+/* Copyright (C) 2013, 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,17 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "const CONST UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_lincom.c b/test/native_lincom.c
index abf9a6b..21837a2 100644
--- a/test/native_lincom.c
+++ b/test/native_lincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "lincom LINCOM data 1 0\n"
-    "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "lincom LINCOM data 1 0\n"
+    "data RAW UINT8 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_lincom_cmpin.c b/test/native_lincom_cmpin.c
index 2cd24a8..9a1c695 100644
--- a/test/native_lincom_cmpin.c
+++ b/test/native_lincom_cmpin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "lincom LINCOM data 1 0\n"
-    "data RAW COMPLEX64 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "lincom LINCOM data 1 0\n"
+    "data RAW COMPLEX64 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_lincom_cmpscal.c b/test/native_lincom_cmpscal.c
index 055c3af..865f6c1 100644
--- a/test/native_lincom_cmpscal.c
+++ b/test/native_lincom_cmpscal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "lincom LINCOM data 1;1 0\n"
-    "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "lincom LINCOM data 1;1 0\n"
+    "data RAW UINT8 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_linterp.c b/test/native_linterp.c
index 45e4d8a..8343883 100644
--- a/test/native_linterp.c
+++ b/test/native_linterp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,20 +25,18 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *table = "dirfile/table";
-  const char *format_data =
-    "linterp LINTERP data table\n"
-    "data RAW UINT8 11\n";
   const char *table_data = "0 0\n1 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "linterp LINTERP data table\n"
+    "data RAW UINT8 11\n"
+  );
 
   fd = open(table, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, table_data, strlen(table_data));
diff --git a/test/native_linterp_cmp.c b/test/native_linterp_cmp.c
index 91c1e07..f617124 100644
--- a/test/native_linterp_cmp.c
+++ b/test/native_linterp_cmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,20 +25,18 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *table = "dirfile/table";
-  const char *format_data =
-    "linterp LINTERP data table\n"
-    "data RAW UINT8 11\n";
   const char *table_data = "0 0;1\n1 1;1\n";
   int fd, error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "linterp LINTERP data table\n"
+    "data RAW UINT8 11\n"
+  );
 
   fd = open(table, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, table_data, strlen(table_data));
diff --git a/test/native_mult.c b/test/native_mult.c
index eee2b7d..3aa7bb9 100644
--- a/test/native_mult.c
+++ b/test/native_mult.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "mult MULTIPLY data data\n"
-    "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "mult MULTIPLY data data\n"
+    "data RAW UINT8 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_mult1.c b/test/native_mult1.c
index e9ecd72..ff5762f 100644
--- a/test/native_mult1.c
+++ b/test/native_mult1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,20 +24,18 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "mult MULTIPLY cdata data\n"
-    "data RAW UINT8 11\n"
-    "cdata RAW COMPLEX128 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "mult MULTIPLY cdata data\n"
+    "data RAW UINT8 11\n"
+    "cdata RAW COMPLEX128 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_mult2.c b/test/native_mult2.c
index 3655bc2..25ec6df 100644
--- a/test/native_mult2.c
+++ b/test/native_mult2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,20 +24,18 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "mult MULTIPLY data cdata\n"
-    "data RAW UINT8 11\n"
-    "cdata RAW COMPLEX128 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "mult MULTIPLY data cdata\n"
+    "data RAW UINT8 11\n"
+    "cdata RAW COMPLEX128 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_phase.c b/test/native_phase.c
index 0ea04bb..881aaa6 100644
--- a/test/native_phase.c
+++ b/test/native_phase.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "phase PHASE data 1\n"
-    "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "phase PHASE data 1\n"
+    "data RAW UINT8 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_polynom.c b/test/native_polynom.c
index 78c8036..c550d7c 100644
--- a/test/native_polynom.c
+++ b/test/native_polynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "polynom POLYNOM data 1 0\n"
-    "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "polynom POLYNOM data 1 0\n"
+    "data RAW UINT8 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_polynom_cmpin.c b/test/native_polynom_cmpin.c
index 3c35b68..df85467 100644
--- a/test/native_polynom_cmpin.c
+++ b/test/native_polynom_cmpin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "polynom POLYNOM data 1 0\n"
-    "data RAW COMPLEX128 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "polynom POLYNOM data 1 0\n"
+    "data RAW COMPLEX128 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_polynom_cmpscal.c b/test/native_polynom_cmpscal.c
index 6f047f6..4d1e675 100644
--- a/test/native_polynom_cmpscal.c
+++ b/test/native_polynom_cmpscal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "polynom POLYNOM data 1;1 0\n"
-    "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "polynom POLYNOM data 1;1 0\n"
+    "data RAW UINT8 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_raw.c b/test/native_raw.c
index 1a33278..7850dc2 100644
--- a/test/native_raw.c
+++ b/test/native_raw.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,17 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_recip.c b/test/native_recip.c
index df3608f..f423864 100644
--- a/test/native_recip.c
+++ b/test/native_recip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "recip RECIP data 1\n"
-    "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "recip RECIP data 1\n"
+    "data RAW UINT8 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_recip_cmpin.c b/test/native_recip_cmpin.c
index fd9ee0a..f58d1ab 100644
--- a/test/native_recip_cmpin.c
+++ b/test/native_recip_cmpin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "recip RECIP data 1\n"
-    "data RAW COMPLEX128 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "recip RECIP data 1\n"
+    "data RAW COMPLEX128 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_recip_cmpscal.c b/test/native_recip_cmpscal.c
index b45aa46..b110207 100644
--- a/test/native_recip_cmpscal.c
+++ b/test/native_recip_cmpscal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "recip RECIP data 1;1\n"
-    "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "recip RECIP data 1;1\n"
+    "data RAW UINT8 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_recurse.c b/test/native_recurse.c
new file mode 100644
index 0000000..8a4f228
--- /dev/null
+++ b/test/native_recurse.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+  gd_type_t t1;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "phase PHASE phase 0");
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  t1 = gd_native_type(D, "phase");
+  e1 = gd_error(D);
+  CHECKU(t1, GD_UNKNOWN);
+  CHECKI(e1, GD_E_RECURSE_LEVEL);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/native_reprz.c b/test/native_reprz.c
new file mode 100644
index 0000000..6ca55ca
--- /dev/null
+++ b/test/native_reprz.c
@@ -0,0 +1,72 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, e4, r = 0;
+  DIRFILE *D;
+  gd_type_t t1, t2, t3, t4;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "code RAW UINT64 1\n"
+      "code.r RAW COMPLEX128 1\n"
+      "more.r RAW COMPLEX64 1\n"
+      );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  /* Real part of "code" */
+  t1 = gd_native_type(D, "code.r");
+  e1 = gd_error(D);
+  CHECKU(t1, GD_UINT64);
+  CHECKI(e1, 0);
+
+  /* Native type of code.r */
+  t2 = gd_native_type(D, "code.r.z");
+  e2 = gd_error(D);
+  CHECKU(t2, GD_COMPLEX128);
+  CHECKI(e2, 0);
+
+  /* Real part of code.r */
+  t3 = gd_native_type(D, "code.r.r");
+  e3 = gd_error(D);
+  CHECKU(t3, GD_FLOAT64);
+  CHECKI(e3, 0);
+
+  /* Native type of more.r */
+  t4 = gd_native_type(D, "more.r");
+  e4 = gd_error(D);
+  CHECKU(t4, GD_COMPLEX64);
+  CHECKI(e4, 0);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/native_sbit.c b/test/native_sbit.c
index 3f63241..9e0b6f2 100644
--- a/test/native_sbit.c
+++ b/test/native_sbit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,19 +24,17 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "sbit SBIT data 1\n"
-    "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "sbit SBIT data 1\n"
+    "data RAW UINT8 11\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/native_string.c b/test/native_string.c
index d081a2c..5c29dad 100644
--- a/test/native_string.c
+++ b/test/native_string.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,23 +24,20 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "string STRING value\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_type_t type;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "string STRING value\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
   type = gd_native_type(D, "string");
   error = gd_error(D);
-  CHECKU(type, GD_NULL);
+  CHECKU(type, GD_STRING);
   CHECKI(error, 0);
 
   gd_discard(D);
diff --git a/test/nentries_alias.c b/test/nentries_alias.c
index 88d75ea..7e747b2 100644
--- a/test/nentries_alias.c
+++ b/test/nentries_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,42 +20,34 @@
  */
 #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;
+  int error, r = 0;
   unsigned int nfields;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+      "data1 RAW UINT8 1\n"
+      "/ALIAS data2 data1\n"
+      "/ALIAS data3 data4\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
   nfields = gd_nentries(D, NULL, GD_ALIAS_ENTRIES, 0);
+  CHECKI(nfields, 2);
+
   error = gd_error(D);
+  CHECKI(error, 0);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, 0);
-  CHECKI(nfields, 2);
-
   return r;
 }
diff --git a/test/nentries_entype.c b/test/nentries_entype.c
new file mode 100644
index 0000000..bffa36c
--- /dev/null
+++ b/test/nentries_entype.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  nfields = gd_nentries(D, NULL, 999, 0);
+  CHECKI(nfields, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_ENTRY);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/nentries_hidden.c b/test/nentries_hidden.c
index 6886b4c..e358fd7 100644
--- a/test/nentries_hidden.c
+++ b/test/nentries_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -39,28 +46,19 @@ int main(void)
     "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);
+    "string2 STRING value\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nentries(D, NULL, GD_ALL_ENTRIES, GD_ENTRIES_HIDDEN);
+  CHECKI(nfields, 8);
+
   error = gd_error(D);
+  CHECKI(error, 0);
+
   gd_discard(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
index b763f84..f94394b 100644
--- a/test/nentries_noalias.c
+++ b/test/nentries_noalias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,43 +24,41 @@ 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;
+  int error, r = 0;
   unsigned int nfields;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+      "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");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nentries(D, NULL, GD_ALL_ENTRIES, GD_ENTRIES_NOALIAS);
+  CHECKI(nfields, 8);
+
   error = gd_error(D);
+  CHECKI(error, 0);
+
   gd_discard(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
index f8f4195..d7d4bde 100644
--- a/test/nentries_scalar.c
+++ b/test/nentries_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,43 +24,41 @@ 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;
+  int error, r = 0;
   unsigned int nfields;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+      "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");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nentries(D, NULL, GD_SCALAR_ENTRIES, 0);
+  CHECKI(nfields, 3);
+
   error = gd_error(D);
+  CHECKI(error, 0);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, 0);
-  CHECKI(nfields, 3);
-
   return r;
 }
diff --git a/test/nfields_hidden.c b/test/nfields_hidden.c
index 65106f7..3d78ba0 100644
--- a/test/nfields_hidden.c
+++ b/test/nfields_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -39,17 +46,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nfields(D);
diff --git a/test/nfields_nfields.c b/test/nfields_nfields.c
index a29e30e..0f611fb 100644
--- a/test/nfields_nfields.c
+++ b/test/nfields_nfields.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,18 +21,18 @@
 /* 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 <string.h>
-#include <errno.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -45,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nfields(D);
diff --git a/test/nfields_type.c b/test/nfields_type.c
index b2fd967..bfdcf78 100644
--- a/test/nfields_type.c
+++ b/test/nfields_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,18 +21,18 @@
 /* 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 <string.h>
-#include <errno.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -45,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nfields_by_type(D, GD_STRING_ENTRY);
diff --git a/test/nfields_type_hidden.c b/test/nfields_type_hidden.c
index cba34f1..cdc4d5d 100644
--- a/test/nfields_type_hidden.c
+++ b/test/nfields_type_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -38,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nfields_by_type(D, GD_STRING_ENTRY);
diff --git a/test/nfields_vector.c b/test/nfields_vector.c
index 4135cdc..a9ddab9 100644
--- a/test/nfields_vector.c
+++ b/test/nfields_vector.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -38,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nvectors(D);
diff --git a/test/nfields_vector_hidden.c b/test/nfields_vector_hidden.c
index 75cbd5a..fb431de 100644
--- a/test/nfields_vector_hidden.c
+++ b/test/nfields_vector_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -39,17 +46,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nvectors(D);
diff --git a/test/nframes64.c b/test/nframes64.c
index 0938196..df44142 100644
--- a/test/nframes64.c
+++ b/test/nframes64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -23,30 +23,20 @@
 
 #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 1\n";
   int fd, r = 0;
   size_t n;
   const size_t len = strlen(data);
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
diff --git a/test/nframes_empty.c b/test/nframes_empty.c
index 1b2f030..38d61d9 100644
--- a/test/nframes_empty.c
+++ b/test/nframes_empty.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,12 +21,6 @@
 /* Requesting the number of frames from an empty dirfile should fail cleanly */
 #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";
@@ -36,8 +30,8 @@ int main(void)
   size_t n;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_nframes(D);
diff --git a/test/nframes_invalid.c b/test/nframes_invalid.c
index 655b9ed..db0b356 100644
--- a/test/nframes_invalid.c
+++ b/test/nframes_invalid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,21 +18,14 @@
  * 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"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   int error, r = 0;
   DIRFILE *D;
-  size_t n;
+  off_t n;
 
   rmdirfile();
   D = gd_open(filedir, GD_RDONLY);
@@ -40,7 +33,7 @@ int main(void)
   error = gd_error(D);
   gd_discard(D);
 
-  CHECKU(n, 0);
+  CHECKU(n, GD_E_BAD_DIRFILE);
   CHECKI(error, GD_E_BAD_DIRFILE);
 
   return r;
diff --git a/test/nframes_nframes.c b/test/nframes_nframes.c
index eeb1593..d6188b3 100644
--- a/test/nframes_nframes.c
+++ b/test/nframes_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,20 @@
 /* Retreiving the number of frames 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 *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);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 1\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
diff --git a/test/nframes_off64.c b/test/nframes_off64.c
index 9587645..113b84c 100644
--- a/test/nframes_off64.c
+++ b/test/nframes_off64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -27,13 +27,6 @@
 
 #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)
 {
 #ifdef SKIP_TEST
@@ -42,18 +35,15 @@ int main(void)
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
diff --git a/test/nframes_spf.c b/test/nframes_spf.c
index a3f60f1..e586bf8 100644
--- a/test/nframes_spf.c
+++ b/test/nframes_spf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* The number of frames should track the samples per frame */
 #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>
-
 static void write_format(const char *format, int spf)
 {
   char format_data[100];
@@ -49,7 +41,7 @@ int main(void)
   const size_t len = strlen(data);
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data, len);
diff --git a/test/nmeta.c b/test/nmeta.c
index cb5def2..ef33030 100644
--- a/test/nmeta.c
+++ b/test/nmeta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,18 +21,18 @@
 /* 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 <string.h>
-#include <errno.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -45,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nmfields(D, "raw1");
diff --git a/test/nmeta_hidden.c b/test/nmeta_hidden.c
index 659f6f3..1a70537 100644
--- a/test/nmeta_hidden.c
+++ b/test/nmeta_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -38,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nmfields(D, "raw1");
diff --git a/test/nmeta_parent.c b/test/nmeta_parent.c
index 72c964f..4e5980f 100644
--- a/test/nmeta_parent.c
+++ b/test/nmeta_parent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,18 +21,18 @@
 /* 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 <string.h>
-#include <errno.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -45,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   nfields = gd_nmfields(D, "raw9");
diff --git a/test/nmeta_parent_meta.c b/test/nmeta_parent_meta.c
new file mode 100644
index 0000000..fb05f2b
--- /dev/null
+++ b/test/nmeta_parent_meta.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  unsigned int nf;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INDEX/meta CONST UINT8 1");
+
+  D = gd_open(filedir, GD_RDONLY);
+  nf = gd_nmfields(D, "INDEX/meta");
+  CHECKU(nf, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+
+  return r;
+}
diff --git a/test/nmeta_type.c b/test/nmeta_type.c
index c82d625..5ed2f1f 100644
--- a/test/nmeta_type.c
+++ b/test/nmeta_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,18 +21,18 @@
 /* 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 <string.h>
-#include <errno.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -45,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nmfields_by_type(D, "raw1", GD_STRING_ENTRY);
diff --git a/test/nmeta_type_hidden.c b/test/nmeta_type_hidden.c
index fe35b4f..e17269c 100644
--- a/test/nmeta_type_hidden.c
+++ b/test/nmeta_type_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -38,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nmfields_by_type(D, "raw1", GD_STRING_ENTRY);
diff --git a/test/nmeta_type_parent.c b/test/nmeta_type_parent.c
index dd51557..f2c8867 100644
--- a/test/nmeta_type_parent.c
+++ b/test/nmeta_type_parent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,18 +21,18 @@
 /* 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 <string.h>
-#include <errno.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -45,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   nfields = gd_nmfields_by_type(D, "raw9", GD_STRING_ENTRY);
diff --git a/test/nmeta_vectors.c b/test/nmeta_vectors.c
index cab94f9..0609d7a 100644
--- a/test/nmeta_vectors.c
+++ b/test/nmeta_vectors.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,18 +21,18 @@
 /* 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 <string.h>
-#include <errno.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -45,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nmvectors(D, "raw1");
diff --git a/test/nmeta_vectors_del.c b/test/nmeta_vectors_del.c
index 5d95c91..7cf869c 100644
--- a/test/nmeta_vectors_del.c
+++ b/test/nmeta_vectors_del.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,18 +20,18 @@
  */
 #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 =
+  int error, error2, error3, r = 0;
+  unsigned int nvec, nvec2, nvec3;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -44,17 +44,8 @@ int main(void)
     "raw4 RAW UINT8 1\n"
     "const CONST UINT8 1\n"
     "string STRING value\n"
-    "string2 STRING value\n";
-  int fd, error, error2, error3, r = 0;
-  unsigned int nvec, nvec2, nvec3;
-  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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   nvec = gd_nmvectors(D, "raw1");
diff --git a/test/nmeta_vectors_hidden.c b/test/nmeta_vectors_hidden.c
index 85369b2..34b0626 100644
--- a/test/nmeta_vectors_hidden.c
+++ b/test/nmeta_vectors_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -38,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   nfields = gd_nmvectors(D, "raw1");
diff --git a/test/nmeta_vectors_parent.c b/test/nmeta_vectors_parent.c
index a5bba51..3611de4 100644
--- a/test/nmeta_vectors_parent.c
+++ b/test/nmeta_vectors_parent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,18 +21,18 @@
 /* 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 <string.h>
-#include <errno.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -45,17 +45,8 @@ int main(void)
     "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);
+    "string2 STRING value\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   nfields = gd_nmvectors(D, "raw9");
diff --git a/test/open_abs.c b/test/open_abs.c
index b0e112d..da92ffe 100644
--- a/test/open_abs.c
+++ b/test/open_abs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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";
@@ -35,8 +29,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   getcwd(path, 4096);
   strcat(path, "/");
diff --git a/test/open_cb_abort.c b/test/open_cb_abort.c
index e7ed55a..2e5108f 100644
--- a/test/open_cb_abort.c
+++ b/test/open_cb_abort.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Parser check */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-
 static int saw_callback = 0;
 
 int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
@@ -42,19 +34,17 @@ int main(void)
 {
   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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "BADDIRECTIVE BADTYPE\n"
+    "BADDIRECTIVE BADTYPE\n"
+    "BADDIRECTIVE BADTYPE\n"
+  );
 
   D = gd_cbopen(filedir, GD_RDONLY, callback, NULL);
   error = gd_error(D);
diff --git a/test/open_cb_cont.c b/test/open_cb_cont.c
index 92380db..85ae6ad 100644
--- a/test/open_cb_cont.c
+++ b/test/open_cb_cont.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,13 +21,6 @@
 /* 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>
-
 static int saw_callback = 0;
 
 int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
@@ -41,19 +34,17 @@ int main(void)
 {
   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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "BADDIRECTIVE BADTYPE\n"
+    "BADDIRECTIVE BADTYPE\n"
+    "BADDIRECTIVE BADTYPE\n"
+  );
 
   D = gd_cbopen(filedir, GD_RDONLY, callback, NULL);
   error = gd_error(D);
diff --git a/test/open_cb_ignore.c b/test/open_cb_ignore.c
index 1bdc54a..14222b4 100644
--- a/test/open_cb_ignore.c
+++ b/test/open_cb_ignore.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,13 +21,6 @@
 /* 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>
-
 static int saw_callback = 0;
 
 int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
@@ -41,16 +34,13 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "BADDIRECTIVE BADTYPE\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "BADDIRECTIVE BADTYPE\n");
 
   D = gd_cbopen(filedir, GD_RDONLY, callback, NULL);
   error = gd_error(D);
diff --git a/test/open_cb_invalid.c b/test/open_cb_invalid.c
index 2be3439..dd3f134 100644
--- a/test/open_cb_invalid.c
+++ b/test/open_cb_invalid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Parser check */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-
 static int saw_callback = 0;
 
 int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
@@ -42,19 +34,17 @@ int main(void)
 {
   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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "BADDIRECTIVE BADTYPE\n"
+    "BADDIRECTIVE BADTYPE\n"
+    "BADDIRECTIVE BADTYPE\n"
+  );
 
   D = gd_cbopen(filedir, GD_RDONLY, callback, NULL);
   error = gd_error(D);
diff --git a/test/open_cb_rescan.c b/test/open_cb_rescan.c
index 3e74d49..870b9d5 100644
--- a/test/open_cb_rescan.c
+++ b/test/open_cb_rescan.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Parser check */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-
 static int saw_callback = 0;
 
 int callback(gd_parser_data_t *pdata, void *extra gd_unused_)
@@ -47,16 +39,13 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "BADDIRECTIVE BADTYPE\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "BADDIRECTIVE BADTYPE\n");
 
   D = gd_cbopen(filedir, GD_RDONLY, callback, NULL);
   error = gd_error(D);
diff --git a/test/open_cb_rescan_alloc.c b/test/open_cb_rescan_alloc.c
index e851a92..802af39 100644
--- a/test/open_cb_rescan_alloc.c
+++ b/test/open_cb_rescan_alloc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,6 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-
 static int saw_callback = 0;
 
 int callback(gd_parser_data_t *pdata, void *extra gd_unused_)
@@ -46,16 +38,13 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "BADDIRECTIVE BADTYPE\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "BADDIRECTIVE BADTYPE\n");
 
   D = gd_cbopen(filedir, GD_RDONLY, callback, NULL);
   error = gd_error(D);
diff --git a/test/open_eaccess.c b/test/open_eaccess.c
index cf94598..74d35ef 100644
--- a/test/open_eaccess.c
+++ b/test/open_eaccess.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
@@ -35,8 +28,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0000));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0000);
 
   /* ensure filesystem honours access */
   if ((fd = open(format, O_RDONLY)) >= 0 || errno != EACCES) {
diff --git a/test/open_notdirfile.c b/test/open_notdirfile.c
index 2f2a258..9111e9d 100644
--- a/test/open_notdirfile.c
+++ b/test/open_notdirfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,12 +21,6 @@
 /* Opening an non-dirfile should fail cleanly */
 #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";
@@ -34,7 +28,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   D = gd_open(filedir, GD_RDONLY);
 
diff --git a/test/open_open.c b/test/open_open.c
index 93fe38f..288b6ed 100644
--- a/test/open_open.c
+++ b/test/open_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,12 +21,6 @@
 /* Opening an empty  dirfile should succeed cleanly */
 #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";
@@ -35,8 +29,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/open_rofs.c b/test/open_rofs.c
index dfba438..72a4026 100644
--- a/test/open_rofs.c
+++ b/test/open_rofs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,31 +21,20 @@
 /* Truncating a read-only dirfile should fail cleanly */
 #include "test.h"
 
-#include <stdlib.h>
-#include <errno.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 *format1 = "dirfile/format1";
-  const char *format_data = "/INCLUDE format1\n";
-  int error, fd, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0444);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  close(open(format1, O_CREAT | O_EXCL | O_WRONLY, 0444));
-  chmod(filedir, 0555);
+  MAKEFORMATFILE(format, "/INCLUDE format1\n");
+  MAKEEMPTYFILE(format1, 0400);
+  chmod(filedir, 0500);
 
   /* ensure filesystem honours read-onlyness */
   if (!unlink(format1) || errno != EACCES) {
@@ -58,7 +47,7 @@ int main(void)
   error = gd_error(D);
   gd_discard(D);
 
-  chmod(filedir, 0777);
+  chmod(filedir, 0700);
   unlink(format1);
   unlink(format);
   rmdir(filedir);
diff --git a/test/open_sym_al.c b/test/open_sym_al.c
index 908d56b..4b0aa5f 100644
--- a/test/open_sym_al.c
+++ b/test/open_sym_al.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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
@@ -42,8 +36,8 @@ int main(void)
   gdtest_getcwd(ptr, cwd, cwd_size);
 
   rmdirfile();
-  mkdir("dirfile", 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir("dirfile", 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   /* make a symlink */
   targ = (char*)malloc(cwd_size + 8);
diff --git a/test/open_sym_at.c b/test/open_sym_at.c
index 6b69ed6..8618050 100644
--- a/test/open_sym_at.c
+++ b/test/open_sym_at.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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
@@ -42,8 +36,8 @@ int main(void)
   gdtest_getcwd(ptr, cwd, cwd_size);
 
   rmdirfile();
-  mkdir("dirfile", 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir("dirfile", 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   /* make a symlink */
   targ = (char*)malloc(cwd_size + 8);
diff --git a/test/open_sym_c.c b/test/open_sym_c.c
index e7c04da..401c6a2 100644
--- a/test/open_sym_c.c
+++ b/test/open_sym_c.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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
@@ -38,8 +32,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir("dirfile", 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir("dirfile", 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   /* make a symlink */
   symlink(targ, filedir);
diff --git a/test/open_sym_cl.c b/test/open_sym_cl.c
index ed96670..6c0fcb4 100644
--- a/test/open_sym_cl.c
+++ b/test/open_sym_cl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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
@@ -38,8 +32,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir("dirfile", 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir("dirfile", 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   /* make a symlink */
   symlink(targ, filedir);
diff --git a/test/open_sym_ct.c b/test/open_sym_ct.c
index 6a47c65..62af245 100644
--- a/test/open_sym_ct.c
+++ b/test/open_sym_ct.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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
@@ -38,8 +32,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir("dirfile", 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir("dirfile", 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   /* make a symlink */
   symlink(targ, "dirfile/link");
diff --git a/test/open_sym_d.c b/test/open_sym_d.c
index 845e161..73b6e34 100644
--- a/test/open_sym_d.c
+++ b/test/open_sym_d.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,12 +22,6 @@
  * symlinks */
 #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
@@ -43,7 +37,7 @@ int main(void)
   gdtest_getcwd(ptr, cwd, cwd_size);
 
   rmdirfile();
-  mkdir("dirfile", 0777);
+  mkdir("dirfile", 0700);
 
   /* make a bad symlink */
   symlink("non_existent", link);
diff --git a/test/open_sym_l.c b/test/open_sym_l.c
index c0706b1..83ac4b1 100644
--- a/test/open_sym_l.c
+++ b/test/open_sym_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,13 +21,6 @@
 /* this tests whether _GD_CanonicalPath can deal with symlink loops */
 #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)
 {
 #if ! defined HAVE_SYMLINK || defined GD_NO_GETCWD
@@ -43,7 +36,7 @@ int main(void)
   gdtest_getcwd(ptr, cwd, cwd_size);
 
   rmdirfile();
-  mkdir("dirfile", 0777);
+  mkdir("dirfile", 0700);
 
   /* make a bad symlink */
   symlink("link", link);
diff --git a/test/open_sym_p.c b/test/open_sym_p.c
index dcea936..3bdba8d 100644
--- a/test/open_sym_p.c
+++ b/test/open_sym_p.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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
@@ -38,8 +32,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir("dirfile", 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir("dirfile", 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   /* make a symlink */
   symlink(targ, filedir);
diff --git a/test/open_sym_pl.c b/test/open_sym_pl.c
index 459547f..96fd4db 100644
--- a/test/open_sym_pl.c
+++ b/test/open_sym_pl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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
@@ -38,8 +32,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir("dirfile", 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir("dirfile", 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   /* make a symlink */
   symlink(targ, filedir);
diff --git a/test/open_sym_pt.c b/test/open_sym_pt.c
index 55f714b..9b14a32 100644
--- a/test/open_sym_pt.c
+++ b/test/open_sym_pt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #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
@@ -38,8 +32,8 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir("dirfile", 0777);
-  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkdir("dirfile", 0700);
+  MAKEEMPTYFILE(format, 0600);
 
   /* make a symlink */
   symlink(targ, "dirfile/link");
diff --git a/test/parse_alias.c b/test/parse_alias.c
index ecfa88d..e072e7e 100644
--- a/test/parse_alias.c
+++ b/test/parse_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 D. V. Wiebe
+/* Copyright (C) 2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,16 +25,13 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n/ALIAS rata data\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_alias_code.c b/test/parse_alias_code.c
index 3860eed..c2ef02c 100644
--- a/test/parse_alias_code.c
+++ b/test/parse_alias_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 D. V. Wiebe
+/* Copyright (C) 2011, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,23 +18,23 @@
  * 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/VERSION 9\n"
+    "data RAW UINT8 1\n"
+    "/ALIAS ra.ta data\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_alias_dup.c b/test/parse_alias_dup.c
index a1cc501..920f15e 100644
--- a/test/parse_alias_dup.c
+++ b/test/parse_alias_dup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 D. V. Wiebe
+/* Copyright (C) 2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,19 +25,17 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 1\n"
+    "cata RAW UINT8 1\n"
+    "/ALIAS cata data\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_alias_loop.c b/test/parse_alias_loop.c
new file mode 100644
index 0000000..64ee8e6
--- /dev/null
+++ b/test/parse_alias_loop.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, e4, e5, r = 0;
+  const char *s1, *s2, *s3, *s4;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "/ALIAS loop1 loop1\n"
+      "/ALIAS loop3a loop3b\n"
+      "/ALIAS loop3b loop3c\n"
+      "/ALIAS loop3c loop3a\n"
+      );
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  e2 = gd_validate(D, "loop1");
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  s1 = gd_alias_target(D, "loop1");
+  CHECKS(s1, "loop1");
+
+  e3 = gd_validate(D, "loop3a");
+  CHECKI(e3, GD_E_BAD_CODE);
+
+  s2 = gd_alias_target(D, "loop3a");
+  CHECKS(s2, "loop3b");
+
+  e4 = gd_validate(D, "loop3b");
+  CHECKI(e4, GD_E_BAD_CODE);
+
+  s3 = gd_alias_target(D, "loop3b");
+  CHECKS(s3, "loop3c");
+
+  e5 = gd_validate(D, "loop3c");
+  CHECKI(e5, GD_E_BAD_CODE);
+
+  s4 = gd_alias_target(D, "loop3c");
+  CHECKS(s4, "loop3a");
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_alias_meta.c b/test/parse_alias_meta.c
index de0fbde..d74f737 100644
--- a/test/parse_alias_meta.c
+++ b/test/parse_alias_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 D. V. Wiebe
+/* Copyright (C) 2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,19 +25,17 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 1\n"
+    "data/cata CONST UINT8 1\n"
+    "/ALIAS data/eata data\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_alias_missing.c b/test/parse_alias_missing.c
index f662a78..5f2a00d 100644
--- a/test/parse_alias_missing.c
+++ b/test/parse_alias_missing.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 D. V. Wiebe
+/* Copyright (C) 2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,16 +25,13 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/ALIAS alias target\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_alias_ncols.c b/test/parse_alias_ncols.c
new file mode 100644
index 0000000..1282550
--- /dev/null
+++ b/test/parse_alias_ncols.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/ALIAS name\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_badline.c b/test/parse_badline.c
index e143e61..014316e 100644
--- a/test/parse_badline.c
+++ b/test/parse_badline.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "BADDIRECTIVE BADTYPE\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "BADDIRECTIVE BADTYPE\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_bit.c b/test/parse_bit.c
index 9684f1a..8d8c4e6 100644
--- a/test/parse_bit.c
+++ b/test/parse_bit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 BIT in1 3\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in1 3\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_bit4.c b/test/parse_bit4.c
index 432bb81..bd43847 100644
--- a/test/parse_bit4.c
+++ b/test/parse_bit4.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 BIT in1 3 4\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in1 3 4\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_bit_bitnum.c b/test/parse_bit_bitnum.c
index 0862c1f..91da663 100644
--- a/test/parse_bit_bitnum.c
+++ b/test/parse_bit_bitnum.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 BIT in1 -1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in1 -1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_bit_bitsize.c b/test/parse_bit_bitsize.c
index 33c5332..5269431 100644
--- a/test/parse_bit_bitsize.c
+++ b/test/parse_bit_bitsize.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 BIT in1 63 2\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in1 63 2\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_bit_ncols.c b/test/parse_bit_ncols.c
index 30cc257..7e27304 100644
--- a/test/parse_bit_ncols.c
+++ b/test/parse_bit_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 BIT in1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_bit_numbits.c b/test/parse_bit_numbits.c
index 5d9954e..a489002 100644
--- a/test/parse_bit_numbits.c
+++ b/test/parse_bit_numbits.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 BIT in1 1 0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data BIT in1 1 0\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_bit_scalar.c b/test/parse_bit_scalar.c
index 039d06d..3dc3594 100644
--- a/test/parse_bit_scalar.c
+++ b/test/parse_bit_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 3\ndata BIT in1 const\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST INT32 3\ndata BIT in1 const\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_carray.c b/test/parse_carray.c
index 8f39299..3bf823e 100644
--- a/test/parse_carray.c
+++ b/test/parse_carray.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "c CARRAY UINT8 1 2 3 4\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "c CARRAY UINT8 1 2 3 4\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_carray_long.c b/test/parse_carray_long.c
index fa7965e..c62a233 100644
--- a/test/parse_carray_long.c
+++ b/test/parse_carray_long.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "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");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_carray_ncols.c b/test/parse_carray_ncols.c
new file mode 100644
index 0000000..aa66af6
--- /dev/null
+++ b/test/parse_carray_ncols.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "carray CARRAY UINT8\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_carray_type.c b/test/parse_carray_type.c
new file mode 100644
index 0000000..021c20d
--- /dev/null
+++ b/test/parse_carray_type.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "carray CARRAY UINT 8\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_const.c b/test/parse_const.c
index a7347f0..8f5bf65 100644
--- a/test/parse_const.c
+++ b/test/parse_const.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_const_complex.c b/test/parse_const_complex.c
index 896b51b..aa526a5 100644
--- a/test/parse_const_complex.c
+++ b/test/parse_const_complex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,19 +20,11 @@
  */
 #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;
+  int e1, e2, r = 0;
 #ifdef GD_NO_C99_API
   double c[2];
   const double v[2] = {1, 2};
@@ -42,11 +34,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST COMPLEX128 1;2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   e1 = gd_error(D);
diff --git a/test/parse_const_ncols.c b/test/parse_const_ncols.c
index 4c96679..261f517 100644
--- a/test/parse_const_ncols.c
+++ b/test/parse_const_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,38 +18,27 @@
  * 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 RAW UINT8\n";
-  int fd, error, r = 0;
+  int e1, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST UINT8");
 
   D = gd_open(filedir, GD_RDONLY);
-  error = gd_error(D);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error,GD_E_FORMAT);
   return r;
 }
diff --git a/test/parse_const_type.c b/test/parse_const_type.c
new file mode 100644
index 0000000..167ded1
--- /dev/null
+++ b/test/parse_const_type.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "const CONST UINT 1");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_divide.c b/test/parse_divide.c
index 2512e12..3006eee 100644
--- a/test/parse_divide.c
+++ b/test/parse_divide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 DIVIDE in1 in2\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data DIVIDE in1 in2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_double.c b/test/parse_double.c
index 4ac50a7..600a768 100644
--- a/test/parse_double.c
+++ b/test/parse_double.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,33 +20,24 @@
  */
 #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;
+  int e1, e2, e3, e4, e5, e6, r = 0;
   double d, h, i, n, p;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   e1 = gd_error(D);
diff --git a/test/parse_duplicate.c b/test/parse_duplicate.c
index 44a2351..13745aa 100644
--- a/test/parse_duplicate.c
+++ b/test/parse_duplicate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 RAW UINT8 1\ndata RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\ndata RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_duplicate_ignore.c b/test/parse_duplicate_ignore.c
index 0b8e5be..35ec04a 100644
--- a/test/parse_duplicate_ignore.c
+++ b/test/parse_duplicate_ignore.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 RAW UINT8 1\ndata RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\ndata RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_IGNORE_DUPS | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_endian_bad.c b/test/parse_endian_bad.c
index 3efbb18..94f472c 100644
--- a/test/parse_endian_bad.c
+++ b/test/parse_endian_bad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "ENDIAN badendianness\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "ENDIAN badendianness\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_endian_bad2.c b/test/parse_endian_bad2.c
new file mode 100644
index 0000000..ab591e8
--- /dev/null
+++ b/test/parse_endian_bad2.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/ENDIAN big leg\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_endian_big.c b/test/parse_endian_big.c
index fd44d4c..a896183 100644
--- a/test/parse_endian_big.c
+++ b/test/parse_endian_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "ENDIAN big\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "ENDIAN big\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_endian_force.c b/test/parse_endian_force.c
index ff1671f..84a46e6 100644
--- a/test/parse_endian_force.c
+++ b/test/parse_endian_force.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "ENDIAN badendianness\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "ENDIAN badendianness\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_FORCE_ENDIAN | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_endian_little.c b/test/parse_endian_little.c
index ef1bc64..093be8a 100644
--- a/test/parse_endian_little.c
+++ b/test/parse_endian_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "ENDIAN little\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "ENDIAN little\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_endian_slash.c b/test/parse_endian_slash.c
index 3daf20b..4f2aa37 100644
--- a/test/parse_endian_slash.c
+++ b/test/parse_endian_slash.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "/ENDIAN big\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/ENDIAN big\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_eol.c b/test/parse_eol.c
index 59d78b2..0c56f6a 100644
--- a/test/parse_eol.c
+++ b/test/parse_eol.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 RAW UINT8 1\\\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\\\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_esc.c b/test/parse_esc.c
new file mode 100644
index 0000000..8b44ed7
--- /dev/null
+++ b/test/parse_esc.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2013, 2017 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  const char *s;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "string STRING \\a\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\l"
+      "\\m\\n\\o\\p\\q\\r\\s\\t\\v\\w\\y\\z\\\\\\\"\\#");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, 0);
+
+  gd_get_sarray(D, "string", &s);
+  CHECKS(s, "\a\bcd\x1B\fghijklm\nopq\rs\t\vwyz\\\"#");
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_foffs.c b/test/parse_foffs.c
index 512d55d..0d313af 100644
--- a/test/parse_foffs.c
+++ b/test/parse_foffs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "FRAMEOFFSET 73\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "FRAMEOFFSET 73\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_foffs_include.c b/test/parse_foffs_include.c
index f631c7b..672be70 100644
--- a/test/parse_foffs_include.c
+++ b/test/parse_foffs_include.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,47 +21,27 @@
 /* Parser check */
 #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";
-  const char *format_data = "FRAMEOFFSET 1\nINCLUDE format1\nINCLUDE format2";
 
   const char *data1 = "dirfile/data1";
   const char *format1 = "dirfile/format1";
-  const char *format1_data = "data1 RAW UINT8 1\n";
 
   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);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "FRAMEOFFSET 1\nINCLUDE format1\nINCLUDE format2");
+  MAKEFORMATFILE(format1, "data1 RAW UINT8 1\n");
+  MAKEFORMATFILE(format2, "data2 RAW UINT8 1\nFRAMEOFFSET 2");
 
   fd = open(data1, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 4);
diff --git a/test/parse_foffs_slash.c b/test/parse_foffs_slash.c
index e66baab..1db991f 100644
--- a/test/parse_foffs_slash.c
+++ b/test/parse_foffs_slash.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "/FRAMEOFFSET 73\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/FRAMEOFFSET 73\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_hex.c b/test/parse_hex.c
index 61fbabe..0ecc9e3 100644
--- a/test/parse_hex.c
+++ b/test/parse_hex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
 #define GOOD  "z\\x1y\\xcx\\xDw\\x0eE\\x0Ff\\x10g\\x1ah\\x1Ei"
 #define GOODs "z\x1y\xcx\xDw\x0e" "E\x0F" "f\x10g\x1ah\x1Ei"
 #define BAD0  "a\\x00g"
@@ -44,22 +37,20 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
-    "good STRING " GOOD "\n"
-    "bad0 STRING " BAD0 "\n"
-    "bad1 STRING " BAD1 "\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   int le[3] = {0, 0, 0};
   char s[100];
   size_t i;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "good STRING " GOOD "\n"
+    "bad0 STRING " BAD0 "\n"
+    "bad1 STRING " BAD1 "\n"
+  );
 
   D = gd_cbopen(filedir, GD_RDONLY, callback, le);
   error = gd_error(D);
diff --git a/test/parse_hidden.c b/test/parse_hidden.c
index 78c7320..3e298d2 100644
--- a/test/parse_hidden.c
+++ b/test/parse_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,16 +25,13 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n/HIDDEN data\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_hidden_field.c b/test/parse_hidden_field.c
index 0bd8237..4bbb5d7 100644
--- a/test/parse_hidden_field.c
+++ b/test/parse_hidden_field.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,16 +25,13 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "/HIDDEN data\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/HIDDEN data\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_hidden_frag.c b/test/parse_hidden_frag.c
new file mode 100644
index 0000000..f285114
--- /dev/null
+++ b/test/parse_hidden_frag.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n/INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "/HIDDEN data");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_hidden_meta.c b/test/parse_hidden_meta.c
index 463f144..877b68b 100644
--- a/test/parse_hidden_meta.c
+++ b/test/parse_hidden_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,19 +25,17 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 1\n"
+    "data/meta CONST UINT8 1\n"
+    "/HIDDEN data/meta\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_huge.c b/test/parse_huge.c
new file mode 100644
index 0000000..f3b3025
--- /dev/null
+++ b/test/parse_huge.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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"
+
+/* Fun with preprocessors */
+#define n 18446744073709551615
+#define llu(n) n ## LLU
+#define LLU(n) llu(n)
+#define N LLU(n)
+#define s_(x) #x
+#define s(x) s_(x)
+#define S s(n)
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  DIRFILE *D;
+  uint64_t u;
+  double d, c[2];
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "u CONST UINT64 " S "\n"
+    "r CONST FLOAT64 " S"\n"
+    "c CONST COMPLEX128 " S ";" S "\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  CHECKI(error,GD_E_OK);
+
+  gd_get_constant(D, "u", GD_UINT64, &u);
+  CHECKU(u, N);
+
+  gd_get_constant(D, "r", GD_FLOAT64, &d);
+  CHECKF(d, N);
+
+  gd_get_constant(D, "c", GD_COMPLEX128, &c);
+  CHECKF(c[0], N);
+  CHECKF(c[1], N);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include.c b/test/parse_include.c
index cd49370..b538db3 100644
--- a/test/parse_include.c
+++ b/test/parse_include.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,20 @@
 /* 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 = "INCLUDE format1\n";
-  const char *format1_data = "data RAW UINT8 11\n";
-  int fd, r = 0;
+  int r = 0;
   DIRFILE *D;
   unsigned int spf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "data");
diff --git a/test/parse_include_absolute.c b/test/parse_include_absolute.c
index 36413fb..d4193f3 100644
--- a/test/parse_include_absolute.c
+++ b/test/parse_include_absolute.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2013 D. V. Wiebe
+/* Copyright (C) 2011-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Test include */
 #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)
 {
 #if defined GD_NO_GETCWD
@@ -39,7 +31,6 @@ int main(void)
   const char *format1 = "dirfile/format1";
   const char *format_data1 = "INCLUDE ";
   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;
@@ -47,7 +38,7 @@ int main(void)
   unsigned int spf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   gdtest_getcwd(ptr, cwd, cwd_size);
 
@@ -57,9 +48,7 @@ int main(void)
   write(fd, format_data2, strlen(format_data2));
   close(fd);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "data");
diff --git a/test/parse_include_absrel.c b/test/parse_include_absrel.c
index f065a85..926372d 100644
--- a/test/parse_include_absrel.c
+++ b/test/parse_include_absrel.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2013 D. V. Wiebe
+/* Copyright (C) 2011-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Test include */
 #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)
 {
 #if defined GD_NO_GETCWD
@@ -40,8 +32,6 @@ int main(void)
   const char *format2 = "dirfile/format2";
   const char *format_data1 = "INCLUDE ";
   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;
@@ -49,7 +39,7 @@ int main(void)
   unsigned int spf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   gdtest_getcwd(ptr, cwd, cwd_size);
 
@@ -59,13 +49,8 @@ int main(void)
   write(fd, format_data2, strlen(format_data2));
   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);
+  MAKEFORMATFILE(format1, "INCLUDE format2\n");
+  MAKEFORMATFILE(format2, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "data");
diff --git a/test/parse_include_affix_bad.c b/test/parse_include_affix_bad.c
index 243ab1c..882b1c6 100644
--- a/test/parse_include_affix_bad.c
+++ b/test/parse_include_affix_bad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,22 @@
 /* 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 \"\" .txt\n";
-  const char *format1_data = "zata RAW UINT8 11\n";
-  int fd, e, r = 0;
+  int e, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 1\n"
+    "INCLUDE format1 \"\" .txt\n"
+  );
+  MAKEFORMATFILE(format1, "zata RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY);
   e = gd_error(D);
diff --git a/test/parse_include_affix_ref.c b/test/parse_include_affix_ref.c
index ecc000c..0a438ed 100644
--- a/test/parse_include_affix_ref.c
+++ b/test/parse_include_affix_ref.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,36 +21,23 @@
 /* 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;
+  int r = 0;
   DIRFILE *D;
   const char *ref;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 1\n"
+    "INCLUDE format1 A B\n"
+  );
+  MAKEFORMATFILE(format1, "zata RAW UINT8 11\n/REFERENCE zata\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   ref = gd_reference(D, NULL);
diff --git a/test/parse_include_dir.c b/test/parse_include_dir.c
index e7bbf1b..91c517a 100644
--- a/test/parse_include_dir.c
+++ b/test/parse_include_dir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,19 @@
  */
 #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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  mkdir(subdir, 0777);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE sub\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_include_loop.c b/test/parse_include_loop.c
index 20df193..a0f7956 100644
--- a/test/parse_include_loop.c
+++ b/test/parse_include_loop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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;
+  int e, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE format\n");
 
   D = gd_open(filedir, GD_RDONLY);
   e = gd_error(D);
diff --git a/test/parse_include_nodir.c b/test/parse_include_nodir.c
new file mode 100644
index 0000000..6907b12
--- /dev/null
+++ b/test/parse_include_nodir.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE sub/format\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  CHECKI(error, GD_E_IO);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_nonexistent.c b/test/parse_include_nonexistent.c
index b203890..2a269e3 100644
--- a/test/parse_include_nonexistent.c
+++ b/test/parse_include_nonexistent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "INCLUDE non_existent_file\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE non_existent_file\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_include_ns.c b/test/parse_include_ns.c
new file mode 100644
index 0000000..9c0f1d6
--- /dev/null
+++ b/test/parse_include_ns.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int r = 0;
+  DIRFILE *D;
+  unsigned int spf, spfaff;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.pre post\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "data");
+  spfaff = gd_spf(D, "ns.predatapost");
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKU(spf, 0);
+  CHECKU(spfaff, 11);
+  return r;
+}
diff --git a/test/parse_include_ns2.c b/test/parse_include_ns2.c
new file mode 100644
index 0000000..11580cf
--- /dev/null
+++ b/test/parse_include_ns2.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int r = 0;
+  DIRFILE *D;
+  unsigned int spf, spfaff;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "/INCLUDE format1 ns2.pre post\n"
+  );
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "data");
+  CHECKU(spf, 0);
+
+  spfaff = gd_spf(D, "ns2.predatapost");
+  CHECKU(spfaff, 11);
+
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_nsabs.c b/test/parse_include_nsabs.c
new file mode 100644
index 0000000..a6512d3
--- /dev/null
+++ b/test/parse_include_nsabs.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int r = 0;
+  DIRFILE *D;
+  unsigned int spf;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "/INCLUDE format1 .ns2.pre post\n"
+  );
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "ns2.predatapost");
+  CHECKU(spf, 11);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_nsinh.c b/test/parse_include_nsinh.c
new file mode 100644
index 0000000..f74bfbf
--- /dev/null
+++ b/test/parse_include_nsinh.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int r = 0;
+  DIRFILE *D;
+  unsigned int spf;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.pre post\n");
+  MAKEFORMATFILE(format1, "INCLUDE format2\n");
+  MAKEFORMATFILE(format2,
+    "/NAMESPACE .\n"
+    "data RAW UINT8 11\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "ns.predatapost");
+  CHECKU(spf, 11);
+  gd_discard(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_nspop.c b/test/parse_include_nspop.c
new file mode 100644
index 0000000..a058d66
--- /dev/null
+++ b/test/parse_include_nspop.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int r = 0;
+  DIRFILE *D;
+  unsigned int spf;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "/INCLUDE format1 ns2.pre post\n"
+    "data RAW UINT8 11\n"
+  );
+  MAKEFORMATFILE(format1, "#\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "ns.data");
+  CHECKU(spf, 11);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_nsrabs.c b/test/parse_include_nsrabs.c
new file mode 100644
index 0000000..a685371
--- /dev/null
+++ b/test/parse_include_nsrabs.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int r = 0;
+  DIRFILE *D;
+  unsigned int spf;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "/INCLUDE format1 .pre post\n"
+  );
+  MAKEFORMATFILE(format1,
+    "/NAMESPACE .\n"
+    "data RAW UINT8 11\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "predatapost");
+  CHECKU(spf, 11);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_nsrainh.c b/test/parse_include_nsrainh.c
new file mode 100644
index 0000000..26b4b04
--- /dev/null
+++ b/test/parse_include_nsrainh.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int r = 0;
+  DIRFILE *D;
+  unsigned int spf;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.pre post\n");
+  MAKEFORMATFILE(format1,
+    "/NAMESPACE ns2\n"
+    "/INCLUDE format2 .\n"
+  );
+  MAKEFORMATFILE(format2,
+    "/NAMESPACE .\n"
+    "data RAW UINT8 11\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "ns.predatapost");
+  CHECKU(spf, 11);
+  gd_discard(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_nsrinh.c b/test/parse_include_nsrinh.c
new file mode 100644
index 0000000..17e2102
--- /dev/null
+++ b/test/parse_include_nsrinh.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int r = 0;
+  DIRFILE *D;
+  unsigned int spf;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "INCLUDE format1 ns.pre post\n");
+  MAKEFORMATFILE(format1,
+    "/NAMESPACE .\n"
+    "/INCLUDE format2 ns2.\n"
+  );
+  MAKEFORMATFILE(format2,
+    "/NAMESPACE .\n"
+    "data RAW UINT8 11\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "ns.ns2.predatapost");
+  CHECKU(spf, 11);
+  gd_discard(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_nsroot.c b/test/parse_include_nsroot.c
new file mode 100644
index 0000000..4dd9757
--- /dev/null
+++ b/test/parse_include_nsroot.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int r = 0;
+  DIRFILE *D;
+  unsigned int spf;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1 ns.pre post\n");
+  MAKEFORMATFILE(format1,
+    "/NAMESPACE .\n"
+    "data RAW UINT8 11\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  spf = gd_spf(D, "ns.predatapost");
+  CHECKU(spf, 11);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_prefix.c b/test/parse_include_prefix.c
index 8417903..91b37f2 100644
--- a/test/parse_include_prefix.c
+++ b/test/parse_include_prefix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,22 +25,15 @@ 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;
+  int r = 0;
   DIRFILE *D;
   unsigned int spf, spfaff;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "INCLUDE format1 pre\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY);
   spf = gd_spf(D, "data");
diff --git a/test/parse_include_prefix_dup.c b/test/parse_include_prefix_dup.c
index 6dfdf22..136abc2 100644
--- a/test/parse_include_prefix_dup.c
+++ b/test/parse_include_prefix_dup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,21 +25,14 @@ 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;
+  int e, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "INCLUDE format1 pre\npredata RAW UINT8 1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY);
   e = gd_error(D);
diff --git a/test/parse_include_preprefix.c b/test/parse_include_preprefix.c
index ea5f8c1..a0822a5 100644
--- a/test/parse_include_preprefix.c
+++ b/test/parse_include_preprefix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,27 +26,16 @@ int main(void)
   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;
+  int r = 0;
   DIRFILE *D;
   unsigned int spf, spf1, spf2;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "INCLUDE format1 pre\n");
+  MAKEFORMATFILE(format1, "INCLUDE format2 PRE\n");
+  MAKEFORMATFILE(format2, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY);
   spf = gd_spf(D, "data");
diff --git a/test/parse_include_ref.c b/test/parse_include_ref.c
index 37bd623..f29fda1 100644
--- a/test/parse_include_ref.c
+++ b/test/parse_include_ref.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,24 @@
 /* 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;
+  int r = 0;
   DIRFILE *D;
   const char *ref;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 1\n"
+    "/REFERENCE data\n"
+    "INCLUDE format1\n"
+  );
+  MAKEFORMATFILE(format1, "zata RAW UINT8 11\n/REFERENCE zata\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   ref = gd_reference(D, NULL);
diff --git a/test/parse_include_relabs.c b/test/parse_include_relabs.c
index 849a7c2..39a29c1 100644
--- a/test/parse_include_relabs.c
+++ b/test/parse_include_relabs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2013 D. V. Wiebe
+/* Copyright (C) 2011-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Test include */
 #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)
 {
 #if defined GD_NO_GETCWD
@@ -39,10 +31,8 @@ int main(void)
   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 = "/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;
@@ -50,14 +40,12 @@ int main(void)
   unsigned int spf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  mkdir(subdir, 0777);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
   gdtest_getcwd(ptr, cwd, cwd_size);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE sub/format1\n");
 
   fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format1_data1, strlen(format1_data1));
@@ -65,9 +53,7 @@ int main(void)
   write(fd, format1_data2, strlen(format1_data2));
   close(fd);
 
-  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format2_data, strlen(format2_data));
-  close(fd);
+  MAKEFORMATFILE(format2, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "data");
diff --git a/test/parse_include_relrel.c b/test/parse_include_relrel.c
index 04639dd..ee00c67 100644
--- a/test/parse_include_relrel.c
+++ b/test/parse_include_relrel.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Test include */
 #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";
@@ -36,28 +28,17 @@ int main(void)
   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;
+  int r = 0;
   DIRFILE *D;
   unsigned int spf;
 
   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);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
-  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format2_data, strlen(format2_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE sub/format1\n");
+  MAKEFORMATFILE(format1, "INCLUDE format2\n");
+  MAKEFORMATFILE(format2, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "data");
diff --git a/test/parse_include_slash.c b/test/parse_include_slash.c
index ec3fe67..60e5793 100644
--- a/test/parse_include_slash.c
+++ b/test/parse_include_slash.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,20 @@
 /* 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 = "/INCLUDE format1\n";
-  const char *format1_data = "data RAW UINT8 11\n";
-  int fd, r = 0;
+  int r = 0;
   DIRFILE *D;
   unsigned int spf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "data");
diff --git a/test/parse_include_suffix.c b/test/parse_include_suffix.c
index 17333b3..9b3d6ce 100644
--- a/test/parse_include_suffix.c
+++ b/test/parse_include_suffix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,22 +25,15 @@ 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;
+  int r = 0;
   DIRFILE *D;
   unsigned int spf, spfaff;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "INCLUDE format1 pre post\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY);
   spf = gd_spf(D, "data");
diff --git a/test/parse_include_sufsuffix.c b/test/parse_include_sufsuffix.c
index 7a2a738..350a67e 100644
--- a/test/parse_include_sufsuffix.c
+++ b/test/parse_include_sufsuffix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,27 +26,16 @@ int main(void)
   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;
+  int r = 0;
   DIRFILE *D;
   unsigned int spf, spf1, spf2;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "INCLUDE format1 pre post\n");
+  MAKEFORMATFILE(format1, "INCLUDE format2 \"\" POST\n");
+  MAKEFORMATFILE(format2, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY);
   spf = gd_spf(D, "data");
diff --git a/test/parse_index.c b/test/parse_index.c
index 9c8c4a2..f9d0e86 100644
--- a/test/parse_index.c
+++ b/test/parse_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "INDEX RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INDEX RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_indir.c b/test/parse_indir.c
new file mode 100644
index 0000000..5464e07
--- /dev/null
+++ b/test/parse_indir.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data INDIR in1 in2\n");
+
+  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_lincom.c b/test/parse_lincom.c
index dbfe8d6..ef78f03 100644
--- a/test/parse_lincom.c
+++ b/test/parse_lincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "lincom LINCOM 2 in1 1 0 in2 1 0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 2 in1 1 0 in2 1 0\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_lincom_ncols1.c b/test/parse_lincom_ncols1.c
index d70179c..15eac3e 100644
--- a/test/parse_lincom_ncols1.c
+++ b/test/parse_lincom_ncols1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "lincom LINCOM\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_lincom_ncols2.c b/test/parse_lincom_ncols2.c
index 4df839b..6e0ecc7 100644
--- a/test/parse_lincom_ncols2.c
+++ b/test/parse_lincom_ncols2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "lincom LINCOM 2 in1 1 0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 2 in1 1 0\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_lincom_nfields.c b/test/parse_lincom_nfields.c
index 2416ed7..c1b394f 100644
--- a/test/parse_lincom_nfields.c
+++ b/test/parse_lincom_nfields.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "lincom LINCOM 4 in1 1 0 in2 1 0 in1 1 0 in2 1 0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 4 in1 1 0 in2 1 0 in1 1 0 in2 1 0\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_lincom_nofields.c b/test/parse_lincom_nofields.c
index 50c0aa8..8418203 100644
--- a/test/parse_lincom_nofields.c
+++ b/test/parse_lincom_nofields.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "lincom LINCOM 0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 0\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_lincom_non.c b/test/parse_lincom_non.c
index 49428b4..5811f3f 100644
--- a/test/parse_lincom_non.c
+++ b/test/parse_lincom_non.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "lincom LINCOM in1 1 0 in2 1 0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM in1 1 0 in2 1 0\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_lincom_non_ncols.c b/test/parse_lincom_non_ncols.c
index 5d72c76..02caf46 100644
--- a/test/parse_lincom_non_ncols.c
+++ b/test/parse_lincom_non_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "lincom LINCOM in1 1 0 in2\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM in1 1 0 in2\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_lincom_scalar.c b/test/parse_lincom_scalar.c
index 723d7cf..e8399ae 100644
--- a/test/parse_lincom_scalar.c
+++ b/test/parse_lincom_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,20 @@
 /* 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 FLOAT64 3.2\n"
-    "lincom LINCOM 1 in1 const 0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "const  CONST FLOAT64 3.2\n"
+    "lincom LINCOM 1 in1 const 0\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_linterp.c b/test/parse_linterp.c
index 8e17281..5937563 100644
--- a/test/parse_linterp.c
+++ b/test/parse_linterp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 LINTERP in1 lut\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data LINTERP in1 lut\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_linterp_ncols.c b/test/parse_linterp_ncols.c
index b4cbc83..56efc05 100644
--- a/test/parse_linterp_ncols.c
+++ b/test/parse_linterp_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 LINTERP in1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data LINTERP in1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_literal_cmpbad.c b/test/parse_literal_cmpbad.c
index e88165b..9d4edd7 100644
--- a/test/parse_literal_cmpbad.c
+++ b/test/parse_literal_cmpbad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 COMPLEX128 1;a\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST COMPLEX128 1;a\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_literal_fltcmp.c b/test/parse_literal_fltcmp.c
index 95b571c..4e7ca58 100644
--- a/test/parse_literal_fltcmp.c
+++ b/test/parse_literal_fltcmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 FLOAT64 1;1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST FLOAT64 1;1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_literal_fltcmp0.c b/test/parse_literal_fltcmp0.c
index de5474f..af7d91c 100644
--- a/test/parse_literal_fltcmp0.c
+++ b/test/parse_literal_fltcmp0.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 FLOAT64 1;0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST FLOAT64 1;0\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_literal_intcmp.c b/test/parse_literal_intcmp.c
index 1724112..859d98e 100644
--- a/test/parse_literal_intcmp.c
+++ b/test/parse_literal_intcmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 PHASE in1 1;1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data PHASE in1 1;1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_literal_intcmp0.c b/test/parse_literal_intcmp0.c
index 0e4e085..4decb49 100644
--- a/test/parse_literal_intcmp0.c
+++ b/test/parse_literal_intcmp0.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 PHASE in1 1;0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data PHASE in1 1;0\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_literal_uintcmp.c b/test/parse_literal_uintcmp.c
index bea52eb..08eba5f 100644
--- a/test/parse_literal_uintcmp.c
+++ b/test/parse_literal_uintcmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 RAW UINT8 1;1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1;1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_literal_uintcmp0.c b/test/parse_literal_uintcmp0.c
index 601d2e7..aa930f7 100644
--- a/test/parse_literal_uintcmp0.c
+++ b/test/parse_literal_uintcmp0.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 RAW UINT8 1;0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1;0\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_malias.c b/test/parse_malias.c
index d084bf3..4cf9f6b 100644
--- a/test/parse_malias.c
+++ b/test/parse_malias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 D. V. Wiebe
+/* Copyright (C) 2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,19 +25,17 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 1\n"
+    "cata CONST UINT8 1\n"
+    "/ALIAS data/eata cata\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_malias_dup.c b/test/parse_malias_dup.c
index 7c506f3..51d5ad7 100644
--- a/test/parse_malias_dup.c
+++ b/test/parse_malias_dup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 D. V. Wiebe
+/* Copyright (C) 2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,20 +25,18 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 1\n"
+    "data/cata CONST UINT8 1\n"
+    "/ALIAS eata data\n"
+    "/ALIAS eata/cata data/cata\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_malias_meta.c b/test/parse_malias_meta.c
index db5c642..ea78c5c 100644
--- a/test/parse_malias_meta.c
+++ b/test/parse_malias_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2012 D. V. Wiebe
+/* Copyright (C) 2011-2012, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,26 +18,23 @@
  * 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;
+  int e1, e2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 1\n"
+    "data/cata CONST UINT8 1\n"
+    "/ALIAS data/eata data\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   e1 = gd_error(D);
@@ -48,6 +45,6 @@ int main(void)
   rmdir(filedir);
 
   CHECKI(e1,0);
-  CHECKI(e2,-1);
+  CHECKI(e2, GD_E_BAD_CODE);
   return r;
 }
diff --git a/test/parse_meta.c b/test/parse_meta.c
index b6266e7..ecf25d2 100644
--- a/test/parse_meta.c
+++ b/test/parse_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,20 @@
 /* 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"
-    "META parent child CONST UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "META parent child CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_meta_affix.c b/test/parse_meta_affix.c
index 6d49590..8ece4b8 100644
--- a/test/parse_meta_affix.c
+++ b/test/parse_meta_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,23 +25,17 @@ 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1,
+    "parent RAW UINT8 1\n"
+    "META parent child CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_meta_alias.c b/test/parse_meta_alias.c
index 603dd66..27b87c6 100644
--- a/test/parse_meta_alias.c
+++ b/test/parse_meta_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,21 @@
 /* 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "/ALIAS alias parent\n"
+    "META alias child CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_meta_frag.c b/test/parse_meta_frag.c
index bf1a42a..7773c00 100644
--- a/test/parse_meta_frag.c
+++ b/test/parse_meta_frag.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,19 @@
 /* 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 *format1 = "dirfile/format1";
-  const char *format_data = "parent RAW UINT8 1\nINCLUDE format1\n";
-  const char *format1_data = "parent/child CONST UINT8 1\n";
-  int fd, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "parent RAW UINT8 1\nINCLUDE format1\n");
+  MAKEFORMATFILE(format1, "parent/child CONST UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_meta_implicit.c b/test/parse_meta_implicit.c
index 09b750d..ec99bdb 100644
--- a/test/parse_meta_implicit.c
+++ b/test/parse_meta_implicit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,21 @@
 /* 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"
-    "parent/child CONST UINT8 1\n";
   signed char c;
-  int fd, error, error2, r = 0;
+  int error, error2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "parent/child CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_meta_implicit2.c b/test/parse_meta_implicit2.c
index a56e7db..f057106 100644
--- a/test/parse_meta_implicit2.c
+++ b/test/parse_meta_implicit2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,20 @@
 /* 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"
-    "parent/child/extra CONST UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "parent/child/extra CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_meta_implicit_affix.c b/test/parse_meta_implicit_affix.c
index 039a1fa..ea98e67 100644
--- a/test/parse_meta_implicit_affix.c
+++ b/test/parse_meta_implicit_affix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,23 +25,17 @@ 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1 A Z\n");
+  MAKEFORMATFILE(format1,
+    "parent RAW UINT8 1\n"
+    "parent/child CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_meta_index.c b/test/parse_meta_index.c
index 65584d4..15503b5 100644
--- a/test/parse_meta_index.c
+++ b/test/parse_meta_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* 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 =
-    "META INDEX child CONST UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "META INDEX child CONST UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_meta_index2.c b/test/parse_meta_index2.c
index d2ae5dc..f13b71c 100644
--- a/test/parse_meta_index2.c
+++ b/test/parse_meta_index2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,20 @@
 /* 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"
-    "META parent INDEX CONST UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "META parent INDEX CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_meta_jump.c b/test/parse_meta_jump.c
index cc19fd8..a647456 100644
--- a/test/parse_meta_jump.c
+++ b/test/parse_meta_jump.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,20 +25,18 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "META parent child CONST UINT8 1\n"
+    "ALIAS alias parent/child\n"
+    "META alias grandchild CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_meta_malias.c b/test/parse_meta_malias.c
index 358b0ad..5fd4c86 100644
--- a/test/parse_meta_malias.c
+++ b/test/parse_meta_malias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,20 +25,18 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "ALIAS parent/alias const\n"
+    "META parent/alias grandchild CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_meta_meta.c b/test/parse_meta_meta.c
index 93cc81e..12e039f 100644
--- a/test/parse_meta_meta.c
+++ b/test/parse_meta_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,19 +25,17 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "META parent child CONST UINT8 1\n"
+    "META parent/child grandchild CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_meta_ncols.c b/test/parse_meta_ncols.c
new file mode 100644
index 0000000..26b3384
--- /dev/null
+++ b/test/parse_meta_ncols.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "META INDEX child\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_meta_parent.c b/test/parse_meta_parent.c
index 8c51531..3f103f2 100644
--- a/test/parse_meta_parent.c
+++ b/test/parse_meta_parent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "META parent child CONST UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "META parent child CONST UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_meta_raw.c b/test/parse_meta_raw.c
index 0f0eced..a88a43f 100644
--- a/test/parse_meta_raw.c
+++ b/test/parse_meta_raw.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,20 @@
 /* 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"
-    "META parent child RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent RAW UINT8 1\n"
+    "META parent child RAW UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_mplex.c b/test/parse_mplex.c
index 34464a0..845a6d6 100644
--- a/test/parse_mplex.c
+++ b/test/parse_mplex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,16 +24,13 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data MPLEX in1 in2 1 2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_mplex_ncols.c b/test/parse_mplex_ncols.c
index 4e968a6..42161da 100644
--- a/test/parse_mplex_ncols.c
+++ b/test/parse_mplex_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,16 +24,13 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data MPLEX in1 in2\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_mplex_neg.c b/test/parse_mplex_neg.c
new file mode 100644
index 0000000..9330147
--- /dev/null
+++ b/test/parse_mplex_neg.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "mplex MPLEX a b 3 -1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_mplex_nomax.c b/test/parse_mplex_nomax.c
index caeb5a1..ec949fb 100644
--- a/test/parse_mplex_nomax.c
+++ b/test/parse_mplex_nomax.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,17 +24,14 @@ 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;
+  int e1, e2, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data MPLEX in1 in2 6\n");
 
   D = gd_open(filedir, GD_RDONLY);
   e1 = gd_error(D);
diff --git a/test/parse_mplex_scalar.c b/test/parse_mplex_scalar.c
index d510234..e873ab5 100644
--- a/test/parse_mplex_scalar.c
+++ b/test/parse_mplex_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,16 +24,13 @@ 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data MPLEX in1 in2 a b\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_multiply.c b/test/parse_multiply.c
index cc86896..7a7decf 100644
--- a/test/parse_multiply.c
+++ b/test/parse_multiply.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 MULTIPLY in1 in2\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data MULTIPLY in1 in2\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_multiply_ncols.c b/test/parse_multiply_ncols.c
index 8c59fab..dc54788 100644
--- a/test/parse_multiply_ncols.c
+++ b/test/parse_multiply_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 MULTIPLY in1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data MULTIPLY in1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_name.c b/test/parse_name.c
index 9fc166c..a8659b0 100644
--- a/test/parse_name.c
+++ b/test/parse_name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "d/ta RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "d/ta RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_name_dot.c b/test/parse_name_dot.c
index a9b659b..b773989 100644
--- a/test/parse_name_dot.c
+++ b/test/parse_name_dot.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,38 +18,31 @@
  * 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 = "d.ta RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, v, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "d.ta RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
+  CHECKI(error,0);
+
+  v = gd_validate(D, "d.ta");
+  CHECKI(v,0);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error,GD_E_OK);
   return r;
 }
diff --git a/test/parse_name_ext.c b/test/parse_name_ext.c
index e21bcd3..18fcec9 100644
--- a/test/parse_name_ext.c
+++ b/test/parse_name_ext.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* Parser check */
 #include "test.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)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "data.txt RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data.txt RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_name_pedantic.c b/test/parse_name_pedantic.c
deleted file mode 100644
index 9c2d324..0000000
--- a/test/parse_name_pedantic.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 2008-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
- */
-/* 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 = "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);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
-
-  D = gd_open(filedir, GD_RDONLY | GD_PEDANTIC);
-  error = gd_error(D);
-  gd_discard(D);
-
-  unlink(format);
-  rmdir(filedir);
-
-  CHECKI(error,GD_E_FORMAT);
-  return r;
-}
diff --git a/test/parse_ncols.c b/test/parse_ncols.c
index 208e5b2..c869776 100644
--- a/test/parse_ncols.c
+++ b/test/parse_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "ENDIAN\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "ENDIAN\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_ns.c b/test/parse_ns.c
new file mode 100644
index 0000000..aff7704
--- /dev/null
+++ b/test/parse_ns.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE ns\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  CHECKI(error,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ns_dot.c b/test/parse_ns_dot.c
new file mode 100644
index 0000000..4196324
--- /dev/null
+++ b/test/parse_ns_dot.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE .\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  CHECKI(error,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ns_dotdot.c b/test/parse_ns_dotdot.c
new file mode 100644
index 0000000..69bc6a0
--- /dev/null
+++ b/test/parse_ns_dotdot.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE ..\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  CHECKI(error,GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ns_dotdotns.c b/test/parse_ns_dotdotns.c
new file mode 100644
index 0000000..c1268e7
--- /dev/null
+++ b/test/parse_ns_dotdotns.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE ..ns\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  CHECKI(error,GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ns_dotns.c b/test/parse_ns_dotns.c
new file mode 100644
index 0000000..04b7f49
--- /dev/null
+++ b/test/parse_ns_dotns.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE .ns\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  CHECKI(error,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ns_include.c b/test/parse_ns_include.c
new file mode 100644
index 0000000..6bf3d28
--- /dev/null
+++ b/test/parse_ns_include.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int v1, v2, v3, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "/INCLUDE format1 pre post\n"
+    "after RAW UINT8 1\n"
+  );
+  MAKEFORMATFILE(format1, "data RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  v1 = gd_validate(D, "data");
+  CHECKU(v1, GD_E_BAD_CODE);
+  v2 = gd_validate(D, "ns.predatapost");
+  CHECKU(v2, 0);
+  v3 = gd_validate(D, "ns.after");
+  CHECKU(v3, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ns_include_ns.c b/test/parse_ns_include_ns.c
new file mode 100644
index 0000000..143de13
--- /dev/null
+++ b/test/parse_ns_include_ns.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int v1, v2, v3, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "/INCLUDE format1 ns2.pre post\n"
+    "after RAW UINT8 1\n"
+  );
+  MAKEFORMATFILE(format1, "data RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  v1 = gd_validate(D, "data");
+  CHECKU(v1, GD_E_BAD_CODE);
+  v2 = gd_validate(D, "ns2.predatapost");
+  CHECKU(v2, 0);
+  v3 = gd_validate(D, "ns.after");
+  CHECKU(v3, 0);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ns_ndotdots.c b/test/parse_ns_ndotdots.c
new file mode 100644
index 0000000..f5fffe0
--- /dev/null
+++ b/test/parse_ns_ndotdots.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE n..s\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  CHECKI(error,GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ns_ndots.c b/test/parse_ns_ndots.c
new file mode 100644
index 0000000..0b39902
--- /dev/null
+++ b/test/parse_ns_ndots.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE n.s\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  CHECKI(error,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ns_nsdot.c b/test/parse_ns_nsdot.c
new file mode 100644
index 0000000..8508fa6
--- /dev/null
+++ b/test/parse_ns_nsdot.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE ns.\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  CHECKI(error,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ns_nsdotdot.c b/test/parse_ns_nsdotdot.c
new file mode 100644
index 0000000..7c3b3e8
--- /dev/null
+++ b/test/parse_ns_nsdotdot.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE ns..\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  CHECKI(error,GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf.c b/test/parse_nsf.c
new file mode 100644
index 0000000..371e2d9
--- /dev/null
+++ b/test/parse_nsf.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE ns\ndata CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  gd_validate(D, "ns.data");
+  e2 = gd_error(D);
+  CHECKI(e2,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_abs.c b/test/parse_nsf_abs.c
new file mode 100644
index 0000000..d7909d5
--- /dev/null
+++ b/test/parse_nsf_abs.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "/NAMESPACE .ns2\n"
+    "data CONST UINT8 1\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  gd_validate(D, "ns2.data");
+  e2 = gd_error(D);
+  CHECKI(e2,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_alias.c b/test/parse_nsf_alias.c
new file mode 100644
index 0000000..9f58694
--- /dev/null
+++ b/test/parse_nsf_alias.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "data RAW UINT8 1\n"
+    "/ALIAS alias data\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  e2 = gd_validate(D, "ns.alias");
+  CHECKI(e2,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_dot.c b/test/parse_nsf_dot.c
new file mode 100644
index 0000000..190e037
--- /dev/null
+++ b/test/parse_nsf_dot.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, v, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/NAMESPACE ns\nd.ta CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  v = gd_validate(D, "ns.d.ta");
+  CHECKI(v,0);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_hide.c b/test/parse_nsf_hide.c
new file mode 100644
index 0000000..ac1d771
--- /dev/null
+++ b/test/parse_nsf_hide.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 h, e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "data RAW UINT8 1\n"
+    "/HIDDEN data\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  h = gd_hidden(D, "ns.data");
+  e2 = gd_error(D);
+  CHECKI(e2,0);
+  CHECKI(h, 1);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_index.c b/test/parse_nsf_index.c
new file mode 100644
index 0000000..381ad65
--- /dev/null
+++ b/test/parse_nsf_index.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "data LINCOM INDEX 1 0\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  gd_validate(D, "ns.data");
+  e2 = gd_error(D);
+  CHECKI(e2,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_meta.c b/test/parse_nsf_meta.c
new file mode 100644
index 0000000..6680728
--- /dev/null
+++ b/test/parse_nsf_meta.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "parent RAW UINT8 1\n"
+    "/META parent meta CONST UINT8 2\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  gd_validate(D, "ns.parent/meta");
+  e2 = gd_error(D);
+  CHECKI(e2,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_meta2.c b/test/parse_nsf_meta2.c
new file mode 100644
index 0000000..f7e6446
--- /dev/null
+++ b/test/parse_nsf_meta2.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "parent RAW UINT8 1\n"
+    "parent/meta CONST UINT8 2\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  gd_validate(D, "ns.parent/meta");
+  e2 = gd_error(D);
+  CHECKI(e2,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_ref.c b/test/parse_nsf_ref.c
new file mode 100644
index 0000000..dcd0743
--- /dev/null
+++ b/test/parse_nsf_ref.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  const char *ref;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "data RAW UINT8 1\n"
+    "/REFERENCE data\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  ref = gd_reference(D, NULL);
+  e2 = gd_error(D);
+  CHECKI(e2,0);
+  CHECKS(ref, "ns.data");
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_refabs.c b/test/parse_nsf_refabs.c
new file mode 100644
index 0000000..9830eba
--- /dev/null
+++ b/test/parse_nsf_refabs.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  const char *ref;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "data RAW UINT8 1\n"
+    "/NAMESPACE ns2\n"
+    "/REFERENCE .ns.data\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  ref = gd_reference(D, NULL);
+  e2 = gd_error(D);
+  CHECKI(e2,0);
+  CHECKS(ref, "ns.data");
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_root.c b/test/parse_nsf_root.c
new file mode 100644
index 0000000..0a1c4c7
--- /dev/null
+++ b/test/parse_nsf_root.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "/NAMESPACE .\n"
+    "data CONST UINT8 1\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  gd_validate(D, "data");
+  e2 = gd_error(D);
+  CHECKI(e2,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_nsf_sub.c b/test/parse_nsf_sub.c
new file mode 100644
index 0000000..058169e
--- /dev/null
+++ b/test/parse_nsf_sub.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/NAMESPACE ns\n"
+    "/NAMESPACE ns2\n"
+    "data CONST UINT8 1\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  CHECKI(e1,0);
+
+  gd_validate(D, "ns2.data");
+  e2 = gd_error(D);
+  CHECKI(e2,0);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_octal_zero.c b/test/parse_octal_zero.c
index 73fe148..f19048b 100644
--- a/test/parse_octal_zero.c
+++ b/test/parse_octal_zero.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 = "string STRING \\00\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "string STRING \\00\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_phase.c b/test/parse_phase.c
index 434a565..148cd0f 100644
--- a/test/parse_phase.c
+++ b/test/parse_phase.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 PHASE in1 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data PHASE in1 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_phase_ncols.c b/test/parse_phase_ncols.c
index 557e823..db715fb 100644
--- a/test/parse_phase_ncols.c
+++ b/test/parse_phase_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 PHASE in1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data PHASE in1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_phase_scalar.c b/test/parse_phase_scalar.c
index 25eca96..909655b 100644
--- a/test/parse_phase_scalar.c
+++ b/test/parse_phase_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 PHASE in1 const\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST INT32 1\ndata PHASE in1 const\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_polynom.c b/test/parse_polynom.c
index 1f4ac97..9f93148 100644
--- a/test/parse_polynom.c
+++ b/test/parse_polynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "polynom POLYNOM in 1 2 3 4\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "polynom POLYNOM in 1 2 3 4\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_polynom_ncols1.c b/test/parse_polynom_ncols1.c
index 0ec3de7..b2a53f3 100644
--- a/test/parse_polynom_ncols1.c
+++ b/test/parse_polynom_ncols1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "polynom POLYNOM in 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "polynom POLYNOM in 1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_polynom_ncols2.c b/test/parse_polynom_ncols2.c
index 191bf6c..0374c80 100644
--- a/test/parse_polynom_ncols2.c
+++ b/test/parse_polynom_ncols2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "polynom POLYNOM in 1 2 3 4 5 6 7 8 9\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "polynom POLYNOM in 1 2 3 4 5 6 7 8 9\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_polynom_scalar.c b/test/parse_polynom_scalar.c
index 5fa5626..bdb427f 100644
--- a/test/parse_polynom_scalar.c
+++ b/test/parse_polynom_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,20 @@
 /* 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 FLOAT64 3.2\n"
-    "polynom POLYNOM in const 0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "const  CONST FLOAT64 3.2\n"
+    "polynom POLYNOM in const 0\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_protect_all.c b/test/parse_protect_all.c
index 7fbd8a3..8339a88 100644
--- a/test/parse_protect_all.c
+++ b/test/parse_protect_all.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "PROTECT all\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "PROTECT all\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_protect_bad.c b/test/parse_protect_bad.c
index aaa49e3..0b87920 100644
--- a/test/parse_protect_bad.c
+++ b/test/parse_protect_bad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "PROTECT badprotection\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "PROTECT badprotection\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_protect_data.c b/test/parse_protect_data.c
index 7cd6812..e54b9a6 100644
--- a/test/parse_protect_data.c
+++ b/test/parse_protect_data.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "PROTECT data\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "PROTECT data\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_protect_format.c b/test/parse_protect_format.c
index 8e145d4..48ba733 100644
--- a/test/parse_protect_format.c
+++ b/test/parse_protect_format.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "PROTECT format\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "PROTECT format\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_protect_none.c b/test/parse_protect_none.c
index 2a60bb6..4926384 100644
--- a/test/parse_protect_none.c
+++ b/test/parse_protect_none.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "PROTECT none\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "PROTECT none\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_quote.c b/test/parse_quote.c
index 495aa29..86752d1 100644
--- a/test/parse_quote.c
+++ b/test/parse_quote.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "\"da ta\" RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "\"da ta\" RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_quote_mismatch.c b/test/parse_quote_mismatch.c
index c8ea6b1..9092d41 100644
--- a/test/parse_quote_mismatch.c
+++ b/test/parse_quote_mismatch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 RAW UINT8 \"1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 \"1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_raw.c b/test/parse_raw.c
index 4b51329..c2939cd 100644
--- a/test/parse_raw.c
+++ b/test/parse_raw.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_raw_char.c b/test/parse_raw_char.c
index b186e57..22d7c76 100644
--- a/test/parse_raw_char.c
+++ b/test/parse_raw_char.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 RAW c 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW c 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_raw_char_bad.c b/test/parse_raw_char_bad.c
index 098ed2d..fb187b5 100644
--- a/test/parse_raw_char_bad.c
+++ b/test/parse_raw_char_bad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 RAW z 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW z 1\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_raw_ncols.c b/test/parse_raw_ncols.c
index 6a1a608..9e8cb2a 100644
--- a/test/parse_raw_ncols.c
+++ b/test/parse_raw_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 RAW UINT8\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_raw_scalar.c b/test/parse_raw_scalar.c
index 002073b..1ce3767 100644
--- a/test/parse_raw_scalar.c
+++ b/test/parse_raw_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 INT8 1\ndata RAW UINT8 const\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST INT8 1\ndata RAW UINT8 const\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_raw_spf.c b/test/parse_raw_spf.c
index e5cfaa5..db45501 100644
--- a/test/parse_raw_spf.c
+++ b/test/parse_raw_spf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 RAW UINT8 0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 0\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_raw_type.c b/test/parse_raw_type.c
index 522f3b9..f84253b 100644
--- a/test/parse_raw_type.c
+++ b/test/parse_raw_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 RAW BADTYPE 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW BADTYPE 11\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_recip.c b/test/parse_recip.c
index c97bc40..a6b3be0 100644
--- a/test/parse_recip.c
+++ b/test/parse_recip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 RECIP in2 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RECIP in2 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_recip_ncols.c b/test/parse_recip_ncols.c
new file mode 100644
index 0000000..ef2fa3d
--- /dev/null
+++ b/test/parse_recip_ncols.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "recip RECIP a\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_ref.c b/test/parse_ref.c
index 7c38780..ffab62e 100644
--- a/test/parse_ref.c
+++ b/test/parse_ref.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "REFERENCE data\ndata RAW UINT8 1";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "REFERENCE data\ndata RAW UINT8 1");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_ref_nonexistent.c b/test/parse_ref_nonexistent.c
index 25c0dd8..7ad10ef 100644
--- a/test/parse_ref_nonexistent.c
+++ b/test/parse_ref_nonexistent.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "REFERENCE data\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "REFERENCE data\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_ref_type.c b/test/parse_ref_type.c
new file mode 100644
index 0000000..04873bd
--- /dev/null
+++ b/test/parse_ref_type.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data CONST UINT8 1\n"
+      "/REFERENCE data\n"
+      );
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_REFERENCE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_sarray.c b/test/parse_sarray.c
new file mode 100644
index 0000000..7d5ef34
--- /dev/null
+++ b/test/parse_sarray.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General 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";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "s SARRAY a b c d\n");
+
+  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_sarray_long.c b/test/parse_sarray_long.c
new file mode 100644
index 0000000..03e62d4
--- /dev/null
+++ b/test/parse_sarray_long.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General 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";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "s SARRAY 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 42\n");
+
+  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_sarray_ncols.c b/test/parse_sarray_ncols.c
new file mode 100644
index 0000000..dec777e
--- /dev/null
+++ b/test/parse_sarray_ncols.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray SARRAY\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_sbit.c b/test/parse_sbit.c
index 3f93aff..08c1cbd 100644
--- a/test/parse_sbit.c
+++ b/test/parse_sbit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 SBIT in1 3\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data SBIT in1 3\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_scalar1.c b/test/parse_scalar1.c
index efd18ca..e854aca 100644
--- a/test/parse_scalar1.c
+++ b/test/parse_scalar1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 = "/VERSION 9\ndata RAW UINT8 scalar<3>\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/VERSION 9\ndata RAW UINT8 scalar<3>\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_scalar2.c b/test/parse_scalar2.c
index 375e8e0..2fdcf08 100644
--- a/test/parse_scalar2.c
+++ b/test/parse_scalar2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014, 2016 D. V. Wiebe
+/* Copyright (C) 2014, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,18 @@
  */
 #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 = "/VERSION 9\ndata RAW UINT8 scalar<3\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/VERSION 9\ndata RAW UINT8 scalar<3\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_scalar_repr.c b/test/parse_scalar_repr.c
index f655f30..1d03d18 100644
--- a/test/parse_scalar_repr.c
+++ b/test/parse_scalar_repr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 D. V. Wiebe
+/* Copyright (C) 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 RAW UINT8 scalar.r\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 scalar.r\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_sindir.c b/test/parse_sindir.c
new file mode 100644
index 0000000..b9205ba
--- /dev/null
+++ b/test/parse_sindir.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data SINDIR in1 in2\n");
+
+  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_sort.c b/test/parse_sort.c
index 3bd945c..969d9cf 100644
--- a/test/parse_sort.c
+++ b/test/parse_sort.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,75 +18,45 @@
  * 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"
 
-#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 =
-    "c RAW UINT8 1\n"
-    "d RAW UINT8 1\n"
-    "g RAW UINT8 1\n"
-    "h RAW UINT8 1\n"
-    "i RAW UINT8 1\n"
-    "k RAW UINT8 1\n"
-    "f RAW UINT8 1\n"
-    "b RAW UINT8 1\n"
-    "a RAW UINT8 1\n"
-    "j RAW UINT8 1\n"
-    "e RAW UINT8 1\n";
-  int fd, r = 0;
-  const char **field_list;
+  int error, i, r = 0;
+  const char **fl;
   DIRFILE *D;
+#define NFIELDS 12
+  const char *field_list[NFIELDS] = {
+    "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "INDEX"
+  };
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+      "c RAW UINT8 1\n"
+      "d RAW UINT8 1\n"
+      "g RAW UINT8 1\n"
+      "h RAW UINT8 1\n"
+      "i RAW UINT8 1\n"
+      "k RAW UINT8 1\n"
+      "f RAW UINT8 1\n"
+      "b RAW UINT8 1\n"
+      "a RAW UINT8 1\n"
+      "j RAW UINT8 1\n"
+      "e RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-  field_list = gd_field_list(D);
+  fl = gd_field_list(D);
+
+  error = gd_error(D);
+  CHECKI(error, 0);
 
-  if (gd_error(D))
-    r = 1;
-  else if (field_list == NULL)
-    r = 1;
-  else if (field_list[0][0] != 'I')
-    r = 1;
-  else if (field_list[1][0] != 'a')
-    r = 1;
-  else if (field_list[2][0] != 'b')
-    r = 1;
-  else if (field_list[3][0] != 'c')
-    r = 1;
-  else if (field_list[4][0] != 'd')
-    r = 1;
-  else if (field_list[5][0] != 'e')
-    r = 1;
-  else if (field_list[6][0] != 'f')
-    r = 1;
-  else if (field_list[7][0] != 'g')
-    r = 1;
-  else if (field_list[8][0] != 'h')
-    r = 1;
-  else if (field_list[9][0] != 'i')
-    r = 1;
-  else if (field_list[10][0] != 'j')
-    r = 1;
-  else if (field_list[11][0] != 'k')
-    r = 1;
+  for (i = 0; fl[i]; ++i)
+    CHECKSi(i, fl[i], field_list[i]);
+  CHECKI(i, NFIELDS);
 
   gd_discard(D);
   unlink(format);
diff --git a/test/parse_string.c b/test/parse_string.c
index c20701c..8aa2e2b 100644
--- a/test/parse_string.c
+++ b/test/parse_string.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "string STRING value\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "string STRING value\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_string_ncols.c b/test/parse_string_ncols.c
index ee000ec..8b55671 100644
--- a/test/parse_string_ncols.c
+++ b/test/parse_string_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "string STRING\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "string STRING\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_string_null.c b/test/parse_string_null.c
index a66710a..2952893 100644
--- a/test/parse_string_null.c
+++ b/test/parse_string_null.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "string STRING \"\"\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "string STRING \"\"\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_utf8.c b/test/parse_utf8.c
index fc23f04..1cc6bb7 100644
--- a/test/parse_utf8.c
+++ b/test/parse_utf8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,19 +21,11 @@
 /* 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 = "string STRING \\u65\\u654\\u6543\\u65432\n";
-  int i, fd, error, r = 0;
+  int i, error, r = 0;
 #define STRLEN 11
   const unsigned char u[STRLEN] =
   {
@@ -47,11 +39,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "string STRING \\u65\\u654\\u6543\\u65432\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_utf8_invalid.c b/test/parse_utf8_invalid.c
index d33cff4..d92af26 100644
--- a/test/parse_utf8_invalid.c
+++ b/test/parse_utf8_invalid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 = "string STRING \\u654321\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "string STRING \\u654321\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_utf8_zero.c b/test/parse_utf8_zero.c
index 911cf5f..ef0005d 100644
--- a/test/parse_utf8_zero.c
+++ b/test/parse_utf8_zero.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,27 +20,17 @@
  */
 #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 = "string STRING \\u0\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "string STRING \\u0\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_version.c b/test/parse_version.c
index 322fbbf..f19a176 100644
--- a/test/parse_version.c
+++ b/test/parse_version.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* 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>
-#include <stdio.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "VERSION 999999\nBADDIRECTIVE BADTYPE\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "VERSION 999999\nBADDIRECTIVE BADTYPE\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_version_89.c b/test/parse_version_89.c
index 3e228a9..e2d2a76 100644
--- a/test/parse_version_89.c
+++ b/test/parse_version_89.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -27,24 +27,18 @@ int main(void)
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/VERSION 8\n"
+    "/INCLUDE format1\n"
+    "r WINDOW a b EQ 1.\n"
+  );
+  MAKEFORMATFILE(format1, "/VERSION 9\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_version_98.c b/test/parse_version_98.c
index a3361b8..522001f 100644
--- a/test/parse_version_98.c
+++ b/test/parse_version_98.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -27,24 +27,18 @@ int main(void)
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/VERSION 9\n"
+    "/INCLUDE format1\n"
+    "r WINDOW a b EQ 1.\n"
+  );
+  MAKEFORMATFILE(format1, "/VERSION 8\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_version_include.c b/test/parse_version_include.c
index f06f468..83ab577 100644
--- a/test/parse_version_include.c
+++ b/test/parse_version_include.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,19 @@
 /* VERSION should cross INCLUDEs */
 #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 = "VERSION 999999\nINCLUDE format1\n";
-  const char *format1_data = "BADDIRECTIVE BADTYPE\n";
-  int fd, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "VERSION 999999\nINCLUDE format1\n");
+  MAKEFORMATFILE(format1, "BADDIRECTIVE BADTYPE\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE | GD_PERMISSIVE);
   error = gd_error(D);
diff --git a/test/parse_version_p8.c b/test/parse_version_p8.c
index 5dba70e..7d7db0d 100644
--- a/test/parse_version_p8.c
+++ b/test/parse_version_p8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -27,23 +27,17 @@ int main(void)
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/INCLUDE format1\n"
+    "r.d RECIP a b EQ 1.\n"
+  );
+  MAKEFORMATFILE(format1, "/VERSION 8\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_version_p9.c b/test/parse_version_p9.c
index b8583af..b35c352 100644
--- a/test/parse_version_p9.c
+++ b/test/parse_version_p9.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -27,23 +27,17 @@ int main(void)
   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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/INCLUDE format1\n"
+    "r.d WINDOW a b EQ 1.\n"
+  );
+  MAKEFORMATFILE(format1, "/VERSION 9\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_version_permissive.c b/test/parse_version_permissive.c
index f6321fc..def2a9f 100644
--- a/test/parse_version_permissive.c
+++ b/test/parse_version_permissive.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* 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>
-#include <stdio.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "VERSION 999999\nBADDIRECTIVE BADTYPE\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "VERSION 999999\nBADDIRECTIVE BADTYPE\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_PERMISSIVE | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_version_slash.c b/test/parse_version_slash.c
index 59624b5..bc19ae1 100644
--- a/test/parse_version_slash.c
+++ b/test/parse_version_slash.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* 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>
-#include <stdio.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data = "/VERSION 999999\nBADDIRECTIVE BADTYPE\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/VERSION 999999\nBADDIRECTIVE BADTYPE\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_whitespace.c b/test/parse_whitespace.c
index 6b07a53..5320dbf 100644
--- a/test/parse_whitespace.c
+++ b/test/parse_whitespace.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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 = "da\\ ta RAW UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "da\\ ta RAW UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_window.c b/test/parse_window.c
index 4d7059a..271a811 100644
--- a/test/parse_window.c
+++ b/test/parse_window.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data WINDOW in1 in2 EQ 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/parse_window_ncols.c b/test/parse_window_ncols.c
index 7922a15..52c9819 100644
--- a/test/parse_window_ncols.c
+++ b/test/parse_window_ncols.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data WINDOW in1 XOR 0x10\n");
 
   D = gd_open(filedir, GD_RDONLY);
   error = gd_error(D);
diff --git a/test/parse_window_op.c b/test/parse_window_op.c
index 06835bb..f5b8ca1 100644
--- a/test/parse_window_op.c
+++ b/test/parse_window_op.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,38 +18,49 @@
  * 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 nerror = 0;
+
+int callback(gd_parser_data_t *pdata, void *extra)
+{
+  pdata = extra; /* avoid compiler warnings */
+  extra = pdata;
+
+  nerror++;
+  return GD_SYNTAX_CONTINUE;
+}
 
 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;
+  int e1, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+      "w1 WINDOW a b = 1\n"
+      "w2 WINDOW a b EQUALS 2\n"
+      "w3 WINDOW a b LTDL 3\n"
+      "w4 WINDOW a b LET 4\n"
+      "w5 WINDOW a b GTO 5\n"
+      "w6 WINDOW a b GET 6\n"
+      "w7 WINDOW a b NET 7\n"
+      "w8 WINDOW a b SETTER 8\n"
+      "w9 WINDOW a b CLRV 9\n"
+      );
 
-  D = gd_open(filedir, GD_RDONLY);
-  error = gd_error(D);
+  D = gd_cbopen(filedir, GD_RDONLY, callback, NULL);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_FORMAT);
+  CHECKI(nerror, 9);
   gd_discard(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
index 1256fb5..e2c4157 100644
--- a/test/parse_window_scalar.c
+++ b/test/parse_window_scalar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,27 +21,17 @@
 /* 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;
+  int error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "const CONST INT32 1\ndata WINDOW a b LT const\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   error = gd_error(D);
diff --git a/test/protect_alter.c b/test/protect_alter.c
index 1c36326..01dfb56 100644
--- a/test/protect_alter.c
+++ b/test/protect_alter.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,19 @@
 /* Test frameoffset */
 #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 = "data RAW UINT8 8\nPROTECT format\n";
-  unsigned char data_data[256];
-  int fd, ret, p, error, r = 0;
+  int ret, p, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nPROTECT format\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_protection(D, GD_PROTECT_DATA, 0);
diff --git a/test/protect_alter_all.c b/test/protect_alter_all.c
index 563c7ce..88fb0a7 100644
--- a/test/protect_alter_all.c
+++ b/test/protect_alter_all.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,37 +20,23 @@
  */
 #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 *format_data =
-    "data RAW UINT8 8\n"
-    "INCLUDE format1\n"
-    "PROTECT format\n";
-  const char *format1_data = "PROTECT none\n";
-  int fd, ret, p0, p1, error, r = 0;
+  int ret, p0, p1, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 8\n"
+    "INCLUDE format1\n"
+    "PROTECT format\n"
+  );
+  MAKEFORMATFILE(format1, "PROTECT none\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_alter_protection(D, GD_PROTECT_DATA, GD_ALL_FRAGMENTS);
diff --git a/test/protect_alter_arg.c b/test/protect_alter_arg.c
new file mode 100644
index 0000000..2af751e
--- /dev/null
+++ b/test/protect_alter_arg.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  e1 = gd_alter_protection(D, -1, 0);
+  CHECKI(e1, GD_E_ARGUMENT);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/protect_alter_index.c b/test/protect_alter_index.c
new file mode 100644
index 0000000..47d4e16
--- /dev/null
+++ b/test/protect_alter_index.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  e1 = gd_alter_protection(D, GD_PROTECT_ALL, -2);
+  CHECKI(e1, GD_E_BAD_INDEX);
+
+  e2 = gd_alter_protection(D, GD_PROTECT_ALL, 1);
+  CHECKI(e2, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/protect_alter_rdonly.c b/test/protect_alter_rdonly.c
new file mode 100644
index 0000000..6c7f6e2
--- /dev/null
+++ b/test/protect_alter_rdonly.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_alter_protection(D, 0, GD_PROTECT_ALL);
+  CHECKI(e1, GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/protect_get.c b/test/protect_get.c
index edd6476..e84bca8 100644
--- a/test/protect_get.c
+++ b/test/protect_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,36 +21,19 @@
 /* Test protection */
 #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\nPROTECT format\n";
-  unsigned char data_data[256];
-  int fd, p, error, r = 0;
+  int p, 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nPROTECT format\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   p = gd_protection(D, 0);
diff --git a/test/protect_index.c b/test/protect_index.c
new file mode 100644
index 0000000..68bdd10
--- /dev/null
+++ b/test/protect_index.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  e1 = gd_protection(D, -1);
+  CHECKI(e1, GD_E_BAD_INDEX);
+
+  e2 = gd_protection(D, 1);
+  CHECKI(e2, GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put64.c b/test/put64.c
index 41e2e11..116b962 100644
--- a/test/put64.c
+++ b/test/put64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,20 +22,11 @@
 
 #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;
   int fd, n, e1, e2, i, r = 0;
   struct stat buf;
@@ -43,14 +34,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata64(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/put_bad_code.c b/test/put_bad_code.c
index 83d3d82..c81f90b 100644
--- a/test/put_bad_code.c
+++ b/test/put_bad_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* Attempt to write a non-existant field */
 #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 = "#\n";
   unsigned char c = 0;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "#\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "no-such-field", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/put_bit.c b/test/put_bit.c
index 14458c6..6ff4285 100644
--- a/test/put_bit.c
+++ b/test/put_bit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,23 @@
 /* Attempt to write BIT */
 #include "test.h"
 
-#include <inttypes.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";
-  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);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = i;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "bit BIT data 2 3\ndata RAW UINT8 8\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   for (i = 0; i < 50; ++i)
diff --git a/test/put_bit_repr.c b/test/put_bit_repr.c
new file mode 100644
index 0000000..4c35a74
--- /dev/null
+++ b/test/put_bit_repr.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char c = 0;
+  int n, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "bit BIT data.r 1 1\n"
+      "data RAW COMPLEX128 1\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "bit", 5, 0, 1, 0, GD_INT8, &c);
+  CHECKI(n, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_bof.c b/test/put_bof.c
index cf784e4..3d14cee 100644
--- a/test/put_bof.c
+++ b/test/put_bof.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,29 +21,18 @@
 /* Attempt to write UINT8 past the beginning-of-field*/
 #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 *format_data = "data RAW UINT8 8\nFRAMEOFFSET 10000";
   uint8_t c[8];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nFRAMEOFFSET 10000");
 
   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_carray_bad.c b/test/put_carray_bad.c
new file mode 100644
index 0000000..bc58c85
--- /dev/null
+++ b/test/put_carray_bad.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  void *ptr = main;
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_put_carray_slice(D, "carray", 10, 1, GD_UINT8, ptr);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  e2 = gd_put_carray(D, "carray", GD_UINT8, ptr);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_carray_bounds.c b/test/put_carray_bounds.c
new file mode 100644
index 0000000..1bc74e3
--- /dev/null
+++ b/test/put_carray_bounds.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  void *ptr = main;
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "carray CARRAY UINT8 1 2 3 4 5 6 7 8\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_put_carray_slice(D, "carray", 10, 1, GD_UINT8, ptr);
+  CHECKI(e1, GD_E_BOUNDS);
+
+  e2 = gd_put_carray_slice(D, "carray", 1, 10, GD_UINT8, ptr);
+  CHECKI(e2, GD_E_BOUNDS);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_carray_rdonly.c b/test/put_carray_rdonly.c
new file mode 100644
index 0000000..efa4311
--- /dev/null
+++ b/test/put_carray_rdonly.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  void *ptr = main;
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "carray CARRAY UINT8 1 2 3 4 5 6 7 8\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_put_carray(D, "carray", GD_UINT8, ptr);
+  CHECKI(e1, GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_carray_type.c b/test/put_carray_type.c
new file mode 100644
index 0000000..9dd742d
--- /dev/null
+++ b/test/put_carray_type.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  void *ptr = main;
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "carray RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_put_carray_slice(D, "carray", 10, 1, GD_UINT8, ptr);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  e2 = gd_put_carray(D, "carray", GD_UINT8, ptr);
+  CHECKI(e2, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_char.c b/test/put_char.c
index 923652a..f3fecdb 100644
--- a/test/put_char.c
+++ b/test/put_char.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,22 @@
 /* Attempt to write UINT8 c/ an old-style type character should fail cleanly */
 #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 *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "data", 5, 0, 1, 0, (gd_type_t)'c', c);
diff --git a/test/put_clincom1.c b/test/put_clincom1.c
index 492c967..ec92f89 100644
--- a/test/put_clincom1.c
+++ b/test/put_clincom1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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 = "lincom LINCOM 1 data 1;1 0;-1\ndata RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, q, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (q = 0; q < 8; ++q)
     c[q] = (int8_t)(39 + q * 2);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 1 data 1;1 0;-1\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "lincom", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_complex128.c b/test/put_complex128.c
index b32a27e..dee09c2 100644
--- a/test/put_complex128.c
+++ b/test/put_complex128.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,22 +20,11 @@
  */
 #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 <math.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 COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double c[8][2], d[2];
   const double zero[] = {0, 0};
@@ -49,7 +38,7 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i) {
 #ifdef GD_NO_C99_API
@@ -60,9 +49,7 @@ int main(void)
 #endif
   }
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/put_complex64.c b/test/put_complex64.c
index cfab93a..8cdb289 100644
--- a/test/put_complex64.c
+++ b/test/put_complex64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,22 +20,11 @@
  */
 #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 <math.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 COMPLEX64 8\n";
 #ifdef GD_NO_C99_API
   float c[8][2], d[2];
   const float zero[] = {0, 0};
@@ -49,7 +38,7 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i) {
 #ifdef GD_NO_C99_API
@@ -60,9 +49,7 @@ int main(void)
 #endif
   }
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX64 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_COMPLEX64, c);
diff --git a/test/put_const_protect.c b/test/put_const_protect.c
index 360a8a6..03317c4 100644
--- a/test/put_const_protect.c
+++ b/test/put_const_protect.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,44 +18,31 @@
  * 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)
 {
   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;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data CONST UINT8 8\nPROTECT all\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_put_constant(D, "data", GD_UINT8, &d);
   error = gd_error(D);
 
+  CHECKI(error, GD_E_PROTECTED);
+  CHECKI(n, GD_E_PROTECTED);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
-
-  CHECKI(error, GD_E_PROTECTED);
-  CHECKI(n, -1);
   return r;
 }
diff --git a/test/put_cpolynom.c b/test/put_cpolynom.c
index 45f4def..8741086 100644
--- a/test/put_cpolynom.c
+++ b/test/put_cpolynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,22 +20,11 @@
  */
 #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 =
-    "polynom POLYNOM data 0;1 0.5;0.5\n"
-    "data RAW INT8 8\n";
   int8_t d;
   double c[16];
   struct stat buf;
@@ -43,16 +32,17 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i) {
     c[2 * i] = 0.5;
     c[2 * i + 1] = 40 + i + 0.5;
   }
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "polynom POLYNOM data 0;1 0.5;0.5\n"
+    "data RAW INT8 8\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "polynom", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/put_crecip.c b/test/put_crecip.c
index 33c6c1e..d1f2205 100644
--- a/test/put_crecip.c
+++ b/test/put_crecip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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 = "div RECIP data 0;1000.\ndata RAW INT8 8\n";
   int8_t d;
   double c[16];
   struct stat buf;
@@ -42,16 +33,14 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i) {
     c[2 * i] = 0;
     c[2 * i + 1] = (40. + i);
   }
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "div RECIP data 0;1000.\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "div", 5, 0, 1, 0, GD_COMPLEX128, c);
diff --git a/test/put_divide.c b/test/put_divide.c
index 41142a6..4db1eab 100644
--- a/test/put_divide.c
+++ b/test/put_divide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,35 +20,24 @@
  */
 #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 = "div DIVIDE data data\ndata RAW INT8 8\n";
   int8_t c[8];
   struct stat buf;
-  int fd, i, n, e1, e2, r = 0;
+  int i, n, e1, e2, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "div DIVIDE data data\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "div", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_endian16.c b/test/put_endian16.c
index 961ed89..62ddeb9 100644
--- a/test/put_endian16.c
+++ b/test/put_endian16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* Attempt to write UINT16 with the opposite endianness */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
 static int BigEndian(void)
 {
   union {
@@ -52,7 +43,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   sprintf(format_data, "data RAW UINT16 1\nENDIAN %s\n", (big_endian)
       ? "little" : "big");
diff --git a/test/put_endian32.c b/test/put_endian32.c
index e82a476..e4f7af3 100644
--- a/test/put_endian32.c
+++ b/test/put_endian32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* Attempt to write UINT32 with the opposite endianness */
 #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>
-
 static int BigEndian(void)
 {
   union {
@@ -52,7 +43,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   sprintf(format_data, "data RAW UINT32 1\nENDIAN %s\n", (big_endian)
       ? "little" : "big");
diff --git a/test/put_endian64.c b/test/put_endian64.c
index a22616e..18479f3 100644
--- a/test/put_endian64.c
+++ b/test/put_endian64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* Attempt to write UINT64 with the opposite endianness */
 #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>
-
 static int BigEndian(void)
 {
   union {
@@ -52,7 +43,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   sprintf(format_data, "data RAW UINT64 1\nENDIAN %s\n", (big_endian)
       ? "little" : "big");
diff --git a/test/put_endian8.c b/test/put_endian8.c
index f929da0..d611562 100644
--- a/test/put_endian8.c
+++ b/test/put_endian8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* Attempt to write UINT8 with the opposite endianness */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
 static int BigEndian(void)
 {
   union {
@@ -52,7 +43,7 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
   sprintf(format_data, "data RAW UINT8 1\nENDIAN %s\n", (big_endian)
       ? "little" : "big");
diff --git a/test/put_endian_complex128_arm.c b/test/put_endian_complex128_arm.c
index 9afb915..aa1bba5 100644
--- a/test/put_endian_complex128_arm.c
+++ b/test/put_endian_complex128_arm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write arm-endian COMPLEX128 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 COMPLEX128 1\nENDIAN little arm\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const double c[] = {1.5, 2.25};
@@ -51,11 +41,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\nENDIAN little arm\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
 #ifdef GD_NO_C99_API
diff --git a/test/put_endian_complex128_big.c b/test/put_endian_complex128_big.c
index b2e52ed..5a63303 100644
--- a/test/put_endian_complex128_big.c
+++ b/test/put_endian_complex128_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write big-endian COMPLEX128 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 COMPLEX128 1\nENDIAN big\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const double c[] = {1.5, 2.25};
@@ -51,11 +41,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\nENDIAN big\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
 #ifdef GD_NO_C99_API
diff --git a/test/put_endian_complex128_little.c b/test/put_endian_complex128_little.c
index 6e39a8a..e6dfd07 100644
--- a/test/put_endian_complex128_little.c
+++ b/test/put_endian_complex128_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write little-endian COMPLEX128 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 COMPLEX128 1\nENDIAN little\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const double c[] = {1.5, 2.25};
@@ -51,11 +41,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\nENDIAN little\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
 #ifdef GD_NO_C99_API
diff --git a/test/put_endian_complex64_arm.c b/test/put_endian_complex64_arm.c
index 4919d70..7d4fd06 100644
--- a/test/put_endian_complex64_arm.c
+++ b/test/put_endian_complex64_arm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write arm-endian COMPLEX64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 COMPLEX64 1\nENDIAN little arm\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const float c[] = {1.5, 2.25};
@@ -50,11 +40,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX64 1\nENDIAN little arm\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
 #ifdef GD_NO_C99_API
diff --git a/test/put_endian_complex64_big.c b/test/put_endian_complex64_big.c
index 6f2a7d6..66907cc 100644
--- a/test/put_endian_complex64_big.c
+++ b/test/put_endian_complex64_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write big-endian COMPLEX64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 COMPLEX64 1\nENDIAN big\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const float c[] = {1.5, 2.25};
@@ -50,11 +40,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX64 1\nENDIAN big\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
 #ifdef GD_NO_C99_API
diff --git a/test/put_endian_complex64_little.c b/test/put_endian_complex64_little.c
index 8d56e35..dd254d8 100644
--- a/test/put_endian_complex64_little.c
+++ b/test/put_endian_complex64_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write little-endian COMPLEX64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 COMPLEX64 1\nENDIAN little\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const float c[] = {1.5, 2.25};
@@ -50,11 +40,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX64 1\nENDIAN little\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
 #ifdef GD_NO_C99_API
diff --git a/test/put_endian_float32_arm.c b/test/put_endian_float32_arm.c
index af44d24..03daa7a 100644
--- a/test/put_endian_float32_arm.c
+++ b/test/put_endian_float32_arm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write arm-endian FLOAT32 (which is just little endian) */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 FLOAT32 1\nENDIAN little arm\n";
   unsigned int i;
   const float c = 1.5;
   unsigned char x[sizeof(float)] = { 0x00, 0x00, 0xC0, 0x3F };
@@ -44,11 +34,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 1\nENDIAN little arm\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, &c);
diff --git a/test/put_endian_float32_big.c b/test/put_endian_float32_big.c
index 6d7109e..19c6c52 100644
--- a/test/put_endian_float32_big.c
+++ b/test/put_endian_float32_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write big-endian FLOAT32 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 FLOAT32 1\nENDIAN big\n";
   unsigned int i;
   const float c = 1.5;
   unsigned char x[sizeof(float)] = { 0x3F, 0xC0, 0x00, 0x00 };
@@ -44,11 +34,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 1\nENDIAN big\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, &c);
diff --git a/test/put_endian_float32_little.c b/test/put_endian_float32_little.c
index d89846d..fd57964 100644
--- a/test/put_endian_float32_little.c
+++ b/test/put_endian_float32_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write little-endian FLOAT32 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 FLOAT32 1\nENDIAN little\n";
   unsigned int i;
   const float c = 1.5;
   unsigned char x[sizeof(float)] = { 0x00, 0x00, 0xC0, 0x3F };
@@ -44,11 +34,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 1\nENDIAN little\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, &c);
diff --git a/test/put_endian_float64_arm.c b/test/put_endian_float64_arm.c
index 0374f90..b6f7ee0 100644
--- a/test/put_endian_float64_arm.c
+++ b/test/put_endian_float64_arm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write arm-endian FLOAT64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 FLOAT64 1\nENDIAN little arm\n";
   unsigned int i;
   const double c = 1.5;
   unsigned char x[sizeof(double)] = {
@@ -46,11 +36,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\nENDIAN little arm\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, &c);
diff --git a/test/put_endian_float64_big.c b/test/put_endian_float64_big.c
index d341377..ad9ec2b 100644
--- a/test/put_endian_float64_big.c
+++ b/test/put_endian_float64_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write big-endian FLOAT64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 FLOAT64 1\nENDIAN big\n";
   unsigned int i;
   const double c = 1.5;
   unsigned char x[sizeof(double)] = {
@@ -46,11 +36,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\nENDIAN big\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, &c);
diff --git a/test/put_endian_float64_little.c b/test/put_endian_float64_little.c
index deaa265..06a5e2c 100644
--- a/test/put_endian_float64_little.c
+++ b/test/put_endian_float64_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,11 @@
 /* Attempt to write little-endian FLOAT64 */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.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 FLOAT64 1\nENDIAN little\n";
   unsigned int i;
   const double c = 1.5;
   unsigned char x[sizeof(double)] = {
@@ -46,11 +36,9 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\nENDIAN little\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, &c);
diff --git a/test/put_ff.c b/test/put_ff.c
index b0b7a53..aea96a0 100644
--- a/test/put_ff.c
+++ b/test/put_ff.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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;
   int fd, i, n, e1, e2, r = 0;
   DIRFILE *D;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/put_float32.c b/test/put_float32.c
index 674293c..1d25eec 100644
--- a/test/put_float32.c
+++ b/test/put_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,21 +20,11 @@
  */
 #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 <math.h>
-
 int main(void)
 {
   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, e1, e2, r = 0;
@@ -42,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = (float)(40 + i);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT32 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/put_float64.c b/test/put_float64.c
index fa8bb22..e04b6d3 100644
--- a/test/put_float64.c
+++ b/test/put_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,21 +20,11 @@
  */
 #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 <math.h>
-
 int main(void)
 {
   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, e1, e2, r = 0;
@@ -42,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = 40 + i;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/put_foffs.c b/test/put_foffs.c
index 0aadd5e..f102667 100644
--- a/test/put_foffs.c
+++ b/test/put_foffs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,35 +20,23 @@
  */
 #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)
 {
   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, e1, e2, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nFRAMEOFFSET 2\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/put_fs.c b/test/put_fs.c
index d85e372..bf12c56 100644
--- a/test/put_fs.c
+++ b/test/put_fs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 0, 8, GD_UINT8, c);
diff --git a/test/put_here.c b/test/put_here.c
index dcc0ea4..d3020bc 100644
--- a/test/put_here.c
+++ b/test/put_here.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   m = gd_seek(D, "data", 5, 0, GD_SEEK_WRITE | GD_SEEK_SET);
diff --git a/test/put_heres.c b/test/put_heres.c
index 107e268..af88ea2 100644
--- a/test/put_heres.c
+++ b/test/put_heres.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   m = gd_seek(D, "data", 5, 0, GD_SEEK_WRITE | GD_SEEK_SET);
diff --git a/test/put_indir.c b/test/put_indir.c
new file mode 100644
index 0000000..63d7bdb
--- /dev/null
+++ b/test/put_indir.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int8_t c[8];
+  struct stat buf;
+  int i, n, e1, e2, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  for (i = 0; i < 8; ++i)
+    c[i] = (int8_t)(40 + i);
+
+  MAKEFORMATFILE(format,
+    "indir INDIR data carray\n"
+    "carray CARRAY INT8 1 2 3 4 5 6 7 8 9 0\n"
+    "data RAW INT8 8\n"
+  );
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "indir", 5, 0, 1, 0, GD_INT8, c);
+  e1 = gd_error(D);
+  CHECKI(n,0);
+  CHECKI(e1,GD_E_BAD_FIELD_TYPE);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  if (!stat(data, &buf)) {
+    perror("stat");
+    r = 1;
+  }
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_int16.c b/test/put_int16.c
index 00e65af..ceb48c4 100644
--- a/test/put_int16.c
+++ b/test/put_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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 INT16 8\n";
   int16_t c[8], d;
   struct stat buf;
   int fd, i, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = (int16_t)(40 + i);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT16 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/put_int32.c b/test/put_int32.c
index a727503..9ab7ce5 100644
--- a/test/put_int32.c
+++ b/test/put_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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 INT32 8\n";
   int32_t c[8], d;
   struct stat buf;
   int fd, i, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = 40 + i;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT32 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/put_int64.c b/test/put_int64.c
index 5be2bcb..d7a6fe9 100644
--- a/test/put_int64.c
+++ b/test/put_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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 INT64 8\n";
   int64_t c[8], d;
   struct stat buf;
   int fd, i, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = 40 + i;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW INT64 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
diff --git a/test/put_int8.c b/test/put_int8.c
index 7b6c29a..2bdb49b 100644
--- a/test/put_int8.c
+++ b/test/put_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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 INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_lincom1.c b/test/put_lincom1.c
index 0e1eb60..75ba2be 100644
--- a/test/put_lincom1.c
+++ b/test/put_lincom1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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 = "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, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "lincom LINCOM 1 data 0.5 3.0\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "lincom", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_lincom2.c b/test/put_lincom2.c
index 2f21280..ad1460c 100644
--- a/test/put_lincom2.c
+++ b/test/put_lincom2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,35 +20,24 @@
  */
 #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 = "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, e1, e2, r = 0;
+  int i, n, e1, e2, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "lincom LINCOM 2 data 0.5 3.0 data 1.0 2.0\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "lincom", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_lincom_noin.c b/test/put_lincom_noin.c
index 82182a0..9fcf8de 100644
--- a/test/put_lincom_noin.c
+++ b/test/put_lincom_noin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,47 +18,32 @@
  * 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"
 
-#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 *format_data = "lincom LINCOM 1 data 0.5 3.0\n";
-  int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int8_t c = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM data 1 0");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
-  n = gd_putdata(D, "lincom", 5, 0, 1, 0, GD_INT8, c);
+  n = gd_putdata(D, "lincom", 0, 0, 0, 1, GD_INT8, &c);
+  CHECKI(n,0);
+
   error = gd_error(D);
+  CHECKI(error,GD_E_BAD_CODE);
 
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(n,0);
-  CHECKI(error,GD_E_BAD_CODE);
   return r;
 }
diff --git a/test/put_lincom_repr.c b/test/put_lincom_repr.c
new file mode 100644
index 0000000..ad338e4
--- /dev/null
+++ b/test/put_lincom_repr.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char c = 0;
+  int n, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "lincom LINCOM data.r 1 1\n"
+      "data RAW COMPLEX128 1\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "lincom", 5, 0, 1, 0, GD_INT8, &c);
+  CHECKI(n, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_linterp.c b/test/put_linterp.c
index 3e8c91b..2f41eb1 100644
--- a/test/put_linterp.c
+++ b/test/put_linterp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,22 +20,12 @@
  */
 #include "test.h"
 
-#include <inttypes.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 *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, e1, e2, r = 0;
@@ -44,14 +34,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\ndata RAW INT8 8\n");
 
   t = fopen(table, "wt");
   for (i = 0; i < 10; ++i)
diff --git a/test/put_linterp_cmp.c b/test/put_linterp_cmp.c
new file mode 100644
index 0000000..c351074
--- /dev/null
+++ b/test/put_linterp_cmp.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *table = "dirfile/table";
+  int8_t c[8];
+  int i, n, e1, r = 0;
+  DIRFILE *D;
+  FILE *t;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "linterp LINTERP data table\n"
+      "data RAW FLOAT64 1\n"
+      );
+
+  for (i = 0; i < 8; ++i)
+    c[i] = (int8_t)(40 + i);
+
+  t = fopen(table, "wt");
+  for (i = 0; i < 10; ++i)
+    fprintf(t, "%i %i;%i\n", i * 6, i * 3, i);
+  fclose(t);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "linterp", 5, 0, 1, 0, GD_INT8, c);
+  CHECKI(n, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_DOMAIN);
+
+  gd_discard(D);
+
+  unlink(table);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_linterp_noin.c b/test/put_linterp_noin.c
index f197bcb..28b34d7 100644
--- a/test/put_linterp_noin.c
+++ b/test/put_linterp_noin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,36 +21,24 @@
 /* Attempt to write LINTERP */
 #include "test.h"
 
-#include <inttypes.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 *table = "dirfile/table";
-  const char *format_data = "linterp LINTERP data ./table\n";
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\n");
 
   t = fopen(table, "wt");
   for (i = 0; i < 10; ++i)
diff --git a/test/put_linterp_nomono.c b/test/put_linterp_nomono.c
index a9e373d..d6f5df1 100644
--- a/test/put_linterp_nomono.c
+++ b/test/put_linterp_nomono.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,25 @@
 /* Attempt to write LINTERP */
 #include "test.h"
 
-#include <inttypes.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 *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;
+  int i, n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\ndata RAW INT8 8\n");
 
   t = fopen(table, "wt");
   for (i = 0; i < 10; ++i)
diff --git a/test/put_linterp_notab.c b/test/put_linterp_notab.c
index cf5df34..343723f 100644
--- a/test/put_linterp_notab.c
+++ b/test/put_linterp_notab.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,23 @@
 /* Attempt to write LINCOM 1 */
 #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 = "linterp LINTERP data ./table\ndata RAW INT8 8\n";
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "linterp", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_linterp_repr.c b/test/put_linterp_repr.c
new file mode 100644
index 0000000..19f0c37
--- /dev/null
+++ b/test/put_linterp_repr.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *table = "dirfile/table";
+  int8_t c[8];
+  int i, n, e1, r = 0;
+  DIRFILE *D;
+  FILE *t;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "linterp LINTERP data.r table\n"
+      "data RAW COMPLEX128 1\n"
+      );
+
+  for (i = 0; i < 8; ++i)
+    c[i] = (int8_t)(40 + i);
+
+  t = fopen(table, "wt");
+  for (i = 0; i < 10; ++i)
+    fprintf(t, "%i %i\n", i * 6, i * 3);
+  fclose(t);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "linterp", 5, 0, 1, 0, GD_INT8, c);
+  CHECKI(n, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(table);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_linterp_reverse.c b/test/put_linterp_reverse.c
index 96d1daa..ccece1d 100644
--- a/test/put_linterp_reverse.c
+++ b/test/put_linterp_reverse.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,22 +20,12 @@
  */
 #include "test.h"
 
-#include <inttypes.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 *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, e1, e2, r = 0;
@@ -44,14 +34,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "linterp LINTERP data ./table\ndata RAW INT8 8\n");
 
   t = fopen(table, "wt");
   for (i = 0; i < 10; ++i)
diff --git a/test/put_mplex.c b/test/put_mplex.c
index a41748e..d624a20 100644
--- a/test/put_mplex.c
+++ b/test/put_mplex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,35 +26,20 @@ int main(void)
   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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "mplex MPLEX data count 1 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
+  MAKEDATAFILE(count, unsigned char, i % 3, 256);
 
   for (i = 0; i < 8; ++i)
     d[i] = 80 + i;
diff --git a/test/put_mplex_complex.c b/test/put_mplex_complex.c
index 64669a5..9e23140 100644
--- a/test/put_mplex_complex.c
+++ b/test/put_mplex_complex.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,10 +26,6 @@ int main(void)
   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 COMPLEX128 8\n";
   double c[16], d[16];
   double data_data[512];
   uint8_t count_data[256];
@@ -37,11 +33,13 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  MAKEFORMATFILE(format,
+    "mplex MPLEX data count 1 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW COMPLEX128 8\n"
+  );
 
   for (i = 0; i < 256; ++i) {
     data_data[2 * i] = i;
diff --git a/test/put_mplex_repr.c b/test/put_mplex_repr.c
new file mode 100644
index 0000000..b74a9c2
--- /dev/null
+++ b/test/put_mplex_repr.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char c = 0;
+  int n, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "mplex MPLEX data.r INDEX 1\n"
+      "data RAW COMPLEX128 1\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "mplex", 5, 0, 1, 0, GD_INT8, &c);
+  CHECKI(n, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_multiply.c b/test/put_multiply.c
index c9e2dbc..5c58f62 100644
--- a/test/put_multiply.c
+++ b/test/put_multiply.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,35 +20,24 @@
  */
 #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 = "mult MULTIPLY data data\ndata RAW INT8 8\n";
   int8_t c[8];
   struct stat buf;
-  int fd, i, n, e1, e2, r = 0;
+  int i, n, e1, e2, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "mult MULTIPLY data data\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "mult", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_neg.c b/test/put_neg.c
new file mode 100644
index 0000000..0e7890d
--- /dev/null
+++ b/test/put_neg.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int8_t c = 0;
+  int e1, e2, r = 0;
+  size_t n1, n2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n1 = gd_putdata(D, "data", 10, -10000, 0, 1, GD_INT8, &c);
+  CHECKU(n1, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_RANGE);
+
+  n2 = gd_putdata(D, "data", -10, 0, 0, 1, GD_INT8, &c);
+  CHECKU(n2, 0);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_RANGE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_null.c b/test/put_null.c
index c9a3fd4..c0c9d54 100644
--- a/test/put_null.c
+++ b/test/put_null.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* Attempt to write NULL */
 #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 *format_data = "data RAW UINT8 8\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_NULL, NULL);
diff --git a/test/put_off64.c b/test/put_off64.c
index 1dd09b2..917ac61 100644
--- a/test/put_off64.c
+++ b/test/put_off64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,14 +26,6 @@
 
 #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)
 {
 #ifdef SKIP_TEST
@@ -42,7 +34,6 @@ 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, n, e1, e2, r = 0;
@@ -50,14 +41,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/put_phase.c b/test/put_phase.c
index d0a6f2e..c523c04 100644
--- a/test/put_phase.c
+++ b/test/put_phase.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,20 +21,11 @@
 /* Attempt to write PHASE */
 #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 = "phase PHASE data -2\ndata RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, e1, e2, r = 0;
@@ -42,14 +33,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "phase PHASE data -2\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "phase", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_phase_noin.c b/test/put_phase_noin.c
index 1c9518d..3fad3be 100644
--- a/test/put_phase_noin.c
+++ b/test/put_phase_noin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,22 @@
 /* Attempt to write PHASE */
 #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 *format_data = "phase PHASE data -2\n";
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "phase PHASE data -2\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "phase", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_phase_repr.c b/test/put_phase_repr.c
new file mode 100644
index 0000000..d4e515c
--- /dev/null
+++ b/test/put_phase_repr.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char c = 0;
+  int n, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "phase PHASE data.r 1\n"
+      "data RAW COMPLEX128 1\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "phase", 5, 0, 1, 0, GD_INT8, &c);
+  CHECKI(n, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_polynom1.c b/test/put_polynom1.c
index 907be40..5d3bbd3 100644
--- a/test/put_polynom1.c
+++ b/test/put_polynom1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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 = "polynom POLYNOM data 3.0 0.5\ndata RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "polynom POLYNOM data 3.0 0.5\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "polynom", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_polynom2.c b/test/put_polynom2.c
index be56063..8ba1dfc 100644
--- a/test/put_polynom2.c
+++ b/test/put_polynom2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,35 +20,24 @@
  */
 #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 = "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, e1, e2, r = 0;
+  int i, n, e1, e2, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "polynom POLYNOM data 3.0 2.0 1.0 0.5\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "polynom", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_polynom_noin.c b/test/put_polynom_noin.c
index 29535cc..8b1aa7e 100644
--- a/test/put_polynom_noin.c
+++ b/test/put_polynom_noin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,22 @@
 /* Attempt to write POLYNOM */
 #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 *format_data = "polynom POLYNOM data 0.5 3.0\n";
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "polynom POLYNOM data 0.5 3.0\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "polynom", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_polynom_repr.c b/test/put_polynom_repr.c
new file mode 100644
index 0000000..78fd0f9
--- /dev/null
+++ b/test/put_polynom_repr.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char c = 0;
+  int n, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "polynom POLYNOM data.r 1 1\n"
+      "data RAW COMPLEX128 1\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "polynom", 5, 0, 1, 0, GD_INT8, &c);
+  CHECKI(n, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_protect.c b/test/put_protect.c
index 2a5dfa2..eb5d81a 100644
--- a/test/put_protect.c
+++ b/test/put_protect.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,22 @@
 /* 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 *format_data = "data RAW UINT8 8\nPROTECT all\n";
   uint8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nPROTECT all\n");
 
   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_range.c b/test/put_range.c
index ea01e93..e488823 100644
--- a/test/put_range.c
+++ b/test/put_range.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,24 +25,15 @@ 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, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR);
   n = gd_putdata64(D, "data", GD_INT64_MAX, GD_INT64_MAX, 1, 0, GD_UINT8,
diff --git a/test/put_rdonly.c b/test/put_rdonly.c
index 148a009..c908284 100644
--- a/test/put_rdonly.c
+++ b/test/put_rdonly.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,20 @@
  */
 #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];
-  int fd, n, e1, e2, unlink_data, r = 0;
+  int n, e1, e2, unlink_data, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_UNENCODED);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/put_recip.c b/test/put_recip.c
index 8c42349..37ebeed 100644
--- a/test/put_recip.c
+++ b/test/put_recip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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 = "div RECIP data 1000.\ndata RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "div RECIP data 1000.\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "div", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_recip_repr.c b/test/put_recip_repr.c
new file mode 100644
index 0000000..8702f74
--- /dev/null
+++ b/test/put_recip_repr.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  char c = 0;
+  int n, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "recip RECIP data.r 1\n"
+      "data RAW COMPLEX128 1\n"
+      );
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "recip", 5, 0, 1, 0, GD_INT8, &c);
+  CHECKI(n, 0);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_recurse.c b/test/put_recurse.c
index e98d127..69fbd80 100644
--- a/test/put_recurse.c
+++ b/test/put_recurse.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,43 +18,31 @@
  * 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"
 
-#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 =
-    "in1 RAW UINT8 11\n"
-    "lincom LINCOM 1 lincom 1 0\n";
   unsigned char c[8];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "lincom LINCOM 1 lincom 1 0\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
-  n = gd_putdata(D, "lincom", 5, 0, 1, 0, GD_UINT8, c);
+  n = gd_putdata(D, "lincom", 0, 0, 0, 1, GD_UINT8, c);
+  CHECKI(n,0);
   error = gd_error(D);
+  CHECKI(error,GD_E_RECURSE_LEVEL);
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(n,0);
-  CHECKI(error,GD_E_RECURSE_LEVEL);
   return r;
 }
diff --git a/test/put_repr.c b/test/put_repr.c
index 13c84c2..03c56a9 100644
--- a/test/put_repr.c
+++ b/test/put_repr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,36 +21,23 @@
 /* Attempt to write COMPLEX64 */
 #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 <math.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 COMPLEX64 8\n";
   float c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = 40 + i;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX64 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "data.r", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/put_rofs.c b/test/put_rofs.c
index 1fd962d..cc114f9 100644
--- a/test/put_rofs.c
+++ b/test/put_rofs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,31 +21,20 @@
 /* Attempt to write a read-only 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 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);
+  mkdir(filedir, 0700);
 
-  close(open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0555));
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
+  MAKEEMPTYFILE(data, 0500);
 
   /* ensure filesystem honours read-onlyness */
   if ((fd = open(data, O_RDWR)) >= 0 || errno != EACCES) {
diff --git a/test/put_sarray.c b/test/put_sarray.c
new file mode 100644
index 0000000..1467352
--- /dev/null
+++ b/test/put_sarray.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *val[] = {"l", "m", "n", "o", "p", "q", "r", "s"};
+  const char *val2[] = {"L", "M", "N", "O", "P", "Q", "R", "S"};
+  int e1, e2, r = 0, i;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add_sarray(D, "data", 8, val, 0);
+  gd_put_sarray(D, "data", val2);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_OK);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  /* check */
+  memset(val, 0, 8 * sizeof(char*));
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  gd_get_sarray(D, "data", val);
+
+  for (i = 0; i < 8; ++i)
+    CHECKSi(i, val[i], val2[i]);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+  return r;
+}
diff --git a/test/put_sarray_bad.c b/test/put_sarray_bad.c
new file mode 100644
index 0000000..e68c823
--- /dev/null
+++ b/test/put_sarray_bad.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  void *ptr = main;
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "#\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_put_sarray_slice(D, "sarray", 10, 1, ptr);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  e2 = gd_put_sarray(D, "sarray", ptr);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_sarray_bounds.c b/test/put_sarray_bounds.c
new file mode 100644
index 0000000..b7ac03d
--- /dev/null
+++ b/test/put_sarray_bounds.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  void *ptr = main;
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray SARRAY 1 2 3 4 5 6 7 8\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_put_sarray_slice(D, "sarray", 10, 1, ptr);
+  CHECKI(e1, GD_E_BOUNDS);
+
+  e2 = gd_put_sarray_slice(D, "sarray", 1, 10, ptr);
+  CHECKI(e2, GD_E_BOUNDS);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_sarray_rdonly.c b/test/put_sarray_rdonly.c
new file mode 100644
index 0000000..a02cb81
--- /dev/null
+++ b/test/put_sarray_rdonly.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  void *ptr = main;
+  int e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray SARRAY a b c d e f g h i j k\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_put_sarray(D, "sarray", ptr);
+  CHECKI(e1, GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_sarray_slice.c b/test/put_sarray_slice.c
new file mode 100644
index 0000000..666f301
--- /dev/null
+++ b/test/put_sarray_slice.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2014 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 *val[] = {"l", "m", "n", "o", "p", "q", "r", "s"};
+  const char *val2[] = {"W", "X", "Y", "Z"};
+  const char *result[] = {"l", "m", "W", "X", "Y", "Z", "r", "s"};
+  int e1, e2, r = 0, i;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add_sarray(D, "data", 8, val, 0);
+  gd_put_sarray_slice(D, "data", 2, 4, val2);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_OK);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  /* check */
+  memset(val, 0, 8 * sizeof(char*));
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  gd_get_sarray(D, "data", val);
+
+  for (i = 0; i < 8; ++i)
+    CHECKSi(i, val[i], result[i]);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+  return r;
+}
diff --git a/test/put_sarray_type.c b/test/put_sarray_type.c
new file mode 100644
index 0000000..48d6401
--- /dev/null
+++ b/test/put_sarray_type.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  void *ptr = main;
+  int e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "sarray RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  e1 = gd_put_sarray_slice(D, "sarray", 10, 1, ptr);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  e2 = gd_put_sarray(D, "sarray", ptr);
+  CHECKI(e2, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_sbit.c b/test/put_sbit.c
index e521ac8..d37373f 100644
--- a/test/put_sbit.c
+++ b/test/put_sbit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,23 @@
 /* Attempt to write BIT */
 #include "test.h"
 
-#include <inttypes.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";
-  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);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = i;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "bit SBIT data 2 3\ndata RAW INT8 8\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   for (i = 0; i < 50; ++i)
diff --git a/test/put_scalar.c b/test/put_scalar.c
new file mode 100644
index 0000000..b1f8201
--- /dev/null
+++ b/test/put_scalar.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int8_t c = 0;
+  int n, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "data", 0, 0, 0, 1, GD_INT8, &c);
+  CHECKI(n, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_DIMENSION);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_sf.c b/test/put_sf.c
index 95abf13..bc474df 100644
--- a/test/put_sf.c
+++ b/test/put_sf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 0, 40, 1, 0, GD_UINT8, c);
diff --git a/test/put_sindir.c b/test/put_sindir.c
new file mode 100644
index 0000000..20adaa1
--- /dev/null
+++ b/test/put_sindir.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2014, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int8_t c[8];
+  struct stat buf;
+  int i, n, e1, e2, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  for (i = 0; i < 8; ++i)
+    c[i] = (int8_t)(40 + i);
+
+  MAKEFORMATFILE(format,
+    "sindir SINDIR data sarray\n"
+    "sarray SARRAY a b c d e f g h i j k l\n"
+    "data RAW INT8 8\n"
+  );
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "sindir", 5, 0, 1, 0, GD_INT8, c);
+  e1 = gd_error(D);
+  CHECKI(n,0);
+  CHECKI(e1,GD_E_BAD_FIELD_TYPE);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  if (!stat(data, &buf)) {
+    perror("stat");
+    r = 1;
+  }
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_ss.c b/test/put_ss.c
index df87795..c05c6c1 100644
--- a/test/put_ss.c
+++ b/test/put_ss.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 0, 40, 0, 8, GD_UINT8, c);
diff --git a/test/put_string.c b/test/put_string.c
index 094c9ea..3e43253 100644
--- a/test/put_string.c
+++ b/test/put_string.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,30 +18,21 @@
  * 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 <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";
   char string[1024] = "";
-  int e1, e2, r = 0;
+  int ret, e1, e2, r = 0;
   DIRFILE *D;
 
   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");
+  ret = gd_put_string(D, "data", "some other string");
+  CHECKI(ret, 0);
   e1 = gd_error(D);
   CHECKI(e1, GD_E_OK);
 
@@ -51,11 +42,12 @@ int main(void)
   /* check */
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   gd_get_string(D, "data", 1023, string);
+  CHECKS(string,"some other string");
+
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKS(string,"some other string");
   return r;
 }
diff --git a/test/put_string_protect.c b/test/put_string_protect.c
index c194304..81e8ab8 100644
--- a/test/put_string_protect.c
+++ b/test/put_string_protect.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,43 +18,30 @@
  * 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 *format_data = "data STRING UINT8\nPROTECT all\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data STRING UINT8\nPROTECT all\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_put_string(D, "data", "some string");
+  CHECKI(n,GD_E_PROTECTED);
   error = gd_error(D);
+  CHECKI(error, GD_E_PROTECTED);
 
   gd_discard(D);
 
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(n,0);
-  CHECKI(error, GD_E_PROTECTED);
-
   return r;
 }
diff --git a/test/put_string_type.c b/test/put_string_type.c
new file mode 100644
index 0000000..b54e8ee
--- /dev/null
+++ b/test/put_string_type.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 n, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_put_string(D, "data", "This probably won't work");
+  CHECKI(n, GD_E_BAD_FIELD_TYPE);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/put_sub.c b/test/put_sub.c
index 601ac62..e6e4693 100644
--- a/test/put_sub.c
+++ b/test/put_sub.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,6 @@
  */
 #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";
@@ -35,8 +27,6 @@ int main(void)
   const char *format = "dirfile/format";
   const char *format1 = "dirfile/sub/format1";
   const char *data = "dirfile/sub/data";
-  const char *format_data = "/INCLUDE sub/format1\n";
-  const char *format1_data = "data RAW UINT8 8\n";
   uint8_t c[8], d;
   int fd, i, n, e1, e2, r = 0;
   DIRFILE *D;
@@ -46,16 +36,11 @@ int main(void)
     c[i] = (uint8_t)(40 + i);
 
   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);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
-  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format1_data, strlen(format1_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE sub/format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/put_type.c b/test/put_type.c
index 758527a..f563eac 100644
--- a/test/put_type.c
+++ b/test/put_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,17 @@
 /* Attempt to write an invalid type */
 #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 *format_data = "data RAW UINT8 8\n";
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UNKNOWN, NULL);
diff --git a/test/put_uint16.c b/test/put_uint16.c
index 13912d4..1557709 100644
--- a/test/put_uint16.c
+++ b/test/put_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,21 +20,11 @@
  */
 #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)
 {
   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, e1, e2, r = 0;
@@ -42,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = (uint16_t)(40 + i);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/put_uint32.c b/test/put_uint32.c
index bf8aaad..1097611 100644
--- a/test/put_uint32.c
+++ b/test/put_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,20 +20,11 @@
  */
 #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 UINT32 8\n";
   uint32_t c[8], d, i;
   struct stat buf;
   int fd, n, e1, e2, r = 0;
@@ -41,14 +32,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = 40 + i;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT32 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/put_uint64.c b/test/put_uint64.c
index 4ff5155..36fcbe7 100644
--- a/test/put_uint64.c
+++ b/test/put_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,20 +21,11 @@
 /* Attempt to write UINT64 */
 #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 UINT64 8\n";
   uint64_t c[8], d, i;
   struct stat buf;
   int fd, n, e1, e2, r = 0;
@@ -42,14 +33,12 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   for (i = 0; i < 8; ++i)
     c[i] = 40 + i;
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT64 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/put_window.c b/test/put_window.c
index b18435e..256b655 100644
--- a/test/put_window.c
+++ b/test/put_window.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,35 +20,24 @@
  */
 #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, e1, e2, r = 0;
+  int i, n, e1, e2, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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);
+  MAKEFORMATFILE(format, "window WINDOW data data EQ 3\ndata RAW INT8 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "window", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/put_zero.c b/test/put_zero.c
index 0f6f548..dea9de3 100644
--- a/test/put_zero.c
+++ b/test/put_zero.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,18 @@
  */
 #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;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
   n = gd_putdata(D, "data", 0, 0, 0, 0, GD_UINT8, NULL);
diff --git a/test/ref.c b/test/ref.c
index 384d767..c299d3c 100644
--- a/test/ref.c
+++ b/test/ref.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,50 +18,29 @@
  * 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 <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";
-  const char *format_data =
-    "data1 RAW UINT8 1\n"
-    "data2 RAW UINT8 1\n"
-    "REFERENCE data2\n"
-    ;
-
   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;
+  int error, error2, r = 0;
   DIRFILE *D;
   off_t nf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
-
-  fd = open(data1, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 4);
-  close(fd);
-
-  fd = open(data2, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 3);
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "REFERENCE data2\n"
+    );
+  MAKEDATAFILE(data1, uint8_t, i, 4);
+  MAKEDATAFILE(data2, uint8_t, i, 3);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/ref_empty.c b/test/ref_empty.c
new file mode 100644
index 0000000..8a68a03
--- /dev/null
+++ b/test/ref_empty.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General 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"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  const char *ref;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  ref = gd_reference(D, NULL);
+  error = gd_error(D);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKP(ref);
+
+  return r;
+}
diff --git a/test/ref_get.c b/test/ref_get.c
new file mode 100644
index 0000000..8efcbba
--- /dev/null
+++ b/test/ref_get.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char *ref;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  ref = gd_reference(D, NULL);
+  error = gd_error(D);
+  CHECKS(ref, "data");
+  CHECKI(error, 0);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/ref_none.c b/test/ref_none.c
index 3fb965e..e7671cb 100644
--- a/test/ref_none.c
+++ b/test/ref_none.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,49 +18,28 @@
  * 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 <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";
-  const char *format_data =
-    "data1 RAW UINT8 1\n"
-    "data2 RAW UINT8 1\n"
-    ;
-
   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;
+  int error, error2, r = 0;
   DIRFILE *D;
   off_t nf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
-
-  fd = open(data1, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 4);
-  close(fd);
-
-  fd = open(data2, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 3);
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+  );
+  MAKEDATAFILE(data1, uint8_t, i, 4);
+  MAKEDATAFILE(data2, uint8_t, i, 3);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/ref_set.c b/test/ref_set.c
new file mode 100644
index 0000000..9ce7cff
--- /dev/null
+++ b/test/ref_set.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char *ref;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "data1 RAW UINT8 1\n"
+                            "data2 RAW UINT8 1\n"
+  );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+
+  ref = gd_reference(D, "data2");
+  error = gd_error(D);
+  CHECKI(error, GD_E_OK);
+  CHECKS(ref, "data2");
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/ref_set_code.c b/test/ref_set_code.c
new file mode 100644
index 0000000..2310d9a
--- /dev/null
+++ b/test/ref_set_code.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  const char *ref;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  ref = gd_reference(D, "data2");
+  CHECKP(ref);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/ref_set_prot.c b/test/ref_set_prot.c
new file mode 100644
index 0000000..876794b
--- /dev/null
+++ b/test/ref_set_prot.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  const char *ref;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "/PROTECT format\n"
+      "data RAW UINT8 1\n"
+      "data2 RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  ref = gd_reference(D, "data2");
+  CHECKP(ref);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/ref_set_rdonly.c b/test/ref_set_rdonly.c
new file mode 100644
index 0000000..da60f6a
--- /dev/null
+++ b/test/ref_set_rdonly.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  const char *ref;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\ndata2 RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  ref = gd_reference(D, "data2");
+  CHECKP(ref);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/ref_set_type.c b/test/ref_set_type.c
new file mode 100644
index 0000000..b273a41
--- /dev/null
+++ b/test/ref_set_type.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  const char *ref;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1\ndata2 CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDWR);
+
+  ref = gd_reference(D, "data2");
+  CHECKP(ref);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/ref_two.c b/test/ref_two.c
index bbf3f56..d23e855 100644
--- a/test/ref_two.c
+++ b/test/ref_two.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,48 +21,28 @@
 /* Parser check */
 #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";
-  const char *format_data =
-    "REFERENCE data1\n"
-    "data1 RAW UINT8 1\n"
-    "data2 RAW UINT8 1\n"
-    "REFERENCE data2\n"
-    ;
-
   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;
+  int error, error2, r = 0;
   DIRFILE *D;
   off_t nf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
-
-  fd = open(data1, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 4);
-  close(fd);
-
-  fd = open(data2, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 3);
-  close(fd);
+  MAKEFORMATFILE(format,
+    "REFERENCE data1\n"
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "REFERENCE data2\n"
+  );
+  MAKEDATAFILE(data1, uint8_t, i, 4);
+  MAKEDATAFILE(data2, uint8_t, i, 3);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 
diff --git a/test/repr_a.c b/test/repr_a.c
index 6c885fb..c5c494f 100644
--- a/test/repr_a.c
+++ b/test/repr_a.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,53 +18,24 @@
  * 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"
 
-#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 *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];
-#else
-  double complex data_data[100];
-#endif
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (i = 0; i < 100; ++i) {
-#ifdef GD_NO_C99_API
-    const double v = i * 3.14159265358979323846 / 5.;
-    data_data[i][0] = cos(v);
-    data_data[i][1] = sin(v);
-#else
-    data_data[i] = cexp(_Complex_I * i * 3.14159265358979323846 / 5.);
-#endif
-  }
+  mkdir(filedir, 0700);
 
-  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, 200 * sizeof(double));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\n");
+  MAKEDATAFILE(data, double, (i % 2)
+      ? sin((i / 2) * 3.14159265358979323846 / 5.)
+      : cos((i / 2) * 3.14159265358979323846 / 5.), 200);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data.a", 5, 0, 8, 0, GD_FLOAT64, &c);
@@ -78,8 +49,12 @@ int main(void)
 
   CHECKI(error,0);
   CHECKI(n,8);
-  for (i = 0; i < 8; ++i)
-    CHECKFi(i,c[i],carg(data_data[5 + i]));
+  for (i = 0; i < 8; ++i) {
+    double v = (5 + i) / 5.;
+    if (v > 1)
+      v -= 2;
+    CHECKFi(i, c[i], v * 3.14159265358979323846);
+  }
 
   return r;
 }
diff --git a/test/repr_bad.c b/test/repr_bad.c
index 197c7b4..873b4a4 100644
--- a/test/repr_bad.c
+++ b/test/repr_bad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,38 +21,21 @@
 /* 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, n, error, r = 0;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY);
   n = gd_getdata(D, "data.3", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/repr_float32.c b/test/repr_float32.c
index fe888a4..c57e810 100644
--- a/test/repr_float32.c
+++ b/test/repr_float32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,49 +21,21 @@
 /* Attempt to read COMPLEX128 as FLOAT32 */
 #include "test.h"
 
-#include <math.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 COMPLEX128 8\n";
-#ifdef GD_NO_C99_API
-  double data_data[256][2];
-#else
-  double complex data_data[256];
-#endif
   float c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[fd][0] = data_data[fd][1] = fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT32, c);
diff --git a/test/repr_float64.c b/test/repr_float64.c
index e30da0c..5c25b4f 100644
--- a/test/repr_float64.c
+++ b/test/repr_float64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,49 +21,21 @@
 /* Attempt to read COMPLEX128 as FLOAT64 */
 #include "test.h"
 
-#include <math.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 COMPLEX128 8\n";
-#ifdef GD_NO_C99_API
-  double data_data[256][2];
-#else
-  double complex data_data[256];
-#endif
   double c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[fd][0] = data_data[fd][1] = fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/repr_i.c b/test/repr_i.c
index 02b49b1..09fac49 100644
--- a/test/repr_i.c
+++ b/test/repr_i.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,53 +18,24 @@
  * 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"
 
-#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 *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];
-#else
-  double complex data_data[100];
-#endif
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (i = 0; i < 100; ++i) {
-#ifdef GD_NO_C99_API
-    const double v = i * 3.14159265358979323846 / 5.;
-    data_data[i][0] = cos(v);
-    data_data[i][1] = sin(v);
-#else
-    data_data[i] = cexp(_Complex_I * i * 3.14159265358979323846 / 5.);
-#endif
-  }
-
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  mkdir(filedir, 0700);
 
-  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(i, data_data, 200 * sizeof(double));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\n");
+  MAKEDATAFILE(data, double, (i % 2)
+      ? sin((i / 2) * 3.14159265358979323846 / 5.)
+      : cos((i / 2) * 3.14159265358979323846 / 5.), 200);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data.i", 5, 0, 8, 0, GD_FLOAT64, &c);
@@ -79,7 +50,7 @@ int main(void)
   CHECKI(n,8);
   CHECKI(error,0);
   for (i = 0; i < 8; ++i)
-    CHECKFi(i,c[i],cimag(data_data[5 + i]));
+    CHECKFi(i,c[i], sin((5 + i) * 3.14159265358979323846 / 5.));
 
   return r;
 }
diff --git a/test/repr_int16.c b/test/repr_int16.c
index c1a0ece..9f679ac 100644
--- a/test/repr_int16.c
+++ b/test/repr_int16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,51 +18,23 @@
  * 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"
 
-#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 COMPLEX128 8\n";
-#ifdef GD_NO_C99_API
-  double data_data[256][2];
-#else
-  double complex data_data[256];
-#endif
   int16_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[fd][0] = data_data[fd][1] = fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT16, c);
diff --git a/test/repr_int32.c b/test/repr_int32.c
index 8e7ca9f..802c3f8 100644
--- a/test/repr_int32.c
+++ b/test/repr_int32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,48 +21,21 @@
 /* Attempt to read COMPLEX128 as INT32 */
 #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 COMPLEX128 8\n";
-#ifdef GD_NO_C99_API
-  double data_data[256][2];
-#else
-  double complex data_data[256];
-#endif
   int32_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[fd][0] = data_data[fd][1] = fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT32, c);
diff --git a/test/repr_int64.c b/test/repr_int64.c
index ae71af9..dff0491 100644
--- a/test/repr_int64.c
+++ b/test/repr_int64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,48 +21,21 @@
 /* Attempt to read COMPLEX128 as UINT64 */
 #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 COMPLEX128 8\n";
-#ifdef GD_NO_C99_API
-  double data_data[256][2];
-#else
-  double complex data_data[256];
-#endif
   uint64_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[fd][0] = data_data[fd][1] = fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/repr_int8.c b/test/repr_int8.c
index 78c01d9..4f2ec21 100644
--- a/test/repr_int8.c
+++ b/test/repr_int8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,48 +21,21 @@
 /* Attempt to read COMPLEX128 as INT8 */
 #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 COMPLEX128 8\n";
-#ifdef GD_NO_C99_API
-  double data_data[256][2];
-#else
-  double complex data_data[256];
-#endif
   int8_t c[8];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[fd][0] = data_data[fd][1] = fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT8, c);
diff --git a/test/repr_m.c b/test/repr_m.c
index d1bfb04..78bc2d7 100644
--- a/test/repr_m.c
+++ b/test/repr_m.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,50 +21,22 @@
 /* Attempt to read argument representation */
 #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 *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];
-#else
-  double complex data_data[100];
-#endif
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (i = 0; i < 100; ++i) {
-#ifdef GD_NO_C99_API
-    const double v = i * 3.14159265358979323846 / 5.;
-    data_data[i][0] = cos(v);
-    data_data[i][1] = sin(v);
-#else
-    data_data[i] = cexp(_Complex_I * i * 3.14159265358979323846 / 5.);
-#endif
-  }
-
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  mkdir(filedir, 0700);
 
-  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(i, data_data, 200 * sizeof(double));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\n");
+  MAKEDATAFILE(data, double, (i % 2)
+      ? sin((i / 2) * 3.14159265358979323846 / 5.)
+      : cos((i / 2) * 3.14159265358979323846 / 5.), 200);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data.m", 5, 0, 8, 0, GD_FLOAT64, &c);
@@ -79,7 +51,7 @@ int main(void)
   CHECKI(error,0);
   CHECKI(n,8);
   for (i = 0; i < 8; ++i)
-    CHECKFi(i,c[i], cabs(data_data[5 + i]));
+    CHECKFi(i,c[i], 1);
 
   return r;
 }
diff --git a/test/repr_r.c b/test/repr_r.c
index 909909e..a9d8bfa 100644
--- a/test/repr_r.c
+++ b/test/repr_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,53 +18,24 @@
  * 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"
 
-#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 *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];
-#else
-  double complex data_data[100];
-#endif
   int i, n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (i = 0; i < 100; ++i) {
-#ifdef GD_NO_C99_API
-    const double v = i * 3.14159265358979323846 / 5.;
-    data_data[i][0] = cos(v);
-    data_data[i][1] = sin(v);
-#else
-    data_data[i] = cexp(_Complex_I * i * 3.14159265358979323846 / 5.);
-#endif
-  }
-
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  mkdir(filedir, 0700);
 
-  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(i, data_data, 200 * sizeof(double));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 1\n");
+  MAKEDATAFILE(data, double, (i % 2)
+      ? sin((i / 2) * 3.14159265358979323846 / 5.)
+      : cos((i / 2) * 3.14159265358979323846 / 5.), 200);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data.r", 5, 0, 8, 0, GD_FLOAT64, &c);
@@ -79,7 +50,7 @@ int main(void)
   CHECKI(error,0);
   CHECKI(n,8);
   for (i = 0; i < 8; ++i)
-    CHECKFi(i,c[i],creal(data_data[5 + i]));
+    CHECKFi(i,c[i],cos((5 + i) * 3.14159265358979323846 / 5.));
 
   return r;
 }
diff --git a/test/repr_real_a.c b/test/repr_real_a.c
index 8cedf89..9c2d0b9 100644
--- a/test/repr_real_a.c
+++ b/test/repr_real_a.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,42 +18,22 @@
  * 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"
 
-#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 *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)
-    data_data[i] = sin(i * 3.14159265358979323846 / 5.);
-
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  mkdir(filedir, 0700);
 
-  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(i, data_data, 100 * sizeof(double));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\n");
+  MAKEDATAFILE(data, double, sin(i * 3.14159265358979323846 / 5.), 100);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data.a", 5, 0, 8, 0, GD_FLOAT64, &c);
@@ -68,7 +48,8 @@ int main(void)
   CHECKI(error,0);
   CHECKI(n,8);
   for (i = 0; i < 8; ++i)
-    CHECKFi(i,c[i],(data_data[i] > 0) ? 3.14159265358979323846 : 0);
+    CHECKFi(i,c[i],(sin((5 + i) * 3.14159265358979323846 / 5.) < 0)
+        ? 3.14159265358979323846 : 0);
 
   return r;
 }
diff --git a/test/repr_real_i.c b/test/repr_real_i.c
index b51baed..0fcc6c4 100644
--- a/test/repr_real_i.c
+++ b/test/repr_real_i.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,20 @@
 /* Attempt to read imaginary representation */
 #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 *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)
-    data_data[i] = sin(i * 3.14159265358979323846 / 5.);
-
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  mkdir(filedir, 0700);
 
-  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(i, data_data, 100 * sizeof(double));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\n");
+  MAKEDATAFILE(data, double, sin(i * 3.14159265358979323846 / 5.), 100);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data.i", 5, 0, 8, 0, GD_FLOAT64, &c);
diff --git a/test/repr_real_m.c b/test/repr_real_m.c
index 20fc22f..3463b26 100644
--- a/test/repr_real_m.c
+++ b/test/repr_real_m.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,20 @@
 /* Attempt to read modulus representation */
 #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 *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)
-    data_data[i] = sin(i * 3.14159265358979323846 / 5.);
-
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  mkdir(filedir, 0700);
 
-  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(i, data_data, 100 * sizeof(double));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\n");
+  MAKEDATAFILE(data, double, sin(i * 3.14159265358979323846 / 5.), 100);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data.m", 5, 0, 8, 0, GD_FLOAT64, &c);
@@ -68,7 +49,7 @@ int main(void)
   CHECKI(error,0);
   CHECKI(n,8);
   for (i = 0; i < 8; ++i)
-    CHECKFi(i,c[i],fabs(data_data[5 + i]));
+    CHECKFi(i,c[i],fabs(sin((5 + i) * 3.14159265358979323846 / 5.)));
 
   return r;
 }
diff --git a/test/repr_real_r.c b/test/repr_real_r.c
index d0e4b08..bdbaac1 100644
--- a/test/repr_real_r.c
+++ b/test/repr_real_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,20 @@
 /* Attempt to read real representation */
 #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 *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)
-    data_data[i] = sin(i * 3.14159265358979323846 / 5.);
-
-  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(i, format_data, strlen(format_data));
-  close(i);
+  mkdir(filedir, 0700);
 
-  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(i, data_data, 100 * sizeof(double));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW FLOAT64 1\n");
+  MAKEDATAFILE(data, double, sin(i * 3.14159265358979323846 / 5.), 100);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data.r", 5, 0, 8, 0, GD_FLOAT64, &c);
@@ -68,7 +49,7 @@ int main(void)
   CHECKI(error,0);
   CHECKI(n,8);
   for (i = 0; i < 8; ++i)
-    CHECKFi(i,c[i],data_data[5 + i]);
+    CHECKFi(i,c[i],sin((5 + i) * 3.14159265358979323846 / 5.));
 
   return r;
 }
diff --git a/test/repr_uint16.c b/test/repr_uint16.c
index 4c539fc..d51124e 100644
--- a/test/repr_uint16.c
+++ b/test/repr_uint16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,48 +21,21 @@
 /* Attempt to read COMPLEX128 as UINT16 */
 #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 COMPLEX128 8\n";
-#ifdef GD_NO_C99_API
-  double data_data[256][2];
-#else
-  double complex data_data[256];
-#endif
   uint16_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[fd][0] = data_data[fd][1] = fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/repr_uint32.c b/test/repr_uint32.c
index 85f484f..2b7058a 100644
--- a/test/repr_uint32.c
+++ b/test/repr_uint32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,48 +21,21 @@
 /* Attempt to read COMPLEX128 as UINT32 */
 #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 COMPLEX128 8\n";
-#ifdef GD_NO_C99_API
-  double data_data[256][2];
-#else
-  double complex data_data[256];
-#endif
   uint32_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[fd][0] = data_data[fd][1] = fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT32, c);
diff --git a/test/repr_uint64.c b/test/repr_uint64.c
index 9a3f8c2..6c385ad 100644
--- a/test/repr_uint64.c
+++ b/test/repr_uint64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,48 +21,21 @@
 /* Attempt to read COMPLEX128 as UINT64 */
 #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 COMPLEX128 8\n";
-#ifdef GD_NO_C99_API
-  double data_data[256][2];
-#else
-  double complex data_data[256];
-#endif
   uint64_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[fd][0] = data_data[fd][1] = fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT64, c);
diff --git a/test/repr_uint8.c b/test/repr_uint8.c
index a320977..114fc86 100644
--- a/test/repr_uint8.c
+++ b/test/repr_uint8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,48 +21,21 @@
 /* Attempt to read COMPLEX128 as 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 COMPLEX128 8\n";
-#ifdef GD_NO_C99_API
-  double data_data[256][2];
-#else
-  double complex data_data[256];
-#endif
   uint8_t c[8], i;
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd) {
-#ifdef GD_NO_C99_API
-    data_data[fd][0] = data_data[fd][1] = fd;
-#else
-    data_data[fd] = fd * (1 + _Complex_I);
-#endif
-  }
-
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 512 * sizeof(double));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW COMPLEX128 8\n");
+  MAKEDATAFILE(data, double, i / 2, 512);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/salist.c b/test/salist.c
new file mode 100644
index 0000000..f6690ce
--- /dev/null
+++ b/test/salist.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 j, error, r = 0;
+  size_t i;
+  const char *lists[4][8] = {
+    { "alfa", "bravo", "charlie", "delta", "echo" },
+    { "foxtrot", "golf", "hotel", "india", "juliet", "kilo" },
+    { "lima", "mike", "november", "oscar", "papa", "quebec", "romeo" },
+    { "sierra", "tango", "uniform", "victor", "whiskey", "xray", "yankee",
+      "zulu" }
+  };
+  const char ***field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "data1 SARRAY alfa bravo charlie delta echo\n"
+    "data2 SARRAY foxtrot golf hotel india juliet kilo\n"
+    "data3 SARRAY lima mike november oscar papa quebec romeo\n"
+    "data4 RAW UINT8 1\n"
+    "data4/meta SARRAY sierra tango uniform victor whiskey xray yankee zulu\n"
+    "/ALIAS data5 data4/meta\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_sarrays(D);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+
+  if (!r)
+    for (j = 0; field_list[j]; ++j) {
+      if (j > 4) {
+        CHECKI(j, 4);
+        break;
+      }
+      for (i = 0; field_list[j][i]; ++i)
+        CHECKSi(j * 1000 + i,field_list[j][i], lists[j][i]);
+      CHECKIi(j, i, 5 + j);
+    }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/salist0.c b/test/salist0.c
new file mode 100644
index 0000000..bae3bc0
--- /dev/null
+++ b/test/salist0.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char ***field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data4 RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_sarrays(D);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKP(field_list[0]);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/salist_hidden.c b/test/salist_hidden.c
new file mode 100644
index 0000000..5b4705c
--- /dev/null
+++ b/test/salist_hidden.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 j, error, r = 0;
+  size_t i;
+  const char *lists[2][8] = {
+    { "alfa", "bravo", "charlie", "delta", "echo" },
+    { "lima", "mike", "november", "oscar", "papa", "quebec", "romeo" }
+  };
+  const char ***field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "data1 SARRAY alfa bravo charlie delta echo\n"
+    "data2 SARRAY foxtrot golf hotel india juliet kilo\n"
+    "data3 SARRAY lima mike november oscar papa quebec romeo\n"
+    "/HIDDEN data2\n"
+    "data4 RAW UINT8 1\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_sarrays(D);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+
+  if (!r)
+    for (j = 0; field_list[j]; ++j) {
+      if (j > 2) {
+        CHECKI(j, 2);
+        break;
+      }
+      for (i = 0; field_list[j][i]; ++i)
+        CHECKSi(j * 1000 + i,field_list[j][i], lists[j][i]);
+      CHECKIi(j, i, 5 + 2 * j);
+    }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/salist_long.c b/test/salist_long.c
new file mode 100644
index 0000000..616b2fb
--- /dev/null
+++ b/test/salist_long.c
@@ -0,0 +1,88 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 SARRAY a\n"
+    "datb SARRAY b\n"
+    "datc SARRAY c\n"
+    "datd SARRAY d\n"
+    "date SARRAY e\n"
+    "datf SARRAY f\n"
+    "datg SARRAY g\n"
+    "dath SARRAY h\n"
+    "dati SARRAY i\n"
+    "datj SARRAY j\n"
+    "datk SARRAY k\n"
+    "datl SARRAY l\n"
+    "datm SARRAY m\n"
+    "datn SARRAY n\n"
+    "dato SARRAY o\n"
+    "datp SARRAY p\n"
+    "datq SARRAY q\n"
+    "datr SARRAY r\n"
+    "dats SARRAY s\n"
+    "datt SARRAY t\n"
+    "datu SARRAY u\n"
+    "datv SARRAY v\n"
+    "datw SARRAY w\n"
+    "datx SARRAY x\n"
+    "daty SARRAY y\n"
+    "datz SARRAY z\n"
+    ;
+  int j, error, r = 0;
+  const char ***field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  j = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(j, format_data, strlen(format_data));
+  close(j);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_sarrays(D);
+
+  error = gd_error(D);
+
+  CHECKPN(field_list);
+  CHECKI(error, 0);
+
+  if (!r)
+    for (j = 0; field_list[j]; ++j) {
+      CHECKPNi(j, field_list[j][0]);
+      CHECKIi(j, field_list[j][0][0], 'a' + j);
+      CHECKIi(j, field_list[j][0][1], 0);
+      CHECKPi(j, field_list[j][1]);
+    }
+
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/salist_meta.c b/test/salist_meta.c
new file mode 100644
index 0000000..33da8ea
--- /dev/null
+++ b/test/salist_meta.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 j, error, r = 0;
+  size_t i;
+  const char ***field_list;
+  DIRFILE *D;
+  const char *lists[4][8] = {
+    { "alfa", "bravo", "charlie", "delta", "echo" },
+    { "foxtrot", "golf", "hotel", "india", "juliet", "kilo" },
+    { "lima", "mike", "november", "oscar", "papa", "quebec", "romeo" },
+    { "sierra", "tango", "uniform", "victor", "whiskey", "xray", "yankee",
+      "zulu" }
+  };
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "data0 SARRAY sierra tango uniform victor whiskey xray yankee zulu\n"
+    "parent SARRAY nil\n"
+    "parent/data1 SARRAY alfa bravo charlie delta echo\n"
+    "parent/data2 SARRAY foxtrot golf hotel india juliet kilo\n"
+    "parent/data3 SARRAY lima mike november oscar papa quebec romeo\n"
+    "META parent data4 LINTERP UINT8 1\n"
+    "/ALIAS parent/data5 data0\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_msarrays(D, "parent");
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+
+  if (!r)
+    for (j = 0; field_list[j]; ++j) {
+      if (j > 4) {
+        CHECKI(j, 4);
+        break;
+      }
+      for (i = 0; field_list[j][i]; ++i)
+        CHECKSi(j * 1000 + i,field_list[j][i], lists[j][i]);
+      CHECKIi(j, i, 5 + j);
+    }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/salist_meta0.c b/test/salist_meta0.c
new file mode 100644
index 0000000..d6ebc3c
--- /dev/null
+++ b/test/salist_meta0.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char ***field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data4 RAW UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_msarrays(D, "data4");
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKP(field_list[0]);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/salist_meta_free.c b/test/salist_meta_free.c
new file mode 100644
index 0000000..55c8a94
--- /dev/null
+++ b/test/salist_meta_free.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 j, error, r = 0;
+  size_t i;
+  const char ***field_list;
+  DIRFILE *D;
+  const char *lists[4][8] = {
+    { "alfa", "bravo", "charlie", "delta", "echo" },
+    { "foxtrot", "golf", "hotel", "india", "juliet", "kilo" },
+    { "lima", "mike", "november", "oscar", "papa", "quebec", "romeo" },
+    { "sierra", "tango", "uniform", "victor", "whiskey", "xray", "yankee",
+      "zulu" }
+  };
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "parent SARRAY nil\n"
+    "parent/data1 SARRAY alfa bravo charlie delta echo\n"
+    "parent/data2 SARRAY foxtrot golf hotel india juliet kilo\n"
+  );
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  field_list = gd_msarrays(D, "parent");
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+
+  if (!r)
+    for (j = 0; field_list[j]; ++j) {
+      if (j > 2) {
+        CHECKI(j, 2);
+        break;
+      }
+      for (i = 0; field_list[j][i]; ++i)
+        CHECKSi(j * 1000 + i,field_list[j][i], lists[j][i]);
+      CHECKIi(j, i, 5 + j);
+    }
+
+  gd_add_spec(D,
+      "parent/data3 SARRAY lima mike november oscar papa quebec romeo", 0);
+
+  field_list = gd_msarrays(D, "parent");
+
+  if (!r)
+    for (j = 0; field_list[j]; ++j) {
+      if (j > 3) {
+        CHECKI(j, 3);
+        break;
+      }
+      for (i = 0; field_list[j][i]; ++i)
+        CHECKSi(j * 1000 + i,field_list[j][i], lists[j][i]);
+      CHECKIi(j, i, 5 + j);
+    }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/salist_meta_hidden.c b/test/salist_meta_hidden.c
new file mode 100644
index 0000000..4026a7d
--- /dev/null
+++ b/test/salist_meta_hidden.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 j, error, r = 0;
+  size_t i;
+  const char ***field_list;
+  DIRFILE *D;
+  const char *lists[2][8] = {
+    { "alfa", "bravo", "charlie", "delta", "echo" },
+    { "lima", "mike", "november", "oscar", "papa", "quebec", "romeo" }
+  };
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "parent SARRAY nil\n"
+    "parent/data1 SARRAY alfa bravo charlie delta echo\n"
+    "parent/data2 SARRAY foxtrot golf hotel india juliet kilo\n"
+    "/HIDDEN parent/data2\n"
+    "parent/data3 SARRAY lima mike november oscar papa quebec romeo\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_msarrays(D, "parent");
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+
+  if (!r)
+    for (j = 0; field_list[j]; ++j) {
+      if (j > 2) {
+        CHECKI(j, 2);
+        break;
+      }
+      for (i = 0; field_list[j][i]; ++i)
+        CHECKSi(j * 1000 + i,field_list[j][i], lists[j][i]);
+      CHECKIi(j, i, 5 + 2 * j);
+    }
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/salist_meta_meta.c b/test/salist_meta_meta.c
new file mode 100644
index 0000000..1174ee7
--- /dev/null
+++ b/test/salist_meta_meta.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char ***field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "data0 SARRAY sierra tango uniform victor whiskey xray yankee zulu\n"
+    "parent SARRAY nil\n"
+    "parent/data1 SARRAY alfa bravo charlie delta echo\n"
+    "parent/data2 SARRAY foxtrot golf hotel india juliet kilo\n"
+    "parent/data3 SARRAY lima mike november oscar papa quebec romeo\n"
+    "META parent data4 LINTERP UINT8 1\n"
+    "/ALIAS parent/data5 data0\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY);
+  field_list = gd_msarrays(D, "parent/data1");
+  CHECKP(field_list);
+
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/salist_meta_parent.c b/test/salist_meta_parent.c
new file mode 100644
index 0000000..8194d5f
--- /dev/null
+++ b/test/salist_meta_parent.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char ***field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  field_list = gd_msarrays(D, "parent");
+  CHECKP(field_list);
+
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/seek64.c b/test/seek64.c
index 3f49e05..90a6280 100644
--- a/test/seek64.c
+++ b/test/seek64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -23,37 +23,20 @@
 
 #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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek64(D, "data", 6, 0, GD_SEEK_SET);
diff --git a/test/seek_arg.c b/test/seek_arg.c
new file mode 100644
index 0000000..c8524ca
--- /dev/null
+++ b/test/seek_arg.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  e1 = gd_seek(D, "INDEX", 0, 3, GD_SEEK_SET | GD_SEEK_CUR | GD_SEEK_END);
+  CHECKI(e1, GD_E_ARGUMENT);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/seek_code.c b/test/seek_code.c
new file mode 100644
index 0000000..9336537
--- /dev/null
+++ b/test/seek_code.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1, e2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "phase PHASE missing 0");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_seek(D, "missing", 0, 3, GD_SEEK_SET);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  e2 = gd_seek(D, "phase", 0, 3, GD_SEEK_SET);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/seek_cur.c b/test/seek_cur.c
index 433d544..c6932b8 100644
--- a/test/seek_cur.c
+++ b/test/seek_cur.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   gd_seek(D, "data", 6, 0, GD_SEEK_SET);
diff --git a/test/seek_dim.c b/test/seek_dim.c
new file mode 100644
index 0000000..83eeed6
--- /dev/null
+++ b/test/seek_dim.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data CONST UINT8 1");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_seek(D, "data", 0, 3, GD_SEEK_SET);
+  CHECKI(e1, GD_E_DIMENSION);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/seek_end.c b/test/seek_end.c
index fe80450..ba02160 100644
--- a/test/seek_end.c
+++ b/test/seek_end.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek(D, "data", -2, 0, GD_SEEK_END);
diff --git a/test/seek_far.c b/test/seek_far.c
index 92b9a80..b1b22a0 100644
--- a/test/seek_far.c
+++ b/test/seek_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek(D, "data", 500, 0, GD_SEEK_SET);
diff --git a/test/seek_foffs.c b/test/seek_foffs.c
index 1a1272c..115fa6b 100644
--- a/test/seek_foffs.c
+++ b/test/seek_foffs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nFRAMEOFFSET 5\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek(D, "data", 6, 0, GD_SEEK_SET);
diff --git a/test/seek_foffs2.c b/test/seek_foffs2.c
index d39fca9..e55ce32 100644
--- a/test/seek_foffs2.c
+++ b/test/seek_foffs2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,32 +20,22 @@
  */
 #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 1\n";
   unsigned char data_data[256];
   int i, fd, e, r = 0;
   off_t t, s;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   memset(data_data, 0, 256);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "FRAMEOFFSET 2\ndata RAW UINT8 1\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 256);
diff --git a/test/seek_index_end.c b/test/seek_index_end.c
new file mode 100644
index 0000000..dc1bc8e
--- /dev/null
+++ b/test/seek_index_end.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  e1 = gd_seek(D, "INDEX", 0, 3, GD_SEEK_END);
+  CHECKI(e1, GD_E_BAD_FIELD_TYPE);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/seek_lincom.c b/test/seek_lincom.c
index 277aef6..0d7b9ea 100644
--- a/test/seek_lincom.c
+++ b/test/seek_lincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,32 +20,23 @@
  */
 #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 =
-    "lincom LINCOM cata 1 0 data 1 0\n"
-    "/ENCODING none\n"
-    "cata RAW UINT8 8\n"
-    "data RAW UINT8 8\n";
-  int fd, e0, e1, e2, e3, r = 0;
+  int e0, e1, e2, e3, r = 0;
   off_t m, n1, n2, n3;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "lincom LINCOM cata 1 0 data 1 0\n"
+    "/ENCODING none\n"
+    "cata RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek(D, "lincom", 6, 0, GD_SEEK_SET | GD_SEEK_WRITE);
diff --git a/test/seek_mplex.c b/test/seek_mplex.c
new file mode 100644
index 0000000..4ea37ae
--- /dev/null
+++ b/test/seek_mplex.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 1\n"
+      "mplex MPLEX INDEX data 0\n");
+
+  D = gd_open(filedir, GD_RDONLY | GD_UNENCODED);
+  e1 = gd_seek(D, "mplex", 0, 3, GD_SEEK_SET);
+  CHECKI(e1, GD_E_IO);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/seek_mult.c b/test/seek_mult.c
index 826497d..d73f6ad 100644
--- a/test/seek_mult.c
+++ b/test/seek_mult.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,32 +20,23 @@
  */
 #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 =
-    "mult MULTIPLY cata data\n"
-    "/ENCODING none\n"
-    "cata RAW UINT8 8\n"
-    "data RAW UINT8 8\n";
-  int fd, e0, e1, e2, e3, r = 0;
+  int e0, e1, e2, e3, r = 0;
   off_t m, n1, n2, n3;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "mult MULTIPLY cata data\n"
+    "/ENCODING none\n"
+    "cata RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek(D, "mult", 6, 0, GD_SEEK_SET | GD_SEEK_WRITE);
diff --git a/test/seek_neg.c b/test/seek_neg.c
index c9e1c37..e375033 100644
--- a/test/seek_neg.c
+++ b/test/seek_neg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,53 +18,35 @@
  * 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;
+  int e1, r = 0;
   off_t m;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY);
   m = gd_seek(D, "data", -3, 0, GD_SEEK_CUR);
   e1 = gd_error(D);
 
+  CHECKI(e1, GD_E_RANGE);
+  CHECKI(m, GD_E_RANGE);
+
   gd_discard(D);
 
   unlink(data);
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(e1, GD_E_RANGE);
-  CHECKI(m, -1);
-
   return r;
 }
diff --git a/test/seek_phase.c b/test/seek_phase.c
index c96c90c..88482c4 100644
--- a/test/seek_phase.c
+++ b/test/seek_phase.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,31 +20,22 @@
  */
 #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 =
-    "phase PHASE data 4\n"
-    "/ENCODING none\n"
-    "data RAW UINT8 8\n";
-  int fd, e0, e1, e2, r = 0;
+  int e0, e1, e2, r = 0;
   off_t m, n1, n2;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "phase PHASE data 4\n"
+    "/ENCODING none\n"
+    "data RAW UINT8 8\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek(D, "phase", 6, 0, GD_SEEK_SET | GD_SEEK_WRITE);
diff --git a/test/seek_range.c b/test/seek_range.c
index 0d11df9..95c6421 100644
--- a/test/seek_range.c
+++ b/test/seek_range.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,32 +25,22 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT8 2\n";
-  unsigned char data_data[256];
-  int fd, e1, r = 0;
+  int e1, r = 0;
   off_t m;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT8 2\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY);
   /* Sample position: 2 * INT64_MAX (bad) */;
   m = gd_seek64(D, "data", GD_INT64_MAX, 0, GD_SEEK_SET);
-  CHECKI(m, -1);
-
   e1 = gd_error(D);
+
+  CHECKI(m, GD_E_RANGE);
   CHECKI(e1, GD_E_RANGE);
 
   gd_discard(D);
diff --git a/test/seek_range2.c b/test/seek_range2.c
index b9f0f9d..fd20ccd 100644
--- a/test/seek_range2.c
+++ b/test/seek_range2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -25,32 +25,21 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *data = "dirfile/data";
-  const char *format_data = "data RAW UINT16 1\n";
-  unsigned char data_data[256];
-  int fd, e1, r = 0;
+  int e1, r = 0;
   off_t m;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 1\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY);
   /* Sample position: INT64_MAX (OK), byte position INT64_MAX * 2 (bad) */;
   m = gd_seek64(D, "data", GD_INT64_MAX, 0, GD_SEEK_SET);
-  CHECKI(m, -1);
-
   e1 = gd_error(D);
+  CHECKI(m, GD_E_RANGE);
   CHECKI(e1, GD_E_RANGE);
 
   gd_discard(D);
diff --git a/test/seek_range_end.c b/test/seek_range_end.c
new file mode 100644
index 0000000..13afd76
--- /dev/null
+++ b/test/seek_range_end.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 1");
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_seek64(D, "data", 0, GD_INT64_MAX, GD_SEEK_END);
+  CHECKI(e1, GD_E_RANGE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/seek_recurse.c b/test/seek_recurse.c
new file mode 100644
index 0000000..56ea82a
--- /dev/null
+++ b/test/seek_recurse.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  off_t m;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data PHASE data 0");
+
+  D = gd_open(filedir, GD_RDONLY);
+  m = gd_seek(D, "data", 0, 3, GD_SEEK_SET);
+  e1 = gd_error(D);
+
+  CHECKI(m, GD_E_RECURSE_LEVEL);
+  CHECKI(e1, GD_E_RECURSE_LEVEL);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/seek_set.c b/test/seek_set.c
index d13f3c4..57480fe 100644
--- a/test/seek_set.c
+++ b/test/seek_set.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek(D, "data", 6, 0, GD_SEEK_SET);
diff --git a/test/seek_sub.c b/test/seek_sub.c
index 92a65b2..bd0fc39 100644
--- a/test/seek_sub.c
+++ b/test/seek_sub.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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";
@@ -34,31 +27,17 @@ int main(void)
   const char *format = "dirfile/format";
   const char *format1 = "dirfile/sub/format1";
   const char *data = "dirfile/sub/data";
-  const char *format_data = "/INCLUDE sub/format1\n";
-  const char *format1_data = "data RAW UINT8 8\n";
-  unsigned char data_data[256];
-  int fd, e1, e2, r = 0;
+  int e1, e2, r = 0;
   off_t m, n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  mkdir(subdir, 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);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE sub/format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   m = gd_seek(D, "data", 6, 0, GD_SEEK_SET);
diff --git a/test/sie_err_open.c b/test/sie_err_open.c
new file mode 100644
index 0000000..8ae1963
--- /dev/null
+++ b/test/sie_err_open.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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.sie";
+  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, e1, e2, r = 0;
+
+  rmdirfile();
+  mkdir(filedir, 0700); 
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN big\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  gd_getdata(D, "data", 3, 0, 2, 0, GD_UINT8, c);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_IO);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 3 * 9 * sizeof(unsigned char));
+  close(fd);
+
+  gd_getdata(D, "data", 3, 0, 2, 0, GD_UINT8, c);
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_OK);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/sie_get_big.c b/test/sie_get_big.c
index 79f58ca..cd82ba4 100644
--- a/test/sie_get_big.c
+++ b/test/sie_get_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,11 @@
 /* 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,
@@ -39,11 +36,9 @@ int main(void)
   int fd, i, n, error, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN big\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 3 * 9 * sizeof(unsigned char));
diff --git a/test/sie_get_header.c b/test/sie_get_header.c
index 7c6ce0d..e59edf6 100644
--- a/test/sie_get_header.c
+++ b/test/sie_get_header.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 D. V. Wiebe
+/* Copyright (C) 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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 UINT16 8\n/ENCODING sie\n/ENDIAN big\n";
   uint16_t c[16];
   const uint8_t data_data[] = {
     /* Header */
@@ -41,11 +38,9 @@ int main(void)
   int fd, i, n, error, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n/ENCODING sie\n/ENDIAN big\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, sizeof(data_data));
diff --git a/test/sie_get_little.c b/test/sie_get_little.c
index d3505bb..57c00f6 100644
--- a/test/sie_get_little.c
+++ b/test/sie_get_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,11 @@
 /* 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,
@@ -39,11 +36,9 @@ int main(void)
   int fd, i, n, error, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 3 * 9 * sizeof(unsigned char));
diff --git a/test/sie_move_from.c b/test/sie_move_from.c
index 399cd01..3b64a13 100644
--- a/test/sie_move_from.c
+++ b/test/sie_move_from.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,12 @@
 /* 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,
@@ -48,11 +45,9 @@ int main(void)
   int fd, i, e1, e2, r = 0, unlink_data_sie, unlink_data_raw;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data_sie, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_in, 3 * 9 * sizeof(unsigned char));
diff --git a/test/sie_move_to.c b/test/sie_move_to.c
index 0b8f108..5e4cc15 100644
--- a/test/sie_move_to.c
+++ b/test/sie_move_to.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,12 @@
 /* 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,
@@ -48,11 +45,9 @@ int main(void)
   int fd, i, e1, e2, r = 0, unlink_data_sie, unlink_data_raw;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING none\n/ENDIAN little\n");
 
   fd = open(data_raw, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_in, 0x31 * sizeof(unsigned char));
diff --git a/test/sie_nframes_big.c b/test/sie_nframes_big.c
index 9da0fa4..17c0791 100644
--- a/test/sie_nframes_big.c
+++ b/test/sie_nframes_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,11 @@
 /* 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 1\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,
@@ -39,11 +36,9 @@ int main(void)
   int fd, error, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n/ENCODING sie\n/ENDIAN big\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 9 * 3 * sizeof(uint8_t));
diff --git a/test/sie_nframes_little.c b/test/sie_nframes_little.c
index 9013b2b..77ccd20 100644
--- a/test/sie_nframes_little.c
+++ b/test/sie_nframes_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,11 @@
 /* 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 1\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,
@@ -39,11 +36,9 @@ int main(void)
   int fd, error, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 1\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 9 * 3 * sizeof(uint8_t));
diff --git a/test/sie_put_append.c b/test/sie_put_append.c
index c3b0df8..f2a6376 100644
--- a/test/sie_put_append.c
+++ b/test/sie_put_append.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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
@@ -49,11 +46,9 @@ int main(void)
   ssize_t l;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 2 * 9 * sizeof(unsigned char));
diff --git a/test/sie_put_append2.c b/test/sie_put_append2.c
index 6d6223e..285db5f 100644
--- a/test/sie_put_append2.c
+++ b/test/sie_put_append2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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
@@ -48,11 +45,9 @@ int main(void)
   ssize_t l;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 2 * 9 * sizeof(unsigned char));
diff --git a/test/sie_put_back.c b/test/sie_put_back.c
index 84efe6c..9510594 100644
--- a/test/sie_put_back.c
+++ b/test/sie_put_back.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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
@@ -50,11 +47,9 @@ int main(void)
   int fd, i, n1, n2, e1, e2, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 3 * 9 * sizeof(unsigned char));
diff --git a/test/sie_put_big.c b/test/sie_put_big.c
index 5b81884..d3d702d 100644
--- a/test/sie_put_big.c
+++ b/test/sie_put_big.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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
@@ -50,11 +47,9 @@ int main(void)
   ssize_t s;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN big\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 3 * 9 * sizeof(unsigned char));
diff --git a/test/sie_put_header.c b/test/sie_put_header.c
index 8899ed3..116ace8 100644
--- a/test/sie_put_header.c
+++ b/test/sie_put_header.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013, 2016 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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
@@ -52,11 +49,9 @@ int main(void)
   ssize_t s;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN big\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, sizeof(data_data));
diff --git a/test/sie_put_little.c b/test/sie_put_little.c
index 4b3a2b3..260d706 100644
--- a/test/sie_put_little.c
+++ b/test/sie_put_little.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,11 @@
 /* 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
@@ -49,11 +46,9 @@ int main(void)
   int fd, i, n, error, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 3 * 9 * sizeof(unsigned char));
diff --git a/test/sie_put_pad.c b/test/sie_put_pad.c
index e93278b..a158743 100644
--- a/test/sie_put_pad.c
+++ b/test/sie_put_pad.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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
@@ -47,11 +44,9 @@ int main(void)
   int fd, i, n, error, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 1 * 9 * sizeof(unsigned char));
diff --git a/test/sie_put_pad0.c b/test/sie_put_pad0.c
index e9eab4d..20bce51 100644
--- a/test/sie_put_pad0.c
+++ b/test/sie_put_pad0.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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
@@ -49,11 +46,9 @@ int main(void)
   ssize_t l;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 2 * 9 * sizeof(unsigned char));
diff --git a/test/sie_put_trunc.c b/test/sie_put_trunc.c
index 9831303..99a20cf 100644
--- a/test/sie_put_trunc.c
+++ b/test/sie_put_trunc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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[0x32];
   const uint8_t data_data[] = {
     0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
@@ -44,11 +41,9 @@ int main(void)
 
   memset(c, 0x43, 0x32);
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 3 * 9 * sizeof(unsigned char));
diff --git a/test/sie_put_trunc2.c b/test/sie_put_trunc2.c
index 53f2b17..8892db0 100644
--- a/test/sie_put_trunc2.c
+++ b/test/sie_put_trunc2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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[0x32];
   const uint8_t data_data[] = {
     0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
@@ -46,11 +43,9 @@ int main(void)
 
   memset(c, 0x29, 0x32);
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 3 * 9 * sizeof(unsigned char));
diff --git a/test/sie_put_trunc_nf.c b/test/sie_put_trunc_nf.c
index 894787a..e1b8cf6 100644
--- a/test/sie_put_trunc_nf.c
+++ b/test/sie_put_trunc_nf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,24 +20,19 @@
  */
 #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 = "/ENCODING sie\n/ENDIAN little\n";
   unsigned char c[] = {1, 1, 2, 1};
   DIRFILE *D;
-  int fd, n1, n2, r = 0;
+  int n1, n2, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/ENCODING sie\n/ENDIAN little\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_add_raw(D, "data", GD_UINT8, 1, 0);
diff --git a/test/sie_seek.c b/test/sie_seek.c
index 061e540..42eee43 100644
--- a/test/sie_seek.c
+++ b/test/sie_seek.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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,
@@ -37,11 +34,9 @@ int main(void)
   int fd, n, error, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 3 * 9 * sizeof(unsigned char));
diff --git a/test/sie_seek_far.c b/test/sie_seek_far.c
index b7e59ea..ff88e6c 100644
--- a/test/sie_seek_far.c
+++ b/test/sie_seek_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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,
@@ -37,11 +34,9 @@ int main(void)
   int fd, n, error, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 3 * 9 * sizeof(unsigned char));
diff --git a/test/sie_sync.c b/test/sie_sync.c
index 9956aca..8492856 100644
--- a/test/sie_sync.c
+++ b/test/sie_sync.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,11 @@
  */
 #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
@@ -41,11 +38,9 @@ int main(void)
   int fd, n, error, r = 0;
 
   rmdirfile();
-  mkdir(filedir, 0777); 
+  mkdir(filedir, 0700); 
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n");
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
   write(fd, data_data, 3 * 9 * sizeof(unsigned char));
diff --git a/test/slim_get.c b/test/slim_get.c
index 5ef2fa3..2281e6d 100644
--- a/test/slim_get.c
+++ b/test/slim_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,15 +21,6 @@
 /* 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)
 {
 #ifndef TEST_SLIM
@@ -39,11 +30,9 @@ int main(void)
   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];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
 #ifdef USE_SLIM
   int i;
 #endif
@@ -51,18 +40,10 @@ int main(void)
 
   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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256 * sizeof(uint16_t));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -k %s > /dev/null", SLIMDATA, data);
diff --git a/test/slim_nframes.c b/test/slim_nframes.c
index 57262dc..8dd386c 100644
--- a/test/slim_nframes.c
+++ b/test/slim_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* 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_SLIM
@@ -38,26 +30,16 @@ int main(void)
   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)
-    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);
+  mkdir(filedir, 0700);
 
-  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(i, data_data, 256 * sizeof(uint16_t));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW UINT16 1\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   snprintf(command, 4096, "%s -k %s > /dev/null", SLIMDATA, data);
diff --git a/test/slim_seek.c b/test/slim_seek.c
index 7f2fee9..3690f3d 100644
--- a/test/slim_seek.c
+++ b/test/slim_seek.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,25 +29,15 @@ int main(void)
   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";
   char command[4096];
-  uint16_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   snprintf(command, 4096, "%s -k %s > /dev/null", SLIMDATA, data);
   if (gd_system(command)) {
diff --git a/test/slim_seek_far.c b/test/slim_seek_far.c
index 39a6770..e39f836 100644
--- a/test/slim_seek_far.c
+++ b/test/slim_seek_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,25 +29,15 @@ int main(void)
   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";
   char command[4096];
-  uint16_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   snprintf(command, 4096, "%s -k %s > /dev/null", SLIMDATA, data);
   if (gd_system(command)) {
diff --git a/test/spf_alias.c b/test/spf_alias.c
index 3b8577c..791e84e 100644
--- a/test/spf_alias.c
+++ b/test/spf_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,17 +24,14 @@ 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;
+  int error, r = 0;
   unsigned int spf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 11\n/ALIAS alias data\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "alias");
diff --git a/test/spf_alias_meta.c b/test/spf_alias_meta.c
index 2f8a3ab..648e755 100644
--- a/test/spf_alias_meta.c
+++ b/test/spf_alias_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,20 +24,18 @@ 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;
+  int error, r = 0;
   unsigned int spf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data RAW UINT8 11\n"
+    "data/sub PHASE data 0\n"
+    "/ALIAS alias data\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "alias/sub");
diff --git a/test/spf_alias_missing.c b/test/spf_alias_missing.c
index 313e131..82d6e9b 100644
--- a/test/spf_alias_missing.c
+++ b/test/spf_alias_missing.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,17 +24,14 @@ 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;
+  int error, r = 0;
   unsigned int spf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/ALIAS alias data\n");
 
   D = gd_open(filedir, GD_RDONLY);
   spf = gd_spf(D, "alias");
diff --git a/test/spf_const.c b/test/spf_const.c
new file mode 100644
index 0000000..0795c33
--- /dev/null
+++ b/test/spf_const.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  unsigned spf;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data CONST UINT8 1\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "data");
+  CHECKU(spf, 0);
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_DIMENSION);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/spf_divide.c b/test/spf_divide.c
index 64811a6..7ba5bc7 100644
--- a/test/spf_divide.c
+++ b/test/spf_divide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,31 +20,22 @@
  */
 #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 =
-    "in1 RAW UINT8 11\n"
-    "in2 RAW UINT8 13\n"
-    "div DIVIDE in1 in2\n";
-  int fd, r = 0;
+  int r = 0;
   DIRFILE *D;
   unsigned int spf;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "in1 RAW UINT8 11\n"
+    "in2 RAW UINT8 13\n"
+    "div DIVIDE in1 in2\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "div");
diff --git a/test/spf_lincom.c b/test/spf_lincom.c
index 829939b..4c6a8c0 100644
--- a/test/spf_lincom.c
+++ b/test/spf_lincom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,31 +21,22 @@
 /* The SPF of a lincom should equal the SPF of the first field */
 #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 =
-    "in1 RAW UINT8 11\n"
-    "in2 RAW UINT8 13\n"
-    "lincom LINCOM 2 in1 1 0 in2 1 0\n";
-  int fd, r = 0;
+  int r = 0;
   unsigned int spf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "in1 RAW UINT8 11\n"
+    "in2 RAW UINT8 13\n"
+    "lincom LINCOM 2 in1 1 0 in2 1 0\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "lincom");
diff --git a/test/spf_multiply.c b/test/spf_multiply.c
index d8ff6bb..973fc0a 100644
--- a/test/spf_multiply.c
+++ b/test/spf_multiply.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,31 +21,22 @@
 /* The SPF of a MULTIPLY should equal the SPF of the first field */
 #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 =
-    "in1 RAW UINT8 11\n"
-    "in2 RAW UINT8 13\n"
-    "lincom MULTIPLY in1 in2\n";
-  int fd, r = 0;
+  int r = 0;
   unsigned int spf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "in1 RAW UINT8 11\n"
+    "in2 RAW UINT8 13\n"
+    "lincom MULTIPLY in1 in2\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "lincom");
diff --git a/test/spf_polynom.c b/test/spf_polynom.c
index 4293dcd..3e1159a 100644
--- a/test/spf_polynom.c
+++ b/test/spf_polynom.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,21 @@
 /* The SPF of a polynom should equal the SPF of its input field */
 #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 =
-    "in RAW UINT8 11\n"
-    "polynom POLYNOM in 1 2 1 3\n";
-  int fd, r = 0;
+  int r = 0;
   unsigned int spf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "in RAW UINT8 11\n"
+    "polynom POLYNOM in 1 2 1 3\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "polynom");
diff --git a/test/spf_raw.c b/test/spf_raw.c
index 79ce3d4..706ecd8 100644
--- a/test/spf_raw.c
+++ b/test/spf_raw.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,28 +21,18 @@
 /* Retreiving the samples-per-frame of a field 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 *format = "dirfile/format";
-  const char *format_data = "data RAW UINT8 11\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   unsigned int spf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 11\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "data");
diff --git a/test/spf_recip.c b/test/spf_recip.c
index 2e39c53..9dbdd41 100644
--- a/test/spf_recip.c
+++ b/test/spf_recip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,21 @@
  */
 #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 =
-    "in2 RAW UINT8 13\n"
-    "div RECIP in2 3.\n";
-  int fd, r = 0;
+  int r = 0;
   unsigned int spf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "in2 RAW UINT8 13\n"
+    "div RECIP in2 3.\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   spf = gd_spf(D, "div");
diff --git a/test/spf_recurse.c b/test/spf_recurse.c
index fb94b4f..5eacd94 100644
--- a/test/spf_recurse.c
+++ b/test/spf_recurse.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,30 +21,21 @@
 /* Attempting to resove a recursively defined field should fail 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 *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;
+  int error, r = 0;
   unsigned int spf;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "in1 RAW UINT8 11\n"
+    "lincom LINCOM 2 lincom 1 0 in1 1 0\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY);
   spf = gd_spf(D, "lincom");
diff --git a/test/svlist.c b/test/svlist.c
index 3cdc57a..51158b2 100644
--- a/test/svlist.c
+++ b/test/svlist.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,33 +21,23 @@
 /* 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 STRING valu1\n"
-    "data2 STRING valu2\n"
-    "data3 STRING valu3\n"
-    "data4 CONST UINT8 1\n";
-  int fd, i, error, r = 0;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 STRING valu1\n"
+    "data2 STRING valu2\n"
+    "data3 STRING valu3\n"
+    "data4 CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_strings(D);
diff --git a/test/svlist0.c b/test/svlist0.c
index 1eda1bc..73502eb 100644
--- a/test/svlist0.c
+++ b/test/svlist0.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,29 +20,18 @@
  */
 #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 = "data4 CONST UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data4 CONST UINT8 1\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_strings(D);
diff --git a/test/svlist2.c b/test/svlist2.c
index bab4973..72a4904 100644
--- a/test/svlist2.c
+++ b/test/svlist2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,33 +20,23 @@
  */
 #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 STRING valu1\n"
-    "data2 STRING valu2\n"
-    "data3 STRING valu3\n"
-    "data4 CONST UINT8 1\n";
-  int fd, z, i, error, r = 0;
+  int z, i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 STRING valu1\n"
+    "data2 STRING valu2\n"
+    "data3 STRING valu3\n"
+    "data4 CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   for (z = 0; z < 2; ++z) {
diff --git a/test/svlist_hidden.c b/test/svlist_hidden.c
index 5f5def9..9696214 100644
--- a/test/svlist_hidden.c
+++ b/test/svlist_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,7 +24,14 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int i, error, r = 0;
+  const char **data;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "data1 STRING valu2\n"
     "data2 STRING valu4\n"
     "/HIDDEN data2\n"
@@ -32,17 +39,8 @@ int main(void)
     "/ALIAS data4 data2\n"
     "data5 STRING valu5\n"
     "/ALIAS data6 data5\n"
-    "/HIDDEN data6\n";
-  int fd, i, error, r = 0;
-  const char **data;
-  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);
+    "/HIDDEN data6\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   data = gd_strings(D);
diff --git a/test/svlist_long.c b/test/svlist_long.c
new file mode 100644
index 0000000..5f7ce2b
--- /dev/null
+++ b/test/svlist_long.c
@@ -0,0 +1,85 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 STRING a\n"
+    "datb STRING b\n"
+    "datc STRING c\n"
+    "datd STRING d\n"
+    "date STRING e\n"
+    "datf STRING f\n"
+    "datg STRING g\n"
+    "dath STRING h\n"
+    "dati STRING i\n"
+    "datj STRING j\n"
+    "datk STRING k\n"
+    "datl STRING l\n"
+    "datm STRING m\n"
+    "datn STRING n\n"
+    "dato STRING o\n"
+    "datp STRING p\n"
+    "datq STRING q\n"
+    "datr STRING r\n"
+    "dats STRING s\n"
+    "datt STRING t\n"
+    "datu STRING u\n"
+    "datv STRING v\n"
+    "datw STRING w\n"
+    "datx STRING x\n"
+    "daty STRING y\n"
+    "datz STRING z\n"
+    ;
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  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) {
+    CHECKIi(i, field_list[i][0], 'a' + i);
+    CHECKIi(i, field_list[i][1], 0);
+  }
+
+  CHECKI(i,26);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/svlist_meta.c b/test/svlist_meta.c
index 839d711..988f5ca 100644
--- a/test/svlist_meta.c
+++ b/test/svlist_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,34 +21,24 @@
 /* Retrieve a list of string metafields */
 #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 =
-    "parent STRING valu1\n"
-    "META parent data1 STRING valu1\n"
-    "META parent data2 STRING valu2\n"
-    "META parent data3 STRING valu3\n"
-    "META parent data4 CONST UINT8 1\n";
-  int fd, i, error, r = 0;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent STRING valu1\n"
+    "META parent data1 STRING valu1\n"
+    "META parent data2 STRING valu2\n"
+    "META parent data3 STRING valu3\n"
+    "META parent data4 CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   gd_nfields(D);
diff --git a/test/svlist_meta0.c b/test/svlist_meta0.c
index 9cce15a..daf8527 100644
--- a/test/svlist_meta0.c
+++ b/test/svlist_meta0.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,31 +20,21 @@
  */
 #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 =
-    "parent STRING valu1\n"
-    "META parent data4 CONST UINT8 1\n";
-  int fd, error, r = 0;
+  int error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "parent STRING valu1\n"
+    "META parent data4 CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   gd_nfields(D);
diff --git a/test/svlist_meta_hidden.c b/test/svlist_meta_hidden.c
index 3845236..1937c51 100644
--- a/test/svlist_meta_hidden.c
+++ b/test/svlist_meta_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,23 +24,21 @@ 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;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   gd_nfields(D);
diff --git a/test/svlist_meta_meta.c b/test/svlist_meta_meta.c
new file mode 100644
index 0000000..614c78f
--- /dev/null
+++ b/test/svlist_meta_meta.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "parent STRING valu1\n"
+    "META parent data1 STRING valu1\n"
+    "META parent data2 STRING valu2\n"
+    "META parent data3 STRING valu3\n"
+    "META parent data4 CONST UINT8 1\n"
+  );
+
+  D = gd_open(filedir, GD_RDONLY);
+  field_list = gd_mstrings(D, "parent/data1");
+  CHECKP(field_list);
+
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/svlist_meta_parent.c b/test/svlist_meta_parent.c
new file mode 100644
index 0000000..eed8555
--- /dev/null
+++ b/test/svlist_meta_parent.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  field_list = gd_mstrings(D, "parent");
+  CHECKP(field_list);
+
+  error = gd_error(D);
+  CHECKI(error, GD_E_BAD_CODE);
+
+  gd_discard(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/table.c b/test/table.c
index 6a3fb4a..9171638 100644
--- a/test/table.c
+++ b/test/table.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,18 @@
  */
 #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;
+  int error, r = 0;
   char *path;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "linterp LINTERP INDEX table\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   path = gd_linterp_tablename(D, "linterp");
diff --git a/test/table_code.c b/test/table_code.c
index 01233b9..2ef0de6 100644
--- a/test/table_code.c
+++ b/test/table_code.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,18 @@
  */
 #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;
+  int error, r = 0;
   const char *path;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "linterp LINTERP INDEX table\n");
 
   D = gd_open(filedir, GD_RDONLY);
   path = gd_linterp_tablename(D, "bata");
diff --git a/test/table_type.c b/test/table_type.c
index 41e4e55..7afc807 100644
--- a/test/table_type.c
+++ b/test/table_type.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2013 D. V. Wiebe
+/* Copyright (C) 2012-2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,18 @@
  */
 #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;
+  int error, r = 0;
   const char *path;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "data CONST UINT8 8\n");
 
   D = gd_open(filedir, GD_RDONLY);
   path = gd_linterp_tablename(D, "data");
diff --git a/test/tell.c b/test/tell.c
index 8716a80..897c4f1 100644
--- a/test/tell.c
+++ b/test/tell.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,37 +21,20 @@
 /* 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   gd_getdata(D, "data", 5, 0, 1, 0, GD_NULL, NULL);
diff --git a/test/tell64.c b/test/tell64.c
index 9692f22..86f31e0 100644
--- a/test/tell64.c
+++ b/test/tell64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -23,37 +23,20 @@
 
 #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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "data RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   gd_getdata(D, "data", 5, 0, 1, 0, GD_NULL, NULL);
diff --git a/test/tell_code.c b/test/tell_code.c
new file mode 100644
index 0000000..f53af18
--- /dev/null
+++ b/test/tell_code.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, r = 0;
+  off_t n1, n2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data PHASE missing 0");
+
+  D = gd_open(filedir, GD_RDONLY);
+  n1 = gd_tell(D, "missing");
+  CHECKI(n1, GD_E_BAD_CODE);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_BAD_CODE);
+
+  n2 = gd_tell(D, "data");
+  CHECKI(n2, GD_E_BAD_CODE);
+
+  e2 = gd_error(D);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/tell_dim.c b/test/tell_dim.c
new file mode 100644
index 0000000..d20f36f
--- /dev/null
+++ b/test/tell_dim.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data CONST UINT8 1");
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_tell(D, "data");
+  CHECKI(e1, GD_E_DIMENSION);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/tell_multi_div.c b/test/tell_multi_div.c
new file mode 100644
index 0000000..7f8f00a
--- /dev/null
+++ b/test/tell_multi_div.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2011, 2013, 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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, r = 0;
+  off_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data RAW UINT8 8\nphase PHASE data 1\ndiv DIVIDE phase data");
+  MAKEDATAFILE(data, unsigned char, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_tell(D, "div");
+  error = gd_error(D);
+
+  CHECKI(error, GD_E_DOMAIN);
+  CHECKI(n, GD_E_DOMAIN);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/tell_multi_lincom.c b/test/tell_multi_lincom.c
new file mode 100644
index 0000000..6a21236
--- /dev/null
+++ b/test/tell_multi_lincom.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 r = 0;
+  off_t e1, e2;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "data RAW UINT8 1\n"
+      "phase PHASE data 1\n"
+      "lincom2 LINCOM data 1 0 phase 1 0\n"
+      "lincom3 LINCOM data 1 0 data 1 0 phase 1 0\n"
+      );
+  MAKEDATAFILE(data, uint8_t, i, 256);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  e1 = gd_tell(D, "lincom2");
+  CHECKI(e1, GD_E_DOMAIN);
+
+  e2 = gd_tell(D, "lincom3");
+  CHECKI(e2, GD_E_DOMAIN);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/tell_multidiv.c b/test/tell_multidiv.c
deleted file mode 100644
index 701c61c..0000000
--- a/test/tell_multidiv.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* 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
- */
-/* 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_discard(D);
-
-  unlink(data);
-  unlink(format);
-  rmdir(filedir);
-
-  CHECKI(error, GD_E_DOMAIN);
-  CHECKI(n, -1);
-
-  return r;
-}
diff --git a/test/tell_recurse.c b/test/tell_recurse.c
new file mode 100644
index 0000000..bd542fe
--- /dev/null
+++ b/test/tell_recurse.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2016 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, r = 0;
+  off_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "data PHASE data 0");
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_tell(D, "data");
+  CHECKI(n, GD_E_RECURSE_LEVEL);
+
+  e1 = gd_error(D);
+  CHECKI(e1, GD_E_RECURSE_LEVEL);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/tell_sub.c b/test/tell_sub.c
index 8a97438..e91f837 100644
--- a/test/tell_sub.c
+++ b/test/tell_sub.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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";
@@ -34,31 +27,17 @@ int main(void)
   const char *format = "dirfile/format";
   const char *format1 = "dirfile/sub/format1";
   const char *data = "dirfile/sub/data";
-  const char *format_data = "/INCLUDE sub/format1\n";
-  const char *format1_data = "data RAW UINT8 8\nFRAMEOFFSET 6\n";
-  unsigned char data_data[256];
-  int fd, e1, r = 0;
+  int e1, r = 0;
   off_t n;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  mkdir(subdir, 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);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE sub/format1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 8\nFRAMEOFFSET 6\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_tell(D, "data");
diff --git a/test/test.h b/test/test.h
index a50b62d..0d10cf5 100644
--- a/test/test.h
+++ b/test/test.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2015 D. V. Wiebe
+/* Copyright (C) 2010-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,6 +29,10 @@
 #define isnan _isnan
 #endif
 
+#ifndef INFINITY
+#define INFINITY gd_strtod("INF", NULL)
+#endif
+
 #if defined HAVE__FINITE && \
   (! defined HAVE_DECL_ISFINITE || HAVE_DECL_ISFINITE == 0)
 #define isfinite _finite
@@ -53,11 +57,14 @@ int gd_system(const char* command)
 #define gd_system system
 #endif
 
-/* rm for MSVC */
+/* rm for WIN32 */
 #ifdef _WIN32
 #define rmdirfile() system("rmdir /q/s dirfile");
 #else
-#define rmdirfile() chmod("dirfile", 0755); system("rm -rf dirfile");
+#define rmdirfile() do { \
+  chmod("dirfile", 0700); \
+  if (system("rm -rf dirfile")) { perror("system"); exit(1); } \
+} while (0)
 #endif
 
 /* sleep for WIN32/64 */
@@ -66,6 +73,12 @@ int gd_system(const char* command)
 #define sleep(x) Sleep(1000 * (x))
 #endif
 
+#ifdef NO_LARGE_TESTS
+#define BIG_JUMP 10000
+#else
+#define BIG_JUMP 1000000
+#endif
+
 /* path munging for format files */
 #define gd_pathwrite(x,y) do { \
   char *ptr; \
@@ -105,7 +118,36 @@ int gd_system(const char* command)
         __VA_ARGS__); } \
   } while(0)
 
-#define strcmpn(n,v) (((n) == NULL) ? 1 : strcmp((n),(v)))
+/* Create an empty file with mode m */
+#define MAKEEMPTYFILE(f,m) \
+  do { \
+    int fd = open(f, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, m); \
+    if (fd < 0) { perror("open"); exit(1); } \
+    if (close(fd)) { perror("close"); exit(1); } \
+  } while (0)
+
+/* Write string literal t to format file f. */
+#define MAKEFORMATFILE(f,t) \
+  do { \
+    int fd = open(f, O_CREAT | O_EXCL | O_WRONLY, 0666); \
+    if (fd < 0) { perror("open"); exit(1); } \
+    if (write(fd, t, -1 + sizeof t) < 0) { perror("write"); exit(1); } \
+    if (close(fd)) { perror("close"); exit(1); } \
+  } while (0)
+
+/* Write n data of type t initialialised with expression expr to file f. */
+#define MAKEDATAFILE(f,t,expr,n) \
+  do { \
+    int i; \
+    t *data_data = malloc(sizeof(*data_data) * n); \
+    if (data_data == NULL) { perror("malloc"); exit(1); } \
+    for (i = 0; i < n; ++i) data_data[i] = (t)(expr); \
+    i = open(f, O_BINARY | O_CREAT | O_EXCL | O_WRONLY, 0666); \
+    if (i < 0) { perror("open"); exit(1); } \
+    if (write(i, data_data, sizeof(t) * n) < 0) { perror("write"); exit(1); } \
+    if (close(i)) { perror("close"); exit(1); } \
+    free(data_data); \
+  } while(0)
 
 #ifdef GD_NO_C99_API
 #define CHECKC(n,v)    CHECK(sqrt(((n)[0]-(v)[0])*((n)[0]-(v)[0]) + \
@@ -135,14 +177,18 @@ int gd_system(const char* command)
 #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(strcmpn((n),(v)),n,"\"%s\"","\"%s\"",(n),(v));
-#define CHECKSi(i,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\"",\
+#define CHECKPP(n,v)   CHECK((n) != (v),n,"%p","%p",n,v)
+#define CHECKPPi(i,n,v) CHECKi(i,(n) != (v),n,"%p","%p",n,v)
+#define CHECKS(n,v)    CHECK((n == NULL) || strcmp((n),(v)),n,"\"%s\"",\
+    "\"%s\"",(n),(v));
+#define CHECKSi(i,n,v) CHECKi(i,(n == NULL) || strcmp((n),(v)),n,"\"%s\"",\
     "\"%s\"",(n),(v));
-#define CHECKBOS(n,v)  CHECK(strncmp((n),(v),strlen(v)-1),n,"\"%s\"","\"%s\"",\
-    (n),(v));
-#define CHECKSS(n,v)  CHECK(strstr((n),(v)) == NULL,n,"\"%s\"","...\"%s\"...",\
-    (n),(v));
+#define CHECKSp(n,v)   CHECK((n == NULL) || strncmp((n),(v), sizeof(v) - 1),n,\
+    "\"%s\"","\"%s\"",(n),(v));
+#define CHECKBOS(n,v)  CHECK((n == NULL) || strncmp((n),(v),strlen(v)-1),n,\
+    "\"%s\"","\"%s\"",(n),(v));
+#define CHECKSS(n,v)  CHECK((n == NULL) || strstr((n),(v)) == NULL,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,"%" PRIu64,"%" PRIu64,\
diff --git a/test/trunc.c b/test/trunc.c
index 5cb0c35..78400db 100644
--- a/test/trunc.c
+++ b/test/trunc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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";
@@ -37,13 +30,13 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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));
+  MAKEEMPTYFILE(data, 0600);
 
   D = gd_open(filedir, GD_RDWR | GD_TRUNC | GD_VERBOSE);
   e1 = gd_error(D);
diff --git a/test/trunc_dir.c b/test/trunc_dir.c
index 02bef99..9b0d1d9 100644
--- a/test/trunc_dir.c
+++ b/test/trunc_dir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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";
@@ -38,14 +31,14 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  mkdir(subdir, 0777);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
   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));
+  MAKEEMPTYFILE(data, 0600);
 
   D = gd_open(filedir, GD_RDWR | GD_TRUNC | GD_VERBOSE);
   e1 = gd_error(D);
diff --git a/test/trunc_rdonly.c b/test/trunc_rdonly.c
index 2cd5150..03b614c 100644
--- a/test/trunc_rdonly.c
+++ b/test/trunc_rdonly.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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";
@@ -36,13 +29,13 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
   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));
+  MAKEEMPTYFILE(data, 0600);
 
   D = gd_open(filedir, GD_RDONLY | GD_TRUNC);
   e1 = gd_error(D);
diff --git a/test/trunc_rofs.c b/test/trunc_rofs.c
index a707d78..3812474 100644
--- a/test/trunc_rofs.c
+++ b/test/trunc_rofs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,13 +21,6 @@
 /* Truncating a read-only dirfile should fail cleanly */
 #include "test.h"
 
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-
 int main(void)
 {
   const char *filedir = "dirfile";
@@ -37,10 +30,10 @@ int main(void)
   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);
+  mkdir(filedir, 0700);
+  MAKEEMPTYFILE(format, 0600);
+  MAKEEMPTYFILE(data, 0600);
+  chmod(filedir, 0500);
 
   /* ensure filesystem honours read-onlyness */
   if (!unlink(data) || errno != EACCES) {
@@ -53,7 +46,7 @@ int main(void)
   error = gd_error(D);
   gd_discard(D);
 
-  chmod(filedir, 0777);
+  chmod(filedir, 0700);
   unlink(data);
   unlink(format);
   rmdir(filedir);
diff --git a/test/trunc_truncsub.c b/test/trunc_truncsub.c
index cc7a9e6..c6c4063 100644
--- a/test/trunc_truncsub.c
+++ b/test/trunc_truncsub.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2013, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,13 +20,6 @@
  */
 #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";
@@ -38,14 +31,14 @@ int main(void)
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-  mkdir(subdir, 0777);
+  mkdir(filedir, 0700);
+  mkdir(subdir, 0700);
 
   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));
+  MAKEEMPTYFILE(data, 0600);
 
   D = gd_open(filedir, GD_RDWR | GD_TRUNC | GD_TRUNCSUB | GD_VERBOSE);
   e1 = gd_error(D);
diff --git a/test/unclude.c b/test/unclude.c
index 9e13fb1..efbb0f4 100644
--- a/test/unclude.c
+++ b/test/unclude.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,41 +20,22 @@
  */
 #include "test.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)
 {
   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, e1, e2, unlink_format1, unlink_format2, r = 0;
+  int ret, e1, e2, 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);
-  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);
+  mkdir(filedir, 0700);
 
-  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format2_data, strlen(format2_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1\na CONST UINT8 1\n");
+  MAKEFORMATFILE(format1, "b CONST UINT8 11\n/INCLUDE format2\n");
+  MAKEFORMATFILE(format2, "c CONST UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_uninclude(D, 1, 0);
diff --git a/test/unclude_del.c b/test/unclude_del.c
index 999248a..b120efc 100644
--- a/test/unclude_del.c
+++ b/test/unclude_del.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,41 +20,22 @@
  */
 #include "test.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)
 {
   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, e1, e2, unlink_format1, unlink_format2, r = 0;
+  int ret, e1, e2, 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);
-  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);
+  mkdir(filedir, 0700);
 
-  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format2_data, strlen(format2_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1\na CONST UINT8 1\n");
+  MAKEFORMATFILE(format1, "b CONST UINT8 11\n/INCLUDE format2\n");
+  MAKEFORMATFILE(format2, "c CONST UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret = gd_uninclude(D, 2, 1);
diff --git a/test/unclude_index.c b/test/unclude_index.c
new file mode 100644
index 0000000..5286c52
--- /dev/null
+++ b/test/unclude_index.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 ret, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  ret = gd_uninclude(D, 1, 0);
+  e1 = gd_error(D);
+  CHECKI(ret,GD_E_BAD_INDEX);
+  CHECKI(e1,GD_E_BAD_INDEX);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/unclude_keep.c b/test/unclude_keep.c
new file mode 100644
index 0000000..031d3b4
--- /dev/null
+++ b/test/unclude_keep.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int f, ret, e1, e2, unlink_format1, unlink_format2, r = 0;
+  unsigned int nfields, nfragments;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/INCLUDE format1\n"
+    "/INCLUDE format2\n"
+    "a CONST UINT8 1\n"
+  );
+  MAKEFORMATFILE(format1, "b CONST UINT8 11\n");
+  MAKEFORMATFILE(format2, "c CONST UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_uninclude(D, 1, 0);
+  e1 = gd_error(D);
+  CHECKI(ret,0);
+  CHECKI(e1,0);
+
+  nfields = gd_nfields(D);
+  CHECKI(nfields,3);
+
+  nfragments = gd_nfragments(D);
+  CHECKI(nfragments,2);
+
+  f = gd_fragment_index(D, "c");
+  CHECKI(f, 1);
+
+  e2 = gd_close(D);
+  CHECKI(e2, 0);
+
+  unlink_format2 = unlink(format2);
+  unlink_format1 = unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(unlink_format2,0);
+  CHECKI(unlink_format1,0);
+
+  return r;
+}
diff --git a/test/unclude_move.c b/test/unclude_move.c
index ffba819..c06d7fc 100644
--- a/test/unclude_move.c
+++ b/test/unclude_move.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,41 +21,22 @@
 /* Test include */
 #include "test.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)
 {
   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;
+  int 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);
-  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);
+  mkdir(filedir, 0700);
 
-  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format2_data, strlen(format2_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1\na CONST UINT8 1\n");
+  MAKEFORMATFILE(format1, "b CONST UINT8 11\n/INCLUDE format2\n");
+  MAKEFORMATFILE(format2, "c CONST UINT8 11\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   ret1 = gd_uninclude(D, 2, 0);
diff --git a/test/unclude_open.c b/test/unclude_open.c
index d253a13..8aae0bd 100644
--- a/test/unclude_open.c
+++ b/test/unclude_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013 D. V. Wiebe
+/* Copyright (C) 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,6 @@
  */
 #include "test.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)
 {
   const char *filedir = "dirfile";
@@ -35,36 +27,18 @@ int main(void)
   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 = "data RAW UINT8 11\n/INCLUDE format2\n";
-  const char *format2_data = "c CONST UINT8 11\n";
-  int fd, ret, e1, e2, unlink_format1, unlink_format2, r = 0;
+  int ret, e1, e2, unlink_format1, unlink_format2, r = 0;
   unsigned int nfields, nfragments;
-  unsigned char data_data[256];
   uint8_t c = 3;
   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(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format2_data, strlen(format2_data));
-  close(fd);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "/INCLUDE format1\na CONST UINT8 1\n");
+  MAKEFORMATFILE(format1, "data RAW UINT8 11\n/INCLUDE format2\n");
+  MAKEFORMATFILE(format2, "c CONST UINT8 11\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   gd_putdata(D, "data", 0, 0, 0, 1, GD_UINT8, &c);
diff --git a/test/unclude_prot.c b/test/unclude_prot.c
new file mode 100644
index 0000000..f0dcb71
--- /dev/null
+++ b/test/unclude_prot.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int ret, e1, unlink_format1, unlink_format2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+    "/INCLUDE format1\n"
+    "/PROTECT all\n"
+    "a CONST UINT8 1\n"
+  );
+  MAKEFORMATFILE(format1, "b CONST UINT8 11\n/INCLUDE format2\n");
+  MAKEFORMATFILE(format2, "c CONST UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_uninclude(D, 1, 0);
+  e1 = gd_error(D);
+  CHECKI(ret,GD_E_PROTECTED);
+  CHECKI(e1,GD_E_PROTECTED);
+
+  gd_discard(D);
+
+  unlink_format2 = unlink(format2);
+  unlink_format1 = unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(unlink_format2,0);
+  CHECKI(unlink_format1,0);
+
+  return r;
+}
diff --git a/test/unclude_rdonly.c b/test/unclude_rdonly.c
new file mode 100644
index 0000000..bb8a8fb
--- /dev/null
+++ b/test/unclude_rdonly.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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";
+  int ret, e1, unlink_format1, unlink_format2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format, "/INCLUDE format1\na CONST UINT8 1\n");
+  MAKEFORMATFILE(format1, "b CONST UINT8 11\n/INCLUDE format2\n");
+  MAKEFORMATFILE(format2, "c CONST UINT8 11\n");
+
+  D = gd_open(filedir, GD_RDONLY);
+  ret = gd_uninclude(D, 1, 0);
+  e1 = gd_error(D);
+  CHECKI(ret,GD_E_ACCMODE);
+  CHECKI(e1,GD_E_ACCMODE);
+
+  gd_discard(D);
+
+  unlink_format2 = unlink(format2);
+  unlink_format1 = unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(unlink_format2,0);
+  CHECKI(unlink_format1,0);
+
+  return r;
+}
diff --git a/test/valid_reprz.c b/test/valid_reprz.c
new file mode 100644
index 0000000..f2f2724
--- /dev/null
+++ b/test/valid_reprz.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2016, 2017 D.V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 e1, e2, e3, e4, r1, r2, r3, r4, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
+      "code RAW UINT64 1\n"
+      "code.r RAW COMPLEX128 1\n"
+      "more.r RAW COMPLEX64 1\n"
+      );
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  /* Real part of "code" */
+  r1 = gd_validate(D, "code.r");
+  e1 = gd_error(D);
+  CHECKU(r1, 0);
+  CHECKI(e1, 0);
+
+  /* All of code.r */
+  r2 = gd_validate(D, "code.r.z");
+  e2 = gd_error(D);
+  CHECKU(r2, 0);
+  CHECKI(e2, 0);
+
+  /* Real part of code.r */
+  r3 = gd_validate(D, "code.r.r");
+  e3 = gd_error(D);
+  CHECKU(r3, 0);
+  CHECKI(e3, 0);
+
+  /* All of more.r */
+  r4 = gd_validate(D, "more.r");
+  e4 = gd_error(D);
+  CHECKU(r4, 0);
+  CHECKI(e4, 0);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/version_0.c b/test/version_0.c
index 9d8ab7c..ba1351f 100644
--- a/test/version_0.c
+++ b/test/version_0.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Open a Standards Version 0 conformant dirfile */
 #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 *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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "FRAMEOFFSET RAW c 8\na&b RAW c 8");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "FRAMEOFFSET", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/version_0_write.c b/test/version_0_write.c
index ea6316d..4c798ac 100644
--- a/test/version_0_write.c
+++ b/test/version_0_write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,17 @@
  */
 #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 = "FRAMEOFFSET RAW c 8\na&b RAW c 8";
-  int fd, e, e2, q, c, r = 0;
+  int e, e2, q, c, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "FRAMEOFFSET RAW c 8\na&b RAW c 8");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   e = gd_dirfile_standards(D, 0);
diff --git a/test/version_1.c b/test/version_1.c
index da27fd5..668cd76 100644
--- a/test/version_1.c
+++ b/test/version_1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Open a Standards Version 1 conformant dirfile */
 #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/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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE RAW c 8\nFRAMEOFFSET 1\na&b RAW c 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "INCLUDE", 5, 0, 1, 0, GD_UINT8, c);
diff --git a/test/version_1_write.c b/test/version_1_write.c
index 2424358..7cc782c 100644
--- a/test/version_1_write.c
+++ b/test/version_1_write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,17 @@
  */
 #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 = "INCLUDE RAW c 8\nFRAMEOFFSET 1\na&b RAW c 8\n";
-  int fd, e, e2, q, c, r = 0;
+  int e, e2, q, c, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "INCLUDE RAW c 8\nFRAMEOFFSET 1\na&b RAW c 8\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   e = gd_dirfile_standards(D, 1);
diff --git a/test/version_2.c b/test/version_2.c
index 222359b..c909303 100644
--- a/test/version_2.c
+++ b/test/version_2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,42 +21,25 @@
 /* Open a Standards Version 2 conformant dirfile */
 #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/INCLUDE";
-  const char *format_data =
-    "INCLUDE RAW c 8\n"
-    "a&b RAW c 8\n"
-    "m MULTIPLY INCLUDE INCLUDE\n";
   uint16_t c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, v, l, e, r = 0;
+  int 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "INCLUDE RAW c 8\n"
+    "a&b RAW c 8\n"
+    "m MULTIPLY INCLUDE INCLUDE\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "m", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/version_2_write.c b/test/version_2_write.c
index 7fc9f10..5e5e0e6 100644
--- a/test/version_2_write.c
+++ b/test/version_2_write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,31 +20,21 @@
  */
 #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 =
-    "INCLUDE RAW c 8\n"
-    "a&b RAW c 8\n"
-    "m MULTIPLY INCLUDE INCLUDE\n";
-  int fd, e, e2, q, c, r = 0;
+  int e, e2, q, c, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "INCLUDE RAW c 8\n"
+    "a&b RAW c 8\n"
+    "m MULTIPLY INCLUDE INCLUDE\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   e = gd_dirfile_standards(D, 2);
diff --git a/test/version_3.c b/test/version_3.c
index 84c9c8d..ebcd43e 100644
--- a/test/version_3.c
+++ b/test/version_3.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,45 +21,28 @@
 /* Open a Standards Version 3 conformant dirfile */
 #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 *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)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "ENDIAN RAW c 8\nINCLUDE RAW\n");
 
   fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data1, strlen(format_data1));
   close(fd);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "m", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/version_3_write.c b/test/version_3_write.c
index 832af0e..99180a9 100644
--- a/test/version_3_write.c
+++ b/test/version_3_write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,19 @@
  */
 #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 *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, e2, q, c, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "ENDIAN RAW c 8\nINCLUDE RAW\n");
 
   fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data1, strlen(format_data1));
diff --git a/test/version_4.c b/test/version_4.c
index 95cbc7d..18698a1 100644
--- a/test/version_4.c
+++ b/test/version_4.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,45 +21,28 @@
 /* Open a Standards Version 4 conformant dirfile */
 #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 *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)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "ENDIAN RAW c 8\nINCLUDE RAW\n");
 
   fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data1, strlen(format_data1));
   close(fd);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "VERSION", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/version_4_write.c b/test/version_4_write.c
index 513a4ed..f4ea6f4 100644
--- a/test/version_4_write.c
+++ b/test/version_4_write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,30 +20,19 @@
  */
 #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 *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, e2, q, c, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "ENDIAN RAW c 8\nINCLUDE RAW\n");
 
   fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data1, strlen(format_data1));
diff --git a/test/version_5.c b/test/version_5.c
index a9ee9f2..79862dd 100644
--- a/test/version_5.c
+++ b/test/version_5.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,20 +21,20 @@
 /* Open a Standards Version 5 conformant dirfile */
 #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/a.r";
-  const char *format_data =
+  uint16_t c[8];
+  int i, n, error, v, l, e, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "/VERSION 5\n"
 #ifdef WORDS_BIGENDIAN
     "/ENDIAN little\n"
@@ -42,26 +42,9 @@ int main(void)
     "/ENDIAN big\n"
 #endif
     "a.r RAW UINT8 8\n"
-    "ENCODING PHASE a.r 0\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)
-    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);
+    "ENCODING PHASE a.r 0\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "a.r", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/version_5_strict.c b/test/version_5_strict.c
index 057ff60..c779e26 100644
--- a/test/version_5_strict.c
+++ b/test/version_5_strict.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* CheckStandards Version 5 strictness */
 #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*)ll)[pdata->linenum - 1] = 1;
@@ -40,35 +32,26 @@ int main(void)
   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"
-    "/ENCODING raw\n"
-    "/REFERENCE ar\n"
-    "/PROTECT none\n"
-    "ar RAW UINT8 8\n";
   uint16_t c[8];
   int ll[7] = {0, 0, 0, 0, 0, 0, 0};
   uint16_t d[8];
-  unsigned char data_data[256];
-  int fd, n, error, m, error2, i, r = 0;
+  int n, error, m, error2, 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "/VERSION 5\n"
+    "ENDIAN little\n"
+    "X<r RAW UINT8 8\n"
+    "/ENCODING raw\n"
+    "/REFERENCE ar\n"
+    "/PROTECT none\n"
+    "ar RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_cbopen(filedir, GD_RDONLY | GD_PEDANTIC, cb, ll);
   n = gd_getdata(D, "ar", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/version_5_write.c b/test/version_5_write.c
index aa94659..edb81ea 100644
--- a/test/version_5_write.c
+++ b/test/version_5_write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,32 +20,22 @@
  */
 #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 =
-    "/VERSION 5\n"
-    "/ENDIAN big\n"
-    "a.r RAW UINT8 8\n"
-    "ENCODING PHASE a.r 0\n";
-  int fd, e, e2, q, c, r = 0;
+  int e, e2, q, c, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/VERSION 5\n"
+    "/ENDIAN big\n"
+    "a.r RAW UINT8 8\n"
+    "ENCODING PHASE a.r 0\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   e = gd_dirfile_standards(D, 5);
diff --git a/test/version_6.c b/test/version_6.c
index 60b7b17..2c8425e 100644
--- a/test/version_6.c
+++ b/test/version_6.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Open a Standards Version 6 conformant dirfile */
 #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/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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "/VERSION 6\na\\#r RAW UINT8 8\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "a#r", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/version_6_strict.c b/test/version_6_strict.c
index 4b1ac7e..9d72558 100644
--- a/test/version_6_strict.c
+++ b/test/version_6_strict.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Check Standards Version 6 strictness */
 #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*)ll)[pdata->linenum - 1] = 1;
@@ -40,7 +32,17 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *data = "dirfile/ar";
-  const char *format_data =
+  uint16_t c[8];
+  int ll[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+  uint16_t d[8];
+  int n, error, m, error2, i, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "/VERSION 6\n"
     "X<r RAW UINT8 8\n"
     "X#r RAW COMPLEX128 8\n"
@@ -50,28 +52,9 @@ int main(void)
     "/REFERENCE ar\n"
     "/PROTECT none\n"
     "c CONST UINT8 3\n"
-    "ar RAW UINT8 8\n";
-  uint16_t c[8];
-  int ll[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-  uint16_t d[8];
-  unsigned char data_data[256];
-  int fd, n, error, m, error2, 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);
-  close(fd);
+    "ar RAW UINT8 8\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_cbopen(filedir, GD_RDONLY | GD_PEDANTIC, cb, ll);
   n = gd_getdata(D, "ar", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/version_6_write.c b/test/version_6_write.c
index 9392474..482203b 100644
--- a/test/version_6_write.c
+++ b/test/version_6_write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,21 +24,19 @@ int main(void)
 {
   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, e2, q, c, r = 0;
+  int e, e2, q, c, r = 0;
   DIRFILE *D;
   unsigned int s;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/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"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   e = gd_dirfile_standards(D, 6);
diff --git a/test/version_7.c b/test/version_7.c
index 3c6a1ca..4cb137d 100644
--- a/test/version_7.c
+++ b/test/version_7.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,39 +21,21 @@
 /* Open a Standards Version 7 conformant dirfile */
 #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 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;
+  int 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);
+  mkdir(filedir, 0700);
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEFORMATFILE(format, "/VERSION 7\nar RAW UINT8 8\nar/q SBIT ar 0 10\n");
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "ar/q", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/version_7_strict.c b/test/version_7_strict.c
index 1182dee..926558b 100644
--- a/test/version_7_strict.c
+++ b/test/version_7_strict.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* Check Standards Version 6 strictness */
 #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*)ll)[pdata->linenum - 1] = 1;
@@ -40,34 +32,26 @@ int main(void)
   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"
-    "X\\#r RAW COMPLEX128 8\n"
-    "Xr POLYNOM INDEX 8 3 1 2\n"
-    "ar RAW UINT8 8\n"
-    "ar/c CONST COMPLEX128 3;3\n";
   uint16_t c[8];
   int ll[7] = {0, 0, 0, 0, 0, 0, 0};
-  unsigned char data_data[256];
-  int fd, i, n, error, r = 0;
+  int i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "/VERSION 7\n"
+    "X<r RAW UINT8 8\n"
+    "X.r RAW UINT8 8\n"
+    "X\\#r RAW COMPLEX128 8\n"
+    "Xr POLYNOM INDEX 8 3 1 2\n"
+    "ar RAW UINT8 8\n"
+    "ar/c CONST COMPLEX128 3;3\n"
+  );
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_cbopen(filedir, GD_RDONLY | GD_PEDANTIC, cb, ll);
   n = gd_getdata(D, "ar", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/version_7_write.c b/test/version_7_write.c
index 72f2ebe..3047261 100644
--- a/test/version_7_write.c
+++ b/test/version_7_write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,17 @@
  */
 #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 = "/VERSION 7\nar RAW UINT8 8\nar/q SBIT ar 0 10\n";
-  int fd, e, e2, q, c, r = 0;
+  int e, e2, q, c, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format, "/VERSION 7\nar RAW UINT8 8\nar/q SBIT ar 0 10\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   e = gd_dirfile_standards(D, 7);
diff --git a/test/version_8.c b/test/version_8.c
index e41ed08..31a78da 100644
--- a/test/version_8.c
+++ b/test/version_8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,43 +21,26 @@
 /* Open a Standards Version 8 conformant dirfile */
 #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 8\n"
-    "ar RAW UINT8 8\n"
-    "FRAMEOFFSET DIVIDE ar ar\n"
-    "r RECIP ar 1.\n";
   double c[8];
-  unsigned char data_data[256];
-  int fd, i, n, error, v, l, e, r = 0;
+  int 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "/VERSION 8\n"
+    "ar RAW UINT8 8\n"
+    "FRAMEOFFSET DIVIDE ar ar\n"
+    "r RECIP ar 1.\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "r", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/version_8_strict.c b/test/version_8_strict.c
index 3d42bb9..73d891f 100644
--- a/test/version_8_strict.c
+++ b/test/version_8_strict.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -32,7 +32,17 @@ int main(void)
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
   const char *data = "dirfile/ar";
-  const char *format_data =
+  uint16_t c[8];
+  int ll[NLINES];
+  int i, n, error, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 16);
+  memset(ll, 0, NLINES * sizeof(int));
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "/VERSION 8\n"
     "X<r RAW UINT8 8\n"
     "X.r RAW UINT8 8\n"
@@ -45,28 +55,10 @@ int main(void)
     "/FRAMEOFFSET 3\n"
     "e RECIP ar/c Xr\n"
     "e DIVIDE ar Xr\n"
-    "ar/c CONST COMPLEX128 3;3\n";
-  uint16_t c[8];
-  int ll[NLINES];
-  unsigned char data_data[256];
-  int fd, i, n, 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);
+    "ar/c CONST COMPLEX128 3;3\n"
+  );
 
-  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(fd, data_data, 256);
-  close(fd);
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_cbopen(filedir, GD_RDONLY | GD_PEDANTIC, cb, ll);
   n = gd_getdata(D, "ar", 5, 0, 1, 0, GD_UINT16, c);
diff --git a/test/version_8_write.c b/test/version_8_write.c
index 0e765fa..ff956e1 100644
--- a/test/version_8_write.c
+++ b/test/version_8_write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,32 +20,22 @@
  */
 #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 =
-    "/VERSION 8\n"
-    "ar RAW UINT8 8\n"
-    "FRAMEOFFSET DIVIDE ar ar\n"
-    "r RECIP ar 1.\n";
-  int fd, e, e2, q, c, r = 0;
+  int e, e2, q, c, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "/VERSION 8\n"
+    "ar RAW UINT8 8\n"
+    "FRAMEOFFSET DIVIDE ar ar\n"
+    "r RECIP ar 1.\n"
+  );
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   e = gd_dirfile_standards(D, 8);
diff --git a/test/version_9.c b/test/version_9.c
index 4d599d3..b8f14de 100644
--- a/test/version_9.c
+++ b/test/version_9.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,43 +20,26 @@
  */
 #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;
+  int 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;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "/VERSION 9\n"
+    "ar RAW UINT8 8\n"
+    "/HIDDEN ar\n"
+    "r WINDOW ar ar LT 0x2C\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   n = gd_getdata(D, "r", 5, 0, 1, 0, GD_FLOAT64, c);
diff --git a/test/version_9_strict.c b/test/version_9_strict.c
index 06d9b0a..4f04a1a 100644
--- a/test/version_9_strict.c
+++ b/test/version_9_strict.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013, 2014 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -34,11 +34,22 @@ int main(void)
   const char *format1 = "dirfile/format1";
   const char *format2 = "dirfile/format2";
   const char *data = "dirfile/ar";
-  const char *format_data =
+  uint16_t c[8];
+  int ll[NLINES];
+  int i, n, v, error, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 16);
+  memset(ll, 0, NLINES * sizeof(int));
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "/VERSION 8\n"  /* 0 */
     "/INCLUDE format1\n" /* 1 */
-    "w WINDOW INDEX INDEX SET 0x1\n"; /* 2 */
-  const char *format1_data =
+    "w WINDOW INDEX INDEX SET 0x1\n"
+  );
+  MAKEFORMATFILE(format1,
     "\n\n\n"
     "/VERSION 9\n" /* 3 */
     "/INCLUDE format2 A Z\n" /* 4 */
@@ -47,8 +58,9 @@ int main(void)
     "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 =
+    "/HIDDEN Xy\n"
+  );
+  MAKEFORMATFILE(format2,
     "\n\n\n"
     "\n\n\n\n\n\n\n\n"
     "c RAW UINT8 1\n" /* 11 */
@@ -57,36 +69,9 @@ int main(void)
     "/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);
+    "/META d d CONST FLOAT64 1\n"
+  );
+  MAKEDATAFILE(data, unsigned char, i, 256);
 
   D = gd_cbopen(filedir, GD_RDONLY | GD_PEDANTIC, cb, ll);
   error = gd_error(D);
diff --git a/test/version_9_write.c b/test/version_9_write.c
index a316b5f..3065510 100644
--- a/test/version_9_write.c
+++ b/test/version_9_write.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2011, 2013, 2014 D. V. Wiebe
+/* Copyright (C) 2010-2011, 2013, 2014, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -30,11 +30,18 @@ int main(void)
     "dirfile/format3",
     "dirfile/format4"
   };
-  const char *data = "dirfile/ar";
-  const char *format_data[] = {
-    "/VERSION 8\n"
-      "/INCLUDE format1\n",
-    "\n\n\n\n\n"
+  uint16_t c[8];
+  int i, e1, e2, e3, n, v, h1, h2, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 16);
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format[0],
+      "/VERSION 8\n"
+      "/INCLUDE format1\n");
+  MAKEFORMATFILE(format[1],
       "/VERSION 9\n"
       "Xr RAW COMPLEX128 0xA\n"
       "Xy POLYNOM INDEX 8 055 0xAE 2\n"
@@ -46,58 +53,40 @@ int main(void)
       "/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, e1, e2, 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);
+      "/HIDDEN Xy\n"
+      );
+  MAKEFORMATFILE(format[2], "/INCLUDE format3 \"\" Y\n");
+  MAKEFORMATFILE(format[3], "/ALIAS d INDEX\n/HIDDEN d\n");
+  MAKEFORMATFILE(format[4], "/ALIAS n m\n");
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
   h1 = gd_hidden(D, "AdYZ");
   CHECKI(h1,1);
 
-  gd_rewrite_fragment(D, GD_ALL_FRAGMENTS);
-  e1 = gd_error(D);
-  CHECKI(e1,0);
+  e1 = gd_dirfile_standards(D, 9);
+  CHECKI(e1, 9);
 
-  e2 = gd_close(D);
+  e2 = gd_rewrite_fragment(D, GD_ALL_FRAGMENTS);
   CHECKI(e2, 0);
 
+  e3 = gd_close(D);
+  CHECKI(e3, 0);
+
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   v = gd_dirfile_standards(D, GD_VERSION_CURRENT);
+  CHECKI(v,9);
+
   n = gd_getdata(D, "ar", 4, 0, 8, 0, GD_UINT16, c);
+  CHECKI(n,8);
+
   h2 = gd_hidden(D, "AdYZ");
   CHECKI(h2,1);
-  CHECKI(n,8);
-  CHECKI(v,GD_DIRFILE_STANDARDS_VERSION);
 
   for (i = 0; i < n; ++i)
     CHECKUi(i,c[i], (i & 1) ? 4 + i : 0);
 
   gd_discard(D);
 
-  unlink(data);
   for (i = 0; i < 5; ++i)
     unlink(format[i]);
   rmdir(filedir);
diff --git a/test/vlist.c b/test/vlist.c
index 3d62dde..5fce2b9 100644
--- a/test/vlist.c
+++ b/test/vlist.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2015, 2016, 2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,22 +24,20 @@ 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"
-    "data4 CONST UINT8 1\n"
-    "data4/sub LINCOM data1 1 0 data2 1 0\n";
-  int fd, i, error, r = 0;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+      "data1 RAW UINT8 1\n"
+      "data2 RAW UINT8 1\n"
+      "data3 RAW UINT8 1\n"
+      "data4 CONST UINT8 1\n"
+      "data4/sub LINCOM data1 1 0 data2 1 0\n"
+      "data5 SINDIR in in\n");
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_vector_list(D);
diff --git a/test/vlist_alias.c b/test/vlist_alias.c
index 062dc14..ec5e1a5 100644
--- a/test/vlist_alias.c
+++ b/test/vlist_alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,35 +21,25 @@
 /* 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;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_vector_list(D);
diff --git a/test/vlist_hidden.c b/test/vlist_hidden.c
index 6f93c67..f023e3e 100644
--- a/test/vlist_hidden.c
+++ b/test/vlist_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,22 +24,20 @@ 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;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "/HIDDEN data2\n"
+    "data3 RAW UINT8 1\n"
+    "data4 CONST UINT8 1\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_vector_list(D);
diff --git a/test/vlist_meta.c b/test/vlist_meta.c
index 0074179..880a4c7 100644
--- a/test/vlist_meta.c
+++ b/test/vlist_meta.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013, 2015 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,24 +24,22 @@ int main(void)
 {
   const char *filedir = "dirfile";
   const char *format = "dirfile/format";
-  const char *format_data =
+  int i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0700);
+
+  MAKEFORMATFILE(format,
     "parent RAW UINT8 1\n"
     "META parent data1 LINCOM parent 1 0\n"
     "META parent data2 LINCOM parent 1 0\n"
     "META parent data3 LINCOM parent 1 0\n"
     "META parent data4 CONST UINT8 1\n"
     "other RAW UINT8 1\n"
-    "META other data5 LINCOM parent 1 0\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);
+    "META other data5 LINCOM parent 1 0\n"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_mvector_list(D, "parent");
diff --git a/test/vlist_meta_hidden.c b/test/vlist_meta_hidden.c
index 2286257..2c7aa44 100644
--- a/test/vlist_meta_hidden.c
+++ b/test/vlist_meta_hidden.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -24,23 +24,21 @@ 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;
+  int i, error, r = 0;
   const char **field_list;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
-  write(fd, format_data, strlen(format_data));
-  close(fd);
+  MAKEFORMATFILE(format,
+    "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"
+  );
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   field_list = gd_mvector_list(D, "parent");
diff --git a/test/zzip_data.c b/test/zzip_data.c
index 5a59086..00fd03c 100644
--- a/test/zzip_data.c
+++ b/test/zzip_data.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,13 +29,9 @@ int main(void)
   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, r = 0;
+  int n, error, r = 0;
 #ifdef USE_ZZIP
   int i;
 #endif
@@ -43,18 +39,13 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT16 8\n"
+    "/ENCODING zzip test\n"
+  );
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   chdir(filedir);
diff --git a/test/zzip_get.c b/test/zzip_get.c
index 5e260a7..84472d3 100644
--- a/test/zzip_get.c
+++ b/test/zzip_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,11 +29,9 @@ int main(void)
   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, r = 0;
+  int n, error, r = 0;
 #ifdef USE_ZZIP
   int i;
 #endif
@@ -41,18 +39,10 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   chdir(filedir);
diff --git a/test/zzip_get_get.c b/test/zzip_get_get.c
index 8623ba8..20d307d 100644
--- a/test/zzip_get_get.c
+++ b/test/zzip_get_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011, 2013 D. V. Wiebe
+/* Copyright (C) 2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,28 +29,18 @@ int main(void)
   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, e1, e2, n2, e3, r = 0;
+  int i, n1, e1, e2, n2, e3, r = 0;
   DIRFILE *D;
 
   memset(c1, 0, 16);
   memset(c2, 0, 16);
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   chdir(filedir);
diff --git a/test/zzip_nframes.c b/test/zzip_nframes.c
index 9462772..d4e7f28 100644
--- a/test/zzip_nframes.c
+++ b/test/zzip_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2016, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -18,17 +18,8 @@
  * 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
@@ -38,26 +29,16 @@ int main(void)
   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;
+  int error, r = 0;
+  off_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);
+  mkdir(filedir, 0700);
 
-  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(i, data_data, 256 * sizeof(uint16_t));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW UINT16 1\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress */
   chdir(filedir);
@@ -85,7 +66,7 @@ int main(void)
   CHECKI(n, 256);
 #else
   CHECKI(error, GD_E_UNKNOWN_ENCODING);
-  CHECKI(n, 0);
+  CHECKI(n, GD_E_UNKNOWN_ENCODING);
 #endif
 
   return r;
diff --git a/test/zzip_seek.c b/test/zzip_seek.c
index 70da389..1ec9448 100644
--- a/test/zzip_seek.c
+++ b/test/zzip_seek.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,25 +29,15 @@ int main(void)
   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";
   char command[4096];
-  uint16_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   chdir(filedir);
   snprintf(command, 4096, "%s raw data > /dev/null", ZIP);
diff --git a/test/zzip_seek_far.c b/test/zzip_seek_far.c
index 697c751..b782863 100644
--- a/test/zzip_seek_far.c
+++ b/test/zzip_seek_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,25 +29,15 @@ int main(void)
   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";
   char command[4096];
-  uint16_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format, "data RAW UINT16 8\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   chdir(filedir);
   snprintf(command, 4096, "%s raw data > /dev/null", ZIP);
diff --git a/test/zzslim_get.c b/test/zzslim_get.c
index b94eb22..cd0f2f2 100644
--- a/test/zzslim_get.c
+++ b/test/zzslim_get.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2014 D. V. Wiebe
+/* Copyright (C) 2012-2014, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -30,13 +30,9 @@ int main(void)
   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, r = 0;
+  int n, error, r = 0;
 #ifdef USE_ZZSLIM
   int i;
 #endif
@@ -44,18 +40,13 @@ int main(void)
 
   memset(c, 0, 8);
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT16 8\n"
+    "/ENCODING zzslim test\n"
+  );
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress, twice */
   snprintf(command, 4096, "%s -k %s > /dev/null", SLIMDATA, data);
diff --git a/test/zzslim_nframes.c b/test/zzslim_nframes.c
index f7fcd39..6fab736 100644
--- a/test/zzslim_nframes.c
+++ b/test/zzslim_nframes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011, 2013 D. V. Wiebe
+/* Copyright (C) 2008-2011, 2013, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,14 +21,6 @@
 /* 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)
@@ -39,26 +31,16 @@ int main(void)
   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);
+  mkdir(filedir, 0700);
 
-  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
-  write(i, data_data, 256 * sizeof(uint16_t));
-  close(i);
+  MAKEFORMATFILE(format, "data RAW UINT16 1\n/ENCODING zzslim\n");
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress, twice */
   snprintf(command, 4096, "%s -k %s > /dev/null", SLIMDATA, data);
@@ -90,7 +72,7 @@ int main(void)
   CHECKI(n, 256);
 #else
   CHECKI(error, GD_E_UNSUPPORTED);
-  CHECKI(n, 0);
+  CHECKI(n, GD_E_UNSUPPORTED);
 #endif
 
   return r;
diff --git a/test/zzslim_seek.c b/test/zzslim_seek.c
index 60846f4..137c240 100644
--- a/test/zzslim_seek.c
+++ b/test/zzslim_seek.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -30,27 +30,18 @@ int main(void)
   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";
   char command[4096];
-  uint16_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT16 8\n"
+    "/ENCODING zzslim test\n"
+  );
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress, twice */
   snprintf(command, 4096, "%s -k %s > /dev/null", SLIMDATA, data);
diff --git a/test/zzslim_seek_far.c b/test/zzslim_seek_far.c
index 1e60208..9316160 100644
--- a/test/zzslim_seek_far.c
+++ b/test/zzslim_seek_far.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 D. V. Wiebe
+/* Copyright (C) 2015, 2017 D.V. Wiebe
  *
  ***************************************************************************
  *
@@ -30,27 +30,18 @@ int main(void)
   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";
   char command[4096];
-  uint16_t data_data[256];
-  int fd, n, error, r = 0;
+  int n, error, r = 0;
   DIRFILE *D;
 
   rmdirfile();
-  mkdir(filedir, 0777);
-
-  for (fd = 0; fd < 256; ++fd)
-    data_data[fd] = (unsigned char)fd;
+  mkdir(filedir, 0700);
 
-  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);
+  MAKEFORMATFILE(format,
+    "data RAW UINT16 8\n"
+    "/ENCODING zzslim test\n"
+  );
+  MAKEDATAFILE(data, uint16_t, i, 256);
 
   /* compress, twice */
   snprintf(command, 4096, "%s -k %s > /dev/null", SLIMDATA, data);
diff --git a/util/Makefile.in b/util/Makefile.in
index bc4e820..d5ea18f 100644
--- a/util/Makefile.in
+++ b/util/Makefile.in
@@ -214,6 +214,8 @@ DEFINE_GD_GETDATA_INT_VERSION = @DEFINE_GD_GETDATA_INT_VERSION@
 DEFINE_GD_GETDATA_VERSION = @DEFINE_GD_GETDATA_VERSION@
 DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
 DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_GD_NO_PCRE = @DEFINE_GD_NO_PCRE@
+DEFINE_GD_NO_REGEX = @DEFINE_GD_NO_REGEX@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
diff --git a/util/checkdirfile.c b/util/checkdirfile.c
index ef34d65..1b4b77a 100644
--- a/util/checkdirfile.c
+++ b/util/checkdirfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2010, 2012, 2014, 2015 D. V. Wiebe
+/* Copyright (C) 2007-2010, 2012, 2014-2017 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -26,6 +26,10 @@
 #endif
 #endif
 
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -58,13 +62,13 @@ int main(int argc, char* argv[])
 
   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"
         "\n\n"
         "This program is part of %s.\n"
-        "Copyright (C) 2008-2010, 2012  D. V. Wiebe\n"
+        "Copyright (C) 2008-2010, 2012, 2014-2017  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"
@@ -99,7 +103,8 @@ int main(int argc, char* argv[])
   }
 
   if (ne > 0)
-    printf("  Found %i line%s with syntax errors.\n", ne, (ne == 1) ? "" : "s");
+    printf("  Found %i %s with syntax errors.\n", ne,
+        (ne == 1) ? "line" : "lines");
   else {
     int vers[GD_DIRFILE_STANDARDS_VERSION + 1];
     int nvers = 0;
@@ -170,8 +175,8 @@ int main(int argc, char* argv[])
   /* Check the validity of each entry defined */
   ne = 0;
   puts("\nChecking fields...");
-  flist = gd_entry_list(dirfile, NULL, 0, GD_ENTRIES_HIDDEN |
-      GD_ENTRIES_NOALIAS);
+  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],
@@ -179,8 +184,8 @@ int main(int argc, char* argv[])
       ne++;
     }
     nfields++;
-    mflist = gd_entry_list(dirfile, flist[i], 0, GD_ENTRIES_HIDDEN | 
-        GD_ENTRIES_NOALIAS);
+    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]);
@@ -248,7 +253,7 @@ int main(int argc, char* argv[])
     return 1;
   }
 
-  printf("  Found %" PRIu64 " %s.\n", n, n == 1 ? "frame" : "frames");
+  printf("  Found %" PRIu64 " %s.\n", (uint64_t)n, n == 1 ? "frame" : "frames");
 
   gd_close(dirfile);
   return 0;

-- 
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