[ferret-vis] 01/01: new upstream 7.2.1-final

Alastair McKinstry mckinstry at moszumanska.debian.org
Sat Dec 9 08:52:04 UTC 2017


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

mckinstry pushed a commit to tag upstream/7.2.1.final
in repository ferret-vis.

commit fab306c0e546cdbafd2d08afd0ff35b1dbe42ee1
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Sat Oct 21 20:23:41 2017 +0100

    new upstream 7.2.1-final
---
 Makefile                                           |  15 +
 README.md                                          |  14 +-
 bench/Makefile                                     |   2 +-
 bench/RUN_TESTS.sh                                 |  51 +-
 bench/TEST_SCRIPTS                                 |   1 +
 bench/ansley_official.rhel6-64_err                 |  31 +-
 bench/ansley_official.rhel6-64_log                 | 808 ++++++++++++---------
 bench/bn721_bug_fixes.jnl                          |  10 +
 bench/bn_all.jnl                                   |   5 +
 bench/err72_atts_as_vars.jnl                       |  26 +
 bench/err72_sum_in_x.jnl                           |  12 +
 bench/memleak.jnl                                  |   7 -
 bench/test_results/bn_axis_vs.gif                  | Bin 6645 -> 6645 bytes
 bench/test_results/bn_contour_conset.gif           | Bin 17361 -> 17361 bytes
 bench/test_results/bn_hovmuller_overlays.gif       | Bin 51920 -> 51920 bytes
 bench/test_results/bn_labels_on_taxis.gif          | Bin 35123 -> 35123 bytes
 bench/test_results/bn_ribbon_vlog.gif              | Bin 12468 -> 12468 bytes
 bench/test_results/bn_subspan_mod_strides.gif      | Bin 24061 -> 24061 bytes
 bench/test_results/bn_vs_const_value.gif           | Bin 10917 -> 10917 bytes
 bench/test_results/bnplot_2.gif                    | Bin 56113 -> 56113 bytes
 bench/test_results/bnplot_3.gif                    | Bin 27755 -> 27755 bytes
 bench/test_results/err700_key.gif                  | Bin 32596 -> 32596 bytes
 bench/test_results/ferret_run_tests_err            |  59 +-
 bench/test_results/ferret_run_tests_log            | 302 ++++++--
 bench/test_results/ferret_run_tests_ncdump         | 143 ++--
 bench/test_results/forecast_actual.gif             | Bin 15839 -> 15839 bytes
 bench/test_results/forecast_diagview.gif           | Bin 14385 -> 14385 bytes
 bench/test_results/forecast_leadview.gif           | Bin 12293 -> 12293 bytes
 bench/test_results/legend_1d_plots.gif             | Bin 10422 -> 10422 bytes
 bench/test_results/lon_lat_label_controls.gif      | Bin 10898 -> 10898 bytes
 bench/test_results/testbackground.gif              | Bin 46738 -> 46738 bytes
 bench/test_results/vs_lon_over.gif                 | Bin 11380 -> 11380 bytes
 .../cflib/curv_to_lonlat_from_weights.c            |  28 +-
 external_functions/cflib/curv_to_lonlat_regrid.c   |  28 +-
 external_functions/cflib/fcn_curv_to_lonlat.c      |  28 +-
 external_functions/contributed/pco2.F              |  18 +-
 .../platform_specific.mk.i386-apple-darwin         |  37 -
 .../ef_utility/platform_specific.mk.i386-linux     |  10 -
 .../ef_utility/platform_specific.mk.intel-mac      |   8 +-
 .../ef_utility/platform_specific.mk.x86_64-darwin  |  33 -
 .../ef_utility/platform_specific.mk.x86_64-linux   |  10 -
 .../platform_specific.mk.x86_64-linux-gnu          |  46 --
 .../{site_specific.mk => site_specific.mk.in}      |   0
 external_functions/examples/Makefile               |   2 +-
 external_functions/examples/earth_distance.F       | 191 +++++
 external_functions/extrema/maxminmax.F             |   2 +-
 external_functions/extrema/minminmax.F             |   2 +-
 ...ft_platform_specific_flags.mk.i386-apple-darwin |  14 -
 external_functions/v5d/binio.c                     |  28 +-
 external_functions/v5d/v5d.c                       |  19 +-
 .../v5d_platform_specific_flags.mk.x86_64-darwin   |   8 -
 fer/Makefile                                       |  26 +-
 fer/ccr/EF_InternalUtil.c                          | 759 +++++++++----------
 fer/ccr/SOURCE_FILES                               |   2 -
 fer/ccr/backing_store_enabled.c                    |  11 +-
 fer/ccr/batch_graphics.c                           |  11 +-
 fer/ccr/binaryRead.c                               |  64 +-
 fer/ccr/c_dncase.c                                 |  17 +-
 fer/ccr/c_strcat.c                                 |  21 +-
 fer/ccr/c_strcmp.c                                 |   6 +-
 fer/ccr/c_strfloat.c                               |   5 +-
 fer/ccr/c_strindex.c                               |   6 +-
 fer/ccr/c_strlen.c                                 |   5 +-
 fer/ccr/c_strrindex.c                              |   6 +-
 fer/ccr/c_substr.c                                 |  19 +-
 fer/ccr/c_upcase.c                                 |  17 +-
 fer/ccr/cache_full_array.c                         |   5 +-
 fer/ccr/check_nan_data_sub.c                       |   6 +-
 fer/ccr/compare_c_strings.c                        |   5 +-
 fer/ccr/copy_buffered_window.c                     |  20 +-
 fer/ccr/copy_c_string.c                            |  16 +-
 fer/ccr/dynmemUtil.c                               |  42 +-
 fer/ccr/fermain_c.c                                |  55 +-
 fer/ccr/ferret_dispatch_c.c                        |  47 +-
 fer/ccr/ferret_query.c                             | 154 ----
 fer/ccr/free_c_pointer.c                           |   7 +-
 fer/ccr/free_c_string_array.c                      |  14 +-
 fer/ccr/free_cached_full_array.c                   |  15 +-
 fer/ccr/free_dyn_mem.c                             |  26 +-
 fer/ccr/get_c_pointer.c                            |   5 +-
 fer/ccr/get_c_string.c                             |   6 +-
 fer/ccr/get_c_string_len.c                         |   4 +-
 fer/ccr/get_max_c_string_len.c                     |   5 +-
 fer/ccr/get_mr_mem.c                               |  27 +-
 fer/ccr/get_offset_c_string.c                      |   7 +-
 fer/ccr/get_offset_c_string_len.c                  |   5 +-
 fer/ccr/get_sys_cmnd.c                             |  52 +-
 fer/ccr/get_ws_mem.c                               |  11 +-
 fer/ccr/grab_image_xwd.c                           | 216 +-----
 fer/ccr/gui_init.c                                 |  80 --
 fer/ccr/init_c_string_array.c                      |  22 +-
 fer/ccr/linux_routines_c.c                         |   3 +-
 fer/ccr/list.c                                     |  65 +-
 fer/ccr/nullify_mr.c                               |  19 +-
 fer/ccr/nullify_ws.c                               |  17 +-
 fer/ccr/put_frame.c                                |  21 +-
 fer/ccr/recover_cached_2d_array_point.c            |   7 +-
 fer/ccr/recover_cached_full_array.c                |   4 +-
 fer/ccr/replace_bad_data_sub.c                     |   5 +-
 fer/ccr/replaceable_bad_flags.c                    |   6 +-
 fer/ccr/run_thredds_browser.h                      |  20 -
 fer/ccr/save_arg_pointers.c                        |   4 -
 fer/ccr/save_c_string.c                            |  15 +-
 fer/ccr/set_nan.c                                  |   2 +-
 fer/ccr/set_null_c_string.c                        |  15 +-
 fer/ccr/set_null_c_string_array.c                  |  16 +-
 fer/ccr/sizeof_pointer.c                           |   3 +-
 fer/ccr/unmap_animate_window.c                     |   9 +-
 fer/ccr/wgif.c                                     |  69 +-
 fer/ccr/whdf.c                                     |   5 +-
 fer/ccr/write_dods.c                               |  24 +-
 fer/ccr/xfer_c_ptrs.c                              |  15 +-
 fer/common/EF_Util.h                               |  20 +-
 fer/common/FerMem.h                                |  58 ++
 fer/{ccr => common}/binaryRead.h                   |  11 +-
 fer/common/dsimple.h                               |  53 --
 fer/common/ferret.h                                | 175 +++--
 fer/common/ferret_query.parm                       |  17 -
 fer/common/ferret_shared_buffer.h                  |  21 +-
 fer/common/list.h                                  |  26 +-
 fer/common/posix_signal.h                          | 108 ---
 fer/common/run_thredds_browser.h                   |  20 +
 fer/ctx/get_context_grid.F                         |   2 +-
 fer/dat/xrevision_data.F                           |   2 +-
 fer/doo/do_sum_sub.F                               |   3 +-
 fer/ef_utility/ef_get_arg_type.c                   |   1 +
 fer/ef_utility/ef_get_bad_flags.c                  |   1 +
 fer/ef_utility/ef_get_cx_list.c                    |   1 +
 fer/ef_utility/ef_get_mr_list.c                    |   2 +-
 fer/ef_utility/ef_get_mres.c                       |   1 +
 fer/ef_utility/ef_get_one_val.c                    |   1 +
 fer/ef_utility/ef_get_result_type.c                |   1 +
 fer/ef_utility/ef_put_string.c                     |   7 +-
 fer/ef_utility/ef_put_string_ptr.c                 |   6 +-
 fer/ef_utility/ef_set_alt_fcn_name_sub.c           |   1 +
 fer/ef_utility/ef_set_arg_desc_sub.c               |   1 +
 fer/ef_utility/ef_set_arg_name_sub.c               |   1 +
 fer/ef_utility/ef_set_arg_type.c                   |   1 +
 fer/ef_utility/ef_set_arg_unit_sub.c               |   1 +
 fer/ef_utility/ef_set_axis_extend.c                |   1 +
 fer/ef_utility/ef_set_axis_influence.c             |   1 +
 fer/ef_utility/ef_set_axis_influence_6d.c          |   1 +
 fer/ef_utility/ef_set_axis_inheritance.c           |   1 +
 fer/ef_utility/ef_set_axis_inheritance_6d.c        |   1 +
 fer/ef_utility/ef_set_axis_limits.c                |   1 +
 fer/ef_utility/ef_set_axis_reduction.c             |   1 +
 fer/ef_utility/ef_set_axis_reduction_6d.c          |   1 +
 fer/ef_utility/ef_set_custom_axis_sub.c            |   1 +
 fer/ef_utility/ef_set_desc_sub.c                   |   1 +
 fer/ef_utility/ef_set_freq_axis_sub.c              |   1 +
 fer/ef_utility/ef_set_has_vari_args.c              |   3 +-
 fer/ef_utility/ef_set_num_args.c                   |   1 +
 fer/ef_utility/ef_set_num_work_arrays.c            |   1 +
 fer/ef_utility/ef_set_piecemeal_ok.c               |   1 +
 fer/ef_utility/ef_set_piecemeal_ok_6d.c            |   1 +
 fer/ef_utility/ef_set_result_type.c                |   1 +
 fer/ef_utility/ef_set_work_array_dims.c            |   1 +
 fer/ef_utility/ef_set_work_array_dims_6d.c         |   1 +
 fer/ef_utility/ef_set_work_array_lens.c            |   1 +
 fer/ef_utility/ef_set_work_array_lens_6d.c         |   1 +
 fer/ef_utility/ef_version_test.c                   |   1 +
 fer/efi/date_decode.c                              |  19 +-
 fer/efi/maxminmax.F                                |   2 +-
 fer/efi/minminmax.F                                |   2 +-
 fer/efi/svdeof-4.F                                 |   7 +-
 fer/efi/time_decode.c                              |   4 +-
 fer/efi/us2i_compare_string_list.c                 |  51 +-
 fer/gnl/SOURCE_FILES                               |   4 +-
 fer/gnl/cancel_data_set.F                          |   4 +-
 fer/gnl/check_member_sets.F                        |   2 +-
 fer/gnl/do_query.F                                 |   6 +-
 fer/gnl/finalize.F                                 |  73 --
 fer/gnl/finalize_ferret.F                          | 199 +++++
 fer/gnl/get_fer_command.F                          |   3 +-
 fer/gnl/init_ef_aggregate_dset.F                   |   4 +-
 fer/gnl/init_u_aggregate_dset.F                    |   4 +-
 fer/gnl/{initialize.F => initialize_ferret.F}      |   2 +-
 fer/gnl/is_agg_member.F                            |   2 +-
 fer/gnl/redefine_ax_att.F                          |   2 +-
 fer/gnl/reset_ax_att.F                             |   2 +-
 fer/gnl/show_data.F                                |   2 +-
 fer/gnl/show_line_xml.F                            |   2 +-
 fer/gnl/special_symbol.F                           |   2 +-
 fer/ino/find_dset_number.F                         |  10 +-
 fer/ino/init_ez_dset.F                             |   2 +-
 fer/mem/create_dyn_wrkspc.F                        |   6 +-
 fer/mem/dynmem_mrlist_c.F                          |   1 +
 fer/mem/find_mr_slot.F                             |   2 +-
 fer/mem/get_dyn_work_space.F                       |   8 +-
 fer/mem/get_mr_dynmem.F                            |  24 +-
 fer/mem/get_ws_dynmem.F                            |  14 +-
 fer/mem/purge_mr_grid.F                            |   2 +-
 fer/mem/r_cgrid_size_delta.F                       |   8 +-
 fer/mem/show_aborted_mem_state.F                   |   8 +-
 fer/mem/store_mr_ptr.F                             |   7 +-
 fer/plt/movie_frame_ris8.F_unused                  |  88 ---
 fer/special/FerMem_routines.c                      | 358 +++++++++
 fer/special/SOURCE_FILES                           |   4 +-
 fer/special/ferret_dispatch.F                      |   4 +-
 fer/special/ferret_query_f.F                       | 535 --------------
 fer/stk/is_attrib_val.F                            |  18 +-
 fer/utl/get_unique_dset_name.F                     |   4 +-
 fer/utl/transfer_axis.F                            |   2 +-
 fer/utl/transfer_cx_axis_to_uv.F                   |   2 +-
 fer/utl/transfer_uv_axis_to_uv.F                   |   2 +-
 fer/xeq/xeq_cancel.F                               |  24 +-
 fer/xeq/xeq_exit.F                                 |  16 +-
 fer/xeq/xeq_go.F                                   |   4 -
 fer/xeq/xeq_set.F                                  |   4 +-
 fer/xeq/xeq_show.F                                 |   2 +-
 fmt/cmn/NCF_Util.h                                 |  16 +-
 fmt/{src => cmn}/deleted_list.h                    |   0
 fmt/cmn/ez_delimited_read.h                        |  62 +-
 fmt/{src => cmn}/fbits.h                           |   2 +-
 fmt/cmn/ferretmacros.h                             |  27 -
 fmt/cmn/fmtprotos.h                                | 158 ++++
 fmt/{src => cmn}/string_array.h                    |   4 +
 fmt/src/NCF_Util.c                                 | 375 ++++------
 fmt/src/SOURCE_FILES                               |   9 +-
 fmt/src/alloca.c                                   | 215 ------
 fmt/src/cd_close_set.F                             |  13 +-
 fmt/src/cd_open_dset.F                             |   2 +-
 fmt/src/cd_rd_r8_as_r4.c                           | 121 ---
 fmt/src/cd_read_scale.c                            |  30 +-
 fmt/src/cd_read_sub.c                              |  27 +-
 fmt/src/cd_write_att_dp_sub.c                      |   7 +-
 fmt/src/cd_write_att_sub.c                         |   2 +-
 fmt/src/cd_write_var_sub.c                         |  42 +-
 fmt/src/deleted_list_clear.c                       |  27 +-
 fmt/src/deleted_list_get_del.c                     |  31 +-
 fmt/src/deleted_list_get_undel.c                   |  31 +-
 fmt/src/deleted_list_init.c                        |  36 +-
 fmt/src/deleted_list_modify.c                      |  43 +-
 fmt/src/emacs_keymap.h                             | 472 ------------
 fmt/src/ez_delimited_read.c                        | 142 ++--
 fmt/src/free_time.F                                |   5 +-
 fmt/src/my_open.c                                  |  73 --
 fmt/src/my_readline.c                              |  80 --
 fmt/src/nc.h                                       |   7 -
 fmt/src/ncconfig.h                                 |   6 -
 fmt/src/ncio.h                                     |   7 -
 fmt/src/str_case_blind_compare_sub.c               |   7 +-
 fmt/src/str_dncase_sub.c                           |   3 +-
 fmt/src/str_upcase_sub.c                           |   4 +-
 fmt/src/string_array_clear.c                       |  28 +-
 fmt/src/string_array_find.c                        |  26 +-
 fmt/src/string_array_find_caseblind.c              |  24 +-
 fmt/src/string_array_find_exact.c                  |  21 +-
 fmt/src/string_array_find_quoted.c                 |  23 +-
 fmt/src/string_array_get_strlen.c                  |  13 +-
 fmt/src/string_array_get_strlen1.c                 |  12 +-
 fmt/src/string_array_hash.c                        |  13 +-
 fmt/src/string_array_init.c                        |  26 +-
 fmt/src/string_array_modify.c                      |  21 +-
 fmt/src/string_array_modify_upcase.c               |  21 +-
 fmt/src/{tm_switch_nan.c => switch_nan.c}          |  24 +-
 fmt/src/tm_blockify_ferret_strings.c               |   4 +-
 fmt/src/tm_break_fmt_date_c.c                      |  33 +-
 fmt/src/tm_c_rename.c                              |  16 +-
 fmt/src/tm_check_inf.c                             |  12 +-
 fmt/src/tm_check_nan.c                             |   8 +-
 fmt/src/tm_close_set_cond_deallo.F                 |   3 +
 fmt/src/tm_dfp_convert.c                           | 208 ------
 fmt/src/tm_ep_time_convrt.c                        |  25 +-
 fmt/src/tm_exit.F                                  |  82 ---
 fmt/src/tm_find_grid_slot.F_unused                 |  81 ---
 fmt/src/tm_ftoc_readline.c                         |  95 ++-
 fmt/src/tm_get_strlen.c                            |   3 +-
 fmt/src/tm_its_subspan_modulo.F                    |  21 +
 fmt/src/tm_make_relative_ver.c                     | 104 +--
 fmt/src/tm_match_capital_name.c                    |   6 +-
 fmt/src/tm_number.F                                |   6 +-
 fmt/src/tm_number_sub.c                            |  13 +-
 fmt/src/tm_set_free_event.c                        |  46 +-
 fmt/src/tm_unblockify_ferret_strings.c             |   9 +-
 fmt/src/tm_unix_versions.c                         |  25 +-
 fmt/src/tm_world_recur.c                           |  38 +-
 fmt/src/urlencode.c                                |  36 +-
 gksm2ps/gksm.c                                     |   2 +-
 gksm2ps/xpreview.c                                 |   2 +-
 jnls/contrib/ratio_set.jnl                         |   4 +-
 jnls/contrib/taylor_agraticule.jnl                 |   4 +-
 jnls/contrib/taylor_example1.jnl                   |   4 +-
 jnls/contrib/taylor_frame.jnl                      |   4 +-
 jnls/contrib/taylor_label.jnl                      |   4 +-
 jnls/contrib/taylor_plot.jnl                       |   4 +-
 jnls/contrib/taylor_polymark.jnl                   |   4 +-
 jnls/contrib/taylor_rgraticule.jnl                 |   4 +-
 jnls/contrib/taylor_wtarea.jnl                     |   4 +-
 platform_specific.mk.i386-apple-darwin             | 164 -----
 platform_specific.mk.i386-linux                    | 255 +++----
 platform_specific.mk.intel-mac                     | 183 +++--
 platform_specific.mk.x86_64-darwin                 | 103 ---
 platform_specific.mk.x86_64-linux                  | 174 ++---
 platform_specific.mk.x86_64-linux-gnu              | 131 ----
 ppl/Makefile                                       |   6 -
 ppl/complot/Makefile                               |   6 -
 ppl/complot/SOURCE_FILES                           |   2 +
 ppl/complot/hdcopy.F_unused                        |  76 --
 ppl/complot/plot.F_unused                          |  90 ---
 ppl/complot/scale.F_unused                         | 102 ---
 ppl/complot/size.F_unused                          | 139 ----
 ppl/complot/symbel.F                               | 609 +---------------
 ppl/complot/{symbel.F => symbel_hershey.F}         |  31 +-
 fmt/src/my_close.c => ppl/complot/symwid.F         |  34 +-
 ppl/include/xgks/gks_implem.h                      |  66 --
 ppl/include/xgks/wslist.h                          | 399 ----------
 ppl/ourlib/Makefile                                |   8 +-
 ppl/ourlib/lnonbl5.F_unused                        |  78 --
 ppl/plot/Makefile                                  |   6 -
 ppl/plot/daxis2.F                                  |  50 +-
 ppl/plot/dsflab.F                                  |   7 +-
 ppl/plotlib/Makefile                               |   6 -
 ppl/pplepic/Makefile                               |   6 -
 ppl/pplusr/Makefile                                |   6 -
 ppl/symlib/Makefile                                |   6 -
 ppl/symlib/setsym.F                                |  18 +-
 ppl/{tmapadds => tmap_inc}/pplmem.h                |  89 +--
 ppl/tmapadds/Makefile                              |   6 -
 ppl/tmapadds/gxstrm.c                              | 252 -------
 ppl/tmapadds/its_gksm.c                            |   8 +-
 ppl/tmapadds/pplcmd_c.c                            |  18 +-
 ppl/tmapadds/pplld_pts_envelope.c                  |  15 +-
 ppl/tmapadds/pplldc_envelope.c                     |  28 +-
 ppl/tmapadds/pplldv_envelope.c                     |  22 +-
 ppl/tmapadds/pplldx_envelope.c                     |  21 +-
 ppl/tmapadds/reallo_envelope.c                     |  11 +-
 ppl/tmapadds/reallo_ppl_memory.c                   |  23 +-
 ppl/tmapadds/resize_xgks_window.c                  |  44 +-
 ppl/tmapadds/set_background.c                      |  25 +-
 ppl/tmapadds/wait_on_resize.c                      |  24 +-
 ppl/tmapadds/xgks_x_events.c                       |  19 +-
 site_specific.mk                                   |  53 --
 site_specific.mk.in                                |  84 +++
 xgks/CUSTOMIZE.i386-apple-darwin                   |  39 -
 xgks/CUSTOMIZE.intel-mac                           |   4 +-
 xgks/Makefile.in                                   |   2 +-
 xgks/configure.in                                  |   2 +-
 xgks/doc/Makefile.in                               |   2 +-
 xgks/doc/binding/Makefile.in                       |   2 +-
 xgks/doc/binding/mkcbinding                        |   2 +-
 xgks/doc/userdoc/Makefile.in                       |   2 +-
 xgks/doc/xgks.3src1                                |   2 +-
 xgks/fontdb/Makefile.in                            |   2 +-
 xgks/fontdb/mkfont.c                               |   4 +-
 xgks/include/gif/gif.h                             | 162 ++---
 xgks/include/ps/ps.h                               | 162 ++---
 xgks/port/Makefile.in                              |   2 +-
 xgks/port/atexit.c                                 |   2 +-
 xgks/port/configure.in                             |   2 +-
 xgks/port/fortc.fc                                 |   2 +-
 xgks/port/fortc.h                                  |   2 +-
 xgks/port/fortc/Makefile.in                        |   2 +-
 xgks/port/fortc/configure.in                       |   2 +-
 xgks/port/fortc/fortc.1                            |   4 +-
 xgks/port/fortc/fortc.src                          |   2 +-
 xgks/port/master.mk.in                             |   2 +-
 xgks/port/sigaddset.c                              |   2 +-
 xgks/port/sigdelset.c                              |   2 +-
 xgks/port/sigemptyset.c                            |   2 +-
 xgks/port/signal.h.in                              |   2 +-
 xgks/port/sigprocmask.c                            |   2 +-
 xgks/port/sigsuspend.c                             |   2 +-
 xgks/port/stdarg.h.in                              |   2 +-
 xgks/port/stddef.h.in                              |   2 +-
 xgks/port/stdlib.h.in                              |   2 +-
 xgks/port/strerror.c                               |   2 +-
 xgks/port/string.h.in                              |   2 +-
 xgks/port/strstr.c                                 |   2 +-
 xgks/port/udalloc.h                                |   2 +-
 xgks/port/udposix.h.in                             |   2 +-
 xgks/progs/Makefile.in                             |   2 +-
 xgks/progs/demo.h                                  |   2 +-
 xgks/progs/font.c                                  |   2 +-
 xgks/progs/gksdemo.f                               |   2 +-
 xgks/progs/hanoi.c                                 |   2 +-
 xgks/progs/mi.c                                    |   2 +-
 xgks/progs/pline.c                                 |   2 +-
 xgks/progs/pmark.c                                 |   2 +-
 xgks/src/Makefile.in                               |   2 +-
 xgks/src/fortran/Makefile.in                       |   2 +-
 xgks/src/fortran/control.fc                        |   2 +-
 xgks/src/fortran/error.fc                          |   2 +-
 xgks/src/fortran/escapes.fc                        |   2 +-
 xgks/src/fortran/finqpixel.fc                      |   2 +-
 xgks/src/fortran/fortmac.h                         |   2 +-
 xgks/src/fortran/fortxgks.h                        |   2 +-
 xgks/src/fortran/fxgksvers.c                       |   2 +-
 xgks/src/fortran/gerhnd.fc                         |   2 +-
 xgks/src/fortran/getlunname.fc                     |   2 +-
 xgks/src/fortran/inputevent.fc                     |   4 +-
 xgks/src/fortran/inputinit.fc                      |   4 +-
 xgks/src/fortran/inputmode.fc                      |   4 +-
 xgks/src/fortran/inputreq.fc                       |   4 +-
 xgks/src/fortran/inputsamp.fc                      |   4 +-
 xgks/src/fortran/inqerrlist.fc                     |   2 +-
 xgks/src/fortran/inqgksdesc.fc                     |   2 +-
 xgks/src/fortran/inqgkslist.fc                     |   2 +-
 xgks/src/fortran/inqlun.f                          |   2 +-
 xgks/src/fortran/inqseglist.fc                     |   2 +-
 xgks/src/fortran/inqstate.fc                       |   2 +-
 xgks/src/fortran/inqwsdesc.fc                      |   2 +-
 xgks/src/fortran/inqwslist.fc                      |   2 +-
 xgks/src/fortran/meta.fc                           |   2 +-
 xgks/src/fortran/output.fc                         |   2 +-
 xgks/src/fortran/pdrutils.h                        |   2 +-
 xgks/src/fortran/ps2aixdefs.h                      |   2 +-
 xgks/src/fortran/rep.fc                            |   2 +-
 xgks/src/fortran/segattr.fc                        |   2 +-
 xgks/src/fortran/segment.fc                        |   2 +-
 xgks/src/fortran/transform.fc                      |   2 +-
 xgks/src/fortran/utils.fc                          |   2 +-
 xgks/src/fortran/wsioutattr.fc                     |   2 +-
 xgks/src/lib/Makefile.in                           |   2 +-
 xgks/src/lib/act_ws.c                              |   2 +-
 xgks/src/lib/aspect_flags.c                        |   2 +-
 xgks/src/lib/cellarray.c                           |   2 +-
 xgks/src/lib/cgm/Makefile.in                       |   2 +-
 xgks/src/lib/cgm/cgm.h                             | 166 ++---
 xgks/src/lib/cgm/cgm_implem.h                      |   2 +-
 xgks/src/lib/cgm/cgmi.c                            |   2 +-
 xgks/src/lib/cgm/cgmo.c                            |   5 +-
 xgks/src/lib/choice.c                              |   2 +-
 xgks/src/lib/colours.c                             |   2 +-
 xgks/src/lib/colours.c.linux                       |   2 +-
 xgks/src/lib/deferral_ws.c                         |   2 +-
 xgks/src/lib/escape.c                              |   2 +-
 xgks/src/lib/event.c                               |   2 +-
 xgks/src/lib/event.h                               |   2 +-
 xgks/src/lib/fillarea.c                            |   2 +-
 xgks/src/lib/fillarea.h                            |   2 +-
 xgks/src/lib/font.h                                |   2 +-
 xgks/src/lib/gif.c                                 |   4 +-
 xgks/src/lib/gif.c.orig                            |   4 +-
 xgks/src/lib/gif.c.test                            |   4 +-
 xgks/src/lib/gif/gif.h                             | 162 ++---
 xgks/src/lib/gks_defines.h                         |   8 +-
 xgks/src/lib/gks_error.c                           |   2 +-
 xgks/src/lib/gks_errors.h                          |   2 +-
 xgks/src/lib/gks_implem.h                          |   2 +-
 xgks/src/lib/gkslist.h                             |   2 +-
 xgks/src/lib/gksm/Makefile.in                      |   2 +-
 xgks/src/lib/gksm/gksm.c                           |   2 +-
 xgks/src/lib/gksm/gksm.h                           | 162 ++---
 xgks/src/lib/gksm/gksm_implem.h                    |   2 +-
 xgks/src/lib/input.c                               |   2 +-
 xgks/src/lib/input.h                               |   2 +-
 xgks/src/lib/inqWDT.c                              |   2 +-
 xgks/src/lib/inqfillareas.c                        |   2 +-
 xgks/src/lib/inqpixel.c                            |   2 +-
 xgks/src/lib/inqpmarker.c                          |   2 +-
 xgks/src/lib/inqpolylines.c                        |   2 +-
 xgks/src/lib/inqtext.c                             |   2 +-
 xgks/src/lib/inqtransform.c                        |   2 +-
 xgks/src/lib/inquiries.c                           |   2 +-
 xgks/src/lib/locator.c                             |   2 +-
 xgks/src/lib/message.c                             |   2 +-
 xgks/src/lib/metafile.c                            |   2 +-
 xgks/src/lib/metafile.h                            | 140 ++--
 xgks/src/lib/mkerrmsg.c                            |   2 +-
 xgks/src/lib/open_gks.c                            |   2 +-
 xgks/src/lib/open_ws.c                             |   2 +-
 xgks/src/lib/pick.c                                |   2 +-
 xgks/src/lib/polylines.c                           |   2 +-
 xgks/src/lib/polylines.h                           |   2 +-
 xgks/src/lib/polymarkers.c                         |   2 +-
 xgks/src/lib/polymarkers.h                         |   2 +-
 xgks/src/lib/primitive.h                           |   2 +-
 xgks/src/lib/prmgr.c                               |   2 +-
 xgks/src/lib/ps.c                                  |   2 +-
 xgks/src/lib/ps/ps.h                               | 162 ++---
 xgks/src/lib/segments.c                            |   2 +-
 xgks/src/lib/string.c                              |   2 +-
 xgks/src/lib/stroke.c                              |   2 +-
 xgks/src/lib/text.c                                |   2 +-
 xgks/src/lib/text.h                                |   2 +-
 xgks/src/lib/transforms.c                          |   2 +-
 xgks/src/lib/update.c                              |   2 +-
 xgks/src/lib/valuator.c                            |   2 +-
 xgks/src/lib/wdt.h                                 |   2 +-
 xgks/src/lib/wslist.h                              |  36 +-
 xgks/src/lib/x/Makefile.in                         |   2 +-
 xgks/src/lib/x/xSet.c                              |   2 +-
 xgks/src/lib/x/xcellarray.c                        |   2 +-
 xgks/src/lib/x/xcolours.c                          |   2 +-
 xgks/src/lib/x/xevent.c                            |   2 +-
 xgks/src/lib/x/xfillarea.c                         |   2 +-
 xgks/src/lib/x/xinqpixel.c                         |   2 +-
 xgks/src/lib/x/xopws.c                             |   2 +-
 xgks/src/lib/x/xpline.c                            |   2 +-
 xgks/src/lib/x/xpmarker.c                          |   2 +-
 xgks/src/lib/x/xport.c                             |   2 +-
 xgks/src/lib/x/xtext.c                             |   2 +-
 xgks/src/lib/x/xupdate.c                           |   2 +-
 xgks/src/lib/xgks.h                                |  18 +-
 495 files changed, 5168 insertions(+), 9421 deletions(-)

diff --git a/Makefile b/Makefile
index d7df8ae..acf6bd4 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,21 @@ debug :
 	$(MAKE) -C gksm2ps
 	$(MAKE) -C bin/build_fonts/unix
 
+# Debug but also print all memory allocations, reallocations, and frees to 
+# file "memorydebug.txt".  Initialize allocated memory with non-zero values. 
+# Expect this to be a lot slower due to all the (intentionally inefficient 
+# but safe) file operations.
+.PHONY : memorydebug
+memorydebug :
+	mkdir -p lib
+	$(MAKE) xgks/Makefile
+	$(MAKE) -C xgks
+	$(MAKE) -C fer memorydebug
+	$(MAKE) -C threddsBrowser
+	$(MAKE) -C external_functions debug
+	$(MAKE) -C gksm2ps
+	$(MAKE) -C bin/build_fonts/unix
+
 
 ## Configure xgks to create the Makefile if it does not exist
 xgks/Makefile :
diff --git a/README.md b/README.md
index 6089197..1f23941 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,14 @@
 # Ferret
-The Ferret program from NOAA/PMEL.
-This repository is regularly synchronized with Ferret repository at PMEL
-(the trunk of the ferret project in the TMAP SVN repository at PMEL)
+The Ferret program from NOAA/PMEL. 
+This repository is regularly synchronized with Ferret repository at PMEL 
+(the trunk of the ferret project in the subversion repository at PMEL) 
 using git-svn.
 
+**If you build Ferret from these source files, please note:**  
+The `site_specific.mk` and `external_functions/ef_utilites/site_specific.mk` 
+files in the repository have been renamed with a `.in` appended to the name. 
+You must copy these files with the `.in` extensions to create files with the 
+`site_specific.mk` name and edit the contents to configure these for your 
+system.  The `site_specific.mk` files will be ignored by git (the name was 
+added to `.gitignore`) so your customized configuration files will not be 
+added to your repository if you have cloned this repository. 
diff --git a/bench/Makefile b/bench/Makefile
index e5632df..fc68241 100644
--- a/bench/Makefile
+++ b/bench/Makefile
@@ -13,7 +13,7 @@ run_tests:
 	    echo "*** Ferret must be installed and the ferret_paths script must have sourced for these tests ***" ; \
 	    exit 1 ; \
 	fi
-	./RUN_TESTS.sh `which ferret` "$(FER_EXTERNAL_FUNCTIONS)"
+	( SED_EXTREGEX_FLAG="$(SED_EXTREGEX_FLAG)"; export SED_EXTREGEX_FLAG; ./RUN_TESTS.sh `which ferret` "$(FER_EXTERNAL_FUNCTIONS)" )
 	@echo 'Differences in the generated bench GIF files versus those in bench/test_results'
 	- at for img in *.gif ; \
 	do \
diff --git a/bench/RUN_TESTS.sh b/bench/RUN_TESTS.sh
index 2f2c70b..d29e61c 100755
--- a/bench/RUN_TESTS.sh
+++ b/bench/RUN_TESTS.sh
@@ -1,4 +1,4 @@
-#! /bin/sh -f
+#! /bin/sh
 # run individually each of the benchmark tests listed in TEST_SCRIPTS
 
 if [ $# -ne 2 ]; then
@@ -18,6 +18,15 @@ efdir="$2"
 PS1='$ '
 export PS1
 
+cleanuponerror() {
+   rm -f $HOME/.ferret
+   if [ -f keep.ferret ]; then
+      echo "****** Returning keep.ferret to $HOME/.ferret ******"
+      mv keep.ferret $HOME/.ferret
+   fi
+   exit 129 
+}
+
 # allow tests to be commented out by beginning with the line with a '!'
 # remove bn_all_ef.jnl from the list if $efdir is "."
 if [ "$efdir" = "." ]; then
@@ -84,7 +93,11 @@ echo "Testing ncdump output in $ncdump_file"
 if ! echo "$fver" | grep -q "pyferret"; then
    ispyferret=0
 #  command-line options for ferret
-   feropts="-nojnl -gif -noverify"
+   feropts="-nojnl -gif -noverify -server"
+#  -server sets line buffering for C I/O
+#  GFORTRAN_UNBUFFERED_PRECONNECTED=1 removes buffering of Fortran I/O
+   GFORTRAN_UNBUFFERED_PRECONNECTED=1
+   export GFORTRAN_UNBUFFERED_PRECONNECTED
 #  external functions search path
    FER_EXTERNAL_FUNCTIONS="$efdir"
    export FER_EXTERNAL_FUNCTIONS
@@ -92,6 +105,10 @@ else
    ispyferret=1
 #  command-line options for pyferret
    feropts="-nojnl -quiet -nodisplay -noverify -linebuffer"
+#  -linebuffer sets line buffering for C and Python I/O
+#  GFORTRAN_UNBUFFERED_PRECONNECTED=1 removes buffering of Fortran I/O
+   GFORTRAN_UNBUFFERED_PRECONNECTED=1
+   export GFORTRAN_UNBUFFERED_PRECONNECTED
 #  external functions search path
    PYFER_EXTERNAL_FUNCTIONS="$efdir"
    export PYFER_EXTERNAL_FUNCTIONS
@@ -119,6 +136,7 @@ if [ -f $HOME/.ferret ]; then
    mv -f $HOME/.ferret ./keep.ferret
 fi
 cp ./default.ferret $HOME/.ferret
+trap "cleanuponerror" SIGHUP SIGINT SIGQUIT SIGILL SIGABRT SIGBUS SIGFPE SIGKILL SIGSEGV SIGTERM
 
 echo "Benchmark scripts that will be run:" >> $log_file
 for script in $jnl_scripts; do
@@ -151,10 +169,17 @@ for script in $jnl_scripts; do
       $fver $feropts -script $script 1>> $log_file 2>> $err_file
    fi
    if [ $? -ne 0 ]; then
-      echo "****** FERRET error: $script failed ******" >> $log_file
-      echo "****** FERRET error: $script failed ******" >> $err_file
-      echo "****** FERRET error: $script failed ******" >> all_ncdump.out
-      echo "****** FERRET error: $script failed ******"
+      if [ "$ispyferret" -eq 0 ]; then
+         echo "****** FERRET error: $script failed ******" >> $log_file
+         echo "****** FERRET error: $script failed ******" >> $err_file
+         echo "****** FERRET error: $script failed ******" >> all_ncdump.out
+         echo "****** FERRET error: $script failed ******"
+      else
+         echo "****** PYFERRET error: $script failed ******" >> $log_file
+         echo "****** PYFERRET error: $script failed ******" >> $err_file
+         echo "****** PYFERRET error: $script failed ******" >> all_ncdump.out
+         echo "****** PYFERRET error: $script failed ******"
+      fi
    fi
 
    if [ $script = "bn_startupfile.jnl" ]; then
@@ -188,6 +213,7 @@ if [ "$ispyferret" -ne 0 ]; then
    done
 fi
 
+trap - SIGHUP SIGINT SIGQUIT SIGILL SIGABRT SIGBUS SIGFPE SIGKILL SIGSEGV SIGTERM
 # Replace $HOME/.ferret if it was removed
 rm -f $HOME/.ferret
 if [ -f keep.ferret ]; then
@@ -230,8 +256,8 @@ echo "s/$timeregex/WKD MON DD HH:MM:SS YYYY/g" >> $cleanups
 
 echo 's/^randu2_randn2 [0-9 .-]+$/randu2_randn2      ....../' >> $cleanups
 echo 's/the_time = [0-9][0-9]:[0-9][0-9]/the_time = HH:MM/g' >> $cleanups
-echo 's/\(AX[0-9][0-9][0-9]\)/(AX###)/g' >> $cleanups
-echo 's/\(G[0-9][0-9][0-9]\)/(G###)/g' >> $cleanups
+echo 's/\(AX[0-9][0-9][0-9]\)/\(AX###\)/g' >> $cleanups
+echo 's/\(G[0-9][0-9][0-9]\)/\(G###\)/g' >> $cleanups
 echo 's/CURRENT_TIME = "[0-9][0-9]:[0-9][0-9]:[0-9][0-9]"/CURRENT_TIME = "HH:MM:SS"/g' >> $cleanups
 echo 's/SESSION_TIME = "[0-9][0-9]:[0-9][0-9]"/SESSION_TIME = "HH:MM"/g' >> $cleanups
 echo 's/SESSION_PID = "[0-9]+"/SESSION_PID = "#####"/g' >> $cleanups
@@ -244,12 +270,11 @@ echo 's/5K LOAD with transform takes  [0-8]\.[0-9]+  seconds/5K LOAD with transf
 echo 's/DEFINE VARIABLE ten_plots = 0\.[0-9]+/DEFINE VARIABLE ten_plots = 0.######/' >> $cleanups
 echo 's/DEFINE VARIABLE dt = 0\.[0-9]+/DEFINE VARIABLE dt = 0.######/' >> $cleanups
 echo 's/DEFINE VARIABLE sumcpu =[ ]?0\.[0-9]+/DEFINE VARIABLE sumcpu = 0.######/' >> $cleanups
-echo '/say `sumcpu`/,+1 s/^ !-> MESSAGE\/CONTINUE 0\.[0-9]+$/ !-> MESSAGE\/CONTINUE 0.######/' >> $cleanups
-echo '/say `sumcpu`/,+2 s/^0\.[0-9]+$/0.######/' >> $cleanups
+echo '/say `sumcpu`/,/sh sym CLOCK_SECS/ s/0\.[0-9]+/0.######/' >> $cleanups
 
-sed -r -i_orig -f $cleanups $log_file
-sed -r -i_orig -f $cleanups $err_file
-sed -r -i_orig -f $cleanups $ncdump_file
+sed $SED_EXTREGEX_FLAG -i_orig -f $cleanups $log_file
+sed $SED_EXTREGEX_FLAG -i_orig -f $cleanups $err_file
+sed $SED_EXTREGEX_FLAG -i_orig -f $cleanups $ncdump_file
 
 rm -f $cleanups
 
diff --git a/bench/TEST_SCRIPTS b/bench/TEST_SCRIPTS
index d65a417..54a280f 100644
--- a/bench/TEST_SCRIPTS
+++ b/bench/TEST_SCRIPTS
@@ -277,6 +277,7 @@ bn_dot_product.jnl
 bn_cache_management.jnl
 bn_transp_choose.jnl
 bn_iin_regrid.jnl
+bn721_bug_fixes.jnl
 !
 ! bn_gif, bn_all_ef, and bn_startupfile at end
 !
diff --git a/bench/ansley_official.rhel6-64_err b/bench/ansley_official.rhel6-64_err
index acf11e1..70bf695 100644
--- a/bench/ansley_official.rhel6-64_err
+++ b/bench/ansley_official.rhel6-64_err
@@ -1,10 +1,10 @@
 Procedure run_all to run all FERRET benchmarks
-Running FERRET version /home/users/ansley/build/working/FERRET/fer/ferret_c
--rwxr-xr-x. 1 ansley tmap 117386464 Jul 12 09:46 /home/users/ansley/build/working/FERRET/fer/ferret_c
-Using external functions from /home/users/ansley/build/working/FERRET/external_functions/ext_func
+Running FERRET version /home/users/ansley/build/trunk/FERRET/fer/ferret_c
+-rwxr-xr-x. 1 ansley tmap 88045520 Sep  6 12:47 /home/users/ansley/build/trunk/FERRET/fer/ferret_c
+Using external functions from /home/users/ansley/build/trunk/FERRET/external_functions/ext_func
 Running the tests of external functions y
 Benchmark run by ansley
-Note: v7.2
+Note: fix for ticket 2560: @SUM in X
 ncdump output will be in all_ncdump.out, and appended to this log file 
 ***** Restricting Ferret paths to bench directory *****
 FER_DAT=.
@@ -13,16 +13,16 @@ FER_DATA_THREDDS= http://ferret.pmel.noaa.gov/geoide/geoIDECleanCatalog.xml /hom
 FER_DESCR=.
 FER_DIR=.
 FER_DSETS=.
-FER_EXTERNAL_FUNCTIONS=/home/users/ansley/build/working/FERRET/external_functions/ext_func
+FER_EXTERNAL_FUNCTIONS=/home/users/ansley/build/trunk/FERRET/external_functions/ext_func
 FER_FONTS=/home/users/tmap/ferret/rhel6-x86_64-linux/ppl/fonts
 FER_GO=. /home/users/tmap/ferret/rhel6-x86_64-linux/go /home/users/tmap/ferret/rhel6-x86_64-linux/examples /home/users/tmap/ferret/rhel6-x86_64-linux/contrib
 FER_GRIDS=.
 FER_LIBS=/home/users/tmap/ferret/rhel6-x86_64-linux/lib
 FER_PALETTE=. /home/users/tmap/ferret/rhel6-x86_64-linux/ppl
 FER_WEB_BROWSER=firefox
-PWD=/home/users/ansley/build/working/FERRET/bench
+PWD=/home/users/ansley/build/trunk/FERRET/bench
 PYFER_EXTERNAL_FUNCTIONS=/home/users/tmap/ferret/rhel6-x86_64-linux/ext_func/pylibs
-Beginning at Wed Jul 12 09:51:20 PDT 2017
+Beginning at Wed Sep 6 12:57:37 PDT 2017
  PERMANENT data cleared from memory
  TEMPORARY data cleared from memory
 ooooooooooooooooooooooooooooooooooooooooooo
@@ -3667,7 +3667,6 @@ Starting test: bn_set_cancel_redirect
      e.g.   yes? GO filename
  
  Use "GO/HELP filename" to read documentation in  the file to be executed.
-           *** NOTE: No active redirects to cancel
  Use the GO command to name a file of FERRET commands to be executed.
      e.g.   yes? GO filename
  
@@ -5327,9 +5326,9 @@ go/garbage tmp/testMe
  **ERROR: unknown command qualifier: garbage
 go/garbage "tmp/testMe"
  **ERROR: unknown command qualifier: garbage
-go/garbage /home/users/ansley/build/working/FERRET/bench/tmp/testMe.jnl
+go/garbage /home/users/ansley/build/trunk/FERRET/bench/tmp/testMe.jnl
  **ERROR: unknown command qualifier: garbage
-go/garbage "/home/users/ansley/build/working/FERRET/bench/tmp/testMe.jnl"
+go/garbage "/home/users/ansley/build/trunk/FERRET/bench/tmp/testMe.jnl"
  PERMANENT data cleared from memory
  TEMPORARY data cleared from memory
 ooooooooooooooooooooooooooooooooooooooooooo
@@ -5993,7 +5992,6 @@ stat/brief v[i=101:200,j=101:200,k=1,l=1:10 at ave], v[i=101:200,j=101:200,k=2,l=1:
 stat/brief a[l=1:10 at ave], b[l=1:10 at ave], c[l=1:10 at ave], d[l=1:10 at ave]
  PERMANENT data cleared from memory
  TEMPORARY data cleared from memory
-           *** NOTE: No active redirects to cancel
  **ERROR: request exceeds memory setting: Requested result is larger than the available memory
 stat/brief v[i=101:200,j=101:200,k=1,l=1:10 at ave], v[i=101:200,j=101:200,k=2,l=1:10 at ave], v[l=1:10 at ave]
  PERMANENT data cleared from memory
@@ -6201,6 +6199,15 @@ ooooooooooooooooooooooooooooooooooooooooooo
  PERMANENT data cleared from memory
  TEMPORARY data cleared from memory
 ooooooooooooooooooooooooooooooooooooooooooo
+ PERMANENT data cleared from memory
+ TEMPORARY data cleared from memory
+ooooooooooooooooooooooooooooooooooooooooooo
+ PERMANENT data cleared from memory
+ TEMPORARY data cleared from memory
+ooooooooooooooooooooooooooooooooooooooooooo
+ PERMANENT data cleared from memory
+ TEMPORARY data cleared from memory
+ooooooooooooooooooooooooooooooooooooooooooo
  **ERROR: command syntax: unknown region name: @w
 set region/@w
  PERMANENT data cleared from memory
@@ -6319,4 +6326,4 @@ vector/i=1:10/j=1:20/nolabel i/j,j/i,i+j
 Re-defining viewport LM6
 Re-defining viewport UM6
            *** NOTE: Cannot create new windows when batch mode set
-Ended at Wed Jul 12 09:57:45 PDT 2017
+Ended at Wed Sep 6 13:02:20 PDT 2017
diff --git a/bench/ansley_official.rhel6-64_log b/bench/ansley_official.rhel6-64_log
index 06a15bb..1de5b5b 100644
--- a/bench/ansley_official.rhel6-64_log
+++ b/bench/ansley_official.rhel6-64_log
@@ -1,10 +1,10 @@
 Procedure run_all to run all FERRET benchmarks
-Running FERRET version /home/users/ansley/build/working/FERRET/fer/ferret_c
--rwxr-xr-x. 1 ansley tmap 117386464 Jul 12 09:46 /home/users/ansley/build/working/FERRET/fer/ferret_c
-Using external functions from /home/users/ansley/build/working/FERRET/external_functions/ext_func
+Running FERRET version /home/users/ansley/build/trunk/FERRET/fer/ferret_c
+-rwxr-xr-x. 1 ansley tmap 88045520 Sep  6 12:47 /home/users/ansley/build/trunk/FERRET/fer/ferret_c
+Using external functions from /home/users/ansley/build/trunk/FERRET/external_functions/ext_func
 Running the tests of external functions y
 Benchmark run by ansley
-Note: v7.2
+Note: fix for ticket 2560: @SUM in X
 ncdump output will be in all_ncdump.out, and appended to this log file 
 ***** Restricting Ferret paths to bench directory *****
 FER_DAT=.
@@ -13,16 +13,16 @@ FER_DATA_THREDDS= http://ferret.pmel.noaa.gov/geoide/geoIDECleanCatalog.xml /hom
 FER_DESCR=.
 FER_DIR=.
 FER_DSETS=.
-FER_EXTERNAL_FUNCTIONS=/home/users/ansley/build/working/FERRET/external_functions/ext_func
+FER_EXTERNAL_FUNCTIONS=/home/users/ansley/build/trunk/FERRET/external_functions/ext_func
 FER_FONTS=/home/users/tmap/ferret/rhel6-x86_64-linux/ppl/fonts
 FER_GO=. /home/users/tmap/ferret/rhel6-x86_64-linux/go /home/users/tmap/ferret/rhel6-x86_64-linux/examples /home/users/tmap/ferret/rhel6-x86_64-linux/contrib
 FER_GRIDS=.
 FER_LIBS=/home/users/tmap/ferret/rhel6-x86_64-linux/lib
 FER_PALETTE=. /home/users/tmap/ferret/rhel6-x86_64-linux/ppl
 FER_WEB_BROWSER=firefox
-PWD=/home/users/ansley/build/working/FERRET/bench
+PWD=/home/users/ansley/build/trunk/FERRET/bench
 PYFER_EXTERNAL_FUNCTIONS=/home/users/tmap/ferret/rhel6-x86_64-linux/ext_func/pylibs
-Beginning at Wed Jul 12 09:51:20 PDT 2017
+Beginning at Wed Sep 6 12:57:37 PDT 2017
 ! BN500_ALL.JNL
 ! - run all the benchmark tests
 ! - ordered (more or less) from least to most complex
@@ -10459,18 +10459,18 @@ show symbols/all
 PPL$XPIXEL = "406"
 PPL$YPIXEL = "406"
 BYTEORDER = "LITTLE"
-FERRET_VERSION = "7.2"
-FERRET_PLATFORM = "Linux 2.6.32-696.3.2.el6.x86_64 64-bit"
+FERRET_VERSION = "7.21"
+FERRET_PLATFORM = "Linux 2.6.32-696.6.3.el6.x86_64 64-bit"
 FERRET_PRECISION = "double"
 NETCDF_VERSION = "4.4.1.1 of Jun 26 2017 08:42:09 $"
 FERRET_MEMORY = "25.6"
-SESSION_DATE = "12-Jul-17"
-SESSION_TIME = "09:51"
-SESSION_PID = "4428"
-DELTA_CPU = "11.9522"
-CLOCK_SECS = "13.908"
-CURRENT_DATE = "12-Jul-17"
-CURRENT_TIME = "09:51:33"
+SESSION_DATE = " 6-Sep-17"
+SESSION_TIME = "12:57"
+SESSION_PID = "38582"
+DELTA_CPU = "10.3804"
+CLOCK_SECS = "12.144"
+CURRENT_DATE = " 6-Sep-17"
+CURRENT_TIME = "12:57:49"
 N_OPEN_DSETS = "0"
 PROGRAM_NAME = "Ferret"
 PEAK_MEMORY = "0"
@@ -10491,18 +10491,18 @@ show symbol/all
 PPL$XPIXEL = "406"
 PPL$YPIXEL = "406"
 BYTEORDER = "LITTLE"
-FERRET_VERSION = "7.2"
-FERRET_PLATFORM = "Linux 2.6.32-696.3.2.el6.x86_64 64-bit"
+FERRET_VERSION = "7.21"
+FERRET_PLATFORM = "Linux 2.6.32-696.6.3.el6.x86_64 64-bit"
 FERRET_PRECISION = "double"
 NETCDF_VERSION = "4.4.1.1 of Jun 26 2017 08:42:09 $"
 FERRET_MEMORY = "25.6"
-SESSION_DATE = "12-Jul-17"
-SESSION_TIME = "09:51"
-SESSION_PID = "4428"
-DELTA_CPU = "0.018997"
-CLOCK_SECS = "13.927"
-CURRENT_DATE = "12-Jul-17"
-CURRENT_TIME = "09:51:33"
+SESSION_DATE = " 6-Sep-17"
+SESSION_TIME = "12:57"
+SESSION_PID = "38582"
+DELTA_CPU = "0.018998"
+CLOCK_SECS = "12.164"
+CURRENT_DATE = " 6-Sep-17"
+CURRENT_TIME = "12:57:49"
 N_OPEN_DSETS = "0"
 PROGRAM_NAME = "Ferret"
 PEAK_MEMORY = "0"
@@ -10515,9 +10515,9 @@ NUM = "3"
 T$DOLLAR = "hi"
 T_HELLO = "hi"
 show symbol s*
-SESSION_DATE = "12-Jul-17"
-SESSION_TIME = "09:51"
-SESSION_PID = "4428"
+SESSION_DATE = " 6-Sep-17"
+SESSION_TIME = "12:57"
+SESSION_PID = "38582"
 SPAWN_OK = "1"
 SPAWN_STATUS = "0"
 S1 = "hello"
@@ -10529,17 +10529,17 @@ S2 = ""hello""
 ! exercise CANCEL SYMBOL
 cancel symbol s2
 show symbol s*
-SESSION_DATE = "12-Jul-17"
-SESSION_TIME = "09:51"
-SESSION_PID = "4428"
+SESSION_DATE = " 6-Sep-17"
+SESSION_TIME = "12:57"
+SESSION_PID = "38582"
 SPAWN_OK = "1"
 SPAWN_STATUS = "0"
 S1 = "hello"
 S3 = "hello and goodbye"
 show symbol S*
-SESSION_DATE = "12-Jul-17"
-SESSION_TIME = "09:51"
-SESSION_PID = "4428"
+SESSION_DATE = " 6-Sep-17"
+SESSION_TIME = "12:57"
+SESSION_PID = "38582"
 SPAWN_OK = "1"
 SPAWN_STATUS = "0"
 S1 = "hello"
@@ -10575,9 +10575,9 @@ Q23456789012345678901234567XXXAAAAA = "6"
 ! show the upper left coordinate limits labels as symbols
 plot/i=1:100/y=10/z=5/set_up SIN(I/6)+Y+Z
 show symbol lab*
-LAB1 = "FERRET (beta/debug) Ver.7.2"
+LAB1 = "FERRET (beta/debug) Ver.7.21"
 LAB2 = "NOAA/PMEL TMAP"
-LAB3 = "12-JUL-2017 09:51:33"
+LAB3 = "06-SEP-2017 12:57:49"
 LABX = "X"
 LAB4 = "Y : 10"
 LABNUM_Y = "4"
@@ -10672,18 +10672,18 @@ show symbols/all
 PPL$XPIXEL = "406"
 PPL$YPIXEL = "406"
 BYTEORDER = "LITTLE"
-FERRET_VERSION = "7.2"
-FERRET_PLATFORM = "Linux 2.6.32-696.3.2.el6.x86_64 64-bit"
+FERRET_VERSION = "7.21"
+FERRET_PLATFORM = "Linux 2.6.32-696.6.3.el6.x86_64 64-bit"
 FERRET_PRECISION = "double"
 NETCDF_VERSION = "4.4.1.1 of Jun 26 2017 08:42:09 $"
 FERRET_MEMORY = "25.6"
-SESSION_DATE = "12-Jul-17"
-SESSION_TIME = "09:51"
-SESSION_PID = "4428"
-DELTA_CPU = "0.040993"
-CLOCK_SECS = "13.968"
-CURRENT_DATE = "12-Jul-17"
-CURRENT_TIME = "09:51:34"
+SESSION_DATE = " 6-Sep-17"
+SESSION_TIME = "12:57"
+SESSION_PID = "38582"
+DELTA_CPU = "0.034994"
+CLOCK_SECS = "12.199"
+CURRENT_DATE = " 6-Sep-17"
+CURRENT_TIME = "12:57:49"
 N_OPEN_DSETS = "0"
 PROGRAM_NAME = "Ferret"
 PEAK_MEMORY = "201"
@@ -25353,7 +25353,7 @@ GO err491_spawn_quotes.jnl
  
 ! this should be a valid command
 SPAWN "date"
-Wed Jul 12 09:51:47 PDT 2017
+Wed Sep  6 12:58:02 PDT 2017
  
 GO bn_reset
 cancel mode verify
@@ -48106,11 +48106,11 @@ ppl list labels
  @ASDeg C                                                                       
 
           XPOS       YPOS     HGT   ROT   UNITS
- LAB 1  8.000E+00  7.200E+00 0.060    0  SYSTEM  @ASFERRET (beta/debug) Ver.7.2
+ LAB 1  8.000E+00  7.200E+00 0.060    0  SYSTEM  @ASFERRET (beta/debug) Ver.7.21
  LINE PT:    0.000E+00 0.000E+00  NO LINE     CENTER JUSTIFY LABEL
  LAB 2  8.000E+00  7.100E+00 0.060    0  SYSTEM  @ASNOAA/PMEL TMAP
  LINE PT:    0.000E+00 0.000E+00  NO LINE     CENTER JUSTIFY LABEL
- LAB 3  8.000E+00  7.000E+00 0.060    0  SYSTEM  @AS12-JUL-2017 09:52:45
+ LAB 3  8.000E+00  7.000E+00 0.060    0  SYSTEM  @AS06-SEP-2017 12:58:50
  LINE PT:    0.000E+00 0.000E+00  NO LINE     CENTER JUSTIFY LABEL
  LAB 4  0.000E+00  6.800E+00 0.120    0  SYSTEM  @ASLONGITUDE : 179E
  LINE PT:    0.000E+00 0.000E+00  NO LINE     LEFT   JUSTIFY LABEL
@@ -49425,7 +49425,7 @@ GO bn_long_revision_num.jnl
  
 ! ferret version
 sh sym FERRET_VERSION
-FERRET_VERSION = "7.2"
+FERRET_VERSION = "7.21"
  
 ! history attribute
 let a = 12
@@ -49443,7 +49443,7 @@ LAB1 = "X : 0.5 to 314.5"
  
 ! show commands without an argument, lists version number at the top
 sho command
- Commands in Program FERRET (beta/debug) version7.2:
+ Commands in Program FERRET (beta/debug) version7.21:
  SET
  SET WINDOW/SIZE/NEW/LOCATION/ASPECT/CLEAR/TITLE
  SET REGION/I/J/K/L/M/N/X/Y/Z/T/E/F/DX/DY/DZ/DT/DE/DF/DI/DJ/DK/DL/DM/DN
@@ -49583,7 +49583,7 @@ go ptest
 PLOT/VS/LINE/I=1:314 i*cos(i/20),i*sin(i/20)
  
 sh sym win_title
-WIN_TITLE = "12-Jul-17:09:51"
+WIN_TITLE = "6-Sep-17:12:57"
  
 set win/title="set the title"
 sho sym win_title
@@ -49601,7 +49601,7 @@ sho sym win_title
 WIN_TITLE = "_"
  
 set win/title="($session_date):($session_time)"
- !-> set win/title="12-Jul-17:09:51"
+ !-> set win/title=" 6-Sep-17:12:57"
  
 ! If the date or time starts with a blank then we get an extra
 ! underscore in the window title. Evaluating the symbols into
@@ -49610,16 +49610,16 @@ set win/title="($session_date):($session_time)"
 ! If so substitute another string.
  
 DEFINE SYMBOL the_date = ($session_date"SESSION_DATE")
- !-> DEFINE SYMBOL the_date = 12-Jul-17
+ !-> DEFINE SYMBOL the_date =  6-Sep-17
 DEFINE SYMBOL the_time = ($session_time"SESSION_TIME")
- !-> DEFINE SYMBOL the_time = 09:51
+ !-> DEFINE SYMBOL the_time = 12:57
 SET WIN/TITLE="($the_date):($the_time)"
- !-> SET WIN/TITLE="12-Jul-17:09:51"
+ !-> SET WIN/TITLE="6-Sep-17:12:57"
  
 can win/all
 set win/new
 sh sym win_title
-WIN_TITLE = "12-Jul-17:09:51"
+WIN_TITLE = "6-Sep-17:12:57"
  
 GO bn_reset bn_last_error.jnl
 cancel mode verify
@@ -54120,7 +54120,7 @@ sho dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (PSXT91_108)           DOUBLE    units           CHAR        12   T       degrees_east
@@ -54169,7 +54169,7 @@ sho dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (PSXT91_108)           DOUBLE    units           CHAR        12   T       degrees_east
@@ -60195,10 +60195,10 @@ ooooooooooooooooooooooooooooooooooooooooooo
 Starting test: bn_clock_syms
 GO bn_clock_syms
 SH SYM delta_cpu, clock_secs, current_date, current_time
-DELTA_CPU = "95.9394"
-CLOCK_SECS = "129.132"
-CURRENT_DATE = "12-Jul-17"
-CURRENT_TIME = "09:53:29"
+DELTA_CPU = "83.3653"
+CLOCK_SECS = "114.647"
+CURRENT_DATE = " 6-Sep-17"
+CURRENT_TIME = "12:59:32"
 ! test special symbols DELTA_CPU, CLOCK_SECS
 !
 ! NOTE THAT THE VALUES OF THE SYMBOLS WILL VARY FROM ONE
@@ -60207,8 +60207,8 @@ CURRENT_TIME = "09:53:29"
 use gt4d011
 shade/k=1 temp[L=@ave]
 sh sym DELTA_CPU, CLOCK_SECS
-DELTA_CPU = "0.079988"
-CLOCK_SECS = "129.293"
+DELTA_CPU = "0.059991"
+CLOCK_SECS = "114.837"
  
 repeat/k=1:10 shade temp[L=@ave]
 !-> REPEAT: K=1
@@ -60222,60 +60222,60 @@ repeat/k=1:10 shade temp[L=@ave]
 !-> REPEAT: K=9
 !-> REPEAT: K=10
 let ten_plots = ($DELTA_CPU)
- !-> DEFINE VARIABLE ten_plots = 0.506922
+ !-> DEFINE VARIABLE ten_plots = 0.435934
 sh sym DELTA_CPU, CLOCK_SECS
 DELTA_CPU = "0.001"
-CLOCK_SECS = "130.91"
+CLOCK_SECS = "116.453"
  
 let  sumclock = 0
 let  sumcpu = 0
 sh sym CLOCK_SECS
-CLOCK_SECS = "130.912"
+CLOCK_SECS = "116.455"
 repeat/k=1:10 (shade/pal=rnb2 temp[L=@ave]; let dt = ($DELTA_CPU);\
 let sumcpu =`sumcpu + dt`)
  !-> repeat/k=1:10 (shade/pal=rnb2 temp[L=@ave]; let dt = ($DELTA_CPU);let sumcpu =`sumcpu + dt`)
 !-> REPEAT: K=1
- !-> DEFINE VARIABLE dt = 0.06799
- !-> DEFINE VARIABLE sumcpu =0.06799
+ !-> DEFINE VARIABLE dt = 0.050992
+ !-> DEFINE VARIABLE sumcpu =0.050992
 !-> REPEAT: K=2
  !-> DEFINE VARIABLE dt = 0.052992
- !-> DEFINE VARIABLE sumcpu =0.120982
+ !-> DEFINE VARIABLE sumcpu =0.103984
 !-> REPEAT: K=3
- !-> DEFINE VARIABLE dt = 0.050992
- !-> DEFINE VARIABLE sumcpu =0.171974
+ !-> DEFINE VARIABLE dt = 0.052992
+ !-> DEFINE VARIABLE sumcpu =0.156976
 !-> REPEAT: K=4
  !-> DEFINE VARIABLE dt = 0.053992
- !-> DEFINE VARIABLE sumcpu =0.225966
+ !-> DEFINE VARIABLE sumcpu =0.210968
 !-> REPEAT: K=5
- !-> DEFINE VARIABLE dt = 0.051992
- !-> DEFINE VARIABLE sumcpu =0.277958
+ !-> DEFINE VARIABLE dt = 0.051991
+ !-> DEFINE VARIABLE sumcpu =0.262959
 !-> REPEAT: K=6
- !-> DEFINE VARIABLE dt = 0.050992
- !-> DEFINE VARIABLE sumcpu =0.32895
+ !-> DEFINE VARIABLE dt = 0.051993
+ !-> DEFINE VARIABLE sumcpu =0.314952
 !-> REPEAT: K=7
- !-> DEFINE VARIABLE dt = 0.053992
- !-> DEFINE VARIABLE sumcpu =0.382942
+ !-> DEFINE VARIABLE dt = 0.053991
+ !-> DEFINE VARIABLE sumcpu =0.368943
 !-> REPEAT: K=8
- !-> DEFINE VARIABLE dt = 0.054991
- !-> DEFINE VARIABLE sumcpu =0.437933
+ !-> DEFINE VARIABLE dt = 0.054992
+ !-> DEFINE VARIABLE sumcpu =0.423935
 !-> REPEAT: K=9
- !-> DEFINE VARIABLE dt = 0.050993
- !-> DEFINE VARIABLE sumcpu =0.488926
-!-> REPEAT: K=10
  !-> DEFINE VARIABLE dt = 0.052992
- !-> DEFINE VARIABLE sumcpu =0.541918
+ !-> DEFINE VARIABLE sumcpu =0.476927
+!-> REPEAT: K=10
+ !-> DEFINE VARIABLE dt = 0.052991
+ !-> DEFINE VARIABLE sumcpu =0.529918
  
 say `sumcpu`
- !-> MESSAGE/CONTINUE 0.541918
-0.541918
+ !-> MESSAGE/CONTINUE 0.529918
+0.529918
 sh sym CLOCK_SECS
-CLOCK_SECS = "133.553"
+CLOCK_SECS = "119.245"
  
 SH SYM session_date, current_date, session_time, current_time
-SESSION_DATE = "12-Jul-17"
-SESSION_TIME = "09:51"
-CURRENT_DATE = "12-Jul-17"
-CURRENT_TIME = "09:53:33"
+SESSION_DATE = " 6-Sep-17"
+SESSION_TIME = "12:57"
+CURRENT_DATE = " 6-Sep-17"
+CURRENT_TIME = "12:59:36"
  
  
 ! ******** V6.3 Additions below ***********
@@ -62981,11 +62981,11 @@ save/file=nc4_deflate4_defaultchunk.nc/clobber/ncformat=4/deflate/shuffle sst
 sp stat nc4_nodeflate3.nc --printf="Bytes: %s\n"
 Bytes: 197528
 sp stat nc4_deflate4bigchunk.nc --printf="Bytes: %s\n"
-Bytes: 125636
+Bytes: 125637
 sp stat nc4_deflate4_xyt.nc --printf="Bytes: %s\n"
-Bytes: 125250
+Bytes: 125251
 sp stat nc4_deflate4_defaultchunk.nc --printf="Bytes: %s\n"
-Bytes: 119315
+Bytes: 119316
  
 ! Write variable as INT
 CAN DAT/all; can var/all; can mem/all
@@ -63002,9 +63002,9 @@ save/clobber/shuffle=1/file=nc4_inttemp_shuffle_set_list_deflate_chunk.nc temp
 sp stat nc4_inttemp_classic.nc --printf="Bytes: %s\n"
 Bytes: 60560
 sp stat nc4_inttemp_set_list_deflate_chunk.nc --printf="Bytes: %s\n"
-Bytes: 32900
+Bytes: 32901
 sp stat nc4_inttemp_shuffle_set_list_deflate_chunk.nc --printf="Bytes: %s\n"
-Bytes: 33115
+Bytes: 33116
  
 cancel list/all
 set list/ncformat=classic
@@ -64188,9 +64188,9 @@ list contents
              VARIABLE : { SPAWN:"cat redirect_journal.txt" }
              SUBSET   : 45 points (X)
  1    /  1:" ! NOAA/PMEL TMAP"                                                          
- 2    /  2:" ! FERRET v7.2 (beta/debug)"                                                
- 3    /  3:" ! Linux 2.6.32-696.3.2.el6.x86_64 64-bit - 07/12/17"                       
- 4    /  4:" ! 12-Jul-17 09:51     "                                                    
+ 2    /  2:" ! FERRET v7.21 (beta/debug)"                                               
+ 3    /  3:" ! Linux 2.6.32-696.6.3.el6.x86_64 64-bit - 09/06/17"                       
+ 4    /  4:" !  6-Sep-17 12:57     "                                                    
  5    /  5:""                                                                           
  6    /  6:"! "                                                                         
  7    /  7:"!! --- 22. produce some output to stdout and stderr"                        
@@ -66741,40 +66741,40 @@ can mode ver
              BAD FLAG : -1.E+34       
              SUBSET   : 5 points (X)
              X        : 0.5 to 5.5
-randu2_randn2       0.755
-randu2_randn2       0.885
-randu2_randn2       0.428
-randu2_randn2       0.677
-randu2_randn2       0.061
+randu2_randn2       0.723
+randu2_randn2       0.844
+randu2_randn2       0.361
+randu2_randn2       0.801
+randu2_randn2       0.714
              VARIABLE : RANDU2(XBIG,-1)
              BAD FLAG : -1.E+34       
              SUBSET   : 5 points (X)
              X        : 0.5 to 5.5
-randu2_randn2       0.613
-randu2_randn2       0.029
-randu2_randn2       0.293
-randu2_randn2       0.277
-randu2_randn2       0.607
+randu2_randn2       0.629
+randu2_randn2       0.222
+randu2_randn2       0.004
+randu2_randn2       0.305
+randu2_randn2       0.983
              VARIABLE : RANDU2(XX,0)
              BAD FLAG : -1.E+34       
              SUBSET   : 6 points (X)
              X        : 0.5 to 6.5
-randu2_randn2       0.713
-randu2_randn2       0.235
-randu2_randn2       0.054
-randu2_randn2       0.282
-randu2_randn2       0.345
-randu2_randn2       0.214
+randu2_randn2       0.810
+randu2_randn2       0.972
+randu2_randn2       0.723
+randu2_randn2       0.013
+randu2_randn2       0.234
+randu2_randn2       0.089
              VARIABLE : RANDU2(XX,0)
              BAD FLAG : -1.E+34       
              SUBSET   : 6 points (X)
              X        : 0.5 to 6.5
-randu2_randn2       0.989
-randu2_randn2       0.563
-randu2_randn2       0.542
-randu2_randn2       0.199
-randu2_randn2       0.853
-randu2_randn2       0.395
+randu2_randn2       0.749
+randu2_randn2       0.206
+randu2_randn2       0.925
+randu2_randn2       0.963
+randu2_randn2       0.098
+randu2_randn2       0.286
              VARIABLE : RANDU2(XX,12436)
              BAD FLAG : -1.E+34       
              SUBSET   : 6 points (X)
@@ -66799,40 +66799,40 @@ randu2_randn2       0.638
              BAD FLAG : -1.E+34       
              SUBSET   : 5 points (X)
              X        : 0.5 to 5.5
-randu2_randn2      -0.985
-randu2_randn2      -2.244
-randu2_randn2       0.281
-randu2_randn2       0.988
-randu2_randn2      -0.766
+randu2_randn2       1.582
+randu2_randn2       0.471
+randu2_randn2       0.045
+randu2_randn2       0.654
+randu2_randn2       0.983
              VARIABLE : RANDN2(XBIG,-1)
              BAD FLAG : -1.E+34       
              SUBSET   : 5 points (X)
              X        : 0.5 to 5.5
-randu2_randn2      -0.698
-randu2_randn2      -0.470
-randu2_randn2      -1.085
-randu2_randn2      -0.810
-randu2_randn2      -0.525
+randu2_randn2      -0.699
+randu2_randn2       1.179
+randu2_randn2      -0.448
+randu2_randn2       1.259
+randu2_randn2       0.687
              VARIABLE : RANDN2(XX,0)
              BAD FLAG : -1.E+34       
              SUBSET   : 6 points (X)
              X        : 0.5 to 6.5
-randu2_randn2       1.275
-randu2_randn2      -1.232
-randu2_randn2       1.093
-randu2_randn2       0.427
-randu2_randn2      -0.453
-randu2_randn2       0.042
+randu2_randn2      -1.156
+randu2_randn2       1.197
+randu2_randn2       0.780
+randu2_randn2      -0.299
+randu2_randn2       0.855
+randu2_randn2      -0.234
              VARIABLE : RANDN2(XX,0)
              BAD FLAG : -1.E+34       
              SUBSET   : 6 points (X)
              X        : 0.5 to 6.5
-randu2_randn2      -0.347
-randu2_randn2      -0.293
-randu2_randn2      -1.142
-randu2_randn2      -1.119
-randu2_randn2       0.198
-randu2_randn2      -0.552
+randu2_randn2       1.989
+randu2_randn2      -1.199
+randu2_randn2      -0.140
+randu2_randn2      -0.038
+randu2_randn2       0.549
+randu2_randn2      -1.772
              VARIABLE : RANDN2(XX,12436)
              BAD FLAG : -1.E+34       
              SUBSET   : 6 points (X)
@@ -66857,14 +66857,14 @@ randu2_randn2      -1.279
  Column  1: VAR2 is COS(Z[GZ=ZAX]/30) + RANDU2(1+K[GZ=ZAX],-1)
  Column  2: VAR2[Z=@MED:3] is COS(Z[GZ=ZAX]/30) + RANDU2(1+K[GZ=ZAX],-1) (median smoothed by 3 pts on Z)
  Column  3: VAR2[Z=@MED:9] is COS(Z[GZ=ZAX]/30) + RANDU2(1+K[GZ=ZAX],-1) (median smoothed by 9 pts on Z)
-randu2_randn2       1.045       1.429       0.276
-randu2_randn2       1.429       1.045       0.276
-randu2_randn2       0.276       0.276       0.262
-randu2_randn2       0.262       0.262       0.276
-randu2_randn2      -0.538      -0.129       0.276
-randu2_randn2      -0.129      -0.538       0.276
-randu2_randn2      -0.554      -0.129       0.276
-randu2_randn2       0.582       0.582       0.582
+randu2_randn2       1.742       1.742       0.784
+randu2_randn2       1.210       1.210       0.784
+randu2_randn2       0.784       0.784       0.039
+randu2_randn2       0.039       0.039       0.784
+randu2_randn2      -0.057      -0.057       0.748
+randu2_randn2      -0.918      -0.174       0.748
+randu2_randn2      -0.174      -0.174       0.748
+randu2_randn2       0.895       0.748       0.748
  
 GO bn_reset bn_axis_cf
 cancel mode verify
@@ -72700,7 +72700,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -72753,7 +72753,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -72795,7 +72795,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -72837,7 +72837,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -72870,7 +72870,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -72904,7 +72904,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -72967,7 +72967,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -73015,7 +73015,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -73072,7 +73072,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -73110,7 +73110,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -73148,7 +73148,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -73186,7 +73186,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -73220,7 +73220,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -73458,7 +73458,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          FLOAT     units           CHAR        13   T       degrees_north
@@ -73492,7 +73492,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          FLOAT     units           CHAR        13   T       degrees_north
@@ -73536,7 +73536,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSY46_48)          DOUBLE    units           CHAR        13   T       degrees_north
@@ -73577,7 +73577,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (MYHOURS1)             DOUBLE    units           CHAR        31   T       hours since 1901-01-15 00:00:00
@@ -73603,7 +73603,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (MYHOURS1)             INT       units           CHAR        31   T       hours since 1901-01-15 00:00:00
@@ -73629,7 +73629,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (MYHOURS1)             DOUBLE    units           CHAR        31   T       hours since 1901-01-15 00:00:00
@@ -74086,7 +74086,7 @@ variables:
 		A:history = "From coads_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -74115,7 +74115,7 @@ variables:
 		E410:history = "From coads_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -74166,7 +74166,7 @@ variables:
 		E410:history = "From coads_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -74745,8 +74745,8 @@ variables:
 		DDAT_ORIG:long_name = "DDAT[GZ=ZAXIS_ORIG at ASN]" ;
 
 // global attributes:
-		:history = "Wed Jul 12 09:54:09 2017: ncks -h -A -h z1.nc append_to_this.nc\n",
-			"FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "Wed Sep  6 13:00:05 2017: ncks -h -A -h z1.nc append_to_this.nc\n",
+			"FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 		:NCO = "4.4.6" ;
 }
@@ -74782,7 +74782,7 @@ variables:
 		AVAR:long_name = "X[GX=XIRREG]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -74813,7 +74813,7 @@ variables:
 		AVAR:long_name = "X[GX=XIRREG]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -74876,7 +74876,7 @@ variables:
 		A:history = "From coads" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -74904,7 +74904,7 @@ variables:
 		A:history = "From coads" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -76644,7 +76644,7 @@ variables:
 		LABELS:history = "From http://dunkel.pmel.noaa.gov:8930/thredds/dodsC/data/atmos3.ncml" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -76667,7 +76667,7 @@ variables:
 		STRVAR:long_name = "mystrings" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -76898,7 +76898,7 @@ variables:
 		B:history = "From b" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -76928,7 +76928,7 @@ variables:
 		A:history = "From a" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -76949,7 +76949,7 @@ variables:
 		B:history = "From b" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -76970,7 +76970,7 @@ variables:
 		B:history = "From b" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -76992,7 +76992,7 @@ variables:
 		B:history = "From b" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -77425,7 +77425,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (x_in_meters)          DOUBLE    units           CHAR        6    T       meters
@@ -77442,7 +77442,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (x_in_meters)          DOUBLE    units           CHAR        6    T       meters
@@ -77459,7 +77459,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (x_in_meters)          DOUBLE    units           CHAR        6    T       meters
@@ -78717,7 +78717,7 @@ variables:
 		:geospatial_lat_max = 29.07 ;
 		:time_coverage_start = "2006-06-10T23:48:00Z" ;
 		:time_converage_end = "2006-06-11T00:12:00Z" ;
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 }
  
 set mode/last upcase
@@ -78815,7 +78815,7 @@ variables:
 		lon360:history = "added to test_save_dsg.nc" ;
 
 // global attributes:
-		:history = "CruiseDsgNcFile 1.0FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "CruiseDsgNcFile 1.0FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:featureType = "Trajectory" ;
 		:Conventions = "Some other conventionsCF-1.6" ;
 		:geospatial_lon_min = -92.77 ;
@@ -78842,7 +78842,7 @@ can dat/all; use anew_global.nc
 sh att .
      attributes for dataset: ./anew_global.nc
  ..history = Subset of etopo20,
- FERRET V7.2 (beta/debug) 12-Jul-17 
+ FERRET V7.21 (beta/debug)  6-Sep-17 
  ..Conventions = Existing conventions note, , CF-1.6 
  
  
@@ -78877,7 +78877,7 @@ can dat/all; use conventions_history
 ! The new attibutes
 sh att .
      attributes for dataset: ./conventions_history.nc
- ..history = The history of the fileFERRET V7.2 (beta/debug) 12-Jul-17 
+ ..history = The history of the fileFERRET V7.21 (beta/debug)  6-Sep-17 
  ..Conventions = Conventions for variables named V2CF-1.6 
  
 GO bn_reset bn_center_key_labels
@@ -87678,20 +87678,20 @@ GO err696_time_overlay
 def ax/t="1-jan-0001":"1-jan-0009":1/unit="year"/t0="1-jan-0001"/cal=noleap tax_nlp
 def ax/t="1-jan-0001":"1-jan-0009":1/unit="year"/t0="1-jan-0001"/cal=julian tax_jul
 sp date
-Wed Jul 12 09:54:47 PDT 2017
+Wed Sep  6 13:00:38 PDT 2017
 set view upper
 plot t[gt=tax_nlp]
 plot/ov/vs/line/dash {1,1}, 1e6*{-1,1}
 sp date
-Wed Jul 12 09:54:47 PDT 2017
+Wed Sep  6 13:00:38 PDT 2017
  
 sp date
-Wed Jul 12 09:54:47 PDT 2017
+Wed Sep  6 13:00:38 PDT 2017
 set view lower
 plot t[gt=tax_jul]
 plot/ov/vs/line/dash {2,2}, 1e6*{-1,1}
 sp date
-Wed Jul 12 09:54:47 PDT 2017
+Wed Sep  6 13:00:38 PDT 2017
  
 GO bn_reset
 cancel mode verify
@@ -87748,7 +87748,7 @@ variables:
 		var:long_name = "0*TT + X[GX=XAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -88650,7 +88650,7 @@ variables:
 		TEMP:history = "From /home/data/socat/socatV3/11SS/11SS20140225.nc" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -90925,10 +90925,10 @@ save/clobber/file="tmp/test3.nc" i[i=1:3] + 3
 ! generate absolute path
 let dir = SPAWN("pwd")
 define sym use_abs_path = `DIR+"/tmp/test1.nc"`
- !-> define sym use_abs_path = /home/users/ansley/build/working/FERRET/bench/tmp/test1.nc
+ !-> define sym use_abs_path = /home/users/ansley/build/trunk/FERRET/bench/tmp/test1.nc
 say ($use_abs_path)
- !-> MESSAGE/CONTINUE /home/users/ansley/build/working/FERRET/bench/tmp/test1.nc
-/home/users/ansley/build/working/FERRET/bench/tmp/test1.nc
+ !-> MESSAGE/CONTINUE /home/users/ansley/build/trunk/FERRET/bench/tmp/test1.nc
+/home/users/ansley/build/trunk/FERRET/bench/tmp/test1.nc
  
 use tmp/test1.nc
 show data/brief
@@ -90955,17 +90955,17 @@ show data/brief
 canc data/all
  
 use "($use_abs_path)"
- !-> SET DAT/FORM=CDF "/home/users/ansley/build/working/FERRET/bench/tmp/test1.nc"
+ !-> SET DAT/FORM=CDF "/home/users/ansley/build/trunk/FERRET/bench/tmp/test1.nc"
 show data/brief
      currently SET data sets:
-    1> /home/users/ansley/build/working/FERRET/bench/tmp/test1.nc  (default)
+    1> /home/users/ansley/build/trunk/FERRET/bench/tmp/test1.nc  (default)
 canc data/all
  
 use ($use_abs_path)
- !-> SET DAT/FORM=CDF /home/users/ansley/build/working/FERRET/bench/tmp/test1.nc
+ !-> SET DAT/FORM=CDF /home/users/ansley/build/trunk/FERRET/bench/tmp/test1.nc
 show data/brief
      currently SET data sets:
-    1> /home/users/ansley/build/working/FERRET/bench/tmp/test1.nc  (default)
+    1> /home/users/ansley/build/trunk/FERRET/bench/tmp/test1.nc  (default)
 canc data/all
  
 use tmp/test1.nc,tmp/test2.nc,tmp/test3.nc
@@ -91031,10 +91031,10 @@ spawn echo 'say $1"1-n/a"  $2"2-n/a"  $3"3-n/a"  $4"4-n/a" $5"5-n/a" $6"6-n/a" $
 ! generate absolute path
 let dir = SPAWN("pwd")
 define sym abs_path = `DIR+"/tmp/testMe.jnl"`
- !-> define sym abs_path = /home/users/ansley/build/working/FERRET/bench/tmp/testMe.jnl
+ !-> define sym abs_path = /home/users/ansley/build/trunk/FERRET/bench/tmp/testMe.jnl
 say ($abs_path)
- !-> MESSAGE/CONTINUE /home/users/ansley/build/working/FERRET/bench/tmp/testMe.jnl
-/home/users/ansley/build/working/FERRET/bench/tmp/testMe.jnl
+ !-> MESSAGE/CONTINUE /home/users/ansley/build/trunk/FERRET/bench/tmp/testMe.jnl
+/home/users/ansley/build/trunk/FERRET/bench/tmp/testMe.jnl
  
 go tmp/testMe.jnl
 say $1"1-n/a"  $2"2-n/a"  $3"3-n/a"  $4"4-n/a" $5"5-n/a" $6"6-n/a" $7"7-n/a" $8"8-n/a"
@@ -91047,13 +91047,13 @@ say $1"1-n/a"  $2"2-n/a"  $3"3-n/a"  $4"4-n/a" $5"5-n/a" $6"6-n/a" $7"7-n/a" $8"
 1-n/a  2-n/a  3-n/a  4-n/a 5-n/a 6-n/a 7-n/a 8-n/a
  
 go ($abs_path)
- !-> go /home/users/ansley/build/working/FERRET/bench/tmp/testMe.jnl
+ !-> go /home/users/ansley/build/trunk/FERRET/bench/tmp/testMe.jnl
 say $1"1-n/a"  $2"2-n/a"  $3"3-n/a"  $4"4-n/a" $5"5-n/a" $6"6-n/a" $7"7-n/a" $8"8-n/a"
  !-> MESSAGE/CONTINUE 1-n/a  2-n/a  3-n/a  4-n/a 5-n/a 6-n/a 7-n/a 8-n/a
 1-n/a  2-n/a  3-n/a  4-n/a 5-n/a 6-n/a 7-n/a 8-n/a
  
 go "($abs_path)"
- !-> go "/home/users/ansley/build/working/FERRET/bench/tmp/testMe.jnl"
+ !-> go "/home/users/ansley/build/trunk/FERRET/bench/tmp/testMe.jnl"
 say $1"1-n/a"  $2"2-n/a"  $3"3-n/a"  $4"4-n/a" $5"5-n/a" $6"6-n/a" $7"7-n/a" $8"8-n/a"
  !-> MESSAGE/CONTINUE 1-n/a  2-n/a  3-n/a  4-n/a 5-n/a 6-n/a 7-n/a 8-n/a
 1-n/a  2-n/a  3-n/a  4-n/a 5-n/a 6-n/a 7-n/a 8-n/a
@@ -91069,13 +91069,13 @@ say $1"1-n/a"  $2"2-n/a"  $3"3-n/a"  $4"4-n/a" $5"5-n/a" $6"6-n/a" $7"7-n/a" $8"
 5  hello  bye  /quoted_path /unquoted_path 6-n/a 7-n/a 8-n/a
  
 go ($abs_path) 5 hello "bye" "/quoted_path" /unquoted_path
- !-> go /home/users/ansley/build/working/FERRET/bench/tmp/testMe.jnl 5 hello "bye" "/quoted_path" /unquoted_path
+ !-> go /home/users/ansley/build/trunk/FERRET/bench/tmp/testMe.jnl 5 hello "bye" "/quoted_path" /unquoted_path
 say $1"1-n/a"  $2"2-n/a"  $3"3-n/a"  $4"4-n/a" $5"5-n/a" $6"6-n/a" $7"7-n/a" $8"8-n/a"
  !-> MESSAGE/CONTINUE 5  hello  bye  /quoted_path /unquoted_path 6-n/a 7-n/a 8-n/a
 5  hello  bye  /quoted_path /unquoted_path 6-n/a 7-n/a 8-n/a
  
 go "($abs_path)" 5 hello "bye" "/quoted_path" /unquoted_path
- !-> go "/home/users/ansley/build/working/FERRET/bench/tmp/testMe.jnl" 5 hello "bye" "/quoted_path" /unquoted_path
+ !-> go "/home/users/ansley/build/trunk/FERRET/bench/tmp/testMe.jnl" 5 hello "bye" "/quoted_path" /unquoted_path
 say $1"1-n/a"  $2"2-n/a"  $3"3-n/a"  $4"4-n/a" $5"5-n/a" $6"6-n/a" $7"7-n/a" $8"8-n/a"
  !-> MESSAGE/CONTINUE 5  hello  bye  /quoted_path /unquoted_path 6-n/a 7-n/a 8-n/a
 5  hello  bye  /quoted_path /unquoted_path 6-n/a 7-n/a 8-n/a
@@ -93476,7 +93476,7 @@ SHOW DATA/ATT t_f04_e3_1v ! note atts im_everwhere vs im_not_everwhere
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (XAX)                  DOUBLE    point_spacing   CHAR        4    T       even
@@ -93974,7 +93974,7 @@ save/clobber/file=a.nc/outtype=float elev[d=1]
 use a.nc
 sh att .
      attributes for dataset: ./a.nc
- ..history = FERRET V7.2 (beta/debug) 12-Jul-17 
+ ..history = FERRET V7.21 (beta/debug)  6-Sep-17 
  ..Conventions = CF-1.6 
  ..dt_internal = 15
 sh att elev
@@ -93995,7 +93995,7 @@ save/clobber/file=a.nc/outtype=float elev[d=1]
 use a.nc
 sh att .
      attributes for dataset: ./a.nc
- ..history = FERRET V7.2 (beta/debug) 12-Jul-17 
+ ..history = FERRET V7.21 (beta/debug)  6-Sep-17 
  ..Conventions = CF-1.6 
 sh att elev
      attributes for dataset: ./a.nc
@@ -94121,9 +94121,9 @@ GO bn_speedtest
 ! bn_speedtest.jnl
 ! issue large numbers of commands, timing with clock time
 can mode verify
-10K LET commands LET a = 0 takes  2.234  seconds
-Second 10K LET commands LET a = 0 takes  3.519  seconds
-5K LOAD with transform takes  3.849000000000018  seconds
+10K LET commands LET a = 0 takes  0.5519999999999925  seconds
+Second 10K LET commands LET a = 0 takes  1.209  seconds
+5K LOAD with transform takes  1.638  seconds
  
 GO bn_reset bn_show_noupcase
 cancel mode verify
@@ -96142,7 +96142,7 @@ sho command/brief v
  
 ! All the commands, no subcommands, no qualifiers
 SHOW COMMAND/BRIEF
- Commands in Program FERRET (beta/debug) version7.2:
+ Commands in Program FERRET (beta/debug) version7.21:
  SET
  SHOW
  CANCEL
@@ -97847,7 +97847,7 @@ variables:
 		VAR:long_name = "X[GX=XLON]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 go bn_reset
@@ -97906,7 +97906,7 @@ variables:
 		VAR:history = "From a1" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -97953,7 +97953,7 @@ variables:
 		VAR:history = "From a1" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -99118,7 +99118,7 @@ variables:
 		abc:history = "From abc.dat" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -99205,7 +99205,7 @@ variables:
 		latitude:history = "From bn_delimited_read_1.dat" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -99914,7 +99914,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (TAXIS1)               DOUBLE    axis            CHAR        1    T       T
@@ -99983,7 +99983,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (TAXIS1)               DOUBLE    axis            CHAR        1    T       T
@@ -100054,7 +100054,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        34   T       FERRET V7.2 (beta/debug) 12-Jul-17
+ .                               history         CHAR        35   T       FERRET V7.21 (beta/debug)  6-Sep-17
                                  Conventions     CHAR        6    F       CF-1.6
   
 (TAXIS1)               DOUBLE    axis            CHAR        1    T       T
@@ -100471,7 +100471,7 @@ variables:
 		VART:long_name = "RESHAPE(VAR, T[GT=TAX])" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -100878,7 +100878,7 @@ variables:
 		uave:history = "From 6dfile" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -100928,7 +100928,7 @@ variables:
 		uave:history = "From 6dfile" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -100975,7 +100975,7 @@ variables:
 		uave:history = "From 6dfile" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -101131,7 +101131,7 @@ variables:
 		BIN:history = "From shorttest.dat" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -105093,6 +105093,154 @@ list b2d[gf=aline_edges at iin]
  9    / 10:  18.00  27.00
  10   / 11:  20.00  30.00
  
+! *********** v7.21 Additions ***********
+ 
+GO bn_reset
+cancel mode verify
+ooooooooooooooooooooooooooooooooooooooooooo
+GO bn721_bug_fixes
+! bn721_bug_fixes.jnl
+! test various fixes that went into version 7.21
+! 7/17 *acm*
+!
+ 
+GO bn_reset
+cancel mode verify
+ooooooooooooooooooooooooooooooooooooooooooo
+GO err72_atts_as_vars
+! err72_atts_as_vars.jnl
+! See ticket 2555.  Allocation of pointers for these strings
+ 
+use coads_climatology
+list sst.attnames[i=1]
+             VARIABLE : SST.ATTNAMES[I=1]
+             FILENAME : coads_climatology.cdf
+             X        : 1
+        "missing_value"
+ 
+use coads_climatology
+let allatts = sst.attnames
+let natts = sst.nattrs
+ repeat/range=1:`natts`/name=m (let attname = allatts[i=`m`]; list attname)
+ !-> repeat/range=1:5/name=m (let attname = allatts[i=`m`]; list attname)
+!-> REPEAT: M:1
+ !-> DEFINE VARIABLE attname = allatts[i=1]
+             VARIABLE : ALLATTS[I=1]
+             FILENAME : coads_climatology.cdf
+             X        : 1
+        "missing_value"
+!-> REPEAT: M:2
+ !-> DEFINE VARIABLE attname = allatts[i=2]
+             VARIABLE : ALLATTS[I=2]
+             FILENAME : coads_climatology.cdf
+             X        : 2
+        "_FillValue"
+!-> REPEAT: M:3
+ !-> DEFINE VARIABLE attname = allatts[i=3]
+             VARIABLE : ALLATTS[I=3]
+             FILENAME : coads_climatology.cdf
+             X        : 3
+        "long_name"
+!-> REPEAT: M:4
+ !-> DEFINE VARIABLE attname = allatts[i=4]
+             VARIABLE : ALLATTS[I=4]
+             FILENAME : coads_climatology.cdf
+             X        : 4
+        "history"
+!-> REPEAT: M:5
+ !-> DEFINE VARIABLE attname = allatts[i=5]
+             VARIABLE : ALLATTS[I=5]
+             FILENAME : coads_climatology.cdf
+             X        : 5
+        "units"
+ 
+! Bug also applied to getting dimnames
+list sst.dimnames[i=2:3]
+             VARIABLE : SST.DIMNAMES[I=2:3]
+             FILENAME : coads_climatology.cdf
+             SUBSET   : 2 points (X)
+ 2   / 2:"COADSY"
+ 3   / 3:"TIME10"
+ 
+let dnames = sst.dimnames
+list dnames[i=2]
+             VARIABLE : SST.DIMNAMES
+             FILENAME : coads_climatology.cdf
+             X        : 2
+        "COADSY"
+ 
+! lots of global attributes
+use err491_attval
+list ..attnames[i=20:23]
+             VARIABLE : ..ATTNAMES[I=20:23]
+             DATA SET : K-Bay OAR3d model (200m)
+             FILENAME : err491_attval.cdf
+             SUBSET   : 4 points (X)
+ 20   / 20:"ny"   
+ 21   / 21:"x_min"
+ 22   / 22:"x_max"
+ 23   / 23:"y_min"
+ 
+ 
+let gattnames = ..attnames
+list gattnames[i=1:10]
+             VARIABLE : ..ATTNAMES
+             DATA SET : K-Bay OAR3d model (200m)
+             FILENAME : err491_attval.cdf
+             SUBSET   : 10 points (X)
+ 1    /  1:"simulation" 
+ 2    /  2:"start_date" 
+ 3    /  3:"history"    
+ 4    /  4:"option"     
+ 5    /  5:"run_mode"   
+ 6    /  6:"srfc_bndry" 
+ 7    /  7:"rad_penet"  
+ 8    /  8:"dt_external"
+ 9    /  9:"dt_internal"
+ 10   / 10:"horiz_diff" 
+ 
+list gattnames[i=1:24:2]
+             VARIABLE : ..ATTNAMES
+                        regrid: 2 delta on X
+             DATA SET : K-Bay OAR3d model (200m)
+             FILENAME : err491_attval.cdf
+             SUBSET   : 12 points (X)
+ 1    /  1:"simulation" 
+ 3    /  2:"history"    
+ 5    /  3:"run_mode"   
+ 7    /  4:"rad_penet"  
+ 9    /  5:"dt_internal"
+ 11   /  6:"inv_prandtl"
+ 13   /  7:"title"      
+ 15   /  8:"remark"     
+ 17   /  9:"y_units"    
+ 19   / 10:"nx"         
+ 21   / 11:"x_min"      
+ 23   / 12:"y_min"      
+ 
+GO bn_reset
+cancel mode verify
+ooooooooooooooooooooooooooooooooooooooooooo
+GO err72_sum_in_x
+! err72_sum_in_x.jnl
+! ticket 2560, sum in X direcgtion when result is 0
+! returne a missing-value
+ 
+! Previously this result was missing
+let var = {-1,1,0}
+list var[x=@sum]
+             VARIABLE : {-1,1,0}
+             X        : 0.5 to 3.5 (summed)
+          0.0000
+ 
+! This was correct, 0
+let yvar = ysequence(var)
+list yvar[j=@sum]
+             VARIABLE : YSEQUENCE(VAR)
+             Y        : 0.5 to 3.5 (summed)
+          0.0000
+ 
+ 
 !  *********** Always do a bn_reset  ***********
 !  *********** make sure things clean up well **
 GO bn_reset
@@ -105107,9 +105255,9 @@ yes? ! run bn_all_ef tests
 yes? 
 yes? GO bn_all_ef
  	NOAA/PMEL TMAP
- 	FERRET v7.2 (beta/debug)
- 	Linux 2.6.32-696.3.2.el6.x86_64 64-bit - 07/12/17
- 	12-Jul-17 09:57     
+ 	FERRET v7.21 (beta/debug)
+ 	Linux 2.6.32-696.6.3.el6.x86_64 64-bit - 09/06/17
+ 	 6-Sep-17 13:02     
 
 SET MODE VERIFY
 ! bn_all_ef.jnl
@@ -105927,7 +106075,7 @@ variables:
 		MY_VAR:long_name = "T[GT=T5]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -105952,7 +106100,7 @@ variables:
 		MY_VAR:long_name = "T[GT=T5]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -105976,7 +106124,7 @@ variables:
 		B:long_name = "\"one line of text\"" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106015,7 +106163,7 @@ variables:
 		D:history = "From test_string" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106050,7 +106198,7 @@ variables:
 		B:long_name = "SAMPLEJ(YSEQUENCE({\"a\",\"b\",,\"d\",\"e\",\"f\"}),{2,,1})" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106091,7 +106239,7 @@ variables:
 		V:long_name = "T[GT=MONTH_IRREG]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106148,7 +106296,7 @@ variables:
 		V:history = "From coads_vwnd" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106205,7 +106353,7 @@ variables:
 		V:history = "From coads_vwnd" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106260,7 +106408,7 @@ variables:
 		T2:long_name = "Z[GZ=ZIRR]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106308,7 +106456,7 @@ variables:
 		V:history = "From coads_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106402,7 +106550,7 @@ variables:
 		SST:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106472,7 +106620,7 @@ variables:
 		SST:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106523,7 +106671,7 @@ variables:
 		V:long_name = "X[GX=XAX] +Z[GZ=ZAX] + T[GT=TAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106598,7 +106746,7 @@ variables:
 		A:long_name = "T[GT=TIME]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106625,7 +106773,7 @@ variables:
 		X_:long_name_mod = "axis ABSTRACT" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 		:title = "a long title longer than 80 characters a123456789b123456789c123456789d123456789e123456789f123456789g123456789h123456789" ;
 data:
@@ -106649,7 +106797,7 @@ variables:
 		A:history = "From x" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 		:title = "a long title, longer than the previous limit of 80 characters.  Previously various buffers were set to 80, and storage in ds_title was also too short." ;
 data:
@@ -106676,11 +106824,11 @@ variables:
 		A:history = "From t0_cdc" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_long_revision_num.jnl --- history attribute
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 bn_bounds_defineax.jnl --- N+1 def of bounds.
 netcdf irrxzt {
 dimensions:
@@ -106711,7 +106859,7 @@ variables:
 		V:long_name = "X[GX=XAX] +Z[GZ=ZAX] + T[GT=TAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106783,7 +106931,7 @@ variables:
 		VAR_B:long_name = "my strings" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106827,7 +106975,7 @@ variables:
 		SST:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106869,7 +107017,7 @@ variables:
 		SST:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -106977,7 +107125,7 @@ variables:
 		ELEV:history = "From err491_attval" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 6 after CANCEL MODE upcase_output
@@ -107018,7 +107166,7 @@ variables:
 		Elev:history = "From err491_attval" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 7 outtput flags to control attribute output
@@ -107041,7 +107189,7 @@ variables:
 		BB:another_attr = 6.f ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107067,7 +107215,7 @@ variables:
 		BB:another_attr = 6.f ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107087,7 +107235,7 @@ variables:
 		BB:long_name = "{3,4.5,6,7,4}" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107108,7 +107256,7 @@ variables:
 		BB:long_name = "{3,4.5,6,7,4}" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107151,7 +107299,7 @@ variables:
 		TEMP:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 12 Check that settings hold for child axis.
@@ -107191,7 +107339,7 @@ variables:
 		TEMP:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 13 cancel output of attributes of the variable.
@@ -107229,7 +107377,7 @@ variables:
 		TEMP:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 14 attributes of data from ez data.
@@ -107258,7 +107406,7 @@ variables:
 		A3:history = "From EZ.DAT" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107291,7 +107439,7 @@ variables:
 		V4:history = "From EZ.DAT" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107317,7 +107465,7 @@ variables:
 		A:four = "theory" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107363,7 +107511,7 @@ variables:
 		ELEV:history = "From err491_attval" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 		:simulation = "K-Bay OAR3d model (200m)" ;
 		:start_date = "980105000000" ;
@@ -107470,7 +107618,7 @@ variables:
 		TEMP:units = "deg. C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 		:dt_internal = 15. ;
 }
@@ -107512,7 +107660,7 @@ variables:
 		ELEV:history = "From err491_attval" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107595,7 +107743,7 @@ variables:
 		RIGUE:history = "From test0" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107632,7 +107780,7 @@ variables:
 		B:long_name = "hello" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107672,7 +107820,7 @@ variables:
 		VWND:units = "M/S" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107723,7 +107871,7 @@ variables:
 		T2:history = "From coads_vwnd" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -107782,7 +107930,7 @@ variables:
 		T2:history = "From gt4d011" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -107827,7 +107975,7 @@ variables:
 		T2:history = "From gt4d011" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -107870,7 +108018,7 @@ variables:
 		T2:history = "From gt4d011" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -107905,7 +108053,7 @@ variables:
 		TEMP:units = "DEG C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -107939,7 +108087,7 @@ variables:
 		TWO:history = "From levitus_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 27 attributes of  user-defined axes
@@ -107969,7 +108117,7 @@ variables:
 		AXY:long_name = "RESHAPE (A,RVAR)" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 28 Define a new global attribute
@@ -107998,7 +108146,7 @@ variables:
 		BROILED:history = "From test0" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 		:glob = "Global attribute" ;
 		:FERRET_comment = "File written via LAS. Attributes are inherited from originating dataset" ;
@@ -108059,7 +108207,7 @@ variables:
 		FAREN:history = "From gt4d011" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -108104,7 +108252,7 @@ variables:
 		FAREN:history = "From gt4d011" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -108123,7 +108271,7 @@ variables:
 		A:long_name = "X[GX=XAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -108153,7 +108301,7 @@ variables:
 		A:long_name = "X[GX=XAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -108183,7 +108331,7 @@ variables:
 		A:long_name = "X[GX=XAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -108236,7 +108384,7 @@ variables:
 		TEMP:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -108278,7 +108426,7 @@ variables:
 		TEMP:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -108296,7 +108444,7 @@ variables:
 		V:long_name = "Y[GY=YAXIS]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 err611_set_var_ez.jnl --- 
@@ -108315,7 +108463,7 @@ variables:
 		MY_ASC:history = "From dat.dat" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -108333,7 +108481,7 @@ variables:
 		MY_UNF:history = "From unf.dat" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- SET VAR/OUTTYPE for user variable
@@ -108350,7 +108498,7 @@ variables:
 		A:long_name = "{1.1,2.2,3.3}" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -108371,7 +108519,7 @@ variables:
 		A:long_name = "{ 3.77, 4.00, 4.10, 4.33, 4.38, 4.27, 4.31, 4.40, 4.75, 5.01, 5.27, 5.52}" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -108434,7 +108582,7 @@ variables:
 		newvar:history = "From a" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_keep_axisnames.jnl --- test SAVE/KEEP_AXISNAMES
@@ -108461,7 +108609,7 @@ variables:
 		A:long_name = "X[GX=X100] + T[GT=T31]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_keep_axisnames.jnl --- without /KEEP_AXISNAMES
@@ -108488,7 +108636,7 @@ variables:
 		A:long_name = "X[GX=X100] + T[GT=T31]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_axis_cf.jnl, degrees_east, degrees_north, std names on axes:
@@ -108554,7 +108702,7 @@ variables:
 		ZUP:long_name = "Z[GZ=ZAXUP]" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_axis_cf.jnl, Convert forms of DEG, degrees to degrees_east:
@@ -108586,7 +108734,7 @@ variables:
 		Y_:long_name_mod = "axis YFIFTEEN" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_axis_cf.jnl, Downcase units, e.g. in time axis DAYS since
@@ -108619,7 +108767,7 @@ variables:
 		XYTVAR:history = "From bn_strides" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -108644,7 +108792,7 @@ variables:
 		TIME:history = "From http://tds.climatedatacloud.com/thredds/dodsC/ensembles/nmme_gfdl/TwoD" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -108682,7 +108830,7 @@ variables:
 		time:history = "From http://tds.climatedatacloud.com/thredds/dodsC/ensembles/nmme_gfdl/TwoD" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -108708,7 +108856,7 @@ variables:
 		MYVAR:history = "From coads_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -108722,7 +108870,7 @@ variables:
 		MYVAR:history = "From levitus_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2 (beta/debug) 12-Jul-17" ;
+		:history = "FERRET V7.21 (beta/debug)  6-Sep-17" ;
 		:Conventions = "CF-1.6" ;
 }
 -----
@@ -108736,9 +108884,9 @@ yes?
 yes? 
 yes? GO bn_startupfile
  	NOAA/PMEL TMAP
- 	FERRET v7.2 (beta/debug)
- 	Linux 2.6.32-696.3.2.el6.x86_64 64-bit - 07/12/17
- 	12-Jul-17 09:57     
+ 	FERRET v7.21 (beta/debug)
+ 	Linux 2.6.32-696.6.3.el6.x86_64 64-bit - 09/06/17
+ 	 6-Sep-17 13:02     
 
 CAN MODE VERIFY
     SET MEMORY/SIZE: 31 megawords
@@ -108747,18 +108895,18 @@ CAN MODE VERIFY
 PPL$XPIXEL = "656"
 PPL$YPIXEL = "492"
 BYTEORDER = "LITTLE"
-FERRET_VERSION = "7.2"
-FERRET_PLATFORM = "Linux 2.6.32-696.3.2.el6.x86_64 64-bit"
+FERRET_VERSION = "7.21"
+FERRET_PLATFORM = "Linux 2.6.32-696.6.3.el6.x86_64 64-bit"
 FERRET_PRECISION = "double"
 NETCDF_VERSION = "4.4.1.1 of Jun 26 2017 08:42:09 $"
 FERRET_MEMORY = "31"
-SESSION_DATE = "12-Jul-17"
-SESSION_TIME = "09:57"
-SESSION_PID = "5815"
-DELTA_CPU = "0.046992"
-CLOCK_SECS = "0.333"
-CURRENT_DATE = "12-Jul-17"
-CURRENT_TIME = "09:57:41"
+SESSION_DATE = " 6-Sep-17"
+SESSION_TIME = "13:02"
+SESSION_PID = "40729"
+DELTA_CPU = "0.06199"
+CLOCK_SECS = "0.177"
+CURRENT_DATE = " 6-Sep-17"
+CURRENT_TIME = "13:02:15"
 N_OPEN_DSETS = "0"
 PROGRAM_NAME = "Ferret"
 PEAK_MEMORY = "0"
@@ -108784,7 +108932,7 @@ PPL$VIEW_X = "0.000"
 PPL$VIEW_Y = "0.000"
 PPL$VIEW_Z = "0.000"
 PPL$COMMAND_FILE = "$$MEMBUF$$"
-WIN_TITLE = "12-Jul-17:09:57"
+WIN_TITLE = "6-Sep-17:13:02"
 VP_WIDTH = "10.2"
 VP_HEIGHT = "8.8"
 VP_SCALE = "1"
@@ -108848,9 +108996,9 @@ yes?
 yes? 
 yes? GO bn_gif
  	NOAA/PMEL TMAP
- 	FERRET v7.2 (beta/debug)
- 	Linux 2.6.32-696.3.2.el6.x86_64 64-bit - 07/12/17
- 	12-Jul-17 09:57     
+ 	FERRET v7.21 (beta/debug)
+ 	Linux 2.6.32-696.6.3.el6.x86_64 64-bit - 09/06/17
+ 	 6-Sep-17 13:02     
 
 ! bn450_gif.JNL - copied from bn450_plot.jnl
 ! this journal file only tests the writing of gif file in batch mode using
@@ -109551,9 +109699,9 @@ yes?
 yes? 
 yes? GO bn_ps
  	NOAA/PMEL TMAP
- 	FERRET v7.2 (beta/debug)
- 	Linux 2.6.32-696.3.2.el6.x86_64 64-bit - 07/12/17
- 	12-Jul-17 09:57     
+ 	FERRET v7.21 (beta/debug)
+ 	Linux 2.6.32-696.6.3.el6.x86_64 64-bit - 09/06/17
+ 	 6-Sep-17 13:02     
 
 ! bn450_ps.JNL - copied from bn450_plot.jnl
 ! this journal file only tests the writing of ps files in batch mode using
@@ -109665,9 +109813,9 @@ yes?
 yes? 
 yes? GO bn_batch_metafile
  	NOAA/PMEL TMAP
- 	FERRET v7.2 (beta/debug)
- 	Linux 2.6.32-696.3.2.el6.x86_64 64-bit - 07/12/17
- 	12-Jul-17 09:57     
+ 	FERRET v7.21 (beta/debug)
+ 	Linux 2.6.32-696.6.3.el6.x86_64 64-bit - 09/06/17
+ 	 6-Sep-17 13:02     
 
 ! bn_batch_metafile.jnl
 ! Run at the end of the benchmark scripts, starting ferret with the flags
@@ -109751,4 +109899,4 @@ set window/location=0.1,0.1/title="another title"
  
 set mode/last logo
 exit/command
-Ended at Wed Jul 12 09:57:45 PDT 2017
+Ended at Wed Sep 6 13:02:20 PDT 2017
diff --git a/bench/bn721_bug_fixes.jnl b/bench/bn721_bug_fixes.jnl
new file mode 100644
index 0000000..abe5a53
--- /dev/null
+++ b/bench/bn721_bug_fixes.jnl
@@ -0,0 +1,10 @@
+! bn721_bug_fixes.jnl
+! test various fixes that went into version 7.21
+! 7/17 *acm*
+!
+
+GO bn_reset
+GO err72_atts_as_vars
+
+GO bn_reset
+GO err72_sum_in_x
diff --git a/bench/bn_all.jnl b/bench/bn_all.jnl
index 706de29..451fdf8 100644
--- a/bench/bn_all.jnl
+++ b/bench/bn_all.jnl
@@ -1141,6 +1141,11 @@ GO bn_transp_choose
 GO bn_reset bn_iin_regrid
 GO bn_iin_regrid
 
+! *********** v7.21 Additions ***********
+
+GO bn_reset
+GO bn721_bug_fixes
+
 !  *********** Always do a bn_reset  *********** 
 !  *********** make sure things clean up well **
 GO bn_reset
diff --git a/bench/err72_atts_as_vars.jnl b/bench/err72_atts_as_vars.jnl
new file mode 100644
index 0000000..92aec60
--- /dev/null
+++ b/bench/err72_atts_as_vars.jnl
@@ -0,0 +1,26 @@
+! err72_atts_as_vars.jnl
+! See ticket 2555.  Allocation of pointers for these strings
+
+use coads_climatology
+list sst.attnames[i=1]
+
+use coads_climatology
+let allatts = sst.attnames
+let natts = sst.nattrs
+ repeat/range=1:`natts`/name=m (let attname = allatts[i=`m`]; list attname)
+
+! Bug also applied to getting dimnames
+list sst.dimnames[i=2:3]
+
+let dnames = sst.dimnames
+list dnames[i=2]
+
+! lots of global attributes
+use err491_attval
+list ..attnames[i=20:23]
+
+
+let gattnames = ..attnames
+list gattnames[i=1:10]
+
+list gattnames[i=1:24:2]
diff --git a/bench/err72_sum_in_x.jnl b/bench/err72_sum_in_x.jnl
new file mode 100644
index 0000000..a90e14f
--- /dev/null
+++ b/bench/err72_sum_in_x.jnl
@@ -0,0 +1,12 @@
+! err72_sum_in_x.jnl
+! ticket 2560, sum in X direcgtion when result is 0
+! returne a missing-value
+
+! Previously this result was missing
+let var = {-1,1,0}
+list var[x=@sum]
+
+! This was correct, 0
+let yvar = ysequence(var)
+list yvar[j=@sum]
+
diff --git a/bench/memleak.jnl b/bench/memleak.jnl
deleted file mode 100644
index 71282a4..0000000
--- a/bench/memleak.jnl
+++ /dev/null
@@ -1,7 +0,0 @@
- ! Run TOP and watch memory use as this runs; memory leak fixed by Remik 
- ! 12-Oct-2007 Ferret v6.08 
-
-! Can use j=1:1000 on slower machines ...
-
-can mode verif; rep/i=1:50 rep/j=1:5000 let a = 0
-
diff --git a/bench/test_results/bn_axis_vs.gif b/bench/test_results/bn_axis_vs.gif
index 724b6cd..738fd06 100644
Binary files a/bench/test_results/bn_axis_vs.gif and b/bench/test_results/bn_axis_vs.gif differ
diff --git a/bench/test_results/bn_contour_conset.gif b/bench/test_results/bn_contour_conset.gif
index ed02488..072f1c3 100644
Binary files a/bench/test_results/bn_contour_conset.gif and b/bench/test_results/bn_contour_conset.gif differ
diff --git a/bench/test_results/bn_hovmuller_overlays.gif b/bench/test_results/bn_hovmuller_overlays.gif
index 01bbe5e..83df73d 100644
Binary files a/bench/test_results/bn_hovmuller_overlays.gif and b/bench/test_results/bn_hovmuller_overlays.gif differ
diff --git a/bench/test_results/bn_labels_on_taxis.gif b/bench/test_results/bn_labels_on_taxis.gif
index 74b0974..57d8749 100644
Binary files a/bench/test_results/bn_labels_on_taxis.gif and b/bench/test_results/bn_labels_on_taxis.gif differ
diff --git a/bench/test_results/bn_ribbon_vlog.gif b/bench/test_results/bn_ribbon_vlog.gif
index 27b8fb1..3a3f053 100644
Binary files a/bench/test_results/bn_ribbon_vlog.gif and b/bench/test_results/bn_ribbon_vlog.gif differ
diff --git a/bench/test_results/bn_subspan_mod_strides.gif b/bench/test_results/bn_subspan_mod_strides.gif
index 077db46..4121fe6 100644
Binary files a/bench/test_results/bn_subspan_mod_strides.gif and b/bench/test_results/bn_subspan_mod_strides.gif differ
diff --git a/bench/test_results/bn_vs_const_value.gif b/bench/test_results/bn_vs_const_value.gif
index 5d735cc..a22c027 100644
Binary files a/bench/test_results/bn_vs_const_value.gif and b/bench/test_results/bn_vs_const_value.gif differ
diff --git a/bench/test_results/bnplot_2.gif b/bench/test_results/bnplot_2.gif
index 7720ec4..1ad19de 100644
Binary files a/bench/test_results/bnplot_2.gif and b/bench/test_results/bnplot_2.gif differ
diff --git a/bench/test_results/bnplot_3.gif b/bench/test_results/bnplot_3.gif
index fb652b7..0f19756 100644
Binary files a/bench/test_results/bnplot_3.gif and b/bench/test_results/bnplot_3.gif differ
diff --git a/bench/test_results/err700_key.gif b/bench/test_results/err700_key.gif
index aa9ba7f..e003db8 100644
Binary files a/bench/test_results/err700_key.gif and b/bench/test_results/err700_key.gif differ
diff --git a/bench/test_results/ferret_run_tests_err b/bench/test_results/ferret_run_tests_err
index 36f6f5b..0ca77c4 100644
--- a/bench/test_results/ferret_run_tests_err
+++ b/bench/test_results/ferret_run_tests_err
@@ -794,22 +794,13 @@ Replacing definition of axis DLOG
  **ERROR: value out of legal range: Limits for log axis negative or too small: -9.00 : 0.00
 plot/hlog fcn
 *** Running ferret script: bn_internal_external_functions.jnl
-
-Bailing out of external function "ffta":
-	 Time axis must be a regular axis
-
-Bailing out of external function "eof_space":
-	 Function EOF_SPACE not available in this version of Ferret. Use EOFSVD_SPACE
-
-Bailing out of external function "eof_stat":
-	 Function EOF_STAT not available in this version of Ferret. Use EOFSVD_STAT
-
-Bailing out of external function "eof_tfunc":
-	 Function EOF_TFUNC not available in this version of Ferret. Use EOFSVD_TFUNC
  PERMANENT data cleared from memory
  TEMPORARY data cleared from memory
 ooooooooooooooooooooooooooooooooooooooooooo
 Replacing definition of axis DAYT
+
+Bailing out of external function "ffta":
+	 Time axis must be a regular axis
  **ERROR: error in external function
 LIST vw_fft
 Replacing definition of grid TGRID
@@ -863,10 +854,19 @@ list tsorted_indices, tsorted_wnd
  PERMANENT data cleared from memory
  TEMPORARY data cleared from memory
 ooooooooooooooooooooooooooooooooooooooooooo
+
+Bailing out of external function "eof_space":
+	 Function EOF_SPACE not available in this version of Ferret. Use EOFSVD_SPACE
  **ERROR: error in external function
 list/l=1:2 eofxyfcn
+
+Bailing out of external function "eof_stat":
+	 Function EOF_STAT not available in this version of Ferret. Use EOFSVD_STAT
  **ERROR: error in external function
 list/i=1:3/j=1:3 eofstat
+
+Bailing out of external function "eof_tfunc":
+	 Function EOF_TFUNC not available in this version of Ferret. Use EOFSVD_TFUNC
  **ERROR: error in external function
 list/i=1:2 eoftime
  PERMANENT data cleared from memory
@@ -1708,9 +1708,6 @@ ooooooooooooooooooooooooooooooooooooooooooo
            *** NOTE: Cannot cancel window when in batch mode
            *** NOTE: Cannot create new windows when batch mode set
 *** Running ferret script: bn_last_error.jnl
-
-Bailing out of external function "ffta":
-	 Time axis must be a regular axis
  **ERROR: command syntax: IF I GT 3 THEN ( IF I LT 5 THEN I ELSE -9 ) ELSE .333
           Cannot use multiple IFs in an expression
 LIST/ORDER=X  IF I GT 3 THEN ( IF I LT 5 THEN I ELSE -9 ) ELSE .333
@@ -1727,6 +1724,9 @@ set data nofile.nc
 repeat/name=a (say `a`)
  **ERROR: command syntax: L is a pseudo-variable; cannot use with REPEAT/RANGE/NAME. Instead use REPEAT/L=
 repeat/range=1:3/name=L (use coads_climatology; list/nohead [sst=I=1,j=1])
+
+Bailing out of external function "ffta":
+	 Time axis must be a regular axis
  **ERROR: error in external function
 LOAD vw_fft
 *** Running ferret script: bn_deg_min.jnl
@@ -1929,8 +1929,6 @@ Replacing definition of axis TIME
            *** NOTE: Cannot cancel window when in batch mode
            *** NOTE: Cannot create new windows when batch mode set
 *** Running ferret script: bn_cdf_errmsg.jnl
-CURL Error: Couldn't resolve host name
-curl error details: 
  **TMAP ERR: non-existent or not on line
              this_is_not_a_file.nc
 SET DAT/FORM=CDF this_is_not_a_file.nc
@@ -1938,6 +1936,8 @@ SET DAT/FORM=CDF this_is_not_a_file.nc
              NetCDF: file not found (OPeNDAP/netCDF Error code -90)
              Data set: http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/COADS/coads_nothing.cdf
 SET DAT/FORM=CDF "http://ferret.pmel.noaa.gov/pmel/thredds/dodsC/data/PMEL/COADS/coads_nothing.cdf"
+CURL Error: Couldn't resolve host name
+curl error details: 
  **Internet Data error
              NetCDF: I/O failure (OPeNDAP/netCDF Error code -68)
              Data set: http://noserver/a/nofile.cdf
@@ -2841,7 +2841,6 @@ ooooooooooooooooooooooooooooooooooooooooooo
      e.g.   yes? GO filename
  
  Use "GO/HELP filename" to read documentation in  the file to be executed.
-           *** NOTE: No active redirects to cancel
  Use the GO command to name a file of FERRET commands to be executed.
      e.g.   yes? GO filename
  
@@ -2959,12 +2958,12 @@ ooooooooooooooooooooooooooooooooooooooooooo
            *** NOTE: A dummy axis of subscripts will be used
            *** NOTE: No missing_value or _FillValue attribute. Using NaN for variable: l
 *** Running ferret script: bn671_bug_fixes.jnl
-
-Bailing out of external function "tax_year":
-	 Function not valid for modulo time axis
  PERMANENT data cleared from memory
  TEMPORARY data cleared from memory
 ooooooooooooooooooooooooooooooooooooooooooo
+
+Bailing out of external function "tax_year":
+	 Function not valid for modulo time axis
  **ERROR: error in external function
 list/L=15:20 tax_year(t[gt=tvar],tvar)
  PERMANENT data cleared from memory
@@ -3082,20 +3081,20 @@ DEFINE VARIABLE A = ifv I LT 5 THEN I ELSE -9
            *** NOTE: Axis has repeated values -- micro-adjusting ...
 *** Running ferret script: bn_xml_header.jnl
 *** Running ferret script: bn_eof_simple.jnl
+Replacing definition of axis XAXIS
 
 Bailing out of external function "eofsvd_stat":
 	There are no spatial locations having complete time series.
+ **ERROR: error in external function
+list eofsvd_stat(spacegap)
 
 Bailing out of external function "eofsvd_space":
 	There are no spatial locations having complete time series.
+ **ERROR: error in external function
+list eofsvd_space(spacegap)
 
 Bailing out of external function "eofsvd_tfunc":
 	There are no spatial locations having complete time series.
-Replacing definition of axis XAXIS
- **ERROR: error in external function
-list eofsvd_stat(spacegap)
- **ERROR: error in external function
-list eofsvd_space(spacegap)
  **ERROR: error in external function
 list eofsvd_tfunc(spacegap)
 *** Running ferret script: bn_eof_simple2.jnl
@@ -4935,7 +4934,6 @@ stat/brief v[i=101:200,j=101:200,k=1,l=1:10 at ave], v[i=101:200,j=101:200,k=2,l=1:
 stat/brief a[l=1:10 at ave], b[l=1:10 at ave], c[l=1:10 at ave], d[l=1:10 at ave]
  PERMANENT data cleared from memory
  TEMPORARY data cleared from memory
-           *** NOTE: No active redirects to cancel
  **ERROR: request exceeds memory setting: Requested result is larger than the available memory
 stat/brief v[i=101:200,j=101:200,k=1,l=1:10 at ave], v[i=101:200,j=101:200,k=2,l=1:10 at ave], v[l=1:10 at ave]
  PERMANENT data cleared from memory
@@ -5137,6 +5135,13 @@ Replacing definition of axis ALINE
 Replacing definition of axis ALINE_EDGES
 Replacing definition of axis ALINE
 Replacing definition of axis ALINE_EDGES
+*** Running ferret script: bn721_bug_fixes.jnl
+ PERMANENT data cleared from memory
+ TEMPORARY data cleared from memory
+ooooooooooooooooooooooooooooooooooooooooooo
+ PERMANENT data cleared from memory
+ TEMPORARY data cleared from memory
+ooooooooooooooooooooooooooooooooooooooooooo
 *** Running ferret script: bn_gif.jnl
  **ERROR: dimensions improperly specified: specified data is not a line
            - its a 2D region: "plot/i=1:10/j=1:20/nolabel i+j"
diff --git a/bench/test_results/ferret_run_tests_log b/bench/test_results/ferret_run_tests_log
index 9e74005..98b0ebe 100644
--- a/bench/test_results/ferret_run_tests_log
+++ b/bench/test_results/ferret_run_tests_log
@@ -278,6 +278,7 @@ Benchmark scripts that will be run:
    bn_cache_management.jnl
    bn_transp_choose.jnl
    bn_iin_regrid.jnl
+   bn721_bug_fixes.jnl
    bn_gif.jnl
    bn_ps.jnl
    bn_all_ef.jnl
@@ -10502,8 +10503,8 @@ show symbols/all
 PPL$XPIXEL = "0"
 PPL$YPIXEL = "0"
 BYTEORDER = "LITTLE"
-FERRET_VERSION = "7.2"
-FERRET_PLATFORM = "Linux 3.10.0-514.26.2.el7.x86_64 64-bit"
+FERRET_VERSION = "7.21"
+FERRET_PLATFORM = "Linux 3.10.0-693.el7.x86_64 64-bit"
 FERRET_PRECISION = "double"
 NETCDF_VERSION = "4.4.1.1 of Jun 27 2017 09:17:01 $"
 FERRET_MEMORY = "25.6"
@@ -10534,8 +10535,8 @@ show symbol/all
 PPL$XPIXEL = "0"
 PPL$YPIXEL = "0"
 BYTEORDER = "LITTLE"
-FERRET_VERSION = "7.2"
-FERRET_PLATFORM = "Linux 3.10.0-514.26.2.el7.x86_64 64-bit"
+FERRET_VERSION = "7.21"
+FERRET_PLATFORM = "Linux 3.10.0-693.el7.x86_64 64-bit"
 FERRET_PRECISION = "double"
 NETCDF_VERSION = "4.4.1.1 of Jun 27 2017 09:17:01 $"
 FERRET_MEMORY = "25.6"
@@ -10712,8 +10713,8 @@ show symbols/all
 PPL$XPIXEL = "0"
 PPL$YPIXEL = "0"
 BYTEORDER = "LITTLE"
-FERRET_VERSION = "7.2"
-FERRET_PLATFORM = "Linux 3.10.0-514.26.2.el7.x86_64 64-bit"
+FERRET_VERSION = "7.21"
+FERRET_PLATFORM = "Linux 3.10.0-693.el7.x86_64 64-bit"
 FERRET_PRECISION = "double"
 NETCDF_VERSION = "4.4.1.1 of Jun 27 2017 09:17:01 $"
 FERRET_MEMORY = "25.6"
@@ -48479,7 +48480,7 @@ list element_index_str_n (axy[k=1:2,j=1:2], {"a10", "a2", "d4", "c5"})
  
 ! ferret version
 sh sym FERRET_VERSION
-FERRET_VERSION = "7.2"
+FERRET_VERSION = "7.21"
  
 ! history attribute
 let a = 12
@@ -48497,7 +48498,7 @@ LAB1 = "X : 0.5 to 314.5"
  
 ! show commands without an argument, lists version number at the top
 sho command
- Commands in Program FERRET  version7.2:
+ Commands in Program FERRET  version7.21:
  SET
  SET WINDOW/SIZE/NEW/LOCATION/ASPECT/CLEAR/TITLE
  SET REGION/I/J/K/L/M/N/X/Y/Z/T/E/F/DX/DY/DZ/DT/DE/DF/DI/DJ/DK/DL/DM/DN
@@ -53103,7 +53104,7 @@ sho dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (PSXT91_108)           DOUBLE    units           CHAR        12   T       degrees_east
@@ -53152,7 +53153,7 @@ sho dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (PSXT91_108)           DOUBLE    units           CHAR        12   T       degrees_east
@@ -54795,6 +54796,7 @@ ADD_9(A,B,C,D,E,F,G,H,I)
 APPENDE(ENS,VAR)
 AVET(A)
 DATES(Offsets)
+EARTH_DISTANCE(longitude,latitude)
 EFSTRINGS(--)
 FACTORIAL(A)
 FFT_AMP(A)
@@ -61647,11 +61649,11 @@ save/file=nc4_deflate4_defaultchunk.nc/clobber/ncformat=4/deflate/shuffle sst
 sp stat nc4_nodeflate3.nc --printf="Bytes: %s\n"
 Bytes: 197508
 sp stat nc4_deflate4bigchunk.nc --printf="Bytes: %s\n"
-Bytes: 125620
+Bytes: 125621
 sp stat nc4_deflate4_xyt.nc --printf="Bytes: %s\n"
-Bytes: 125234
+Bytes: 125235
 sp stat nc4_deflate4_defaultchunk.nc --printf="Bytes: %s\n"
-Bytes: 119299
+Bytes: 119300
  
 ! Write variable as INT
 CAN DAT/all; can var/all; can mem/all
@@ -61668,9 +61670,9 @@ save/clobber/shuffle=1/file=nc4_inttemp_shuffle_set_list_deflate_chunk.nc temp
 sp stat nc4_inttemp_classic.nc --printf="Bytes: %s\n"
 Bytes: 60548
 sp stat nc4_inttemp_set_list_deflate_chunk.nc --printf="Bytes: %s\n"
-Bytes: 32888
+Bytes: 32889
 sp stat nc4_inttemp_shuffle_set_list_deflate_chunk.nc --printf="Bytes: %s\n"
-Bytes: 33103
+Bytes: 33104
  
 cancel list/all
 set list/ncformat=classic
@@ -62824,8 +62826,8 @@ list contents
              VARIABLE : { SPAWN:"cat redirect_journal.txt" }
              SUBSET   : 45 points (X)
  1    /  1:" ! NOAA/PMEL TMAP"                                                          
- 2    /  2:" ! FERRET v7.2 (beta/debug)"                                                
- 3    /  3:" ! Linux 3.10.0-514.26.2.el7.x86_64 64-bit - MM-DD-YY"                      
+ 2    /  2:" ! FERRET v7.21 (beta/debug)"                                               
+ 3    /  3:" ! Linux 3.10.0-693.el7.x86_64 64-bit - MM-DD-YY"                           
  4    /  4:" ! DD-MON-YY HH:MM     "                                                    
  5    /  5:""                                                                           
  6    /  6:"! "                                                                         
@@ -71178,7 +71180,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71236,7 +71238,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71284,7 +71286,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71332,7 +71334,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71372,7 +71374,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71413,7 +71415,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71483,7 +71485,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71536,7 +71538,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71600,7 +71602,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71644,7 +71646,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71688,7 +71690,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71732,7 +71734,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -71773,7 +71775,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -72004,7 +72006,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        FLOAT     units           CHAR        12   T       degrees_east
@@ -72045,7 +72047,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        FLOAT     units           CHAR        12   T       degrees_east
@@ -72096,7 +72098,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (COADSX140_140)        DOUBLE    units           CHAR        12   T       degrees_east
@@ -72144,7 +72146,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (MYHOURS1)             DOUBLE    units           CHAR        31   T       hours since 1901-01-15 00:00:00
@@ -72170,7 +72172,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (MYHOURS1)             INT       units           CHAR        31   T       hours since 1901-01-15 00:00:00
@@ -72196,7 +72198,7 @@ use mytype.nc; sh dat/att mytype.nc; can data mytype
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (MYHOURS1)             DOUBLE    units           CHAR        31   T       hours since 1901-01-15 00:00:00
@@ -72636,7 +72638,7 @@ variables:
 		A:history = "From coads_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -72665,7 +72667,7 @@ variables:
 		E410:history = "From coads_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -72716,7 +72718,7 @@ variables:
 		E410:history = "From coads_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -73293,7 +73295,7 @@ variables:
 
 // global attributes:
 		:history = "WKD MON DD HH:MM:SS YYYY: ncks -h -A -h z1.nc append_to_this.nc\n",
-			"FERRET V7.2  DD-MON-YY" ;
+			"FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 		:NCO = "4.4.4" ;
 }
@@ -73324,7 +73326,7 @@ variables:
 		AVAR:long_name = "X[GX=XIRREG]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -73355,7 +73357,7 @@ variables:
 		AVAR:long_name = "X[GX=XIRREG]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -73418,7 +73420,7 @@ variables:
 		A:history = "From coads" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -73446,7 +73448,7 @@ variables:
 		A:history = "From coads" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -75153,7 +75155,7 @@ variables:
 		LABELS:history = "From http://dunkel.pmel.noaa.gov:8930/thredds/dodsC/data/atmos3.ncml" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -75176,7 +75178,7 @@ variables:
 		STRVAR:long_name = "mystrings" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -75395,7 +75397,7 @@ variables:
 		B:history = "From b" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -75425,7 +75427,7 @@ variables:
 		A:history = "From a" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -75446,7 +75448,7 @@ variables:
 		B:history = "From b" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -75467,7 +75469,7 @@ variables:
 		B:history = "From b" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -75489,7 +75491,7 @@ variables:
 		B:history = "From b" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -75902,7 +75904,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (x_in_meters)          DOUBLE    units           CHAR        6    T       meters
@@ -75919,7 +75921,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (x_in_meters)          DOUBLE    units           CHAR        6    T       meters
@@ -75936,7 +75938,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (x_in_meters)          DOUBLE    units           CHAR        6    T       meters
@@ -77177,7 +77179,7 @@ variables:
 		:geospatial_lat_max = 29.07 ;
 		:time_coverage_start = "2006-06-10T23:48:00Z" ;
 		:time_converage_end = "2006-06-11T00:12:00Z" ;
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 }
  
 set mode/last upcase
@@ -77270,7 +77272,7 @@ variables:
 		lon360:history = "added to test_save_dsg.nc" ;
 
 // global attributes:
-		:history = "CruiseDsgNcFile 1.0FERRET V7.2  DD-MON-YY" ;
+		:history = "CruiseDsgNcFile 1.0FERRET V7.21  DD-MON-YY" ;
 		:featureType = "Trajectory" ;
 		:Conventions = "Some other conventionsCF-1.6" ;
 		:geospatial_lon_min = -92.77 ;
@@ -77297,7 +77299,7 @@ can dat/all; use anew_global.nc
 sh att .
      attributes for dataset: ./anew_global.nc
  ..history = Subset of etopo20,
- FERRET V7.2  DD-MON-YY 
+ FERRET V7.21  DD-MON-YY 
  ..Conventions = Existing conventions note, , CF-1.6 
  
  
@@ -77327,7 +77329,7 @@ can dat/all; use conventions_history
 ! The new attibutes
 sh att .
      attributes for dataset: ./conventions_history.nc
- ..history = The history of the fileFERRET V7.2  DD-MON-YY 
+ ..history = The history of the fileFERRET V7.21  DD-MON-YY 
  ..Conventions = Conventions for variables named V2CF-1.6 
 *** Running ferret script: bn_center_key_labels.jnl
 ! bn_center_key_labels
@@ -86051,7 +86053,7 @@ variables:
 		var:long_name = "0*TT + X[GX=XAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -86953,7 +86955,7 @@ variables:
 		TEMP:history = "From /home/data/socat/socatV3/11SS/11SS20140225.nc" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -91747,7 +91749,7 @@ SHOW DATA/ATT t_f04_e3_1v ! note atts im_everwhere vs im_not_everwhere
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (XAX)                  DOUBLE    units           CHAR        12   T       degrees_east
@@ -92231,7 +92233,7 @@ save/clobber/file=a.nc/outtype=float elev[d=1]
 use a.nc
 sh att .
      attributes for dataset: ./a.nc
- ..history = FERRET V7.2  DD-MON-YY 
+ ..history = FERRET V7.21  DD-MON-YY 
  ..Conventions = CF-1.6 
  ..dt_internal = 15
 sh att elev
@@ -92252,7 +92254,7 @@ save/clobber/file=a.nc/outtype=float elev[d=1]
 use a.nc
 sh att .
      attributes for dataset: ./a.nc
- ..history = FERRET V7.2  DD-MON-YY 
+ ..history = FERRET V7.21  DD-MON-YY 
  ..Conventions = CF-1.6 
 sh att elev
      attributes for dataset: ./a.nc
@@ -94385,7 +94387,7 @@ sho command/brief v
  
 ! All the commands, no subcommands, no qualifiers
 SHOW COMMAND/BRIEF
- Commands in Program FERRET  version7.2:
+ Commands in Program FERRET  version7.21:
  SET
  SHOW
  CANCEL
@@ -96075,7 +96077,7 @@ variables:
 		VAR:long_name = "X[GX=XLON]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 go bn_reset
@@ -96134,7 +96136,7 @@ variables:
 		VAR:history = "From a1" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -96181,7 +96183,7 @@ variables:
 		VAR:history = "From a1" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -97331,7 +97333,7 @@ variables:
 		abc:history = "From abc.dat" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -97418,7 +97420,7 @@ variables:
 		latitude:history = "From bn_delimited_read_1.dat" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -98107,7 +98109,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (TAXIS1)               DOUBLE    axis            CHAR        1    T       T
@@ -98176,7 +98178,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (TAXIS1)               DOUBLE    axis            CHAR        1    T       T
@@ -98247,7 +98249,7 @@ sh dat/att
  Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
 ------------------------------------------------------------------------------------------
   
- .                               history         CHAR        22   T       FERRET V7.2  DD-MON-YY
+ .                               history         CHAR        23   T       FERRET V7.21  DD-MON-YY
                                  Conventions     CHAR        6    F       CF-1.6
   
 (TAXIS1)               DOUBLE    axis            CHAR        1    T       T
@@ -98656,7 +98658,7 @@ variables:
 		VART:long_name = "RESHAPE(VAR, T[GT=TAX])" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -99063,7 +99065,7 @@ variables:
 		uave:history = "From 6dfile" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -99113,7 +99115,7 @@ variables:
 		uave:history = "From 6dfile" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -99160,7 +99162,7 @@ variables:
 		uave:history = "From 6dfile" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -99316,7 +99318,7 @@ variables:
 		BIN:history = "From shorttest.dat" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
  
@@ -103258,6 +103260,148 @@ list b2d[gf=aline_edges at iin]
  8    /  9:  16.00  24.00
  9    / 10:  18.00  27.00
  10   / 11:  20.00  30.00
+*** Running ferret script: bn721_bug_fixes.jnl
+! bn721_bug_fixes.jnl
+! test various fixes that went into version 7.21
+! 7/17 *acm*
+!
+ 
+GO bn_reset
+cancel mode verify
+ooooooooooooooooooooooooooooooooooooooooooo
+GO err72_atts_as_vars
+! err72_atts_as_vars.jnl
+! See ticket 2555.  Allocation of pointers for these strings
+ 
+use coads_climatology
+list sst.attnames[i=1]
+             VARIABLE : SST.ATTNAMES[I=1]
+             FILENAME : coads_climatology.cdf
+             X        : 1
+        "missing_value"
+ 
+use coads_climatology
+let allatts = sst.attnames
+let natts = sst.nattrs
+ repeat/range=1:`natts`/name=m (let attname = allatts[i=`m`]; list attname)
+ !-> repeat/range=1:5/name=m (let attname = allatts[i=`m`]; list attname)
+!-> REPEAT: M:1
+ !-> DEFINE VARIABLE attname = allatts[i=1]
+             VARIABLE : ALLATTS[I=1]
+             FILENAME : coads_climatology.cdf
+             X        : 1
+        "missing_value"
+!-> REPEAT: M:2
+ !-> DEFINE VARIABLE attname = allatts[i=2]
+             VARIABLE : ALLATTS[I=2]
+             FILENAME : coads_climatology.cdf
+             X        : 2
+        "_FillValue"
+!-> REPEAT: M:3
+ !-> DEFINE VARIABLE attname = allatts[i=3]
+             VARIABLE : ALLATTS[I=3]
+             FILENAME : coads_climatology.cdf
+             X        : 3
+        "long_name"
+!-> REPEAT: M:4
+ !-> DEFINE VARIABLE attname = allatts[i=4]
+             VARIABLE : ALLATTS[I=4]
+             FILENAME : coads_climatology.cdf
+             X        : 4
+        "history"
+!-> REPEAT: M:5
+ !-> DEFINE VARIABLE attname = allatts[i=5]
+             VARIABLE : ALLATTS[I=5]
+             FILENAME : coads_climatology.cdf
+             X        : 5
+        "units"
+ 
+! Bug also applied to getting dimnames
+list sst.dimnames[i=2:3]
+             VARIABLE : SST.DIMNAMES[I=2:3]
+             FILENAME : coads_climatology.cdf
+             SUBSET   : 2 points (X)
+ 2   / 2:"COADSY"
+ 3   / 3:"TIME"  
+ 
+let dnames = sst.dimnames
+list dnames[i=2]
+             VARIABLE : SST.DIMNAMES
+             FILENAME : coads_climatology.cdf
+             X        : 2
+        "COADSY"
+ 
+! lots of global attributes
+use err491_attval
+list ..attnames[i=20:23]
+             VARIABLE : ..ATTNAMES[I=20:23]
+             DATA SET : K-Bay OAR3d model (200m)
+             FILENAME : err491_attval.cdf
+             SUBSET   : 4 points (X)
+ 20   / 20:"ny"   
+ 21   / 21:"x_min"
+ 22   / 22:"x_max"
+ 23   / 23:"y_min"
+ 
+ 
+let gattnames = ..attnames
+list gattnames[i=1:10]
+             VARIABLE : ..ATTNAMES
+             DATA SET : K-Bay OAR3d model (200m)
+             FILENAME : err491_attval.cdf
+             SUBSET   : 10 points (X)
+ 1    /  1:"simulation" 
+ 2    /  2:"start_date" 
+ 3    /  3:"history"    
+ 4    /  4:"option"     
+ 5    /  5:"run_mode"   
+ 6    /  6:"srfc_bndry" 
+ 7    /  7:"rad_penet"  
+ 8    /  8:"dt_external"
+ 9    /  9:"dt_internal"
+ 10   / 10:"horiz_diff" 
+ 
+list gattnames[i=1:24:2]
+             VARIABLE : ..ATTNAMES
+                        regrid: 2 delta on X
+             DATA SET : K-Bay OAR3d model (200m)
+             FILENAME : err491_attval.cdf
+             SUBSET   : 12 points (X)
+ 1    /  1:"simulation" 
+ 3    /  2:"history"    
+ 5    /  3:"run_mode"   
+ 7    /  4:"rad_penet"  
+ 9    /  5:"dt_internal"
+ 11   /  6:"inv_prandtl"
+ 13   /  7:"title"      
+ 15   /  8:"remark"     
+ 17   /  9:"y_units"    
+ 19   / 10:"nx"         
+ 21   / 11:"x_min"      
+ 23   / 12:"y_min"      
+ 
+GO bn_reset
+cancel mode verify
+ooooooooooooooooooooooooooooooooooooooooooo
+GO err72_sum_in_x
+! err72_sum_in_x.jnl
+! ticket 2560, sum in X direcgtion when result is 0
+! returne a missing-value
+ 
+! Previously this result was missing
+let var = {-1,1,0}
+list var[x=@sum]
+             VARIABLE : {-1,1,0}
+             X        : 0.5 to 3.5 (summed)
+          0.0000
+ 
+! This was correct, 0
+let yvar = ysequence(var)
+list yvar[j=@sum]
+             VARIABLE : YSEQUENCE(VAR)
+             Y        : 0.5 to 3.5 (summed)
+          0.0000
+ 
 *** Running ferret script: bn_gif.jnl
 ! bn450_gif.JNL - copied from bn450_plot.jnl
 ! this journal file only tests the writing of gif file in batch mode using
@@ -104856,8 +105000,8 @@ exit/command
 PPL$XPIXEL = "0"
 PPL$YPIXEL = "0"
 BYTEORDER = "LITTLE"
-FERRET_VERSION = "7.2"
-FERRET_PLATFORM = "Linux 3.10.0-514.26.2.el7.x86_64 64-bit"
+FERRET_VERSION = "7.21"
+FERRET_PLATFORM = "Linux 3.10.0-693.el7.x86_64 64-bit"
 FERRET_PRECISION = "double"
 NETCDF_VERSION = "4.4.1.1 of Jun 27 2017 09:17:01 $"
 FERRET_MEMORY = "31"
diff --git a/bench/test_results/ferret_run_tests_ncdump b/bench/test_results/ferret_run_tests_ncdump
index e5fb27b..19a64ec 100644
--- a/bench/test_results/ferret_run_tests_ncdump
+++ b/bench/test_results/ferret_run_tests_ncdump
@@ -51,7 +51,7 @@ variables:
 		MY_VAR:long_name = "T[GT=T5]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -76,7 +76,7 @@ variables:
 		MY_VAR:long_name = "T[GT=T5]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -113,7 +113,7 @@ variables:
 		B:long_name = "\"one line of text\"" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -152,7 +152,7 @@ variables:
 		D:history = "From test_string" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -187,7 +187,7 @@ variables:
 		B:long_name = "SAMPLEJ(YSEQUENCE({\"a\",\"b\",,\"d\",\"e\",\"f\"}),{2,,1})" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -257,7 +257,7 @@ variables:
 		V:long_name = "T[GT=MONTH_IRREG]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -314,7 +314,7 @@ variables:
 		V:history = "From coads_vwnd" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -371,7 +371,7 @@ variables:
 		V:history = "From coads_vwnd" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -426,7 +426,7 @@ variables:
 		T2:long_name = "Z[GZ=ZIRR]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -474,7 +474,7 @@ variables:
 		V:history = "From coads_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -568,7 +568,7 @@ variables:
 		SST:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -638,7 +638,7 @@ variables:
 		SST:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -689,7 +689,7 @@ variables:
 		V:long_name = "X[GX=XAX] +Z[GZ=ZAX] + T[GT=TAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -780,7 +780,7 @@ variables:
 		A:long_name = "T[GT=TIME]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -807,7 +807,7 @@ variables:
 		X_:long_name_mod = "axis ABSTRACT" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 		:title = "a long title longer than 80 characters a123456789b123456789c123456789d123456789e123456789f123456789g123456789h123456789" ;
 data:
@@ -831,7 +831,7 @@ variables:
 		A:history = "From x" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 		:title = "a long title, longer than the previous limit of 80 characters.  Previously various buffers were set to 80, and storage in ds_title was also too short." ;
 data:
@@ -858,14 +858,14 @@ variables:
 		A:history = "From t0_cdc" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 *** Running ferret script: bn_tab_comma_multivar.jnl
 *** Running ferret script: bn_element_functions.jnl
 *** Running ferret script: bn_long_revision_num.jnl
 bn_long_revision_num.jnl --- history attribute
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 *** Running ferret script: bn_window_title.jnl
 *** Running ferret script: bn_last_error.jnl
 *** Running ferret script: bn_deg_min.jnl
@@ -901,7 +901,7 @@ variables:
 		V:long_name = "X[GX=XAX] +Z[GZ=ZAX] + T[GT=TAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -974,7 +974,7 @@ variables:
 		VAR_B:long_name = "my strings" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1018,7 +1018,7 @@ variables:
 		SST:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1060,7 +1060,7 @@ variables:
 		SST:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1168,7 +1168,7 @@ variables:
 		ELEV:history = "From err491_attval" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 6 after CANCEL MODE upcase_output
@@ -1209,7 +1209,7 @@ variables:
 		Elev:history = "From err491_attval" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 7 outtput flags to control attribute output
@@ -1232,7 +1232,7 @@ variables:
 		BB:another_attr = 6.f ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1258,7 +1258,7 @@ variables:
 		BB:another_attr = 6.f ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1278,7 +1278,7 @@ variables:
 		BB:long_name = "{3,4.5,6,7,4}" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1299,7 +1299,7 @@ variables:
 		BB:long_name = "{3,4.5,6,7,4}" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1342,7 +1342,7 @@ variables:
 		TEMP:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 12 Check that settings hold for child axis.
@@ -1382,7 +1382,7 @@ variables:
 		TEMP:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 13 cancel output of attributes of the variable.
@@ -1420,7 +1420,7 @@ variables:
 		TEMP:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 14 attributes of data from ez data.
@@ -1449,7 +1449,7 @@ variables:
 		A3:history = "From EZ.DAT" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1482,7 +1482,7 @@ variables:
 		V4:history = "From EZ.DAT" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1508,7 +1508,7 @@ variables:
 		A:four = "theory" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1554,7 +1554,7 @@ variables:
 		ELEV:history = "From err491_attval" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 		:simulation = "K-Bay OAR3d model (200m)" ;
 		:start_date = "980105000000" ;
@@ -1661,7 +1661,7 @@ variables:
 		TEMP:units = "deg. C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 		:dt_internal = 15. ;
 }
@@ -1703,7 +1703,7 @@ variables:
 		ELEV:history = "From err491_attval" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1786,7 +1786,7 @@ variables:
 		RIGUE:history = "From test0" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1823,7 +1823,7 @@ variables:
 		B:long_name = "hello" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1863,7 +1863,7 @@ variables:
 		VWND:units = "M/S" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1914,7 +1914,7 @@ variables:
 		T2:history = "From coads_vwnd" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -1973,7 +1973,7 @@ variables:
 		T2:history = "From gt4d011" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -2018,7 +2018,7 @@ variables:
 		T2:history = "From gt4d011" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -2061,7 +2061,7 @@ variables:
 		T2:history = "From gt4d011" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -2096,7 +2096,7 @@ variables:
 		TEMP:units = "DEG C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -2130,7 +2130,7 @@ variables:
 		TWO:history = "From levitus_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 27 attributes of  user-defined axes
@@ -2160,7 +2160,7 @@ variables:
 		AXY:long_name = "RESHAPE (A,RVAR)" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- 28 Define a new global attribute
@@ -2189,7 +2189,7 @@ variables:
 		BROILED:history = "From test0" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 		:glob = "Global attribute" ;
 		:FERRET_comment = "File written via LAS. Attributes are inherited from originating dataset" ;
@@ -2250,7 +2250,7 @@ variables:
 		FAREN:history = "From gt4d011" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -2295,7 +2295,7 @@ variables:
 		FAREN:history = "From gt4d011" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 *** Running ferret script: bn_transforms.jnl
@@ -2336,7 +2336,7 @@ variables:
 		A:long_name = "X[GX=XAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -2366,7 +2366,7 @@ variables:
 		A:long_name = "X[GX=XAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -2396,7 +2396,7 @@ variables:
 		A:long_name = "X[GX=XAX]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -2449,7 +2449,7 @@ variables:
 		TEMP:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -2491,7 +2491,7 @@ variables:
 		TEMP:units = "Deg C" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -2509,7 +2509,7 @@ variables:
 		V:long_name = "Y[GY=YAXIS]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 *** Running ferret script: bn_no_valid_on_plot.jnl
@@ -2531,7 +2531,7 @@ variables:
 		MY_ASC:history = "From dat.dat" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -2549,7 +2549,7 @@ variables:
 		MY_UNF:history = "From unf.dat" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_attributes.jnl --- SET VAR/OUTTYPE for user variable
@@ -2566,7 +2566,7 @@ variables:
 		A:long_name = "{1.1,2.2,3.3}" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -2587,7 +2587,7 @@ variables:
 		A:long_name = "{ 3.77, 4.00, 4.10, 4.33, 4.38, 4.27, 4.31, 4.40, 4.75, 5.01, 5.27, 5.52}" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -2658,7 +2658,7 @@ variables:
 		newvar:history = "From a" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 *** Running ferret script: bn_cdf_keepax.jnl
@@ -2687,7 +2687,7 @@ variables:
 		A:long_name = "X[GX=X100] + T[GT=T31]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_keep_axisnames.jnl --- without /KEEP_AXISNAMES
@@ -2714,7 +2714,7 @@ variables:
 		A:long_name = "X[GX=X100] + T[GT=T31]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 *** Running ferret script: bn_key_label_minmax.jnl
@@ -2819,7 +2819,7 @@ variables:
 		ZUP:long_name = "Z[GZ=ZAXUP]" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_axis_cf.jnl, Convert forms of DEG, degrees to degrees_east:
@@ -2851,7 +2851,7 @@ variables:
 		Y_:long_name_mod = "axis YFIFTEEN" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 bn_axis_cf.jnl, Downcase units, e.g. in time axis DAYS since
@@ -2884,7 +2884,7 @@ variables:
 		XYTVAR:history = "From bn_strides" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 *** Running ferret script: bn_repeated_coords.jnl
@@ -2961,7 +2961,7 @@ variables:
 		TIME:history = "From http://tds.climatedatacloud.com/thredds/dodsC/ensembles/nmme_gfdl/TwoD" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -2999,7 +2999,7 @@ variables:
 		time:history = "From http://tds.climatedatacloud.com/thredds/dodsC/ensembles/nmme_gfdl/TwoD" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 data:
 
@@ -3051,7 +3051,7 @@ variables:
 		MYVAR:history = "From coads_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 netcdf a {
@@ -3065,7 +3065,7 @@ variables:
 		MYVAR:history = "From levitus_climatology" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 }
 *** Running ferret script: bn_list_clim_axes.jnl
@@ -3092,6 +3092,7 @@ variables:
 *** Running ferret script: bn_cache_management.jnl
 *** Running ferret script: bn_transp_choose.jnl
 *** Running ferret script: bn_iin_regrid.jnl
+*** Running ferret script: bn721_bug_fixes.jnl
 *** Running ferret script: bn_gif.jnl
 *** Running ferret script: bn_ps.jnl
 *** Running ferret script: bn_all_ef.jnl
@@ -3750,7 +3751,7 @@ variables:
 		tmonth:history = "added to /home/data/socat/socatV3/492C/492C19881104.nc" ;
 
 // global attributes:
-		:history = "FERRET V7.2  DD-MON-YY" ;
+		:history = "FERRET V7.21  DD-MON-YY" ;
 		:Conventions = "CF-1.6" ;
 		:featureType = "Trajectory" ;
 		:decimation = "218 original number of obs. Piecewise decimated to 23 obs using tolerances: lon 1, lat 1, fco2_rec 4" ;
diff --git a/bench/test_results/forecast_actual.gif b/bench/test_results/forecast_actual.gif
index d8501e9..346def1 100644
Binary files a/bench/test_results/forecast_actual.gif and b/bench/test_results/forecast_actual.gif differ
diff --git a/bench/test_results/forecast_diagview.gif b/bench/test_results/forecast_diagview.gif
index 689410b..15b03fd 100644
Binary files a/bench/test_results/forecast_diagview.gif and b/bench/test_results/forecast_diagview.gif differ
diff --git a/bench/test_results/forecast_leadview.gif b/bench/test_results/forecast_leadview.gif
index 483c616..982f87d 100644
Binary files a/bench/test_results/forecast_leadview.gif and b/bench/test_results/forecast_leadview.gif differ
diff --git a/bench/test_results/legend_1d_plots.gif b/bench/test_results/legend_1d_plots.gif
index 0b6f71b..bfed9a8 100644
Binary files a/bench/test_results/legend_1d_plots.gif and b/bench/test_results/legend_1d_plots.gif differ
diff --git a/bench/test_results/lon_lat_label_controls.gif b/bench/test_results/lon_lat_label_controls.gif
index 1b610ec..90e86d2 100644
Binary files a/bench/test_results/lon_lat_label_controls.gif and b/bench/test_results/lon_lat_label_controls.gif differ
diff --git a/bench/test_results/testbackground.gif b/bench/test_results/testbackground.gif
index 2a63d55..ee9ab0e 100644
Binary files a/bench/test_results/testbackground.gif and b/bench/test_results/testbackground.gif differ
diff --git a/bench/test_results/vs_lon_over.gif b/bench/test_results/vs_lon_over.gif
index 30eb216..29caa80 100644
Binary files a/bench/test_results/vs_lon_over.gif and b/bench/test_results/vs_lon_over.gif differ
diff --git a/external_functions/cflib/curv_to_lonlat_from_weights.c b/external_functions/cflib/curv_to_lonlat_from_weights.c
index 308ebe5..f8ea23a 100644
--- a/external_functions/cflib/curv_to_lonlat_from_weights.c
+++ b/external_functions/cflib/curv_to_lonlat_from_weights.c
@@ -61,10 +61,10 @@ static size_t count1[D2D] = {336,896};
 
   const char *dimnames[] = {"nj", "ni"};
 
-  clat = ( double* )malloc( nvertex * sizeof( double ));
-  clon = ( double* )malloc( nvertex * sizeof( double ));
-  data = ( double* )malloc( nvertex * sizeof( double ));
-  imask = ( int* )malloc( nvertex * sizeof( int ));
+  clat = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  clon = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  data = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  imask = ( int* )FerMem_Malloc(nvertex * sizeof(int), __FILE__, __LINE__);
 
     if((status = nc_open( filename, NC_NOWRITE, &ncid )))
        ERR;
@@ -118,10 +118,10 @@ static size_t count1[D2D] = {336,896};
   if ((status = nccf_set_data_double(*dataId, data, save, 
 					    NC_FILL_DOUBLE))) ERR;
 
-  free(clat);
-  free(clon);
-  free(data);
-  free(imask);
+  FerMem_Free(clat, __FILE__, __LINE__);
+  FerMem_Free(clon, __FILE__, __LINE__);
+  FerMem_Free(data, __FILE__, __LINE__);
+  FerMem_Free(imask, __FILE__, __LINE__);
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -143,9 +143,9 @@ createLonLat(const double xymin[], const double xymax[],
 
   const char *dimnames[] = {"nj", "ni"};
 
-  clat = ( double* )malloc( nvertex * sizeof( double ));
-  clon = ( double* )malloc( nvertex * sizeof( double ));
-  data = ( double* )malloc( nvertex * sizeof( double ));
+  clat = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  clon = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  data = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
 
   for (i = 0; i < ndims; ++i) {
     dxs[i] = (xymax[i] - xymin[i]) / (dims[i] - 1);
@@ -171,9 +171,9 @@ createLonLat(const double xymin[], const double xymax[],
   if ((status = nccf_set_data_double(*dataId, data, save, 
 					    NC_FILL_DOUBLE))) ERR;
 
-  free(clat);
-  free(clon);
-  free(data);
+  FerMem_Free(clat, __FILE__, __LINE__);
+  FerMem_Free(clon, __FILE__, __LINE__);
+  FerMem_Free(data, __FILE__, __LINE__);
 }
 
 //////////////////////////////////////////////////////////////////////
diff --git a/external_functions/cflib/curv_to_lonlat_regrid.c b/external_functions/cflib/curv_to_lonlat_regrid.c
index 4cb5077..9937dd4 100644
--- a/external_functions/cflib/curv_to_lonlat_regrid.c
+++ b/external_functions/cflib/curv_to_lonlat_regrid.c
@@ -60,10 +60,10 @@ static size_t count1[D2D] = {336,896};
 
   const char *dimnames[] = {"nj", "ni"};
 
-  clat = ( double* )malloc( nvertex * sizeof( double ));
-  clon = ( double* )malloc( nvertex * sizeof( double ));
-  data = ( double* )malloc( nvertex * sizeof( double ));
-  imask = ( int* )malloc( nvertex * sizeof( int ));
+  clat = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  clon = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  data = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  imask = ( int* )FerMem_Malloc(nvertex * sizeof(int), __FILE__, __LINE__);
 
     if((status = nc_open( filename, NC_NOWRITE, &ncid ))) ERR;
 
@@ -108,10 +108,10 @@ static size_t count1[D2D] = {336,896};
   if ((status = nccf_set_data_double(*dataId, data, save, 
 					    NC_FILL_DOUBLE))) ERR;
 
-  free(clat);
-  free(clon);
-  free(data);
-  free(imask);
+  FerMem_Free(clat, __FILE__, __LINE__);
+  FerMem_Free(clon, __FILE__, __LINE__);
+  FerMem_Free(data, __FILE__, __LINE__);
+  FerMem_Free(imask, __FILE__, __LINE__);
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -133,9 +133,9 @@ createLonLat(const double xymin[], const double xymax[],
 
   const char *dimnames[] = {"nj", "ni"};
 
-  clat = ( double* )malloc( nvertex * sizeof( double ));
-  clon = ( double* )malloc( nvertex * sizeof( double ));
-  data = ( double* )malloc( nvertex * sizeof( double ));
+  clat = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  clon = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  data = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
 
   for (i = 0; i < ndims; ++i) {
     dxs[i] = (xymax[i] - xymin[i]) / (dims[i] - 1);
@@ -163,9 +163,9 @@ createLonLat(const double xymin[], const double xymax[],
   if ((status = nccf_set_data_double(*dataId, data, save, 
 					    NC_FILL_DOUBLE))) ERR;
 
-  free(clat);
-  free(clon);
-  free(data);
+  FerMem_Free(clat, __FILE__, __LINE__);
+  FerMem_Free(clon, __FILE__, __LINE__);
+  FerMem_Free(data, __FILE__, __LINE__);
 }
 
 //////////////////////////////////////////////////////////////////////
diff --git a/external_functions/cflib/fcn_curv_to_lonlat.c b/external_functions/cflib/fcn_curv_to_lonlat.c
index d3a5735..234a895 100644
--- a/external_functions/cflib/fcn_curv_to_lonlat.c
+++ b/external_functions/cflib/fcn_curv_to_lonlat.c
@@ -66,10 +66,10 @@ readCurvi(const char *filename, const char *datavar,
   ny = dimsizes[ndims-2];
   nvertex = nx*ny;
 
-  clat = ( double* )malloc( nvertex * sizeof( double ));
-  clon = ( double* )malloc( nvertex * sizeof( double ));
-  data = ( double* )malloc( nvertex * sizeof( double ));
-  imask = ( int* )malloc( nvertex * sizeof( int ));
+  clat = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  clon = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  data = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  imask = ( int* )FerMem_Malloc(nvertex * sizeof(int), __FILE__, __LINE__);
 
   for (i = 0; i < 4; ++i) {
     start[i] = 0;
@@ -119,10 +119,10 @@ readCurvi(const char *filename, const char *datavar,
   if ((status = nccf_set_data_double(*dataId, data, save, 
 					    NC_FILL_DOUBLE))) ERR;
 
-  free(clat);
-  free(clon);
-  free(data);
-  free(imask);
+  FerMem_Free(clat, __FILE__, __LINE__);
+  FerMem_Free(clon, __FILE__, __LINE__);
+  FerMem_Free(data, __FILE__, __LINE__);
+  FerMem_Free(imask, __FILE__, __LINE__);
 }
 
 //////////////////////////////////////////////////////////////////////
@@ -144,9 +144,9 @@ createLonLat(const double xymin[], const double xymax[],
 
   const char *dimnames[] = {"nj", "ni"};
 
-  clat = ( double* )malloc( nvertex * sizeof( double ));
-  clon = ( double* )malloc( nvertex * sizeof( double ));
-  data = ( double* )malloc( nvertex * sizeof( double ));
+  clat = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  clon = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
+  data = ( double* )FerMem_Malloc(nvertex * sizeof(double), __FILE__, __LINE__);
 
   for (i = 0; i < nhoriz; ++i) {
     dxs[i] = (xymax[i] - xymin[i]) / (dims[i] - 1);
@@ -174,9 +174,9 @@ createLonLat(const double xymin[], const double xymax[],
   if ((status = nccf_set_data_double(*dataId, data, save, 
 					    NC_FILL_DOUBLE))) ERR;
 
-  free(clat);
-  free(clon);
-  free(data);
+  FerMem_Free(clat, __FILE__, __LINE__);
+  FerMem_Free(clon, __FILE__, __LINE__);
+  FerMem_Free(data, __FILE__, __LINE__);
 }
 
 //////////////////////////////////////////////////////////////////////
diff --git a/external_functions/contributed/pco2.F b/external_functions/contributed/pco2.F
index f914ce6..7d40cf3 100644
--- a/external_functions/contributed/pco2.F
+++ b/external_functions/contributed/pco2.F
@@ -200,9 +200,9 @@ c_ RCS lines preceded by "c_ "
 c_ ---------------------------------------------------------------------
 c_
 c_ $Source$ 
-c_ $Revision: 11439 $
-c_ $Date: 2010-11-08 11:39:30 -0800 (Mon, 08 Nov 2010) $   ;  $State$
-c_ $Author: ksmith $ ;  $Locker$
+c_ $Revision$
+c_ $Date$   ;  $State$
+c_ $Author$ ;  $Locker$
 c_
 c_ ---------------------------------------------------------------------
 c_ $Log$
@@ -561,9 +561,9 @@ c_ RCS lines preceded by "c_ "
 c_ ---------------------------------------------------------------------
 c_
 c_ $Source$
-c_ $Revision: 11439 $
-c_ $Date: 2010-11-08 11:39:30 -0800 (Mon, 08 Nov 2010) $   ;  $State$
-c_ $Author: ksmith $ ;  $Locker$
+c_ $Revision$
+c_ $Date$   ;  $State$
+c_ $Author$ ;  $Locker$
 c_
 c_ ---------------------------------------------------------------------
 c_ $Log$
@@ -654,9 +654,9 @@ c_ RCS lines preceded by "c_ "
 c_ ---------------------------------------------------------------------
 c_
 c_ $Source$
-c_ $Revision: 11439 $
-c_ $Date: 2010-11-08 11:39:30 -0800 (Mon, 08 Nov 2010) $   ;  $State$
-c_ $Author: ksmith $ ;  $Locker$
+c_ $Revision$
+c_ $Date$   ;  $State$
+c_ $Author$ ;  $Locker$
 c_
 c_ ---------------------------------------------------------------------
 c_ $Log$
diff --git a/external_functions/ef_utility/platform_specific.mk.i386-apple-darwin b/external_functions/ef_utility/platform_specific.mk.i386-apple-darwin
deleted file mode 100644
index e549c7a..0000000
--- a/external_functions/ef_utility/platform_specific.mk.i386-apple-darwin
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# platform_specific_includes.mk.i386-linux
-#
-# This file is included in the External Function Makefiles and defines
-# platform specific macros
-# ACM 2/2001 debug flags
-
-INCLUDES        = -I. -I../ef_utility -I../ef_utility/ferret_cmn
-
-CCSHFLAG        =
-CC              = gcc
-RANLIB          = /usr/bin/ranlib
-CFLAGS          = -fPIC -Dlint -DVOID_SIGHANDLER -D_POSIX_VERSION -DFULL_GUI_VERSION -O2 -DX_REFRESH -DXT_CODE $(INCLUDES)
-FC              = gfortran 
-F77		= gfortran
-F77SHFLAG       = 
-FFLAGS          = -fPIC -Dunix -Dgfortran -fno-second-underscore -fno-backslash -fdollar-ok -ffixed-line-length-132 \
-		  -fdefault-real-8 -fdefault-double-8 $(INCLUDES)
-LD		= gcc
-LD_DYN_FLAGS    = -dynamiclib -Wl,-undefined,dynamic_lookup  
-SYSLIBS         = 
-
-CPP             = /lib/gcc
-CPP_FLAGS       = -P -traditional -Ddouble_p $(INCLUDES)
-CFLAGS_DEBUG	= -g -Ddebug
-FFLAGS_DEBUG	= -g -Ddebug
-FER_LOCAL_EXTFCNS = /usr/local/src/FERRET/external_functions/libs
-
-%.o : %.F
-	$(FC) $(FFLAGS) -c $*.F -o $*.o
-
-#.F.so:
-#	$(FC) $(FFLAGS) $(<F)
-#	$(LD) $(LD_DYN_FLAGS) $*.o -o $*.so
-
-# gcc -dynamiclib -Wl,-undefined,dynamic_lookup -o add_9.dylib add_9.o
-#    gcc -dynamiclib -Wl,-undefined,dynamic_lookup -o .so .o
diff --git a/external_functions/ef_utility/platform_specific.mk.i386-linux b/external_functions/ef_utility/platform_specific.mk.i386-linux
index 22eed40..4d54560 100644
--- a/external_functions/ef_utility/platform_specific.mk.i386-linux
+++ b/external_functions/ef_utility/platform_specific.mk.i386-linux
@@ -29,16 +29,6 @@ CPP_FLAGS	= -P -traditional -Ddouble_p $(INCLUDES)
 CFLAGS_DEBUG	= -O0 -g -Ddebug
 FFLAGS_DEBUG	= -O0 -g -fbounds-check -Ddebug
 
-## cancel the default rule for .f -> .o to prevent objects from being built
-## from .f files that are out-of-date with respect to their corresponding .F file
-#%.o : %.f
-#
-## use cpp to preprocess the .F files to .f files and then compile the .f files
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(FFLAGS) -c $*.f
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/external_functions/ef_utility/platform_specific.mk.intel-mac b/external_functions/ef_utility/platform_specific.mk.intel-mac
index f2d54d0..744ec21 100644
--- a/external_functions/ef_utility/platform_specific.mk.intel-mac
+++ b/external_functions/ef_utility/platform_specific.mk.intel-mac
@@ -7,9 +7,9 @@
 
 INCLUDES	= -I. -I../ef_utility -I../ef_utility/ferret_cmn
 
-CC		= $(shell which gcc-6)
-FC		= $(shell which gfortran-6)
-F77		= $(shell which gfortran-6)
+CC		= $(shell which gcc-7)
+FC		= $(shell which gfortran-7)
+F77		= $(shell which gfortran-7)
 AR		= $(shell which ar)
 ARFLAGS		= -cr
 RANLIB		= $(shell which ranlib)
@@ -19,7 +19,7 @@ FFLAGS		= -fPIC -O -Ddouble_p -fno-second-underscore \
 		  -fno-backslash -fdollar-ok -ffixed-line-length-132 \
 		  -fdefault-real-8 -fdefault-double-8 $(INCLUDES)
 
-LD		= $(shell which gfortran-6)
+LD		= $(shell which gfortran-7)
 LD_DYN_FLAGS	= -fPIC -bundle -undefined dynamic_lookup
 SYSLIBS		=
 
diff --git a/external_functions/ef_utility/platform_specific.mk.x86_64-darwin b/external_functions/ef_utility/platform_specific.mk.x86_64-darwin
deleted file mode 100644
index 82d9c71..0000000
--- a/external_functions/ef_utility/platform_specific.mk.x86_64-darwin
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# platform_specific_includes.mk.x86_64-darwin
-#
-# This file is included in the External Function Makefiles and defines
-# platform specific macros
-# ACM 2/2001 debug flags
-
-INCLUDES        = -I. -I$(TMAP_LOCAL)/include
-
-FINCLUDES       = -I. -I../ef_utility -I../ef_utility/ferret_cmn
-
-
-CCSHFLAG        =
-CC              = gcc
-RANLIB          = /usr/bin/ranlib
-CFLAGS          = -fPIC -arch x86_64 -c -u -O2 $(INCLUDES)
-FC              = gfortran
-F77		= gfortran
-F77SHFLAG       = -dynamiclib
-FFLAGS          = -fPIC -c -assume no2underscores -assume nobscc -zero -noautomatic -extend-source 132 -heap-arrays 10 $(FINCLUDES)
-LD		= gcc
-LD_DYN_FLAGS    = -arch x86_64 -dynamiclib -undefined dynamic_lookup
-SYSLIBS         = -lc
-
-CPP             = cpp
-CPP_FLAGS       = -P -traditional $(INCLUDES)
-CFLAGS_DEBUG	= -g -Ddebug
-FFLAGS_DEBUG	= -g -Ddebug
-FER_LOCAL_EXTFCNS = /usr/local/src/FERRET/external_functions/libs
-
-.F.so:
-	$(FC) $(FFLAGS) $(<F)
-	$(LD) $(LD_DYN_FLAGS) $*.o -o $*.so
diff --git a/external_functions/ef_utility/platform_specific.mk.x86_64-linux b/external_functions/ef_utility/platform_specific.mk.x86_64-linux
index b8522a0..fcaac3e 100644
--- a/external_functions/ef_utility/platform_specific.mk.x86_64-linux
+++ b/external_functions/ef_utility/platform_specific.mk.x86_64-linux
@@ -29,16 +29,6 @@ CPP_FLAGS	= -P -traditional -Ddouble_p $(INCLUDES)
 CFLAGS_DEBUG	= -O0 -g -Ddebug
 FFLAGS_DEBUG	= -O0 -g  -fbounds-check -Ddebug
 
-## cancel the default rule for .f -> .o to prevent objects from being built
-## from .f files that are out-of-date with respect to their corresponding .F file
-#%.o : %.f
-#
-## use cpp to preprocess the .F files to .f files and then compile the .f files
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(FFLAGS) -c $*.f
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/external_functions/ef_utility/platform_specific.mk.x86_64-linux-gnu b/external_functions/ef_utility/platform_specific.mk.x86_64-linux-gnu
deleted file mode 100644
index b8522a0..0000000
--- a/external_functions/ef_utility/platform_specific.mk.x86_64-linux-gnu
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# platform_specific_includes.mk.i386-linux
-#
-# This file is included in the External Function Makefiles and defines
-# platform specific macros
-# ACM 2/2001 debug flags
-
-INCLUDES	= -I. -I../ef_utility -I../ef_utility/ferret_cmn
-
-CCSHFLAG	=
-CC		= gcc
-CFLAGS		= -fPIC -m64 -O2 $(INCLUDES)
-
-FC		= gfortran
-F77		= gfortran
-F77SHFLAG	=
-FFLAGS		= -fPIC -m64 -Ddouble_p -fno-second-underscore \
-		  -fno-backslash -fdollar-ok -ffixed-line-length-132 \
-		  -fdefault-real-8 -fdefault-double-8 $(INCLUDES)
-
-RANLIB		= /usr/bin/ranlib
-
-LD		= gfortran
-LD_DYN_FLAGS	= -fPIC -m64 -shared
-SYSLIBS		=
-
-CPP		= /lib/cpp
-CPP_FLAGS	= -P -traditional -Ddouble_p $(INCLUDES)
-CFLAGS_DEBUG	= -O0 -g -Ddebug
-FFLAGS_DEBUG	= -O0 -g  -fbounds-check -Ddebug
-
-## cancel the default rule for .f -> .o to prevent objects from being built
-## from .f files that are out-of-date with respect to their corresponding .F file
-#%.o : %.f
-#
-## use cpp to preprocess the .F files to .f files and then compile the .f files
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(FFLAGS) -c $*.f
-
-# Directly compile the .F source files to the .o object files
-# since gfortran can handle the C compiler directives in Fortran code
-%.o : %.F
-	$(FC) $(FFLAGS) -c $*.F -o $*.o
-
diff --git a/external_functions/ef_utility/site_specific.mk b/external_functions/ef_utility/site_specific.mk.in
similarity index 100%
rename from external_functions/ef_utility/site_specific.mk
rename to external_functions/ef_utility/site_specific.mk.in
diff --git a/external_functions/examples/Makefile b/external_functions/examples/Makefile
index 777d374..df8218d 100644
--- a/external_functions/examples/Makefile
+++ b/external_functions/examples/Makefile
@@ -35,7 +35,7 @@ include ../ef_utility/platform_specific.mk.$(BUILDTYPE)
 #
 
 all:	add_9.so appende.so avet.so dates.so factorial.so pass_thru.so percent_good_t.so \
-	storage.so string_arg.so subtract.so 
+	storage.so string_arg.so subtract.so earth_distance.so
 debug:
 	$(MAKE) "FFLAGS = $(FFLAGS) -g -Ddebug" "CFLAGS = $(CFLAGS) -g -Ddebug"  all
 
diff --git a/external_functions/examples/earth_distance.F b/external_functions/examples/earth_distance.F
new file mode 100755
index 0000000..720101e
--- /dev/null
+++ b/external_functions/examples/earth_distance.F
@@ -0,0 +1,191 @@
+* 
+*  earth_distance.F
+* 
+*  Ansley manke
+*  9/2017
+* 
+*  Compute the running sum of distance along a path
+*  using the law of cosines as in billy's earth_distance.jnl scriopt
+ 
+*  In this subroutine we provide information about
+*  the function.  The user configurable information 
+*  consists of the following:
+* 
+*  descr              Text description of the function
+* 
+*  num_args           Required number of arguments
+* 
+*  axis_inheritance   Type of axis for the result
+*                        ( CUSTOM, IMPLIED_BY_ARGS, NORMAL, ABSTRACT )
+*                        CUSTOM          - user defined axis
+*                        IMPLIED_BY_ARGS - same axis as the incoming argument
+*                        NORMAL          - the result is normal to this axis
+*                        ABSTRACT        - an axis which only has index values
+* 
+*  piecemeal_ok       For memory optimization:
+*                        axes where calculation may be performed piecemeal
+*                        ( YES, NO )
+* 
+*
+* For each argument we provide the following information:
+*
+* name               Text name for an argument
+*
+* unit               Text units for an argument
+*
+* desc               Text description of an argument
+*
+* axis_influence     Are this argument's axes the same as the result grid?
+*                       ( YES, NO )
+*
+* axis_extend       How much does Ferret need to extend arg limits relative to result 
+*
+
+
+      SUBROUTINE earth_distance_init(id)
+
+      INCLUDE 'ferret_cmn/EF_Util.cmn'
+
+      INTEGER id, arg
+
+* **********************************************************************
+*                                            USER CONFIGURABLE PORTION |
+*                                                                      |
+*                                                                      V
+
+      CALL ef_set_desc(id, 'Return the delta-distance in Km along the path' )
+
+      CALL ef_set_num_args(id, 2)
+      CALL ef_set_has_vari_args(id, NO)
+      CALL ef_set_axis_inheritance(id, IMPLIED_BY_ARGS, 
+     .     IMPLIED_BY_ARGS, IMPLIED_BY_ARGS, IMPLIED_BY_ARGS)
+      CALL ef_set_piecemeal_ok(id, NO, NO, NO, NO)
+
+      arg = 1
+      CALL ef_set_arg_name(id, arg, 'longitude')
+      CALL ef_set_arg_desc(id, arg,
+     .          'List of longitudes in degrees East along the path')
+      CALL ef_set_axis_influence(id, arg, YES, YES, YES, YES)
+
+      arg = 2
+      CALL ef_set_arg_name(id, arg, 'latitude')
+      CALL ef_set_arg_desc(id, arg,
+     .          'List of latitudes in degrees North along the path')
+      CALL ef_set_axis_influence(id, arg, YES, YES, YES, YES)
+*                                                                      ^
+*                                                                      |
+*                                            USER CONFIGURABLE PORTION |
+* **********************************************************************
+
+      RETURN 
+      END
+
+* 
+*  In this subroutine we compute the result
+* 
+      SUBROUTINE earth_distance_compute(id, lons, lats, result)
+
+      INCLUDE 'ferret_cmn/EF_Util.cmn'
+      INCLUDE 'ferret_cmn/EF_mem_subsc.cmn'
+
+      INTEGER id
+
+      REAL bad_flag(EF_MAX_ARGS), bad_flag_result
+      REAL lons(mem1lox:mem1hix, mem1loy:mem1hiy,
+     .	   mem1loz:mem1hiz, mem1lot:mem1hit)
+      REAL lats(mem2lox:mem2hix, mem2loy:mem2hiy,
+     .     mem2loz:mem2hiz, mem2lot:mem2hit)
+      REAL result(memreslox:memreshix, memresloy:memreshiy,
+     .     memresloz:memreshiz, memreslot:memreshit)
+
+* After initialization, the 'res_' arrays contain indexing information 
+* for the result axes.  The 'arg_' arrays will contain the indexing 
+* information for each variable's axes. 
+
+      INTEGER res_lo_ss(4), res_hi_ss(4), res_incr(4)
+      INTEGER arg_lo_ss(4,EF_MAX_ARGS), arg_hi_ss(4,EF_MAX_ARGS),
+     .     arg_incr(4,EF_MAX_ARGS)
+
+
+* **********************************************************************
+*                                            USER CONFIGURABLE PORTION |
+*                                                                      |
+*                                                                      V
+
+      INTEGER i,j,k,l
+      REAL dlo, dhi, ed_pd, ed_rearth, ed_lat1, ed_lat2, ed_lon1, ed_lon2, 
+     .	   ed_x1, ed_x2, ed_y1, ed_y2, ed_z1, ed_z2, ed_d1, ed_angle
+
+      
+      ed_pd = 4.*atan(1.)/180.
+      ed_rearth = 6371.2 
+
+      CALL ef_get_res_subscripts(id, res_lo_ss, res_hi_ss, res_incr)
+      CALL ef_get_arg_subscripts(id, arg_lo_ss, arg_hi_ss, arg_incr)
+      CALL ef_get_bad_flags(id, bad_flag, bad_flag_result)
+
+* pre-check that the lons array has no missing values
+      DO 10 l = arg_lo_ss(T_AXIS,ARG1), arg_hi_ss(T_AXIS,ARG1)
+      DO 10 k = arg_lo_ss(Z_AXIS,ARG1), arg_hi_ss(Z_AXIS,ARG1)
+      DO 10 j = arg_lo_ss(Y_AXIS,ARG1), arg_hi_ss(Y_AXIS,ARG1)
+      DO 10 i = arg_lo_ss(X_AXIS,ARG1), arg_hi_ss(X_AXIS,ARG1)
+        IF (lons(i,j,k,l) .EQ. bad_flag(1)) CALL
+     .             EF_BAIL_OUT(id, 'Missing value found in lats')
+ 10   CONTINUE
+
+* pre-check that the lats array has no missing values
+      DO 20 l = arg_lo_ss(T_AXIS,ARG2), arg_hi_ss(T_AXIS,ARG2)
+      DO 20 k = arg_lo_ss(Z_AXIS,ARG2), arg_hi_ss(Z_AXIS,ARG2)
+      DO 20 j = arg_lo_ss(Y_AXIS,ARG2), arg_hi_ss(Y_AXIS,ARG2)
+      DO 20 i = arg_lo_ss(X_AXIS,ARG2), arg_hi_ss(X_AXIS,ARG2)
+        IF (lats(i,j,k,l) .EQ. bad_flag(2)) CALL
+     .             EF_BAIL_OUT(id, 'Missing value found in lats')
+ 20   CONTINUE
+
+
+* Need to skip the i=1st data
+
+
+      DO 400 l=res_lo_ss(T_AXIS), res_hi_ss(T_AXIS)
+
+        DO 300 k=res_lo_ss(Z_AXIS), res_hi_ss(Z_AXIS)
+
+          DO 200 j=res_lo_ss(Y_AXIS), res_hi_ss(Y_AXIS)
+
+            DO 100 i=res_lo_ss(X_AXIS)+1, res_hi_ss(X_AXIS)  ! faking it, skip 
+              
+              ed_lat1=90-lats(i-1,j,k,l)
+              ed_lat2=90-lats(i,j,k,l)
+              ed_lon1=lons(i-1,j,k,l)
+              ed_lon2=lons(i,j,k,l)
+
+	      
+              ed_x1=sin(ed_pd*ed_lat1)*cos(ed_pd*ed_lon1)
+              ed_y1=sin(ed_pd*ed_lat1)*sin(ed_pd*ed_lon1)
+              ed_z1=cos(ed_pd*ed_lat1)
+              ed_x2=sin(ed_pd*ed_lat2)*cos(ed_pd*ed_lon2)
+              ed_y2=sin(ed_pd*ed_lat2)*sin(ed_pd*ed_lon2)
+              ed_z2=cos(ed_pd*ed_lat2)
+
+
+              ed_d1=(((ed_x1 - ed_x2)**2) + ((ed_y1 - ed_y2)**2)) + ((ed_z1 - ed_z2)**2)
+              ed_angle=acos(1-ed_d1/2)		! angular distance between the points
+
+              result(i,j,k,l) = ed_rearth*ed_angle
+ 100        CONTINUE
+
+ 200      CONTINUE
+
+ 300    CONTINUE
+
+ 400  CONTINUE
+      
+         
+*                                                                      ^
+*                                                                      |
+*                                            USER CONFIGURABLE PORTION |
+* **********************************************************************
+
+      RETURN 
+      END
+
diff --git a/external_functions/extrema/maxminmax.F b/external_functions/extrema/maxminmax.F
index 1de897c..f8fcb1d 100644
--- a/external_functions/extrema/maxminmax.F
+++ b/external_functions/extrema/maxminmax.F
@@ -7,7 +7,7 @@ C  From the NCAR graphics library at http://ngwww.ucar.edu version 4.2
 C  Modified by Ansley Manke to regurn only the maxima for subroutine findhi.F
 C
 C-------------------------------------------------------------
-C	$Id: maxminmax.F 12378 2011-06-28 20:07:59Z ksmith $
+C	$Id$
 C                                                                      
 C                Copyright (C)  2000
 C        University Corporation for Atmospheric Research
diff --git a/external_functions/extrema/minminmax.F b/external_functions/extrema/minminmax.F
index 4b4ed76..bc25f7c 100644
--- a/external_functions/extrema/minminmax.F
+++ b/external_functions/extrema/minminmax.F
@@ -5,7 +5,7 @@ C  based on NCAR routine MINMAX, return minima
 C  From the NCAR graphics library at http://ngwww.ucar.edu version 4.2
 C  Modified by Ansley Manke to regurn only the minima for subroutine findlo.F
 C-------------------------------------------------------------
-C	$Id: minminmax.F 12378 2011-06-28 20:07:59Z ksmith $
+C	$Id$
 C                                                                      
 C                Copyright (C)  2000
 C        University Corporation for Atmospheric Research
diff --git a/external_functions/fft/fft_platform_specific_flags.mk.i386-apple-darwin b/external_functions/fft/fft_platform_specific_flags.mk.i386-apple-darwin
deleted file mode 100644
index 083685d..0000000
--- a/external_functions/fft/fft_platform_specific_flags.mk.i386-apple-darwin
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# platform_specific_includes.mk.i486-linux
-#
-# This file is included in the External Function Makefiles and defines
-# platform specific macros
-
-# FFT functions need the -mismatch_all flag
-# 1/2002 acm  add -u flag
-# 2/2002 ACM  update flags to ones for current compiler.
-
-
-#FFLAGS          = -132 -c -u -save -dusty -f77 -fieee -Nl90 -x77 -w -mismatch_all $(FINCLUDES)
-
-#FFLAGS          = -132 -c -u -save -dusty -fieee -Nl90 -x77 -w -mismatch_all $(FINCLUDES)
diff --git a/external_functions/v5d/binio.c b/external_functions/v5d/binio.c
index 36ebb34..cf9e244 100644
--- a/external_functions/v5d/binio.c
+++ b/external_functions/v5d/binio.c
@@ -277,7 +277,7 @@ int read_int2_array( int f, short *iarray, int n )
    int i;
    signed char *buffer;
    int nread;
-   buffer = (signed char *) malloc( n * 2 );
+   buffer = (signed char *) FerMem_Malloc( n * 2, __FILE__, __LINE__ );
    if (!buffer)  return 0;
    nread = read( f, buffer, n*2 );
    if (nread<=0)  return 0;
@@ -286,7 +286,7 @@ int read_int2_array( int f, short *iarray, int n )
       /* don't forget about sign extension! */
       iarray[i] = (buffer[i*2] * 256) | buffer[i*2+1];
    }
-   free( buffer );
+   FerMem_Free( buffer, __FILE__, __LINE__ );
    return nread;
 #else
    int nread = read( f, iarray, n*2 );
@@ -314,7 +314,7 @@ int read_uint2_array( int f, unsigned short *iarray, int n )
    int i;
    unsigned char *buffer;
    int nread;
-   buffer = (unsigned char *) malloc( n * 2 );
+   buffer = (unsigned char *) FerMem_Malloc( n * 2, __FILE__, __LINE__ );
    if (!buffer)  return 0;
    nread = read( f, buffer, n*2 );
    if (nread<=0)  return 0;
@@ -322,7 +322,7 @@ int read_uint2_array( int f, unsigned short *iarray, int n )
    for (i=0;i<nread;i++) {
       iarray[i] = (buffer[i*2] << 8) | buffer[i*2+1];
    }
-   free( buffer );
+   FerMem_Free( buffer, __FILE__, __LINE__ );
    return nread;
 #else
    int nread = read( f, iarray, n*2 );
@@ -383,7 +383,7 @@ int read_int4_array( int f, int *iarray, int n )
    int j, nread;
    int *buffer;
 
-   buffer = (int *) malloc( (n+1)*4 );
+   buffer = (int *) FerMem_Malloc( (n+1)*4, __FILE__, __LINE__ );
    if (!buffer)
       return 0;
    nread = read( f, buffer, 4*n );
@@ -400,7 +400,7 @@ int read_int4_array( int f, int *iarray, int n )
          iarray[j] = buffer[j/2] & 0xffffffff;
       }
    }
-   free( buffer );
+   FerMem_Free( buffer, __FILE__, __LINE__ );
    return nread;
 #else
    int nread = read( f, iarray, 4*n );
@@ -470,13 +470,13 @@ int read_float4_array( int f, float *x, int n )
    long *buffer;
    int i, nread;
 
-   buffer = (long *) malloc( (n+1) * 4 );
+   buffer = (long *) FerMem_Malloc( (n+1) * 4, __FILE__, __LINE__ );
    if (!buffer) return 0;
    nread = read( f, buffer, n*4 );
    if (nread<=0)  return 0;
    nread /= 4;
    ieee_to_cray_array( x, buffer, nread );
-   free( buffer );
+   FerMem_Free( buffer, __FILE__, __LINE__ );
    return nread;
 #else
    int nread = read( f, x, 4*n );
@@ -601,14 +601,14 @@ int write_uint2_array( int f, const unsigned short *iarray, int n )
 #ifdef _CRAY
    int i, nwritten;
    unsigned char *buffer;
-   buffer = (unsigned char *) malloc( 2*n );
+   buffer = (unsigned char *) FerMem_Malloc( 2*n, __FILE__, __LINE__ );
    if (!buffer)  return 0;
    for (i=0;i<n;i++) {
       buffer[i*2] = (iarray[i] >> 8) & 0xff;
       buffer[i*2+1] = iarray[i] & 0xff;
    }
    nwritten = write( f, buffer, 2*n );
-   free( buffer );
+   FerMem_Free( buffer, __FILE__, __LINE__ );
    if (nwritten<=0)
       return 0;
    else
@@ -665,7 +665,7 @@ int write_int4_array( int f, const int *i, int n )
    int j, nwritten;
    char *buf, *b, *ptr;
 
-   b = buf = (char *) malloc( n*4 + 8 );
+   b = buf = (char *) FerMem_Malloc( n*4 + 8, __FILE__, __LINE__ );
    if (!b)
       return 0;
    ptr = (char *) i;
@@ -677,7 +677,7 @@ int write_int4_array( int f, const int *i, int n )
       *b++ = *ptr++;
    }
    nwritten = write( f, buf, 4*n );
-   free( buf );
+   FerMem_Free( buf, __FILE__, __LINE__ );
    if (nwritten<=0)
       return 0;
    else
@@ -742,12 +742,12 @@ int write_float4_array( int f, const float *x, int n )
    /* convert cray floats to IEEE and put into buffer */
    int nwritten;
    long *buffer;
-   buffer = (long *) malloc( n*4 + 8 );
+   buffer = (long *) FerMem_Malloc( n*4 + 8, __FILE__, __LINE__ );
    if (!buffer)
       return 0;
    cray_to_ieee_array( buffer, x, n );
    nwritten = write( f, buffer, 4*n );
-   free( buffer );
+   FerMem_Free( buffer, __FILE__, __LINE__ );
    if (nwritten<=0)
       return 0;
    else
diff --git a/external_functions/v5d/v5d.c b/external_functions/v5d/v5d.c
index 6b59ed5..24c303f 100644
--- a/external_functions/v5d/v5d.c
+++ b/external_functions/v5d/v5d.c
@@ -1051,7 +1051,7 @@ v5dstruct *v5dNewStruct( void )
 {
    v5dstruct *v;
 
-   v = (v5dstruct *) malloc( sizeof(v5dstruct) );
+   v = (v5dstruct *) FerMem_Malloc( sizeof(v5dstruct), __FILE__, __LINE__ );
    if (v) {
       v5dInitStruct(v);
    }
@@ -1066,8 +1066,8 @@ v5dstruct *v5dNewStruct( void )
 void v5dFreeStruct( v5dstruct* v )
 {
    /*assert( v5dVerifyStruct( v ) );*/
-   free( v );
-   v = 0;
+   FerMem_Free( v, __FILE__, __LINE__ );
+   v = NULL;
 }
 
 
@@ -1417,7 +1417,6 @@ static int read_comp_header( int f, v5dstruct *v )
       int i, j, it, iv, nl;
       int gridsize;
       float hgttop, hgtinc;
-      /*char *compgrid;*/
 
       if (id==0x80808080) {
          /* 20 vars, 300 times */
@@ -1494,8 +1493,6 @@ static int read_comp_header( int f, v5dstruct *v )
          v->MaxVal[i] = -999999.9;
       }
 
-      /*compgrid = (char *) malloc( gridsize );*/
-
       for (it=0; it<v->NumTimes; it++) {
          for (iv=0; iv<v->NumVars; iv++) {
             float ga, gb;
@@ -1517,8 +1514,6 @@ static int read_comp_header( int f, v5dstruct *v )
          }
       }
 
-      /*free( compgrid );*/
-
       /* done */
    }
    else if (id==0x80808082 || id==0x80808083) {
@@ -2226,7 +2221,7 @@ int v5dReadGrid( v5dstruct *v, int time, int var, float data[] )
    else if (v->CompressMode==4) {
       bytes = v->Nr * v->Nc * v->Nl[var] * sizeof(float);
    }
-   compdata = (void *) malloc( bytes );
+   compdata = FerMem_Malloc( bytes, __FILE__, __LINE__ );
    if (!compdata) {
       printf("Error in v5dReadGrid: out of memory (needed %d bytes)\n", bytes);
       return 0;
@@ -2242,7 +2237,7 @@ int v5dReadGrid( v5dstruct *v, int time, int var, float data[] )
                       compdata, ga, gb, data );
 
    /* free compdata */
-   free( compdata );
+   FerMem_Free( compdata, __FILE__, __LINE__ );
    return 1;
 }
 
@@ -2634,7 +2629,7 @@ int v5dWriteGrid( v5dstruct *v, int time, int var, const float data[] )
    else if (v->CompressMode==4) {
       bytes = v->Nr * v->Nc * v->Nl[var] * sizeof(float);
    }
-   compdata = (void *) malloc( bytes );
+   compdata = FerMem_Malloc( bytes, __FILE__, __LINE__ );
    if (!compdata) {
       printf("Error in v5dWriteGrid: out of memory (needed %d bytes)\n",
              bytes );
@@ -2655,7 +2650,7 @@ int v5dWriteGrid( v5dstruct *v, int time, int var, const float data[] )
    n = v5dWriteCompressedGrid( v, time, var, ga, gb, compdata );
 
    /* free compdata */
-   free( compdata );
+   FerMem_Free( compdata, __FILE__, __LINE__  );
 
    return n;
 }
diff --git a/external_functions/v5d/v5d_platform_specific_flags.mk.x86_64-darwin b/external_functions/v5d/v5d_platform_specific_flags.mk.x86_64-darwin
deleted file mode 100644
index 7a46f1c..0000000
--- a/external_functions/v5d/v5d_platform_specific_flags.mk.x86_64-darwin
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# v5d_platform_specific_includes.mk.i486-linux
-#
-# This file is included in the Vis5D External Function Makefiles and defines
-# platform specific macros 
-
-
-V5DFLAGS          = -DLITTLE
diff --git a/fer/Makefile b/fer/Makefile
index 45b1e14..8e07cc8 100644
--- a/fer/Makefile
+++ b/fer/Makefile
@@ -68,12 +68,14 @@ FERLIBS = -lxeq -lgnl  -lccr -lferplt -lrpn -lstk -ldoo  \
 
 PPLLIBS = -lplt -lpll -lsym -lcmp -lour -lepi -lusr -ltmap
 
-FERMAIN = ccr/fermain_c.o ccr/gui_init.o
+FERMAIN = ccr/fermain_c.o
 
-FEROBJS_DFLT = $(LINUX_OBJS) \
+# explicitly include block data object files
+DATA_OBJS = dat/*.o ../fmt/src/x*.o ../ppl/plot/ppldata.o
+
+FEROBJS_DFLT = $(DATA_OBJS) special/linux_routines.o \
 	special/ferret_dispatch.o special/xmake_date_data.o special/fakes3.o \
-	special/ferret_query_f.o  special/xrevision_type_data.o \
-	special/xplatform_type_data.o
+	special/xrevision_type_data.o special/xplatform_type_data.o special/FerMem_routines.o
 
 FEROBJS = ccr/save_arg_pointers.o $(FEROBJS_DFLT)
 
@@ -87,6 +89,8 @@ EXECNAME = ferret_c
 
 WHATGKS = xgks
 
+GKSLIB = ../xgks/src/lib/libxgks.a
+
 EF_CMNS = common/EF_Util.cmn common/EF_Util.parm common/EF_mem_subsc.cmn
 
 #
@@ -129,6 +133,20 @@ debug:
 		"GUI_FAKES=special/gui_fakes.o" \
 		build
 
+# Debug but also print all memory allocations, reallocations, and frees to 
+# file "memorydebug.txt".  Initialize allocated memory with non-zero values. 
+# Expect this to be a lot slower due to all the (intentionally inefficient 
+# but safe) file operations.
+.PHONY: memorydebug
+memorydebug:
+	mkdir -p ../lib
+	$(MAKE) "CFLAGS = -DMEMORYDEBUG $(CFLAGS) $(DBG_FLAGS)"  \
+		"FFLAGS = $(FFLAGS) $(DBG_FLAGS) -fbounds-check" \
+		"PPLUS_FFLAGS = $(PPLUS_FFLAGS) $(DBG_FLAGS)" \
+		"DEBUG_TITLE = beta/debug" \
+		"GUI_FAKES=special/gui_fakes.o" \
+		build
+
 .PHONY: profiling
 profiling:
 	mkdir -p ../lib
diff --git a/fer/ccr/EF_InternalUtil.c b/fer/ccr/EF_InternalUtil.c
index e6f3815..a667f68 100644
--- a/fer/ccr/EF_InternalUtil.c
+++ b/fer/ccr/EF_InternalUtil.c
@@ -85,7 +85,7 @@
 *                  Check that GLOBAL_ExternalFunctionsList is not NULL in ef_ptr_from_id_ptr
 *      *kms* 11/10 Check for libpyefcn.so in $FER_LIBS instead of $FER_DIR/lib
 * *acm*  1/12      - Ferret 6.8 ifdef double_p for double-precision ferret, see the
-*					 definition of macro DFTYPE in ferret.h
+*                  definition of macro DFTYPE in ferret.h
 *      *kms*  3/12 Add E and F dimensions
 *      *acm*  6/14 New separate function for DSG files
 *      *acm*  9/14 Make DATE1900 accept an array of date strings, returning an array of coordinates
@@ -98,20 +98,22 @@
 
 /* .................... Includes .................... */
 
-#include <sys/types.h>	        /* required for some of our prototypes */
+#include <sys/types.h>        /* required for some of our prototypes */
 #include <sys/stat.h>
 #include <sys/errno.h>
 
-#include <unistd.h>		/* for convenience */
-#include <stdlib.h>		/* for convenience */
-#include <stdio.h>		/* for convenience */
-#include <string.h>		/* for convenience */
-#include <fcntl.h>		/* for fcntl() */
-#include <dlfcn.h>		/* for dynamic linking */
-#include <signal.h>             /* for signal() */
-#include <setjmp.h>             /* required for jmp_buf */
+#include <ctype.h>
+#include <dlfcn.h>
+#include <fcntl.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
 #include "ferret.h"
+#include "FerMem.h"
 #include "EF_Util.h"
 #include "list.h"  /* locally added list library */
 
@@ -200,7 +202,6 @@ static void (*pyefcn_compute_func)(int, char [], DFTYPE *[], int,
                                    DFTYPE [], char []) = NULL;
 
 static int I_have_scanned_already = FALSE;
-static int I_have_warned_already = TRUE; /* Warning turned off Jan '98 */
 
 
 /* ............. Function Declarations .............. */
@@ -272,8 +273,6 @@ int EF_Util_setsig();
 int EF_Util_ressig();
 
 
-void FORTRAN(ef_err_bail_out)(int *, char *);
-
 void EF_store_globals(int *, int *, int *, DFTYPE *);
 
 ExternalFunction *ef_ptr_from_id_ptr(int *);
@@ -582,43 +581,42 @@ void FORTRAN(xauto_cor_result_limits)(int *);
 void FORTRAN(xauto_cor_work_size)(int *);
 void FORTRAN(xauto_cor_compute)(int *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *, DFTYPE *);
-						
+
 void FORTRAN(eof_space_init)(int *);
 void FORTRAN(eof_space_result_limits)(int *);
 void FORTRAN(eof_space_work_size)(int *);
 void FORTRAN(eof_space_compute)(int *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *);
-						
+
 void FORTRAN(eof_stat_init)(int *);
 void FORTRAN(eof_stat_result_limits)(int *);
 void FORTRAN(eof_stat_work_size)(int *);
 void FORTRAN(eof_stat_compute)(int *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *);
-						
+
 void FORTRAN(eof_tfunc_init)(int *);
 void FORTRAN(eof_tfunc_result_limits)(int *);
 void FORTRAN(eof_tfunc_work_size)(int *);
 void FORTRAN(eof_tfunc_compute)(int *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *);
-						
-						
+
 void FORTRAN(eofsvd_space_init)(int *);
 void FORTRAN(eofsvd_space_result_limits)(int *);
 void FORTRAN(eofsvd_space_work_size)(int *);
 void FORTRAN(eofsvd_space_compute)(int *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *);
-						
+
 void FORTRAN(eofsvd_stat_init)(int *);
 void FORTRAN(eofsvd_stat_result_limits)(int *);
 void FORTRAN(eofsvd_stat_work_size)(int *);
 void FORTRAN(eofsvd_stat_compute)(int *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *,
                            DFTYPE *);
-						
+
 void FORTRAN(eofsvd_tfunc_init)(int *);
 void FORTRAN(eofsvd_tfunc_result_limits)(int *);
 void FORTRAN(eofsvd_tfunc_work_size)(int *);
@@ -809,7 +807,6 @@ void FORTRAN(lsl_lowpass_init)(int *);
 void FORTRAN(lsl_lowpass_work_size)(int *);
 void FORTRAN(lsl_lowpass_compute)(int *, DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *,
                             DFTYPE *, DFTYPE *, DFTYPE *, DFTYPE *);
-							
 
 void FORTRAN(samplexy_curv_init)(int *);
 void FORTRAN(samplexy_curv_result_limits)(int *);
@@ -1247,6 +1244,8 @@ void FORTRAN( scat2grid_std_xyt_compute)(int *,
  * should pass by reference and should end with an underscore.
  */
 
+static int continue_efcn_scan(int gfcn_num_internal);
+
 /*
  * Find all of the ~.so files in directories listed in the
  * FER_EXTERNAL_FUNCTIONS environment variable and add all
@@ -1255,269 +1254,262 @@ void FORTRAN( scat2grid_std_xyt_compute)(int *,
  */
 int FORTRAN(efcn_scan)( int *gfcn_num_internal )
 {
+  int return_val;
 
-  FILE *file_ptr=NULL;
-  ExternalFunction ef;
-
-  char file[EF_MAX_NAME_LENGTH]="";
-  char *path_ptr=NULL, path[8192]="";
-  char paths[8192]="", cmd[EF_MAX_DESCRIPTION_LENGTH]="";
-  int count=0, status=LIST_OK;
-  int i_intEF; int N_INTEF;
-
-  static int return_val=0; /* static because it needs to exist after the return statement */
-
-/*  ------------------------------------
- *  Count and list the names of internally linked EF's
- *  Lines with names are generated by the perl script
- *  int_dlsym.pl.  Check that N_INTEF is correctly defined below.
- */
-
-#define N_INTEF 202
-
-struct {
-  char funcname[EF_MAX_NAME_LENGTH];
-} I_EFnames[N_INTEF];strcpy(I_EFnames[0].funcname,  "ave_scat2grid_t");
-strcpy(I_EFnames[1].funcname,  "bin_index_wt");
-strcpy(I_EFnames[2].funcname,  "compressi");
-strcpy(I_EFnames[3].funcname,  "compressi_by");
-strcpy(I_EFnames[4].funcname,  "compressj");
-strcpy(I_EFnames[5].funcname,  "compressj_by");
-strcpy(I_EFnames[6].funcname,  "compressk");
-strcpy(I_EFnames[7].funcname,  "compressk_by");
-strcpy(I_EFnames[8].funcname,  "compressl");
-strcpy(I_EFnames[9].funcname,  "compressl_by");
-strcpy(I_EFnames[10].funcname,  "compressm");
-strcpy(I_EFnames[11].funcname,  "compressm_by");
-strcpy(I_EFnames[12].funcname,  "compressn");
-strcpy(I_EFnames[13].funcname,  "compressn_by");
-strcpy(I_EFnames[14].funcname,  "convolvei");
-strcpy(I_EFnames[15].funcname,  "convolvej");
-strcpy(I_EFnames[16].funcname,  "convolvek");
-strcpy(I_EFnames[17].funcname,  "convolvel");
-strcpy(I_EFnames[18].funcname,  "convolvem");
-strcpy(I_EFnames[19].funcname,  "convolven");
-strcpy(I_EFnames[20].funcname,  "curv_range");
-strcpy(I_EFnames[21].funcname,  "curv_to_rect");
-strcpy(I_EFnames[22].funcname,  "curv_to_rect_fsu");
-strcpy(I_EFnames[23].funcname,  "curv_to_rect_map");
-strcpy(I_EFnames[24].funcname,  "date1900");
-strcpy(I_EFnames[25].funcname,  "days1900toymdhms");
-strcpy(I_EFnames[26].funcname,  "dot_e");
-strcpy(I_EFnames[27].funcname,  "dot_f");
-strcpy(I_EFnames[28].funcname,  "dot_t");
-strcpy(I_EFnames[29].funcname,  "dot_x");
-strcpy(I_EFnames[30].funcname,  "dot_y");
-strcpy(I_EFnames[31].funcname,  "dot_z");
-strcpy(I_EFnames[32].funcname,  "ecat");
-strcpy(I_EFnames[33].funcname,  "ecat_str");
-strcpy(I_EFnames[34].funcname,  "element_index");
-strcpy(I_EFnames[35].funcname,  "element_index_str");
-strcpy(I_EFnames[36].funcname,  "element_index_str_n");
-strcpy(I_EFnames[37].funcname,  "eof_space");
-strcpy(I_EFnames[38].funcname,  "eof_stat");
-strcpy(I_EFnames[39].funcname,  "eofsvd_space");
-strcpy(I_EFnames[40].funcname,  "eofsvd_stat");
-strcpy(I_EFnames[41].funcname,  "eofsvd_tfunc");
-strcpy(I_EFnames[42].funcname,  "eof_tfunc");
-strcpy(I_EFnames[43].funcname,  "ereverse");
-strcpy(I_EFnames[44].funcname,  "expnd_by_len");
-strcpy(I_EFnames[45].funcname,  "expnd_by_len_str");
-strcpy(I_EFnames[46].funcname,  "expndi_by");
-strcpy(I_EFnames[47].funcname,  "expndi_by_m_counts");
-strcpy(I_EFnames[48].funcname,  "expndi_by_m_counts_str");
-strcpy(I_EFnames[49].funcname,  "expndi_by_t");
-strcpy(I_EFnames[50].funcname,  "expndi_by_z");
-strcpy(I_EFnames[51].funcname,  "expndi_by_z_counts");
-strcpy(I_EFnames[52].funcname,  "expndi_id_by_z_counts");
-strcpy(I_EFnames[53].funcname,  "expndi_to_et");
-strcpy(I_EFnames[54].funcname,  "fcat");
-strcpy(I_EFnames[55].funcname,  "fcat_str");
-strcpy(I_EFnames[56].funcname,  "fc_isubset");
-strcpy(I_EFnames[57].funcname,  "ffta");
-strcpy(I_EFnames[58].funcname,  "fft_im");
-strcpy(I_EFnames[59].funcname,  "fft_inverse");
-strcpy(I_EFnames[60].funcname,  "fftp");
-strcpy(I_EFnames[61].funcname,  "fft_re");
-strcpy(I_EFnames[62].funcname,  "fill_xy");
-strcpy(I_EFnames[63].funcname,  "findhi");
-strcpy(I_EFnames[64].funcname,  "findlo");
-strcpy(I_EFnames[65].funcname,  "floatstr");
-strcpy(I_EFnames[66].funcname,  "freverse");
-strcpy(I_EFnames[67].funcname,  "ft_to_orthogonal");
-strcpy(I_EFnames[68].funcname,  "is_element_of");
-strcpy(I_EFnames[69].funcname,  "is_element_of_str");
-strcpy(I_EFnames[70].funcname,  "is_element_of_str_n");
-strcpy(I_EFnames[71].funcname,  "labwid");
-strcpy(I_EFnames[72].funcname,  "lanczos");
-strcpy(I_EFnames[73].funcname,  "list_value_xml");
-strcpy(I_EFnames[74].funcname,  "lon_lat_time_string");
-strcpy(I_EFnames[75].funcname,  "lsl_lowpass");
-strcpy(I_EFnames[76].funcname,  "minmax");
-strcpy(I_EFnames[77].funcname,  "minutes24");
-strcpy(I_EFnames[78].funcname,  "nco");
-strcpy(I_EFnames[79].funcname,  "nco_attr");
-strcpy(I_EFnames[80].funcname,  "piecewise3");
-strcpy(I_EFnames[81].funcname,  "pt_in_poly");
-strcpy(I_EFnames[82].funcname,  "rect_to_curv");
-strcpy(I_EFnames[83].funcname,  "sample_fast_i");
-strcpy(I_EFnames[84].funcname,  "sample_fast_i_str");
-strcpy(I_EFnames[85].funcname,  "samplef_date");
-strcpy(I_EFnames[86].funcname,  "sampleij");
-strcpy(I_EFnames[87].funcname,  "samplei_multi");
-strcpy(I_EFnames[88].funcname,  "samplej_multi");
-strcpy(I_EFnames[89].funcname,  "samplek_multi");
-strcpy(I_EFnames[90].funcname,  "samplel_multi");
-strcpy(I_EFnames[91].funcname,  "samplem_multi");
-strcpy(I_EFnames[92].funcname,  "samplen_multi");
-strcpy(I_EFnames[93].funcname,  "samplet_date");
-strcpy(I_EFnames[94].funcname,  "samplexy");
-strcpy(I_EFnames[95].funcname,  "samplexy_closest");
-strcpy(I_EFnames[96].funcname,  "samplexy_curv");
-strcpy(I_EFnames[97].funcname,  "samplexy_curv_avg");
-strcpy(I_EFnames[98].funcname,  "samplexy_curv_nrst");
-strcpy(I_EFnames[99].funcname,  "samplexy_nrst");
-strcpy(I_EFnames[100].funcname,  "samplexyt");
-strcpy(I_EFnames[101].funcname,  "samplexyt_nrst");
-strcpy(I_EFnames[102].funcname,  "samplexz");
-strcpy(I_EFnames[103].funcname,  "sampleyz");
-strcpy(I_EFnames[104].funcname,  "scat2ddups");
-strcpy(I_EFnames[105].funcname,  "scat2grid_bin_xy");
-strcpy(I_EFnames[106].funcname,  "scat2grid_bin_xyt");
-strcpy(I_EFnames[107].funcname,  "scat2grid_bin_xyz");
-strcpy(I_EFnames[108].funcname,  "scat2grid_bin_xyzt");
-strcpy(I_EFnames[109].funcname,  "scat2grid_minmax_xyt");
-strcpy(I_EFnames[110].funcname,  "scat2grid_std_xyt");
-strcpy(I_EFnames[111].funcname,  "scat2gridgauss_xt");
-strcpy(I_EFnames[112].funcname,  "scat2gridgauss_xt_v0");
-strcpy(I_EFnames[113].funcname,  "scat2gridgauss_xy");
-strcpy(I_EFnames[114].funcname,  "scat2gridgauss_xy_v0");
-strcpy(I_EFnames[115].funcname,  "scat2gridgauss_xz");
-strcpy(I_EFnames[116].funcname,  "scat2gridgauss_xz_v0");
-strcpy(I_EFnames[117].funcname,  "scat2gridgauss_yt");
-strcpy(I_EFnames[118].funcname,  "scat2gridgauss_yt_v0");
-strcpy(I_EFnames[119].funcname,  "scat2gridgauss_yz");
-strcpy(I_EFnames[120].funcname,  "scat2gridgauss_yz_v0");
-strcpy(I_EFnames[121].funcname,  "scat2gridgauss_zt");
-strcpy(I_EFnames[122].funcname,  "scat2gridgauss_zt_v0");
-strcpy(I_EFnames[123].funcname,  "scat2gridlaplace_xt");
-strcpy(I_EFnames[124].funcname,  "scat2gridlaplace_xy");
-strcpy(I_EFnames[125].funcname,  "scat2gridlaplace_xz");
-strcpy(I_EFnames[126].funcname,  "scat2gridlaplace_yt");
-strcpy(I_EFnames[127].funcname,  "scat2gridlaplace_yz");
-strcpy(I_EFnames[128].funcname,  "scat2gridlaplace_zt");
-strcpy(I_EFnames[129].funcname,  "scat2grid_nbin_xy");
-strcpy(I_EFnames[130].funcname,  "scat2grid_nbin_xyt");
-strcpy(I_EFnames[131].funcname,  "scat2grid_nobs_xy");
-strcpy(I_EFnames[132].funcname,  "scat2grid_nobs_xyt");
-strcpy(I_EFnames[133].funcname,  "scat2grid_t");
-strcpy(I_EFnames[134].funcname,  "separate");
-strcpy(I_EFnames[135].funcname,  "separate_str");
-strcpy(I_EFnames[136].funcname,  "sorti");
-strcpy(I_EFnames[137].funcname,  "sorti_str");
-strcpy(I_EFnames[138].funcname,  "sortj");
-strcpy(I_EFnames[139].funcname,  "sortj_str");
-strcpy(I_EFnames[140].funcname,  "sortk");
-strcpy(I_EFnames[141].funcname,  "sortk_str");
-strcpy(I_EFnames[142].funcname,  "sortl");
-strcpy(I_EFnames[143].funcname,  "sortl_str");
-strcpy(I_EFnames[144].funcname,  "sortm");
-strcpy(I_EFnames[145].funcname,  "sortm_str");
-strcpy(I_EFnames[146].funcname,  "sortn");
-strcpy(I_EFnames[147].funcname,  "sortn_str");
-strcpy(I_EFnames[148].funcname,  "str_mask");
-strcpy(I_EFnames[149].funcname,  "str_noblanks");
-strcpy(I_EFnames[150].funcname,  "str_replace");
-strcpy(I_EFnames[151].funcname,  "tauto_cor");
-strcpy(I_EFnames[152].funcname,  "tax_datestring");
-strcpy(I_EFnames[153].funcname,  "tax_day");
-strcpy(I_EFnames[154].funcname,  "tax_dayfrac");
-strcpy(I_EFnames[155].funcname,  "tax_jday");
-strcpy(I_EFnames[156].funcname,  "tax_jday1900");
-strcpy(I_EFnames[157].funcname,  "tax_month");
-strcpy(I_EFnames[158].funcname,  "tax_times");
-strcpy(I_EFnames[159].funcname,  "tax_tstep");
-strcpy(I_EFnames[160].funcname,  "tax_units");
-strcpy(I_EFnames[161].funcname,  "tax_year");
-strcpy(I_EFnames[162].funcname,  "tax_yearfrac");
-strcpy(I_EFnames[163].funcname,  "tcat");
-strcpy(I_EFnames[164].funcname,  "tcat_str");
-strcpy(I_EFnames[165].funcname,  "test_opendap");
-strcpy(I_EFnames[166].funcname,  "time_reformat");
-strcpy(I_EFnames[167].funcname,  "tracks2grid_mask_ave_xyt");
-strcpy(I_EFnames[168].funcname,  "tracks2grid_std_xyt");
-strcpy(I_EFnames[169].funcname,  "transpose_ef");
-strcpy(I_EFnames[170].funcname,  "transpose_te");
-strcpy(I_EFnames[171].funcname,  "transpose_tf");
-strcpy(I_EFnames[172].funcname,  "transpose_xe");
-strcpy(I_EFnames[173].funcname,  "transpose_xf");
-strcpy(I_EFnames[174].funcname,  "transpose_xt");
-strcpy(I_EFnames[175].funcname,  "transpose_xy");
-strcpy(I_EFnames[176].funcname,  "transpose_xz");
-strcpy(I_EFnames[177].funcname,  "transpose_ye");
-strcpy(I_EFnames[178].funcname,  "transpose_yf");
-strcpy(I_EFnames[179].funcname,  "transpose_yt");
-strcpy(I_EFnames[180].funcname,  "transpose_yz");
-strcpy(I_EFnames[181].funcname,  "transpose_ze");
-strcpy(I_EFnames[182].funcname,  "transpose_zf");
-strcpy(I_EFnames[183].funcname,  "transpose_zt");
-strcpy(I_EFnames[184].funcname,  "treverse");
-strcpy(I_EFnames[185].funcname,  "unique_str2int");
-strcpy(I_EFnames[186].funcname,  "write_webrow");
-strcpy(I_EFnames[187].funcname,  "write_webrow_gwt");
-strcpy(I_EFnames[188].funcname,  "xauto_cor");
-strcpy(I_EFnames[189].funcname,  "xcat");
-strcpy(I_EFnames[190].funcname,  "xcat_str");
-strcpy(I_EFnames[191].funcname,  "xreverse");
-strcpy(I_EFnames[192].funcname,  "ycat");
-strcpy(I_EFnames[193].funcname,  "ycat_str");
-strcpy(I_EFnames[194].funcname,  "yreverse");
-strcpy(I_EFnames[195].funcname,  "zaxreplace_avg");
-strcpy(I_EFnames[196].funcname,  "zaxreplace_bin");
-strcpy(I_EFnames[197].funcname,  "zaxreplace_rev");
-strcpy(I_EFnames[198].funcname,  "zaxreplace_zlev");
-strcpy(I_EFnames[199].funcname,  "zcat");
-strcpy(I_EFnames[200].funcname,  "zcat_str");
-strcpy(I_EFnames[201].funcname,  "zreverse");
-
-/*
- *  ------------------------------------
- */
-
-
-
+  /* Called multiple times but only do the setup once. */
   if ( I_have_scanned_already ) {
     return_val = list_size(STATIC_ExternalFunctionList);
     return return_val;
   }
 
-  if ( (STATIC_ExternalFunctionList = list_init()) == NULL ) {
+  return_val = continue_efcn_scan(*gfcn_num_internal);
+  if ( return_val >= 0 )
+      I_have_scanned_already = TRUE;
+  return return_val;
+}
+
+/*
+ * Split out as a separate function to minimize cost of calls after scanned.
+ */
+static int continue_efcn_scan(int gfcn_num_internal) {
+  FILE *file_ptr=NULL;
+  ExternalFunction ef;
+
+  char file[EF_MAX_NAME_LENGTH]="";
+  char *path_ptr=NULL;
+  char path[8192]="";
+  char allpaths[8192]="";
+  char cmd[EF_MAX_DESCRIPTION_LENGTH]="";
+  int  count=0;
+  int  i_intEF;
+  char *extension;
+
+  /* The array of names of the internally defined "external functions" defined here. */
+  const char I_EFnames[][EF_MAX_NAME_LENGTH] = {
+     "ave_scat2grid_t",
+     "bin_index_wt",
+     "compressi",
+     "compressi_by",
+     "compressj",
+     "compressj_by",
+     "compressk",
+     "compressk_by",
+     "compressl",
+     "compressl_by",
+     "compressm",
+     "compressm_by",
+     "compressn",
+     "compressn_by",
+     "convolvei",
+     "convolvej",
+     "convolvek",
+     "convolvel",
+     "convolvem",
+     "convolven",
+     "curv_range",
+     "curv_to_rect",
+     "curv_to_rect_fsu",
+     "curv_to_rect_map",
+     "date1900",
+     "days1900toymdhms",
+     "dot_e",
+     "dot_f",
+     "dot_t",
+     "dot_x",
+     "dot_y",
+     "dot_z",
+     "ecat",
+     "ecat_str",
+     "element_index",
+     "element_index_str",
+     "element_index_str_n",
+     "eof_space",
+     "eof_stat",
+     "eofsvd_space",
+     "eofsvd_stat",
+     "eofsvd_tfunc",
+     "eof_tfunc",
+     "ereverse",
+     "expnd_by_len",
+     "expnd_by_len_str",
+     "expndi_by",
+     "expndi_by_m_counts",
+     "expndi_by_m_counts_str",
+     "expndi_by_t",
+     "expndi_by_z",
+     "expndi_by_z_counts",
+     "expndi_id_by_z_counts",
+     "expndi_to_et",
+     "fcat",
+     "fcat_str",
+     "fc_isubset",
+     "ffta",
+     "fft_im",
+     "fft_inverse",
+     "fftp",
+     "fft_re",
+     "fill_xy",
+     "findhi",
+     "findlo",
+     "floatstr",
+     "freverse",
+     "ft_to_orthogonal",
+     "is_element_of",
+     "is_element_of_str",
+     "is_element_of_str_n",
+     "labwid",
+     "lanczos",
+     "list_value_xml",
+     "lon_lat_time_string",
+     "lsl_lowpass",
+     "minmax",
+     "minutes24",
+     "nco",
+     "nco_attr",
+     "piecewise3",
+     "pt_in_poly",
+     "rect_to_curv",
+     "sample_fast_i",
+     "sample_fast_i_str",
+     "samplef_date",
+     "sampleij",
+     "samplei_multi",
+     "samplej_multi",
+     "samplek_multi",
+     "samplel_multi",
+     "samplem_multi",
+     "samplen_multi",
+     "samplet_date",
+     "samplexy",
+     "samplexy_closest",
+     "samplexy_curv",
+     "samplexy_curv_avg",
+     "samplexy_curv_nrst",
+     "samplexy_nrst",
+     "samplexyt",
+     "samplexyt_nrst",
+     "samplexz",
+     "sampleyz",
+     "scat2ddups",
+     "scat2grid_bin_xy",
+     "scat2grid_bin_xyt",
+     "scat2grid_bin_xyz",
+     "scat2grid_bin_xyzt",
+     "scat2grid_minmax_xyt",
+     "scat2grid_std_xyt",
+     "scat2gridgauss_xt",
+     "scat2gridgauss_xt_v0",
+     "scat2gridgauss_xy",
+     "scat2gridgauss_xy_v0",
+     "scat2gridgauss_xz",
+     "scat2gridgauss_xz_v0",
+     "scat2gridgauss_yt",
+     "scat2gridgauss_yt_v0",
+     "scat2gridgauss_yz",
+     "scat2gridgauss_yz_v0",
+     "scat2gridgauss_zt",
+     "scat2gridgauss_zt_v0",
+     "scat2gridlaplace_xt",
+     "scat2gridlaplace_xy",
+     "scat2gridlaplace_xz",
+     "scat2gridlaplace_yt",
+     "scat2gridlaplace_yz",
+     "scat2gridlaplace_zt",
+     "scat2grid_nbin_xy",
+     "scat2grid_nbin_xyt",
+     "scat2grid_nobs_xy",
+     "scat2grid_nobs_xyt",
+     "scat2grid_t",
+     "separate",
+     "separate_str",
+     "sorti",
+     "sorti_str",
+     "sortj",
+     "sortj_str",
+     "sortk",
+     "sortk_str",
+     "sortl",
+     "sortl_str",
+     "sortm",
+     "sortm_str",
+     "sortn",
+     "sortn_str",
+     "str_mask",
+     "str_noblanks",
+     "str_replace",
+     "tauto_cor",
+     "tax_datestring",
+     "tax_day",
+     "tax_dayfrac",
+     "tax_jday",
+     "tax_jday1900",
+     "tax_month",
+     "tax_times",
+     "tax_tstep",
+     "tax_units",
+     "tax_year",
+     "tax_yearfrac",
+     "tcat",
+     "tcat_str",
+     "test_opendap",
+     "time_reformat",
+     "tracks2grid_mask_ave_xyt",
+     "tracks2grid_std_xyt",
+     "transpose_ef",
+     "transpose_te",
+     "transpose_tf",
+     "transpose_xe",
+     "transpose_xf",
+     "transpose_xt",
+     "transpose_xy",
+     "transpose_xz",
+     "transpose_ye",
+     "transpose_yf",
+     "transpose_yt",
+     "transpose_yz",
+     "transpose_ze",
+     "transpose_zf",
+     "transpose_zt",
+     "treverse",
+     "unique_str2int",
+     "write_webrow",
+     "write_webrow_gwt",
+     "xauto_cor",
+     "xcat",
+     "xcat_str",
+     "xreverse",
+     "ycat",
+     "ycat_str",
+     "yreverse",
+     "zaxreplace_avg",
+     "zaxreplace_bin",
+     "zaxreplace_rev",
+     "zaxreplace_zlev",
+     "zcat",
+     "zcat_str",
+     "zreverse"
+  };
+  /* The number of names in the array above */
+  int N_INTEF = sizeof(I_EFnames) / EF_MAX_NAME_LENGTH;
+
+  if ( (STATIC_ExternalFunctionList = list_init(__FILE__, __LINE__)) == NULL ) {
     fputs("**ERROR: efcn_scan: Unable to initialize STATIC_ExternalFunctionList.\n", stderr);
-    return_val = -1;
-    return return_val;
+    return -1;
   }
 
-
   /*
    * Get internally linked external functions;  and add all
    * the names and associated directory information to the
    * STATIC_ExternalFunctionList.
    */
-
-
-  /*
-   * Read a name at a time.
-   */
-
-      for (i_intEF = 0; i_intEF < N_INTEF;   i_intEF = i_intEF + 1 ) {
-	      strcpy(ef.path, "internally_linked");
-	      strcpy(ef.name, I_EFnames[i_intEF].funcname);
-	      ef.id = *gfcn_num_internal + ++count; /* pre-increment because F arrays start at 1 */
-	      ef.already_have_internals = NO;
-	      ef.internals_ptr = NULL;
-	      list_insert_after(STATIC_ExternalFunctionList, (char *) &ef, sizeof(ExternalFunction));
-
-      }
+  for (i_intEF = 0; i_intEF < N_INTEF; i_intEF++ ) {
+      strcpy(ef.path, "internally_linked");
+      strcpy(ef.name, I_EFnames[i_intEF]);
+      ef.id = gfcn_num_internal + ++count; /* pre-increment because F arrays start at 1 */
+      ef.already_have_internals = NO;
+      ef.internals_ptr = NULL;
+      list_insert_after(STATIC_ExternalFunctionList, (char *) &ef, sizeof(ExternalFunction), __FILE__, __LINE__);
+  }
 
   /*
    * - Get all the paths from the "FER_EXTERNAL_FUNCTIONS" environment variable.
@@ -1529,41 +1521,29 @@ strcpy(I_EFnames[201].funcname,  "zreverse");
    *
    */
 
-  if ( !getenv("FER_EXTERNAL_FUNCTIONS") ) {
-    if ( !I_have_warned_already ) {
-      fprintf(stderr, "\n"
-                      "WARNING: environment variable FER_EXTERNAL_FUNCTIONS not defined.\n\n");
-      I_have_warned_already = TRUE;
-    }
+  path_ptr = getenv("FER_EXTERNAL_FUNCTIONS");
+  if ( path_ptr == NULL ) {
+    /* fprintf(stderr, "\nWARNING: environment variable FER_EXTERNAL_FUNCTIONS not defined.\n\n"); */
     /* *kob* v5.32 - the return val was set to 0 below but that was wrong.
        That didn't take into account that on any system, the
        FER_EXTERNAL_FUNCTIONS env variable might not be set.  If that were the
        case, a core dump occurred on all systems.  Set return_val to count,
        which was generated above - also have to  note that the ef's
        have been scanned*/
-    return_val = count;
-    I_have_scanned_already = TRUE;
-    return return_val;
+    return count;
   }
 
-  sprintf(paths, "%s", getenv("FER_EXTERNAL_FUNCTIONS"));
-
-  path_ptr = strtok(paths, " \t");
-
+  strcpy(allpaths, path_ptr);
+  path_ptr = strtok(allpaths, " \t");
   if ( path_ptr == NULL ) {
 
-    fprintf(stderr, "\n"
-                    "WARNING:No paths were found in the environment variable FER_EXTERNAL_FUNCTIONS.\n\n");
-
-    return_val = 0;
-    return return_val;
+    /* fprintf(stderr, "\nWARNING:No paths were found in the environment variable FER_EXTERNAL_FUNCTIONS.\n\n"); */
+    return count;
 
   } else {
 
     do {
-
-	  strcpy(path, path_ptr);
-
+      strcpy(path, path_ptr);
       if (path[strlen(path)-1] != '/')
         strcat(path, "/");
 
@@ -1571,9 +1551,8 @@ strcpy(I_EFnames[201].funcname,  "zreverse");
 
       /* Open a pipe to the "ls" command */
       if ( (file_ptr = popen(cmd, "r")) == (FILE *) NULL ) {
-	    fputs("**ERROR: Cannot open pipe.\n", stderr);
-	    return_val = -1;
-	    return return_val;
+         fputs("**ERROR: Cannot open pipe.\n", stderr);
+         return -1;
       }
 
       /*
@@ -1582,36 +1561,58 @@ strcpy(I_EFnames[201].funcname,  "zreverse");
        */
       while ( fgets(file, EF_MAX_NAME_LENGTH, file_ptr) != NULL ) {
 
-        char *extension;
-
-	    file[strlen(file)-1] = '\0';   /* chop off the carriage return */
-	    extension = &file[strlen(file)-3];
-	    if ( strcmp(extension, ".so") == 0 ) {
-          file[strlen(file)-3] = '\0'; /* chop off the ".so" */
-	      strcpy(ef.path, path);
-	      strcpy(ef.name, file);
-	      ef.id = *gfcn_num_internal + ++count; /* pre-increment because F arrays start at 1 */
-	      ef.already_have_internals = NO;
-	      ef.internals_ptr = NULL;
-	      list_insert_after(STATIC_ExternalFunctionList, (char *) &ef, sizeof(ExternalFunction));
-	    }
-
+         extension = &(file[strlen(file)-1]);
+         while ( isspace(*extension) ) {
+            *extension = '\0';   /* chop off the carriage return (or CR-LF) */
+            extension--;
+         }
+         extension--;
+         extension--;
+         if ( strcmp(extension, ".so") == 0 ) {
+            *extension = '\0'; /* chop off the ".so" */
+            strcpy(ef.path, path);
+            strcpy(ef.name, file);
+            ef.id = gfcn_num_internal + ++count; /* pre-increment because F arrays start at 1 */
+            ef.already_have_internals = NO;
+            ef.internals_ptr = NULL;
+            list_insert_after(STATIC_ExternalFunctionList, (char *) &ef, sizeof(ExternalFunction), __FILE__, __LINE__);
+         }
       }
 
       pclose(file_ptr);
 
       path_ptr = strtok(NULL, " \t"); /* get the next directory */
-
     } while ( path_ptr != NULL );
 
-    I_have_scanned_already = TRUE;
   }
 
-  return_val = count;
-  return return_val;
+  return count;
+}
 
+/*
+ * Clears and frees all memory associated with the given ef pointed to by data
+ */
+static void efcn_dealloc_ef(char *data) {
+  ExternalFunction *ef_ptr = (ExternalFunction *)data;
+  if ( ef_ptr->internals_ptr != NULL ) {
+      /* paranoia */
+      memset(ef_ptr->internals_ptr, 0, sizeof(ExternalFunctionInternals));
+      FerMem_Free(ef_ptr->internals_ptr, __FILE__, __LINE__);
+  }
+  /* paranoia */
+  memset(ef_ptr, 0, sizeof(ExternalFunction));
+  FerMem_Free(ef_ptr, __FILE__, __LINE__);
 }
 
+void FORTRAN(efcn_list_clear)(void)
+{
+  if ( STATIC_ExternalFunctionList != NULL ) {
+      /* free all the elements in the list and the list itseld */
+      list_free(STATIC_ExternalFunctionList, efcn_dealloc_ef, __FILE__, __LINE__);
+      STATIC_ExternalFunctionList = NULL;
+  }
+  I_have_scanned_already = FALSE;
+}
 
 /*
  * Determine whether an external function has already
@@ -1725,7 +1726,7 @@ void FORTRAN(create_pyefcn)(char fname[], int *lenfname, char pymod[], int *lenp
 
     /* Add a copy of this ExternalFunction to the end of the global list of external functions */
     list_mvrear(STATIC_ExternalFunctionList);
-    ef_ptr = (ExternalFunction *)list_insert_after(STATIC_ExternalFunctionList, (char *) &ef, sizeof(ExternalFunction));
+    ef_ptr = (ExternalFunction *)list_insert_after(STATIC_ExternalFunctionList, (char *) &ef, sizeof(ExternalFunction), __FILE__, __LINE__);
 
     /* Allocate and initialize the internals data for this ExternalFunction in the list */
     if ( EF_New(ef_ptr) != 0 ) {
@@ -1743,25 +1744,25 @@ void FORTRAN(create_pyefcn)(char fname[], int *lenfname, char pymod[], int *lenp
      * (for the "bail out" utility function).
      */
     if ( EF_Util_setsig("create_pyefcn")) {
-        list_remove_rear(STATIC_ExternalFunctionList);
-        free(ef_ptr->internals_ptr);
-        free(ef_ptr);
+        list_remove_rear(STATIC_ExternalFunctionList, __FILE__, __LINE__);
+        FerMem_Free(ef_ptr->internals_ptr, __FILE__, __LINE__);
+        FerMem_Free(ef_ptr, __FILE__, __LINE__);
         strcpy(errstring, "Unable to set signal handlers in create_pyefcn");
         *lenerrstring = strlen(errstring);
         return;
     }
     if (sigsetjmp(sigjumpbuffer, 1) != 0) {
-        list_remove_rear(STATIC_ExternalFunctionList);
-        free(ef_ptr->internals_ptr);
-        free(ef_ptr);
+        list_remove_rear(STATIC_ExternalFunctionList, __FILE__, __LINE__);
+        FerMem_Free(ef_ptr->internals_ptr, __FILE__, __LINE__);
+        FerMem_Free(ef_ptr, __FILE__, __LINE__);
         strcpy(errstring, "Signal caught in create_pyefcn");
         *lenerrstring = strlen(errstring);
         return;
     }
     if (setjmp(jumpbuffer) != 0) {
-        list_remove_rear(STATIC_ExternalFunctionList);
-        free(ef_ptr->internals_ptr);
-        free(ef_ptr);
+        list_remove_rear(STATIC_ExternalFunctionList, __FILE__, __LINE__);
+        FerMem_Free(ef_ptr->internals_ptr, __FILE__, __LINE__);
+        FerMem_Free(ef_ptr, __FILE__, __LINE__);
         strcpy(errstring, "ef_bail_out called in create_pyefcn");
         *lenerrstring = strlen(errstring);
         return;
@@ -1775,9 +1776,9 @@ void FORTRAN(create_pyefcn)(char fname[], int *lenfname, char pymod[], int *lenp
 
     *lenerrstring = strlen(errstring);
     if ( *lenerrstring > 0 ) {
-        list_remove_rear(STATIC_ExternalFunctionList);
-        free(ef_ptr->internals_ptr);
-        free(ef_ptr);
+        list_remove_rear(STATIC_ExternalFunctionList, __FILE__, __LINE__);
+        FerMem_Free(ef_ptr->internals_ptr, __FILE__, __LINE__);
+        FerMem_Free(ef_ptr, __FILE__, __LINE__);
     }
     return;
 }
@@ -1820,7 +1821,7 @@ int FORTRAN(efcn_gather_info)( int *id_ptr )
 
    /* Get a handle for the shared object if not internally linked */
    if ( ! internally_linked ) {
-      strcat(tempText, ef_ptr->path);
+      strcpy(tempText, ef_ptr->path);
       strcat(tempText, ef_ptr->name);
       strcat(tempText, ".so");
 
@@ -1962,8 +1963,7 @@ void FORTRAN(efcn_get_custom_axes)( int *id_ptr, int *cx_list_ptr, int *status )
 
     canjump = 1;
 
-    sprintf(tempText, "");
-    strcat(tempText, ef_ptr->name);
+    strcpy(tempText, ef_ptr->name);
     strcat(tempText, "_custom_axes_");
 
     if (!internally_linked) {
@@ -2027,7 +2027,7 @@ void FORTRAN(efcn_get_custom_axes)( int *id_ptr, int *cx_list_ptr, int *status )
       (*pyefcn_custom_axes_func)(*id_ptr, ef_ptr->path, errstring);
       if ( strlen(errstring) > 0 ) {
           /* (In effect) call ef_bail_out_ to process the error in a standard way */
-          ef_err_bail_out_(id_ptr, errstring);
+          FORTRAN(ef_err_bail_out)(id_ptr, errstring);
           /* Should never return - instead jumps to setjmp() returning 1 */
       }
 
@@ -2112,8 +2112,7 @@ void FORTRAN(efcn_get_result_limits)( int *id_ptr, int *mr_list_ptr, int *cx_lis
     canjump = 1;
 
 
-    sprintf(tempText, "");
-    strcat(tempText, ef_ptr->name);
+    strcpy(tempText, ef_ptr->name);
     strcat(tempText, "_result_limits_");
 
     if (!internally_linked) {
@@ -2177,7 +2176,7 @@ void FORTRAN(efcn_get_result_limits)( int *id_ptr, int *mr_list_ptr, int *cx_lis
       (*pyefcn_result_limits_func)(*id_ptr, ef_ptr->path, errstring);
       if ( strlen(errstring) > 0 ) {
           /* (In effect) call ef_bail_out_ to process the error in a standard way */
-          ef_err_bail_out_(id_ptr, errstring);
+          FORTRAN(ef_err_bail_out)(id_ptr, errstring);
           /* Should never return - instead jumps to setjmp() returning 1 */
       }
 
@@ -2203,10 +2202,16 @@ void FORTRAN(efcn_get_result_limits)( int *id_ptr, int *mr_list_ptr, int *cx_lis
 void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *mr_list_ptr, int *mres_ptr,
 	DFTYPE *bad_flag_ptr, int *status )
 {
+  /* 
+   * The array of work array memory pointers are used in return setjmp/longjmp 
+   * and sigsetjmp/siglongjmp blocks so cannot be an normal automatic variable.
+   */
+  static DFTYPE *(work_ptr[EF_MAX_WORK_ARRAYS]);
+
   ExternalFunction *ef_ptr=NULL;
   ExternalFunctionInternals *i_ptr=NULL;
   DFTYPE *arg_ptr[EF_MAX_COMPUTE_ARGS];
-  int xyzt=0, i=0, j=0;
+  int i=0, j=0;
   int size=0;
   int nargs=0;
   char tempText[EF_MAX_NAME_LENGTH]="";
@@ -2327,8 +2332,7 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
 
     } else if (i_ptr->num_work_arrays > 0)  {
 
-      sprintf(tempText, "");
-      strcat(tempText, ef_ptr->name);
+      strcpy(tempText, ef_ptr->name);
       strcat(tempText, "_work_size_");
 
       if (!internally_linked) {
@@ -2345,8 +2349,9 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
       (*fptr)( id_ptr );
 
 
-	  /* Allocate memory for each individual work array */
-
+      /* Allocate memory for each individual work array */
+      for (j = 0; j < EF_MAX_WORK_ARRAYS; j++)
+         work_ptr[j] = NULL;
       for (j=0; j<i_ptr->num_work_arrays; i++, j++) {
 
         int iarray, xlo, ylo, zlo, tlo, elo, flo,
@@ -2371,14 +2376,20 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
         size = sizeof(DFTYPE) * (xhi-xlo+1) * (yhi-ylo+1) * (zhi-zlo+1)
                               * (thi-tlo+1) * (ehi-elo+1) * (fhi-flo+1);
 
-        arg_ptr[i] = (DFTYPE *)malloc(size);
+        arg_ptr[i] = (DFTYPE *)FerMem_Malloc(size, __FILE__, __LINE__);
         if ( arg_ptr[i] == NULL ) {
           fprintf(stderr, "**ERROR in efcn_compute() allocating %d bytes of memory\n"
                           "\twork array %d:  X=%d:%d, Y=%d:%d, Z=%d:%d, T=%d:%d, E=%d:%d, F=%d:%d\n",
                           size, iarray, xlo, xhi, ylo, yhi, zlo, zhi, tlo, thi, elo, ehi, flo, fhi);
+          while ( j > 0 ) {
+             j--;
+             FerMem_Free(work_ptr[j], __FILE__, __LINE__);
+             work_ptr[j] = NULL;
+          }
 	  *status = FERR_EF_ERROR;
 	  return;
         }
+        work_ptr[j] = arg_ptr[i];
       }
 
     }
@@ -2391,6 +2402,12 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
      */
 
     if ( EF_Util_setsig("efcn_compute")) {
+      for (j = 0; j < EF_MAX_WORK_ARRAYS; j++) {
+        if ( work_ptr[j] == NULL )
+          break;
+        FerMem_Free(work_ptr[j], __FILE__, __LINE__);
+        work_ptr[j] = NULL;
+      }
       *status = FERR_EF_ERROR;
       return;
     }
@@ -2399,6 +2416,12 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
      * Set the signal return location and process jumps
      */
     if (sigsetjmp(sigjumpbuffer, 1) != 0) {
+      for (j = 0; j < EF_MAX_WORK_ARRAYS; j++) {
+        if ( work_ptr[j] == NULL )
+          break;
+        FerMem_Free(work_ptr[j], __FILE__, __LINE__);
+        work_ptr[j] = NULL;
+      }
       *status = FERR_EF_ERROR;
       return;
     }
@@ -2407,6 +2430,12 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
      * Set the bail out return location and process jumps
      */
     if (setjmp(jumpbuffer) != 0) {
+      for (j = 0; j < EF_MAX_WORK_ARRAYS; j++) {
+        if ( work_ptr[j] == NULL )
+          break;
+        FerMem_Free(work_ptr[j], __FILE__, __LINE__);
+        work_ptr[j] = NULL;
+      }
       *status = FERR_EF_ERROR;
       return;
     }
@@ -2418,8 +2447,7 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
      * Now go ahead and call the external function's "_compute_" function,
      * prototyping it for the number of arguments expected.
      */
-    sprintf(tempText, "");
-    strcat(tempText, ef_ptr->name);
+    strcpy(tempText, ef_ptr->name);
     strcat(tempText, "_compute_");
 
     switch ( i_ptr->num_reqd_args + i_ptr->num_work_arrays ) {
@@ -2683,6 +2711,12 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
 
 
     default:
+      for (j = 0; j < EF_MAX_WORK_ARRAYS; j++) {
+        if ( work_ptr[j] == NULL )
+          break;
+        FerMem_Free(work_ptr[j], __FILE__, __LINE__);
+        work_ptr[j] = NULL;
+      }
       fprintf(stderr, "**ERROR: External functions with more than %d arguments are not implemented.\n",
                       EF_MAX_ARGS);
       *status = FERR_EF_ERROR;
@@ -2691,21 +2725,20 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
 
     }
 
-    /*
-     * Restore the old signal handlers.
-     */
-    if ( EF_Util_ressig("efcn_compute")) {
-       *status = FERR_EF_ERROR;
-       return;
+    /* Release the work space. */
+    for (j = 0; j < EF_MAX_WORK_ARRAYS; j++) {
+      if ( work_ptr[j] == NULL )
+        break;
+      FerMem_Free(work_ptr[j], __FILE__, __LINE__);
+      work_ptr[j] = NULL;
     }
 
     /*
-     * Now it's time to release the work space.
-     * With arg_ptr[0] for argument #1, and remembering one slot for the result,
-     * we should begin freeing up memory at arg_ptr[num_reqd_args+1].
+     * Restore the old signal handlers.
      */
-    for (i=i_ptr->num_reqd_args+1; i<i_ptr->num_reqd_args+1+i_ptr->num_work_arrays; i++) {
-      free(arg_ptr[i]);
+    if ( EF_Util_ressig("efcn_compute")) {
+      *status = FERR_EF_ERROR;
+      return;
     }
 
     /* Success for EF_F */
@@ -2746,11 +2779,11 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
       }
 
       /* Assign the memory limits, step values, and bad-data-flag values - first result, then arguments */
-      ef_get_res_mem_subscripts_(id_ptr, memlo[0], memhi[0]);
-      ef_get_arg_mem_subscripts_(id_ptr, &(memlo[1]), &(memhi[1]));
-      ef_get_res_subscripts_(id_ptr, steplo[0], stephi[0], incr[0]);
-      ef_get_arg_subscripts_(id_ptr, &(steplo[1]), &(stephi[1]), &(incr[1]));
-      ef_get_bad_flags_(id_ptr, &(badflags[1]), &(badflags[0]));
+      FORTRAN(ef_get_res_mem_subscripts_6d)(id_ptr, memlo[0], memhi[0]);
+      FORTRAN(ef_get_arg_mem_subscripts_6d)(id_ptr, &(memlo[1]), &(memhi[1]));
+      FORTRAN(ef_get_res_subscripts_6d)(id_ptr, steplo[0], stephi[0], incr[0]);
+      FORTRAN(ef_get_arg_subscripts_6d)(id_ptr, &(steplo[1]), &(stephi[1]), &(incr[1]));
+      FORTRAN(ef_get_bad_flags)(id_ptr, &(badflags[1]), &(badflags[0]));
 
       /* Reset zero increments to +1 or -1 for pyefcn_compute */
       for (i = 0; i <= i_ptr->num_reqd_args; i++) {
@@ -2789,7 +2822,7 @@ void FORTRAN(efcn_compute)( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *m
                              memlo, memhi, steplo, stephi, incr, badflags, errstring);
       if ( strlen(errstring) > 0 ) {
           /* (In effect) call ef_bail_out_ to process the error in a standard way */
-          ef_err_bail_out_(id_ptr, errstring);
+          FORTRAN(ef_err_bail_out)(id_ptr, errstring);
           /* Should never return - instead jumps to setjmp() returning 1 */
       }
 
@@ -2899,7 +2932,6 @@ int FORTRAN(efcn_get_id)( char name[] )
 int FORTRAN(efcn_match_template)( int *id_ptr, char template[] )
 {
   ExternalFunction *ef_ptr=NULL;
-  int status=LIST_OK;
   int EF_LT_MT_return;
 
   static int return_val=0; /* static because it needs to exist after the return statement */
@@ -3367,7 +3399,7 @@ void FORTRAN(ef_err_bail_out)(int *id_ptr, char *text)
 int EF_New( ExternalFunction *this )
 {
   ExternalFunctionInternals *i_ptr=NULL;
-  int status=LIST_OK, i=0, j=0;
+  int i=0, j=0;
 
   static int return_val=0; /* static because it needs to exist after the return statement */
 
@@ -3377,7 +3409,7 @@ int EF_New( ExternalFunction *this )
    * If the allocation failed, print a warning message and return.
    */
 
-  this->internals_ptr = malloc(sizeof(ExternalFunctionInternals));
+  this->internals_ptr = FerMem_Malloc(sizeof(ExternalFunctionInternals), __FILE__, __LINE__);
   i_ptr = this->internals_ptr;
 
   if ( i_ptr == NULL ) {
@@ -3438,13 +3470,10 @@ int EF_New( ExternalFunction *this )
 void EF_store_globals(int *mr_list_ptr, int *cx_list_ptr,
 	int *mres_ptr, DFTYPE *bad_flag_ptr)
 {
-  int i=0;
-
   GLOBAL_mr_list_ptr = mr_list_ptr;
   GLOBAL_cx_list_ptr = cx_list_ptr;
   GLOBAL_mres_ptr = mres_ptr;
   GLOBAL_bad_flag_ptr = bad_flag_ptr;
-
 }
 void FORTRAN(efcn_pass_arg_ptr)(int *iarg, DFTYPE *arg_ptr)
 {
@@ -3489,7 +3518,6 @@ ExternalFunction *ef_ptr_from_id_ptr(int *id_ptr)
 
 int EF_ListTraverse_fprintf( char *data, char *curr )
 {
-   FILE *File_ptr=(FILE *)data;
    ExternalFunction *ef_ptr=(ExternalFunction *)curr;
 
    fprintf(stderr, "path = \"%s\", name = \"%s\", id = %d, internals_ptr = %ld\n",
@@ -3541,7 +3569,8 @@ int EF_ListTraverse_MatchTemplate( char data[], char *curr )
       if ( star_skip ) {
 	continue;
       } else {
-	if ( ++n == '\0' ) /* end of name */
+        n++;
+	if ( *n == '\0' ) /* end of name */
 	  return TRUE; /* no match */
 	else
 	  continue;
diff --git a/fer/ccr/SOURCE_FILES b/fer/ccr/SOURCE_FILES
index 807cef0..fa142f1 100644
--- a/fer/ccr/SOURCE_FILES
+++ b/fer/ccr/SOURCE_FILES
@@ -21,7 +21,6 @@ perl_read.c\
 EF_InternalUtil.c\
 fermain_c.c\
 ferret_dispatch_c.c\
-ferret_query.c\
 free_cached_full_array.c\
 free_c_pointer.c\
 free_c_string_array.c\
@@ -35,7 +34,6 @@ get_ws_mem.c\
 get_offset_c_string.c\
 get_offset_c_string_len.c\
 get_sys_cmnd.c\
-gui_init.c\
 grab_image_xwd.c\
 init_c_string_array.c\
 linux_routines_c.c\
diff --git a/fer/ccr/backing_store_enabled.c b/fer/ccr/backing_store_enabled.c
index 0f62300..e4be182 100644
--- a/fer/ccr/backing_store_enabled.c
+++ b/fer/ccr/backing_store_enabled.c
@@ -42,17 +42,10 @@
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <stdlib.h>
+#include "ferret.h"
 #include "gks_implem.h"
-#include "wslist.h"
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-backing_store_enabled(ws_id, bs)
-#else
-backing_store_enabled_(ws_id, bs)
-#endif
-     int *ws_id;
-     int *bs;
 
+void FORTRAN(backing_store_enabled)(int *ws_id, int *bs)
 {
   WS_STATE_ENTRY *ws;
   XWindowAttributes win_info;
diff --git a/fer/ccr/batch_graphics.c b/fer/ccr/batch_graphics.c
index 110ecdc..2e8b5cb 100644
--- a/fer/ccr/batch_graphics.c
+++ b/fer/ccr/batch_graphics.c
@@ -57,12 +57,7 @@
 
 #include <assert.h>
 #include <string.h>
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
+#include "ferret.h"
 
 /* local static variable to contain the state */
 static int its_batch=0;
@@ -88,8 +83,8 @@ void FORTRAN(set_batch_graphics)(char *outfile, int *batmode)
   result = strstr(outfile,".gif"); 
   if (result)  {
       its_gif = -1;
-      if (length > 4)
-      {FORTRAN(save_frame_name)(outfile, &length);
+      if (length > 4) {
+          FORTRAN(save_frame_name)(outfile, &length);
       }
    }
   result = strstr(outfile,".ps"); 
diff --git a/fer/ccr/binaryRead.c b/fer/ccr/binaryRead.c
index 82dba3c..299c65b 100644
--- a/fer/ccr/binaryRead.c
+++ b/fer/ccr/binaryRead.c
@@ -2,7 +2,7 @@
  *
  * Utility functions for reading binary data
  *
- * $Id: binaryRead.c 21935 2016-06-15 23:59:38Z ksmith $
+ * $Id$
  *
  *
  * *kob*  4/06 v600 - changes for 64-bit build 
@@ -23,6 +23,8 @@
 #include <string.h>
 #include <stdio.h>
 #include <unistd.h>
+#include "ferret.h"
+#include "FerMem.h"
 #include "binaryRead.h"
 
                                 /* FORTRAN interface variables */
@@ -126,17 +128,18 @@ static void freeMemory(FileInfo *file) {
   }
 }
 
-static FileInfo *createBinaryReader(char *name, int lengths[MAXDIMS],
-                             int permutes[MAXDIMS], int skip, int swap){
-  FileInfo *fi = (FileInfo *)calloc(1, sizeof(FileInfo));
+static FileInfo *createBinaryReader(char *name, int lengths[MAXDIMS], int permutes[MAXDIMS], int skip, int swap)
+{
   int i;
-                                /* Open file */
+  FileInfo *fi = (FileInfo *)FerMem_Malloc(sizeof(FileInfo), __FILE__, __LINE__);
+  memset(fi, 0, sizeof(FileInfo));
+
   if (!checkMem(fi)){
     return 0;
   }
   Errbuf[0] = '\0';
   fi->pageSize = getpagesize();
-  fi->name = (char *)malloc(strlen(name)+1);
+  fi->name = (char *)FerMem_Malloc(strlen(name)+1, __FILE__, __LINE__);
   fi->doSwap = swap;
   if (!checkMem(fi->name)){
     return 0;
@@ -179,25 +182,23 @@ static FileInfo *createBinaryReader(char *name, int lengths[MAXDIMS],
   return fi;
 }
 
-static void deleteVar(VarInfo *theVar) {
-  free(theVar);
-}
-
 static void deleteBinaryReader(FileInfo *fi){
-  free(fi->vars);
+  FerMem_Free(fi->vars, __FILE__, __LINE__);
+  fi->vars = NULL;
   tidyUp(fi);
-  free(fi->name);
-  free(fi);
+  FerMem_Free(fi->name, __FILE__, __LINE__);
+  /* paranoia */
+  memset(fi, 0, sizeof(FileInfo));
+  FerMem_Free(fi, __FILE__, __LINE__);
 }
 
 static int addVar(FileInfo *fi, DFTYPE *data, int type, int doRead){
   VarInfo *theVar = 0;
-  int i;
 
   if (fi->vars == (VarInfo *)0){
-    fi->vars = malloc(sizeof(VarInfo));
+    fi->vars = FerMem_Malloc(sizeof(VarInfo), __FILE__, __LINE__);
   } else {
-    fi->vars = (VarInfo *)realloc(fi->vars, sizeof(VarInfo)*(fi->nvars+1));
+    fi->vars = (VarInfo *)FerMem_Realloc(fi->vars, sizeof(VarInfo)*(fi->nvars+1), __FILE__, __LINE__);
   }
   if (!checkMem(fi->vars)){
     return 0;
@@ -239,7 +240,7 @@ static void SWAP(unsigned char *p1, unsigned char *p2)
 }
 
 /* switch the order of the bytes in a long integer */
-static int SWAP32(void *i_in)
+static void SWAP32(void *i_in)
 {
   unsigned char *inptr = (unsigned char *)i_in;
   SWAP(inptr, &inptr[3]);
@@ -253,7 +254,7 @@ static void SWAP16(void *i_in)
   SWAP(inptr, &inptr[1]);
 }
  
-static double SWAP64(void *i_in)
+static void SWAP64(void *i_in)
 {
   unsigned char *inptr = (unsigned char *)i_in;
   SWAP(inptr, &inptr[7]);
@@ -391,15 +392,17 @@ static int readBinary(FileInfo *file){
   return okReturn(file);
 }
   
-int FORTRAN(br_open)(char *name, int lengths[MAXDIMS],
-                                  int permutes[MAXDIMS], int *iskip){
+int FORTRAN(br_open)(char *name, int lengths[MAXDIMS], int permutes[MAXDIMS], int *iskip)
+{
   int skip = (*iskip) * sizeof(DFTYPE); /* Words -> bytes */
   assert(FFileInfo == 0);
   FFileInfo = createBinaryReader(name, lengths, permutes, skip, Swap);
   return FFileInfo != 0;
 }
 
-int FORTRAN(br_add_var)(DFTYPE *data, int *doRead) {
+int FORTRAN(br_add_var)(DFTYPE *data, int *doRead) 
+{
+  char type;
   assert(FFileInfo != 0);
   assert(Types.length > 0);
   if (Types.length != 1 && FFileInfo->nvars >= Types.length){
@@ -407,23 +410,22 @@ int FORTRAN(br_add_var)(DFTYPE *data, int *doRead) {
              "Number of args in /type doesn't match number of variables");
     return 0;
   }
-  {
-    char type;
-    if (Types.length == 1){        /* All variables same type */
-      type = Types.type[0];
-    } else {
-      type = Types.type[FFileInfo->nvars];
-    }
-    return addVar(FFileInfo, data, type, *doRead);
+  if (Types.length == 1){        /* All variables same type */
+    type = Types.type[0];
+  } else {
+    type = Types.type[FFileInfo->nvars];
   }
+  return addVar(FFileInfo, data, type, *doRead);
 }
 
-int FORTRAN(br_read)() {
+int FORTRAN(br_read)(void)
+{
   assert(FFileInfo != 0);
   return readBinary(FFileInfo);
 }
 
-void FORTRAN(br_close)() {
+void FORTRAN(br_close)(void)
+{
   if (FFileInfo != 0){
     deleteBinaryReader(FFileInfo);
     FFileInfo = 0;
diff --git a/fer/ccr/c_dncase.c b/fer/ccr/c_dncase.c
index 2807303..8c55899 100644
--- a/fer/ccr/c_dncase.c
+++ b/fer/ccr/c_dncase.c
@@ -43,23 +43,28 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void c_dncase_(in_ptr, out_ptr)
-     char** in_ptr;
-     char** out_ptr;
+void FORTRAN(c_dncase)(char **in_ptr, char **out_ptr)
 {
    char* tmp;
    char* tmp2;
 
-   if ( *out_ptr != NULL )
-      free(*out_ptr);
+   if ( (*out_ptr != NULL) && (*out_ptr != STRING_MISSING_VALUE) )
+      FerMem_Free(*out_ptr, __FILE__, __LINE__);
    if ( *in_ptr == NULL ) {
       /* undefined string given, so return an undefined string */
       *out_ptr = NULL;
       return;
    }
+   if ( *in_ptr == STRING_MISSING_VALUE ) {
+      /* missing string given, so return an missing string */
+      *out_ptr = STRING_MISSING_VALUE;
+      return;
+   }
   
-   *out_ptr = (char *) malloc(sizeof(char) * (strlen(*in_ptr)+1));
+   *out_ptr = (char *) FerMem_Malloc(sizeof(char) * (strlen(*in_ptr)+1), __FILE__, __LINE__);
    if ( *out_ptr == NULL )
       abort();
 
diff --git a/fer/ccr/c_strcat.c b/fer/ccr/c_strcat.c
index a01d275..45fa143 100644
--- a/fer/ccr/c_strcat.c
+++ b/fer/ccr/c_strcat.c
@@ -42,36 +42,35 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void c_strcat_(in_ptr1, in_ptr2, out_ptr)  
-     char** in_ptr1;
-     char** in_ptr2;
-     char** out_ptr;
+void FORTRAN(c_strcat)(char **in_ptr1, char **in_ptr2, char **out_ptr)
 {
    char* tmp1; 
    char* tmp2;
    int len1;
    int len2;
 
-   if ( *out_ptr != NULL )
-      free(*out_ptr);
+   if ( (*out_ptr != NULL) && (*out_ptr != STRING_MISSING_VALUE) )
+      FerMem_Free(*out_ptr, __FILE__, __LINE__);
 
    /* this treats an undefined string the same as an empty string */
-   if ( *in_ptr1 == NULL )
+   if ( (*in_ptr1 == NULL) || (*in_ptr1 == STRING_MISSING_VALUE) )
       len1 = 0;
    else
       len1 = strlen(*in_ptr1);
-   if ( *in_ptr2 == NULL )
+   if ( (*in_ptr2 == NULL) || (*in_ptr2 == STRING_MISSING_VALUE) )
       len2 = 0;
    else
       len2 = strlen(*in_ptr2);
 
-   *out_ptr = (char *) malloc(sizeof(char) * (len1 + len2 + 1));
+   *out_ptr = (char *) FerMem_Malloc(sizeof(char) * (len1 + len2 + 1), __FILE__, __LINE__);
    if ( *out_ptr == NULL )
       abort();
 
    tmp2 = *out_ptr;
-   if ( *in_ptr1 != NULL ) {
+   if ( (*in_ptr1 != NULL) && (*in_ptr1 != STRING_MISSING_VALUE) ) {
       tmp1 = *in_ptr1;
       while ( *tmp1 != '\0' ) {
          *tmp2 = *tmp1;
@@ -79,7 +78,7 @@ void c_strcat_(in_ptr1, in_ptr2, out_ptr)
          tmp2++;
       } 
    } 
-   if ( *in_ptr2 != NULL ) {
+   if ( (*in_ptr2 != NULL) && (*in_ptr2 != STRING_MISSING_VALUE) ) {
       tmp1 = *in_ptr2;
       while ( *tmp1 != '\0' ) {
          *tmp2 = *tmp1;
diff --git a/fer/ccr/c_strcmp.c b/fer/ccr/c_strcmp.c
index 89094db..26d7d3e 100644
--- a/fer/ccr/c_strcmp.c
+++ b/fer/ccr/c_strcmp.c
@@ -39,11 +39,9 @@
  */
 
 #include <string.h>
+#include "ferret.h"
 
-void c_strcmp_(in_ptr1, in_ptr2, out_ptr)
-     char** in_ptr1;
-     char** in_ptr2;
-     int* out_ptr;
+void FORTRAN(c_strcmp)(char **in_ptr1, char **in_ptr2, int *out_ptr)
 {
    char *str1;
    char *str2;
diff --git a/fer/ccr/c_strfloat.c b/fer/ccr/c_strfloat.c
index 05ed332..5bd8ba4 100644
--- a/fer/ccr/c_strfloat.c
+++ b/fer/ccr/c_strfloat.c
@@ -47,10 +47,7 @@
 #include <stdlib.h>
 #include "ferret.h"
 
-void c_strfloat_(in_ptr, out_ptr, bad_ptr)
-     char** in_ptr;
-     DFTYPE* out_ptr;
-     DFTYPE* bad_ptr;
+void FORTRAN(c_strfloat)(char **in_ptr, DFTYPE *out_ptr, DFTYPE *bad_ptr)
 {
    double dval;
    char  *endptr;
diff --git a/fer/ccr/c_strindex.c b/fer/ccr/c_strindex.c
index 8bae209..9a82cf0 100644
--- a/fer/ccr/c_strindex.c
+++ b/fer/ccr/c_strindex.c
@@ -42,11 +42,9 @@
  */ 
 
 #include <string.h>
+#include "ferret.h"
 
-void c_strindex_(in_ptr1, in_ptr2, out_ptr)
-     char** in_ptr1;
-     char** in_ptr2;
-     int* out_ptr;
+void FORTRAN(c_strindex)(char **in_ptr1, char **in_ptr2, int *out_ptr)
 {
    char * result;
 
diff --git a/fer/ccr/c_strlen.c b/fer/ccr/c_strlen.c
index 6e3aee8..346994a 100644
--- a/fer/ccr/c_strlen.c
+++ b/fer/ccr/c_strlen.c
@@ -42,10 +42,9 @@
  */
 
 #include <string.h>
+#include "ferret.h"
 
-void c_strlen_(in_ptr, out_ptr)
-     char** in_ptr;
-     int* out_ptr;
+void FORTRAN(c_strlen)(char **in_ptr, int *out_ptr)
 {
    /* this treats an undefined string the same as an empty string */
    if ( *in_ptr == NULL )
diff --git a/fer/ccr/c_strrindex.c b/fer/ccr/c_strrindex.c
index 41fe283..135c4d8 100644
--- a/fer/ccr/c_strrindex.c
+++ b/fer/ccr/c_strrindex.c
@@ -43,11 +43,9 @@
  */
 
 #include <string.h>
+#include "ferret.h"
 
-void c_strrindex_(in_ptr1, in_ptr2, out_ptr)
-     char** in_ptr1;
-     char** in_ptr2;
-     int* out_ptr;
+void FORTRAN(c_strrindex)(char **in_ptr1, char **in_ptr2, int *out_ptr)
 {
    char *result;
    char *tmp;
diff --git a/fer/ccr/c_substr.c b/fer/ccr/c_substr.c
index 74141f6..da2eef2 100644
--- a/fer/ccr/c_substr.c
+++ b/fer/ccr/c_substr.c
@@ -47,29 +47,32 @@
  */
 
 #include <stdlib.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void c_substr_(in_ptr, offset, length, out_ptr)
-     char** in_ptr;
-     int* offset;
-     int* length;
-     char** out_ptr;     
+void FORTRAN(c_substr)(char **in_ptr, int *offset, int *length, char **out_ptr)
 {
    char* tmp;
    char* tmp2;
    int i, int_length, int_offset;
 
-   if ( *out_ptr != NULL )
-      free(*out_ptr);
+   if ( (*out_ptr != NULL) && (*out_ptr != STRING_MISSING_VALUE) )
+      FerMem_Free(*out_ptr, __FILE__, __LINE__);
    if ( *in_ptr == NULL ) {
       /* undefined string given, so return an undefined string */
       *out_ptr = NULL;
       return;
    }
+   if ( *in_ptr == STRING_MISSING_VALUE ) {
+      /* missing string given, so return an missing string */
+      *out_ptr = STRING_MISSING_VALUE;
+      return;
+   }
 
    int_length = (int)(*length + 0.5);
    int_offset = (int)(*offset + 0.5) - 1;
 
-   *out_ptr = (char *) malloc(sizeof(char) * (int_length + 1));
+   *out_ptr = (char *) FerMem_Malloc(sizeof(char) * (int_length + 1), __FILE__, __LINE__);
    if ( *out_ptr == NULL )
       abort();
 
diff --git a/fer/ccr/c_upcase.c b/fer/ccr/c_upcase.c
index 060752d..2289248 100644
--- a/fer/ccr/c_upcase.c
+++ b/fer/ccr/c_upcase.c
@@ -43,23 +43,28 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void c_upcase_(in_ptr, out_ptr)
-     char** out_ptr;
-     char** in_ptr;
+void FORTRAN(c_upcase)(char **in_ptr, char **out_ptr)
 {
    char* tmp;
    char* tmp2;
 
-   if ( *out_ptr != NULL )
-      free(*out_ptr);
+   if ( (*out_ptr != NULL) && (*out_ptr != STRING_MISSING_VALUE) )
+      FerMem_Free(*out_ptr, __FILE__, __LINE__);
    if ( *in_ptr == NULL ) {
       /* undefined string given, so return an undefined string */
       *out_ptr = NULL;
       return;
    }
+   if ( *in_ptr == STRING_MISSING_VALUE ) {
+      /* missing string given, so return an missing string */
+      *out_ptr = STRING_MISSING_VALUE;
+      return;
+   }
 
-   *out_ptr = (char *) malloc(sizeof(char) * (strlen(*in_ptr) + 1));
+   *out_ptr = (char *) FerMem_Malloc(sizeof(char) * (strlen(*in_ptr) + 1), __FILE__, __LINE__);
    if ( *out_ptr == NULL )
       abort();
 
diff --git a/fer/ccr/cache_full_array.c b/fer/ccr/cache_full_array.c
index 49ada13..c6f6092 100644
--- a/fer/ccr/cache_full_array.c
+++ b/fer/ccr/cache_full_array.c
@@ -51,8 +51,9 @@
 
 #include <stdlib.h>
 #include "ferret.h"
+#include "FerMem.h"
  
-void FORTRAN(cache_full_array)( double *array, int *alen, double **pointer_val )
+void FORTRAN(cache_full_array)( double *array, int *alen, double **pointer_val)
 
 /*
   input  - array and alen (array length)
@@ -64,7 +65,7 @@ void FORTRAN(cache_full_array)( double *array, int *alen, double **pointer_val )
   double *ptr;
   int i;
 
-  ptr = (double *) malloc(sizeof(double) * (*alen));
+  ptr = (double *) FerMem_Malloc(sizeof(double) * (*alen), __FILE__, __LINE__);
 
   for (i=0; i < *alen; i++) {
     ptr[i] = array[i];
diff --git a/fer/ccr/check_nan_data_sub.c b/fer/ccr/check_nan_data_sub.c
index fae3aa1..312b7a1 100644
--- a/fer/ccr/check_nan_data_sub.c
+++ b/fer/ccr/check_nan_data_sub.c
@@ -44,12 +44,10 @@
  *
  */
 
-#include <float.h>
+#include <math.h>
 #include "ferret.h"
 
-void check_nan_data_sub_ ( DFTYPE *src, 
-			   int *size, DFTYPE *data_bad )
-
+void FORTRAN(check_nan_data_sub)(DFTYPE *src, int *size, DFTYPE *data_bad)
 {
   int i;
 
diff --git a/fer/ccr/compare_c_strings.c b/fer/ccr/compare_c_strings.c
index d347c41..17007cc 100644
--- a/fer/ccr/compare_c_strings.c
+++ b/fer/ccr/compare_c_strings.c
@@ -38,10 +38,9 @@
  */
 
 #include <string.h>
+#include "ferret.h"
 
-int compare_c_strings_(ptr_1, ptr_2)
-     char** ptr_2;
-     char** ptr_1;
+int FORTRAN(compare_c_strings)(char **ptr_1, char **ptr_2)
 {
    char *str1;
    char *str2;
diff --git a/fer/ccr/copy_buffered_window.c b/fer/ccr/copy_buffered_window.c
index 82a251f..7999b5b 100644
--- a/fer/ccr/copy_buffered_window.c
+++ b/fer/ccr/copy_buffered_window.c
@@ -43,24 +43,14 @@
 #include <X11/Xutil.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "ferret.h"
 #include "gks_implem.h"
-#include "wslist.h"
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-void copy_buffered_window(ws_id, anim_id)
-#else
-void copy_buffered_window_(ws_id, anim_id)
-#endif
-     int *ws_id, *anim_id;
 
+void FORTRAN(copy_buffered_window)(int *ws_id, int *anim_id)
 {
-  WS_STATE_ENTRY *ws, *anim, *temp_win;
+  WS_STATE_ENTRY *ws, *anim;
   unsigned width, height;
-  XWindowAttributes win_info, anim_win_info;
-  int src_absx, src_absy, dest_absx, dest_absy;
-  int screen, tmp_id;
-  Window dummywin;
-  Pixmap pixmap;
+  XWindowAttributes win_info;
 
 /* determine the XGKS ws state entry structure from ws_id */
   ws  = OPEN_WSID (*ws_id);
@@ -75,8 +65,6 @@ void copy_buffered_window_(ws_id, anim_id)
       exit(1);
     }
   
-  screen = DefaultScreen(ws->dpy);
-  
   width = win_info.width;
   height = win_info.height;
 
diff --git a/fer/ccr/copy_c_string.c b/fer/ccr/copy_c_string.c
index 8ee2ea4..8f7b852 100644
--- a/fer/ccr/copy_c_string.c
+++ b/fer/ccr/copy_c_string.c
@@ -43,19 +43,23 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void copy_c_string_(in_ptr, out_ptr)
-     char** out_ptr;
-     char** in_ptr;
+void FORTRAN(copy_c_string)(char **in_ptr, char **out_ptr)
 {
-   if ( *out_ptr != NULL )
-      free(*out_ptr);
+   if ( (*out_ptr != NULL) && (*out_ptr != STRING_MISSING_VALUE) )
+      FerMem_Free(*out_ptr, __FILE__, __LINE__);
    if ( *in_ptr == NULL ) {
      *out_ptr = NULL;
      return;
    }
+   if ( *in_ptr == STRING_MISSING_VALUE ) {
+      *out_ptr = STRING_MISSING_VALUE;
+      return;
+   }
 
-   *out_ptr = (char *) malloc(sizeof(char) * (strlen(*in_ptr) + 1));
+   *out_ptr = (char *) FerMem_Malloc(sizeof(char) * (strlen(*in_ptr) + 1), __FILE__, __LINE__);
    if ( *out_ptr == NULL )
       abort();
 
diff --git a/fer/ccr/dynmemUtil.c b/fer/ccr/dynmemUtil.c
index ea93de2..09f6332 100644
--- a/fer/ccr/dynmemUtil.c
+++ b/fer/ccr/dynmemUtil.c
@@ -59,63 +59,51 @@
 #include <stdio.h>		/* for convenience */
 #include <string.h>		/* for convenience */
 
-
 #include "ferret.h"
+#include "FerMem.h"
 #include "EF_Util.h"
 
 
-/* prototypes */
-void FORTRAN(dynmem_make_ptr_array)(int* n, long* mr_ptrs_val, int* status);
-void FORTRAN(dynmem_pass_1_ptr)(int* iarg, DFTYPE* arg_ptr, long* mr_ptrs_val);
-void FORTRAN(dynmem_free_ptr_array)(long* mr_ptrs_val);
-
-
 /*
- * Create a pointer array in c.  Pass the pointer back as an long int value.
+ * Create a pointer array in c.
  */
-void FORTRAN(dynmem_make_ptr_array)(int* n, long* mr_ptrs_val, int* status)
+void FORTRAN(dynmem_make_ptr_array)(int* n, DFTYPE ***mr_ptrs_ptr, int* status)
 {
   int size;
   DFTYPE** mr_ptrs;
-  *status = FERR_OK;  // default
-
-  size = sizeof(DFTYPE*) * *n;
-  mr_ptrs = (DFTYPE**)malloc(size);
+  *status = FERR_EF_ERROR;
 
+  size = *n * sizeof(DFTYPE*);
+  mr_ptrs = (DFTYPE**)FerMem_Malloc(size, __FILE__, __LINE__);
   if ( mr_ptrs == NULL ) { 
     fprintf(stderr, "**ERROR in dynmem_make_ptr_array");
-    *status = FERR_EF_ERROR;
     return;
   }
 
-
-  *mr_ptrs_val = (long)mr_ptrs; 
+  *mr_ptrs_ptr = mr_ptrs; 
+  *status = FERR_OK;
 }
 
 /*
  * Insert one pointer (from FORTRAN) into the c pointer array
  */
-void FORTRAN(dynmem_pass_1_ptr)(int* iarg, DFTYPE* arg_ptr, long* mr_ptrs_val)
+void FORTRAN(dynmem_pass_1_ptr)(int* iarg, DFTYPE *arg_ptr, DFTYPE ***mr_ptrs_ptr)
 {
-  int iarg_c = *iarg-1;   // FORTRAN index to c index
+  int iarg_c = *iarg - 1;   // FORTRAN index to c index
   DFTYPE**  mr_ptrs;
 
-  mr_ptrs = (DFTYPE**) *mr_ptrs_val;
-
-  mr_ptrs[iarg_c]  = arg_ptr;
+  mr_ptrs = *mr_ptrs_ptr;
+  mr_ptrs[iarg_c] = arg_ptr;
 }
 
 
 /*
  * Free the pointer array
  */
-void FORTRAN(dynmem_free_ptr_array)(long* mr_ptrs_val)
+void FORTRAN(dynmem_free_ptr_array)(DFTYPE ***mr_ptrs_ptr)
 {
-  DFTYPE** mr_ptrs;
-
-  mr_ptrs = (DFTYPE**) *mr_ptrs_val;
-
-  free(mr_ptrs);
+  FerMem_Free(*mr_ptrs_ptr, __FILE__, __LINE__);
+  *mr_ptrs_ptr = NULL;
 }
 
 
diff --git a/fer/ccr/fermain_c.c b/fer/ccr/fermain_c.c
index b86ce31..0923771 100644
--- a/fer/ccr/fermain_c.c
+++ b/fer/ccr/fermain_c.c
@@ -145,18 +145,22 @@
 #include <string.h>
 #include <signal.h>
 #include "ferret.h"
+#include "FerMem.h"
 #include "ferret_shared_buffer.h"
+#include "pplmem.h"
+#include "xgks.h"
+
+/* Instantiate the globals in ferret_shared_buffer */
+smPtr sBuffer;
+float *ppl_memory;
 
-void gui_run(int *, char **);
-int gui_init();
 int its_script;
 char script_args[2048];
 int arg_pos;
 
-DFTYPE **gui_get_memory();
 static void command_line_run();
 
-void help_text()
+static void help_text(void)
 {
   printf(
 	 "Usage:  ferret [-memsize Mflts] [-batch [outfile]] [-server] [-secure] [-gif] [-unmapped] [-help] [-nojnl] [-noverify] [-script [args]]\n"
@@ -190,33 +194,24 @@ static void fer_signal_handler(int signal_num)
 }
 #endif
 
-/*
- * Eliminated _NO_PROTO ifdef (are there still non-ANSI C compilers around?)
- * JS
- */
 
 static int ttout_lun=TTOUT_LUN;
 
 
-main (int oargc, char *oargv[])
+int main(int oargc, char *oargv[])
 {
   int status;
-  smPtr sBuffer;
-  DFTYPE **memory = gui_get_memory(); 
   int argc = oargc;
   char **argv = oargv;
 
   int i=1;
   int j=1;
   double rmem_size = 0;
-  int using_gui = 0;
   int pplmem_size;
 
-  int gui_enabled = gui_init();
   int journalfile = 1;
   int verify_flag = 1;
   int len_str;
-  int uvar_dset;
   int bat_mode;
 
   its_script = 0;
@@ -379,14 +374,14 @@ main (int oargc, char *oargv[])
   /* initial allocation of PPLUS memory size pointer*/
   pplmem_size = (int)(0.5* 1.E6);  
   FORTRAN(save_ppl_memory_size)( &pplmem_size ); 
-  ppl_memory = (float *) malloc(sizeof(float) * pplmem_size );
+  ppl_memory = (float *) FerMem_Malloc(sizeof(float) * pplmem_size, __FILE__, __LINE__);
 
   if ( ppl_memory == NULL ) {
     printf("Unable to allocate the initial %d words of PLOT memory.\n",pplmem_size);
-    exit(0);
+    exit(1);
   }
   /* initialize stuff: keyboard, todays date, grids, GFDL terms, PPL brain */
-  FORTRAN(initialize)();
+  FORTRAN(initialize_ferret)();
 
   /*  prepare appropriate console input state and open the output journal file */
 
@@ -403,11 +398,7 @@ main (int oargc, char *oargv[])
   /* initialize size and shape of memory and linked lists */
   FORTRAN(init_memory)(&rmem_size);
 
-  if ( using_gui ) {
-    gui_run(&argc, argv);
-  } else {
-    command_line_run();
-  }
+  command_line_run();
   /* 
    *kob* 5/97 - need to close f90 files and flush buffers.....
    */
@@ -418,16 +409,15 @@ main (int oargc, char *oargv[])
 #ifdef __CYGWIN__
   for_rtl_finish_(&argc, argv);
 #endif
+  return 0;
 }
 
-  static void command_line_run(){
-
+static void command_line_run()
+{
   FILE *fp = 0;
   char init_command[2176], script_file[2048], *home = getenv("HOME");
   int ipath = 0;
-  int len_str = 0;
   int script_resetmem = 0;
-  double rmem_size;
 
   /* turn on ^C interrupts  */
   /* 10/97 *kob* add check for gui now that there is only one main program */
@@ -456,6 +446,7 @@ main (int oargc, char *oargv[])
   
     if (its_script)
     {
+        /* assume Unix-style passing of Holerith strings - add size as int to end */
 	FORTRAN(get_scriptfile_name)(script_file, &ipath, 2048);
       if ( ipath ) {
 	  strcat( init_command, "; GO \"" ); 
@@ -468,14 +459,13 @@ main (int oargc, char *oargv[])
 	  strcat( init_command, " ");
       }
 	  if (arg_pos !=0) {
-	       len_str = strlen(init_command);
 		   strcat( init_command, script_args );
 	  }
 	  strcat( init_command, "; EXIT/PROGRAM");
     }
 
   /* allocate the shared buffer */
-  sBuffer = (sharedMem *)malloc(sizeof(sharedMem));
+  sBuffer = (sharedMem *)FerMem_Malloc(sizeof(sharedMem), __FILE__, __LINE__);
 
  
   /* run the initialization file
@@ -555,7 +545,14 @@ main (int oargc, char *oargv[])
     /* ***** EXIT ***** */
     else if  (sBuffer->flags[FRTN_ACTION] == FACTN_EXIT ) {
       /*      printf("exit from FERRET requested\n"); */
-      FORTRAN(finalize)();
+      FORTRAN(finalize_ferret)();
+      if ( sBuffer != NULL )
+          FerMem_Free(sBuffer, __FILE__, __LINE__);
+      if ( ppl_memory != NULL )
+          FerMem_Free(ppl_memory, __FILE__, __LINE__);
+#ifdef MEMORYDEBUG
+      (void) ReportAnyMemoryLeaks();
+#endif
       exit(0);
     }
 
diff --git a/fer/ccr/ferret_dispatch_c.c b/fer/ccr/ferret_dispatch_c.c
index f6fc2ea..e33b841 100644
--- a/fer/ccr/ferret_dispatch_c.c
+++ b/fer/ccr/ferret_dispatch_c.c
@@ -60,39 +60,13 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <ferret.h>
+#include "ferret.h"
 #include "ferret_shared_buffer.h"
 
-/* function prototype for FORTRAN routine */
-/* added ifdef for necessity of trailing underscores *kob* */
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#   ifdef _NO_PROTO
-void ferret_dispatch_( );
-#   else
-void ferret_dispatch( char *init_command, int *rtn_flags,
-		      int *nflags, char *rtn_chars, int *nchars, int *nerrlines );
-#   endif
-#else                     /*NO_ENTRY_NAME_UNDERSCORES*/
-#   ifdef _NO_PROTO
-void ferret_dispatch_( );
-#   else
-void ferret_dispatch_( char *init_command, int *rtn_flags,
-		       int *nflags, char *rtn_chars, int *nchars, int *nerrlines );
-#   endif
-#endif                    /*NO_ENTRY_NAME_UNDERSCORES*/
-
-#ifdef _NO_PROTO
-void ferret_dispatch_c( init_command, sBuffer )
-char *init_command;
-smPtr sBuffer;
-#else
-void ferret_dispatch_c( char *init_command, smPtr sBuffer )
-#endif
+void ferret_dispatch_c(char *init_command, smPtr sBuffer)
 {
   int flag_buff_size  = NUMFLAGS;
   int TEXTLENGTH_size  = TEXTLENGTH;
-  int NUMDOUBLES_size = NUMDOUBLES;
 
 /* call the FORTRAN program that actually does the FERRET command */
 /* all arguments must be pointers for FORTRAN */
@@ -100,13 +74,8 @@ void ferret_dispatch_c( char *init_command, smPtr sBuffer )
 /* 1/17 *sh* removed the "memory" argument -- replaced by dynamic allocation
    of hyperslab memory using FORTRAN90 pointers and c (or python) */
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-  ferret_dispatch
-#else
-  ferret_dispatch_
-#endif
-                  ( init_command, sBuffer->flags, &flag_buff_size,
-		    sBuffer->text, &TEXTLENGTH_size, &(sBuffer->numStrings) );
+  FORTRAN(ferret_dispatch)(init_command, sBuffer->flags, &flag_buff_size,
+		    sBuffer->text, &TEXTLENGTH_size, &(sBuffer->numStrings));
 
   return;
 }
@@ -117,24 +86,24 @@ static int ServerFlag = 0;
 /*
  * Routines for setting/getting security settings
  */
-void set_secure() {
+void set_secure(void) {
   SecureFlag = 1;
 }
 
-int FORTRAN(is_secure)() {
+int FORTRAN(is_secure)(void) {
   return SecureFlag;
 }
 /*
  * Routines for setting/getting server settings
  */
-void set_server() {
+void set_server(void) {
   ServerFlag = 1;
   /* Should always be line buffered */
   setvbuf(stdout, NULL, _IOLBF, 0);
   setvbuf(stderr, NULL, _IOLBF, 0);
 }
 
-int FORTRAN(is_server)() {
+int FORTRAN(is_server)(void) {
   return ServerFlag;
 }
 
diff --git a/fer/ccr/ferret_query.c b/fer/ccr/ferret_query.c
deleted file mode 100644
index 065823b..0000000
--- a/fer/ccr/ferret_query.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.  
-*
-*/
-
-
-
-/*
-*	ferret_query - C routine to query state information from FERRET 
-*
-* TMAP interactive data analysis program
-*
-* programmer - steve hankin
-* NOAA/PMEL, Seattle, WA - Tropical Modeling and Analysis Program
-*/
-
-/*
-* revision history:
-*   11/16/94 - updated to use macro declarations from ferret_shared_buffer.h
-*   
-*   05/25/95 - added ifdef check for trailing underscores not needed on HP *kob*
-*
-*/
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "ferret_shared_buffer.h"
-
-/* function prototype for FORTRAN routine */
-/* added ifdef for necessity of trailing underscores *kob* */
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#    ifdef _NO_PROTO
-void ferret_query_f( );
-#    else
-void ferret_query_f( int *query, int *flags, int *nflags,
-		      char *text, int *ntext,
-		      int *numStrings, int *numNumbers,
-		      double *nums, int *ncoord,
-		      char *arg1, char *arg2, char *arg3,
-		      char *arg4, char *arg5,
-		      int *status );
-#    endif
-#else                              /*NO_ENTRY_NAME_UNDERSCORES*/
-#    ifdef _NO_PROTO
-void ferret_query_f_( );
-#    else
-void ferret_query_f_( int *query, int *flags, int *nflags,
-		      char *text, int *ntext,
-		      int *numStrings, int *numNumbers,
-		      double *nums, int *ncoord,
-		      char *arg1, char *arg2, char *arg3,
-		      char *arg4, char *arg5,
-		      int *status );
-#    endif
-#endif                             /*NO_ENTRY_NAME_UNDERSCORES*/
-
-#ifdef _NO_PROTO
-int ferret_query(query, sBuffer, arg1, arg2, arg3, arg4, arg5 )
-int query;
-smPtr sBuffer;
-char *arg1, *arg2, *arg3, *arg4, *arg5;
-
-#else
-int ferret_query(int query, smPtr sBuffer,
-		 char *arg1, char *arg2, char *arg3, char *arg4, char *arg5 )
-#endif
-{
-  int flag_buff_size  = NUMFLAGS;
-  int TEXTLENGTH_size  = TEXTLENGTH;
-  int NUMDOUBLES_size = NUMDOUBLES;
-
-  int status, i;
-
-/* diagnostic code */
-#ifdef QUERY_DEBUG
-  printf("Query number %d\n",query);
-  if ( arg1[0] ) printf("Arg 1 = %s\n",arg1);
-  if ( arg2[0] ) printf("Arg 2 = %s\n",arg2);
-  if ( arg3[0] ) printf("Arg 3 = %s\n",arg3);
-  if ( arg4[0] ) printf("Arg 4 = %s\n",arg4);
-  if ( arg5[0] ) printf("Arg 5 = %s\n",arg4);
-  *(sBuffer->text) = 'Q';
-#endif
-
-/* call the FORTRAN program that actually does the query */
-/* all arguments must be pointers for FORTRAN */
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-  ferret_query_f
-#else
-  ferret_query_f_
-#endif
-                 ( &query, sBuffer->flags, &flag_buff_size,
-		   sBuffer->text, &TEXTLENGTH_size,
-		   &(sBuffer->numStrings), &(sBuffer->numNumbers),
-		   &(sBuffer->nums[0]), &NUMDOUBLES_size,
-		   arg1, arg2, arg3, arg4, arg5, &status );
-
-
-/* diagnostic code */
-#ifdef QUERY_DEBUG
-  for (i=0; i<NUMFLAGS; i++) printf("Flag %d is %d\n",i,sBuffer->flags[i]);
-  {
-    char *ptext = sBuffer->text;
-    while (*ptext) {
-      putchar((int) *ptext);
-      if (13 == (int) *ptext ) putchar('\n');
-      ptext++;
-    }
-  }
-/*  printf("Returned text:%s\n",sBuffer->text); */
-  printf("numStrings: %d\n",sBuffer->numStrings);
-  printf("numNumbers: %d\n",sBuffer->numNumbers);
-  for (i=0; i<sBuffer->numNumbers; i++) printf("Object %d is %g\n",i,
-					      sBuffer->nums[i]);
-#endif
-
-  return( status );
-}
-
diff --git a/fer/ccr/free_c_pointer.c b/fer/ccr/free_c_pointer.c
index 2e206f5..df9e0ea 100644
--- a/fer/ccr/free_c_pointer.c
+++ b/fer/ccr/free_c_pointer.c
@@ -40,10 +40,11 @@
  */
 
 #include <stdlib.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void free_c_pointer_(fer_ptr)
-     char*** fer_ptr;
+void FORTRAN(free_c_pointer)(char ***fer_ptr)
 {
-   free(*fer_ptr);
+   FerMem_Free(*fer_ptr, __FILE__, __LINE__);
    *fer_ptr = NULL;
 }
diff --git a/fer/ccr/free_c_string_array.c b/fer/ccr/free_c_string_array.c
index 259f8c2..a6857f2 100644
--- a/fer/ccr/free_c_string_array.c
+++ b/fer/ccr/free_c_string_array.c
@@ -43,21 +43,19 @@
  */
 
 #include <stdlib.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void free_c_string_array_(fer_ptr, length)
-     char*** fer_ptr;
-     int* length;
+void FORTRAN(free_c_string_array)(char ***fer_ptr, int *length)
 {
    char** each_str_ptr = *fer_ptr;
    int i;
 
    /* free the individual strings */
    for (i=0; i<*length; i++) {
-      if ( *each_str_ptr != NULL ) {
-         free(*each_str_ptr);
-         *each_str_ptr = NULL;
-      }
+      if ( (*each_str_ptr != NULL) && (*each_str_ptr != STRING_MISSING_VALUE) )
+         FerMem_Free(*each_str_ptr, __FILE__, __LINE__);
+      *each_str_ptr = NULL;
       each_str_ptr += 8/sizeof(char**);
    }
-   /* memory for the array itself is from Ferret's memory block */
 }
diff --git a/fer/ccr/free_cached_full_array.c b/fer/ccr/free_cached_full_array.c
index 594df6c..d41700c 100644
--- a/fer/ccr/free_cached_full_array.c
+++ b/fer/ccr/free_cached_full_array.c
@@ -51,23 +51,18 @@
 #include <stdlib.h>
 #include <assert.h>
 #include "ferret.h"
+#include "FerMem.h"
 
  
-void FORTRAN(free_cached_full_array)( double **pointer_val )
+void FORTRAN(free_cached_full_array)(double **pointer_val)
 
 /*
   see complementary routines recover_cached_full_array and cache_full_array.c
 */
 
 {
-  double *ptr;
-
-  ptr = *pointer_val;
-
-  if (ptr) {
-	  free(ptr);  // could do assert on ptr==0
-	  *pointer_val=0;
+  if ( *pointer_val != NULL ) {
+      FerMem_Free(*pointer_val, __FILE__, __LINE__);
+      *pointer_val = NULL;
   }
-
-  return;
 }
diff --git a/fer/ccr/free_dyn_mem.c b/fer/ccr/free_dyn_mem.c
index 91641b8..027bb94 100644
--- a/fer/ccr/free_dyn_mem.c
+++ b/fer/ccr/free_dyn_mem.c
@@ -7,27 +7,11 @@
  */
 
 #include <stdlib.h>
-/*  the relevant definition of "FORTRAN" pulled from
- *   #include "../common/ferret.h"
- */
-#ifndef FORTRAN
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-#endif
-
-
-void FORTRAN(free_dyn_mem) ( double *mvar )
-
-/*
-  input  - mvar: pointer to memory allocated to Ferret variable, "mvar"
-*/
+#include "ferret.h"
+#include "FerMem.h"
 
+void FORTRAN(free_dyn_mem)(double *mvar)
 {
-
-  free(mvar);
-
-  return;
+  FerMem_Free( mvar, __FILE__, __LINE__ );
+  mvar = NULL;
 }
diff --git a/fer/ccr/get_c_pointer.c b/fer/ccr/get_c_pointer.c
index c9db52f..61dd5db 100644
--- a/fer/ccr/get_c_pointer.c
+++ b/fer/ccr/get_c_pointer.c
@@ -40,8 +40,9 @@
  */
 
 #include <stdlib.h>
+#include "ferret.h"
 
-double get_c_pointer_(char** mr_ptr, char** mr_ptr_val)
+void FORTRAN(get_c_pointer)(char** mr_ptr, char** mr_ptr_val)
 {
 
   union ptr_or_val
@@ -54,6 +55,4 @@ double get_c_pointer_(char** mr_ptr, char** mr_ptr_val)
   my_conversion.ptr = mr_ptr;
   *mr_ptr_val = my_conversion.val;
 
-  return;
-
 }
diff --git a/fer/ccr/get_c_string.c b/fer/ccr/get_c_string.c
index 94ab222..d4a90ac 100644
--- a/fer/ccr/get_c_string.c
+++ b/fer/ccr/get_c_string.c
@@ -39,11 +39,9 @@
  */
 
 #include <string.h>
+#include "ferret.h"
 
-void get_c_string_(ptr_ptr, outstring, maxlen)
-     char** ptr_ptr;
-     char* outstring;
-     int* maxlen;
+void FORTRAN(get_c_string)(char **ptr_ptr, char *outstring, int *maxlen)
 {
     char *str1;
 
diff --git a/fer/ccr/get_c_string_len.c b/fer/ccr/get_c_string_len.c
index 9708963..b1507c1 100644
--- a/fer/ccr/get_c_string_len.c
+++ b/fer/ccr/get_c_string_len.c
@@ -39,9 +39,9 @@
  */
 
 #include <string.h>
+#include "ferret.h"
 
-int get_c_string_len_(ptr_ptr)
-     char** ptr_ptr;
+int FORTRAN(get_c_string_len)(char **ptr_ptr)
 {
    /* treats an undefined string the same as an empty string */
    if ( *ptr_ptr == NULL )
diff --git a/fer/ccr/get_max_c_string_len.c b/fer/ccr/get_max_c_string_len.c
index a79b1c6..ba7ea10 100644
--- a/fer/ccr/get_max_c_string_len.c
+++ b/fer/ccr/get_max_c_string_len.c
@@ -41,10 +41,9 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
 
-int get_max_c_string_len_(fer_ptr, nstr)
-     char*** fer_ptr;
-     int* nstr;
+int FORTRAN(get_max_c_string_len)(char ***fer_ptr, int *nstr)
 {
    char** each_str_ptr;
    int max=0;
diff --git a/fer/ccr/get_mr_mem.c b/fer/ccr/get_mr_mem.c
index f568cb4..a88fda2 100644
--- a/fer/ccr/get_mr_mem.c
+++ b/fer/ccr/get_mr_mem.c
@@ -8,37 +8,20 @@
  *
  */
 
-/* F90 pointers are not true pointers.  Instead they are simply names that 
- serve as aliases for normal FORTRAN variables.  The only way I could think
- of to pass the c-malloc'ed pointer into the F90 pointer was to disguise
- it as a normal FORTRAN variable by passing it as a subroutine argument.
-*/
-
 #include <stdlib.h>
-/*  the relevant definition of "FORTRAN" pulled from
- *   #include "../common/ferret.h"
- */
-#ifndef FORTRAN
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-#endif
-
-
-void FORTRAN(get_mr_mem)( double *index, int *alen, int *status )
+#include "ferret.h"
+#include "FerMem.h"
 
+void FORTRAN(get_mr_mem)( double *index, long *alen, int *status )
 /*
   input  - index:  Ferret mr index at which to store the array pointer
-  input  - alen:   array length
+  input  - alen:   array length  NOTE: INTEGER*8
 */
-
 {
 
   double *pointer;
 
-  pointer = (double *) malloc(sizeof(double) * (*alen));
+  pointer = (double *) FerMem_Malloc(sizeof(double) * (*alen), __FILE__, __LINE__);
 
   if (pointer)
     {
diff --git a/fer/ccr/get_offset_c_string.c b/fer/ccr/get_offset_c_string.c
index d33dd1f..8838c00 100644
--- a/fer/ccr/get_offset_c_string.c
+++ b/fer/ccr/get_offset_c_string.c
@@ -34,17 +34,14 @@
 */
 
 #include <stdlib.h>
+#include "ferret.h"
 
 /* 
  *  Return (copy) the null-terminated string to the array provided,
  *  converting to blank-terminated strings.
  */
 
-void get_offset_c_string_(fer_ptr, offset, outstring, maxlen)
-     char*** fer_ptr;
-     int* offset;
-     char* outstring;
-     int* maxlen;
+void FORTRAN(get_offset_c_string)(char ***fer_ptr, int *offset, char *outstring, int *maxlen)
 {
    char** each_str_ptr;
    char* str_ptr;
diff --git a/fer/ccr/get_offset_c_string_len.c b/fer/ccr/get_offset_c_string_len.c
index b6171c3..02b9158 100644
--- a/fer/ccr/get_offset_c_string_len.c
+++ b/fer/ccr/get_offset_c_string_len.c
@@ -39,10 +39,9 @@
  */
 
 #include <string.h>
+#include "ferret.h"
 
-int get_offset_c_string_len_(fer_ptr, offset)
-     char*** fer_ptr;
-     int* offset;
+int FORTRAN(get_offset_c_string_len)(char ***fer_ptr, int *offset)
 {
    char** each_str_ptr;
 
diff --git a/fer/ccr/get_sys_cmnd.c b/fer/ccr/get_sys_cmnd.c
index e4172b6..d26d640 100644
--- a/fer/ccr/get_sys_cmnd.c
+++ b/fer/ccr/get_sys_cmnd.c
@@ -43,12 +43,16 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void get_sys_cmnd_(fer_ptr, nlines, cmd, stat)
-     char*** fer_ptr; /* output: char** pointer to strings */
-     int* nlines; /* output: number of strings read */
-     char* cmd; /* input: the shell command to execute */
+void FORTRAN(get_sys_cmnd)(char ***fer_ptr, int *nlines, char *cmd, int *stat)
+/*
+     char*** fer_ptr; output: char** pointer to strings 
+     int* nlines; output: number of strings read 
+     char* cmd; input: the shell command to execute 
      int* stat;
+*/
 {
     char** sarray;
     int linebufsize =  BUFSIZ;  /* initial size of input line buffer */
@@ -71,15 +75,16 @@ void get_sys_cmnd_(fer_ptr, nlines, cmd, stat)
      * Use calloc for sarray to initialize everything to NULL pointers
      * for Ferret's string arrays.
      */
-    sarray = (char **) calloc(BUFSIZ, sizeof(char *));
+    sarray = (char **) FerMem_Malloc(BUFSIZ * sizeof(char *), __FILE__, __LINE__);
     if ( sarray == NULL ) {
        *stat = 1;
        return;
     }
+    memset(sarray, 0, BUFSIZ * sizeof(char *));
 
-    buf = (char *) malloc(sizeof(char) * linebufsize);
+    buf = (char *) FerMem_Malloc(sizeof(char) * linebufsize, __FILE__, __LINE__);
     if ( buf == NULL ) {
-       free(sarray);
+       FerMem_Free(sarray, __FILE__, __LINE__);
        *stat = 1;
        return;
     }
@@ -95,12 +100,12 @@ void get_sys_cmnd_(fer_ptr, nlines, cmd, stat)
              /* line buffer wasn't large enough --> allocate more */
              while (incomplete) {
                 linebufsize += BUFSIZ;
-                newbuf = (char *) realloc(buf, sizeof(char) * linebufsize);
+                newbuf = (char *) FerMem_Realloc(buf, sizeof(char) * linebufsize, __FILE__, __LINE__);
                 if ( newbuf == NULL ) {
-                   free(buf);
+                   FerMem_Free(buf, __FILE__, __LINE__);
                    for (i = 0; i < *nlines; i++)
-                      free(sarray[i]);
-                   free(sarray);
+                      FerMem_Free(sarray[i], __FILE__, __LINE__);
+                   FerMem_Free(sarray, __FILE__, __LINE__);
                    *stat = 1;
                    return;
                 }
@@ -117,12 +122,12 @@ void get_sys_cmnd_(fer_ptr, nlines, cmd, stat)
 
           /* make and save a permanent copy of the input line */
           /* BUG FIX *kob* v552 - need to add one to string length for null */
-          pmnt = (char *) malloc(sizeof(char) * (int)(strlen(buf)+1));
+          pmnt = (char *) FerMem_Malloc(sizeof(char) * (int)(strlen(buf)+1), __FILE__, __LINE__);
           if ( pmnt == NULL ) {
-             free(buf);
+             FerMem_Free(buf, __FILE__, __LINE__);
              for (i = 0; i < *nlines; i++)
-                free(sarray[i]);
-             free(sarray);
+                FerMem_Free(sarray[i], __FILE__, __LINE__);
+             FerMem_Free(sarray, __FILE__, __LINE__);
              *stat = 1;
              return;
           }
@@ -131,13 +136,13 @@ void get_sys_cmnd_(fer_ptr, nlines, cmd, stat)
              /* double the length of the string pointer array */
              last_increment = increment;
              increment *= 2;
-             newsarray = (char **) realloc(sarray, sizeof(char *) * increment);
+             newsarray = (char **) FerMem_Realloc(sarray, sizeof(char *) * increment, __FILE__, __LINE__);
              if ( newsarray == NULL ) {
-                free(buf);
+                FerMem_Free(buf, __FILE__, __LINE__);
                 for (i = 0; i < *nlines; i++)
-                   free(sarray[i]);
-                free(sarray);
-                free(pmnt);
+                   FerMem_Free(sarray[i], __FILE__, __LINE__);
+                FerMem_Free(sarray, __FILE__, __LINE__);
+                FerMem_Free(pmnt, __FILE__, __LINE__);
                 *stat = 1;
                 return;
              }
@@ -156,14 +161,15 @@ void get_sys_cmnd_(fer_ptr, nlines, cmd, stat)
     }
 
     /* buf no longer needed */
-    free(buf);
+    FerMem_Free(buf, __FILE__, __LINE__);
+    buf = NULL;
 
     /* always return at least one string (avoid FORTRAN probs) */
     /* *kob* v552 - bug fix - still need to allocate space for the null string */
     if (*nlines == 0 ) {
-       pmnt = (char *) malloc(sizeof(char));
+       pmnt = (char *) FerMem_Malloc(sizeof(char), __FILE__, __LINE__);
        if ( pmnt == NULL ) {
-          free(sarray);
+          FerMem_Free(sarray, __FILE__, __LINE__);
           *stat = 1;
           return;
        }
diff --git a/fer/ccr/get_ws_mem.c b/fer/ccr/get_ws_mem.c
index ae81d9c..c172adc 100644
--- a/fer/ccr/get_ws_mem.c
+++ b/fer/ccr/get_ws_mem.c
@@ -8,16 +8,11 @@
  *
  */
 
-/* F90 pointers are not true pointers.  Instead they are simply names that 
- serve as aliases for normal FORTRAN variables.  The only way I could think
- of to pass the c-malloc'ed pointer into the F90 pointer was to disguise
- it as a normal FORTRAN variable by passing it as a subroutine argument.
-*/
-
 #include <stdlib.h>
 #include "ferret.h"
+#include "FerMem.h"
 
-void FORTRAN(get_ws_mem)( int *index, long *alen, int *status )
+void FORTRAN(get_ws_mem)(int *index, int *alen, int *status)
 
 /*
   input  - index:  Ferret ws index at which to store the array pointer
@@ -28,7 +23,7 @@ void FORTRAN(get_ws_mem)( int *index, long *alen, int *status )
 
   double *pointer;
 
-  pointer = (double *) malloc(sizeof(double) * (*alen));
+  pointer = (double *) FerMem_Malloc(sizeof(double) * (*alen), __FILE__, __LINE__);
 
   if (pointer)
     {
diff --git a/fer/ccr/grab_image_xwd.c b/fer/ccr/grab_image_xwd.c
index d2f844f..ab108ca 100644
--- a/fer/ccr/grab_image_xwd.c
+++ b/fer/ccr/grab_image_xwd.c
@@ -109,6 +109,7 @@
 
 #include <X11/Xos.h>
 #include <X11/Xlib.h>
+#include <X11/Intrinsic.h>
 #include <X11/Xutil.h>
 #ifndef NO_WIN_UTIL_H
 #include <X11/Xmu/WinUtil.h>
@@ -122,43 +123,24 @@
 /*add include for signal for sunOS benefit *kob*/
 #include <signal.h>
 
-
-
-typedef unsigned long Pixel;
-
 #define FEEP_VOLUME 0
 
-/* Include routines to do parsing */
-#include "dsimple.h"
+#include "ferret.h"
+#include "FerMem.h"
 
 /* Setable Options */
 
-int format = ZPixmap;
-Bool nobdrs = False;
-Bool on_root = False;
-Bool standard_out = True;
-Bool debug = False;
-Bool use_installed = False;
-long add_pixel_value = 0;
-
-extern int (*_XErrorFunction)();
-extern int _XDefaultError();
+static int format = ZPixmap;
+static Bool on_root = False;
+/* static Bool debug = False; */
+static Bool use_installed = False;
+static long add_pixel_value = 0;
 
+static int Get_XColors(XWindowAttributes *win_info, XImage *image, XColor **colors, Display *dpy);
 
-static long parse_long (s)
-    char *s;
+static int endian_type (void)
 {
-    char *fmt = "%lu";
-    long retval = 0L;
-    int thesign = 1;
-
-    if (s && s[0]) {
-	if (s[0] == '-') s++, thesign = -1;
-	if (s[0] == '0') s++, fmt = "%lo";
-	if (s[0] == 'x' || s[0] == 'X') s++, fmt = "%lx";
-	(void) sscanf (s, fmt, &retval);
-    }
-    return (thesign * retval);
+  return (*(short *) "AZ")& 255;
 }
 
 /*
@@ -166,32 +148,18 @@ static long parse_long (s)
  *              writting.
  */
 
-/* calloc defined in stdlib.h 
-  char *calloc();
-  */
-
-/* #include "X11/XWDFile.h" */
-
-Window_Dump(window, dpy,outfile, type)
-     Window window;
-     Display *dpy;
-     char *outfile;
-     char *type;
+void Window_Dump(Window window, Display *dpy, char *outfile, char *type)
 {
-    unsigned long swaptest = 1;
-    XColor *colors;
-    unsigned buffer_size;
-    int win_name_size;
-    int header_size;
+    XColor *colors = NULL;
     int ncolors, i;
     char *win_name;
     Bool got_win_name;
     XWindowAttributes win_info;
     XImage *image;
+    int screen = 0;
     int absx, absy, x, y;
     unsigned width, height;
     int dwidth, dheight;
-    int bw;
     Window dummywin;
     int *r, *g, *b;
     void (*func)();
@@ -206,13 +174,6 @@ Window_Dump(window, dpy,outfile, type)
     func = signal(SIGIO, SIG_DFL);
 #endif
 
-
-
-    /*
-     * Inform the user not to alter the screen.
-     */
-/*    Beep(); */
-
     /*
      * Get the parameters of the window being dumped.
      */
@@ -231,8 +192,8 @@ Window_Dump(window, dpy,outfile, type)
     if (!XTranslateCoordinates (dpy, window, RootWindow (dpy, screen), 0, 0,
 				&absx, &absy, &dummywin)) {
 	fprintf (stderr, 
-		 "%s:  unable to translate window coordinates (%d,%d)\n",
-		 program_name, absx, absy);
+		 "unable to translate window coordinates (%d,%d)\n",
+		 absx, absy);
 #ifdef HP_SIGNALS
 	signal(_SIGIO, func);
 #else
@@ -244,19 +205,7 @@ Window_Dump(window, dpy,outfile, type)
     win_info.y = absy;
     width = win_info.width;
     height = win_info.height;
-    bw = 0;
-
-/* If borders are taken into account with unmapped windows, things crash. 
-   this check on borders in xwd code not needed here.  
-   if (!nobdrs) {
-	absx -= win_info.border_width;
-	absy -= win_info.border_width;
-	bw = win_info.border_width;
-	width += (2 * bw);
-	height += (2 * bw);
-	}
 
-*/
     dwidth = DisplayWidth (dpy, screen);
     dheight = DisplayHeight (dpy, screen);
 
@@ -275,9 +224,6 @@ Window_Dump(window, dpy,outfile, type)
 	got_win_name = True;
     }
 
-    /* sizeof(char) is included for the null string terminator. */
-    win_name_size = strlen(win_name) + sizeof(char);
-
     /*
      * Snarf the pixmap with XGetImage.
      */
@@ -299,8 +245,8 @@ Window_Dump(window, dpy,outfile, type)
       image = XGetImage (dpy, window, x, y, width, height, AllPlanes, format);
 
     if (!image) {
-	fprintf (stderr, "%s:  unable to get image at %dx%d+%d+%d\n",
-		 program_name, width, height, x, y);
+	fprintf (stderr, "unable to get image at %dx%d+%d+%d\n",
+		 width, height, x, y);
 #ifdef HP_SIGNALS
 	signal(_SIGIO, func);
 #else
@@ -311,11 +257,6 @@ Window_Dump(window, dpy,outfile, type)
 
     if (add_pixel_value != 0) XAddPixel (image, add_pixel_value);
 
-    /*
-     * Determine the pixmap size.
-     */
-    buffer_size = Image_Size(image);
-
 /*     if (debug) outl("xwd: Getting Colors.\n");*/
 
     ncolors = Get_XColors(&win_info, image, &colors,dpy); 
@@ -334,9 +275,9 @@ Window_Dump(window, dpy,outfile, type)
     XFlush(dpy);
 #endif
 
-    r = (int *)malloc(sizeof(int) * ncolors);
-    g = (int *)malloc(sizeof(int) * ncolors);
-    b = (int *)malloc(sizeof(int) * ncolors); 
+    r = (int *)FerMem_Malloc(sizeof(int) * ncolors, __FILE__, __LINE__);
+    g = (int *)FerMem_Malloc(sizeof(int) * ncolors, __FILE__, __LINE__);
+    b = (int *)FerMem_Malloc(sizeof(int) * ncolors, __FILE__, __LINE__); 
     for (i=0; i < ncolors; i++) {
       r[i] = colors[i].red;
       g[i] = colors[i].green;
@@ -357,7 +298,14 @@ Window_Dump(window, dpy,outfile, type)
 
 /*    if(debug && ncolors > 0) outl("xwd: Freeing colors.\n"); */
 /* *kob* 5/96 - also free the arrays r,g,b */
-    if(ncolors > 0) free(colors);free(r); free(g); free(b);
+    FerMem_Free(colors, __FILE__, __LINE__);
+    colors = NULL;
+    FerMem_Free(r, __FILE__, __LINE__); 
+    r = NULL;
+    FerMem_Free(g, __FILE__, __LINE__); 
+    g = NULL;
+    FerMem_Free(b, __FILE__, __LINE__);
+    b = NULL;
 
     /*
      * Free window name string.
@@ -386,66 +334,18 @@ Window_Dump(window, dpy,outfile, type)
     XDestroyImage(image);
 }
 
-/*
- * Report the syntax for calling xwd.
- */
-/*usage()
-{
-    fprintf (stderr,
-"usage: %s [-display host:dpy] [-debug] [-help] %s [-nobdrs] [-out <file>]",
-	   program_name, SELECT_USAGE);
-    fprintf (stderr, " [-kludge] [-xy] [-add value] [-frame]\n");
-    exit(1);
-}
-*/
-
-/*
- * Error - Fatal xwd error.
- */
-extern int errno;
-
-Error(string)
-	char *string;	/* Error description string. */
-{
-/*	outl("\nxwd: Error => %s\n", string); */
-	if (errno != 0) {
-		perror("xwd");
-	/*outl("\n"); */
-	} exit(1);
-}
-
-
-/*
- * Determine the pixmap size.
- */
-
-int Image_Size(image)
-     XImage *image;
-{
-    if (image->format != ZPixmap)
-      return(image->bytes_per_line * image->height * image->depth);
-
-    return(image->bytes_per_line * image->height);
-}
-
 #define lowbit(x) ((x) & (~(x) + 1))
 #define lowbyte(x) ((x) & (~(x) + 8))
 
 /*
  * Get the XColors of all pixels in image - returns # of colors
  */
-int Get_XColors(win_info, image, colors,dpy) 
-     XImage *image;  
-     XWindowAttributes *win_info;
-     XColor **colors;
-     Display *dpy;
+static int Get_XColors(XWindowAttributes *win_info, XImage *image, XColor **colors, Display *dpy) 
 {
     int i, ncolors;
     unsigned long pixel;
     unsigned char *cptr,tmp_cptr;
 
-    Pixel pmask = 0xff000000;
-
     Bool reverse_bytes;
 
     Colormap cmap = win_info->colormap;
@@ -460,17 +360,17 @@ int Get_XColors(win_info, image, colors,dpy)
     /* ncolors = win_info->visual->map_entries;*/
     ncolors = 256;
 
-    if (!(*colors = (XColor *) malloc (sizeof(XColor) * ncolors)))
-      {
+    *colors = (XColor *) FerMem_Malloc(sizeof(XColor) * ncolors, __FILE__, __LINE__);
+    if ( *colors == NULL ) {
 	fprintf (stderr, "Fatal Error - Out of memory!");
 	exit (1);
-      }
+    }
 
     if (win_info->visual->class == DirectColor ||
 	win_info->visual->class == TrueColor) {
 
 	int nunique_colors;
-	char ind; 
+	int ind; 
 	char *color_indices =  (char *) image->data;
 	unsigned int *color_values = (unsigned int *) image->data;
 	/*	int npixels = image->bytes_per_line * image->height; */
@@ -506,18 +406,18 @@ int Get_XColors(win_info, image, colors,dpy)
 	  /* see if this pixel matches a known color index */
 	  ind = 0;
 
-	  while ( (ind < (int) nunique_colors) 
+	  while ( (ind < nunique_colors) 
                && (color_values[i] != (*colors)[ind].pixel) ) ind++;
 
 	  /* store unique color just found */
-	  if (ind == (int)nunique_colors ) {
+	  if (ind == nunique_colors ) {
 	    (*colors)[ind].pixel = color_values[i]; 
 	    nunique_colors++;
 	  }  
 
 	  /* replace color with index pointer in image structure */
 	  /* (Read the image as color_values.  Write it as color_indices) */
-	  color_indices[i] = ind; 
+	  color_indices[i] = (char) ind; 
 	}	  
 	
 
@@ -529,7 +429,6 @@ int Get_XColors(win_info, image, colors,dpy)
 
 	/* need to test the blue mask to see which endianness machine we are on. 
 	   then grab the individual rgb values from the pixel value */
-	/*	for (i=0; i<= nunique_colors; i++) { */
 
 	if ( endian_type() == 65 ) {
 	  if (ImageByteOrder(dpy))
@@ -581,44 +480,3 @@ int Get_XColors(win_info, image, colors,dpy)
     return(ncolors);
 }
 
-_swapshort (bp, n)
-    register char *bp;
-    register unsigned n;
-{
-    register char c;
-    register char *ep = bp + n;
-
-    while (bp < ep) {
-	c = *bp;
-	*bp = *(bp + 1);
-	bp++;
-	*bp++ = c;
-    }
-}
-
-_swaplong (bp, n)
-    register char *bp;
-    register unsigned n;
-{
-    register char c;
-    register char *ep = bp + n;
-    register char *sp;
-
-    while (bp < ep) {
-	sp = bp + 3;
-	c = *sp;
-	*sp = *bp;
-	*bp++ = c;
-	sp = bp + 1;
-	c = *sp;
-	*sp = *bp;
-	*bp++ = c;
-	bp += 2;
-    }
-}
-
-
-int endian_type ()
-{
-  return (*(short *) "AZ")& 255;
-}
diff --git a/fer/ccr/gui_init.c b/fer/ccr/gui_init.c
deleted file mode 100644
index ad28784..0000000
--- a/fer/ccr/gui_init.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.  
-*
-*/
-
-/*
- * Init gui dependent code
- * JS 3.99
- *
- *
- *  *acm*  1/12 Ferret 6.8 ifdef double_p for double-precision ferret. Define dp_gui_get_memory
- *  *kms*  3/12 Removed XWindow GUI code which is no longer used.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "ferret.h"
-#define __globalDefs
-#include "ferret_shared_buffer.h"
-#undef __globalDefs
-
-static void do_gui_init() {
-
-  /*
-   * Make sure the FERRET environment is set up and ready by looking for $FER_DIR.
-   */
-  if (getenv("FER_DIR") == NULL){
-    printf("\n  The FERRET environment has not been properly set up.\n");
-    printf("  (The environment variable FER_DIR is not defined)\n");
-    printf("\n  Have you executed \"source your_system_path/ferret_paths\" ?\n");
-    exit(1);
-  }
-}
-
-int gui_init() {
-  return 0;
-}
-
-static DFTYPE *mem;
-				
-DFTYPE **gui_get_memory() {
-  return &mem;
-}	
-double **dp_gui_get_memory() {
-  return &mem;
-}
-void gui_run(int *argc, char **argv){
-}
-
diff --git a/fer/ccr/init_c_string_array.c b/fer/ccr/init_c_string_array.c
index a8f63e5..dabdf5a 100644
--- a/fer/ccr/init_c_string_array.c
+++ b/fer/ccr/init_c_string_array.c
@@ -39,22 +39,28 @@
  */
 
 #include <stdlib.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void init_c_string_array_(length, mr_blk1, fer_ptr)
-     int* length;
-     char** mr_blk1;
-     char*** fer_ptr;
+void FORTRAN(init_c_string_array)(int *length, char **mr_blk1, char ***fer_ptr)
 {
    int i;
    char** ptr;
 
-   /* save the pointer */
+#ifdef MEMORYDEBUG
+   char msg[1024];
+   sprintf(msg, "assigned as an array of %d 64-bit pointers (%d bytes) initialize to NULL", *length, (*length)*8);
+   FerMem_WriteDebugMessage(mr_blk1, mr_blk1 + (*length), msg, __FILE__, __LINE__);
+#endif
+
+   /* save the pointer to the array of pointers */
    *fer_ptr = mr_blk1;
 
-   /* good house-keepping */
+   /* initialize the pointers - room for 64-bit pointers, so double if 32-bit pointers */
    ptr = mr_blk1;
-   for (i=0; i<*length; i++) {
+   for (i = 0; i < (*length)*(8/sizeof(char *)); i++) {
       *ptr = NULL;
-      ptr += (8/sizeof(char**));
+      ptr++;
    }
+
 }
diff --git a/fer/ccr/linux_routines_c.c b/fer/ccr/linux_routines_c.c
index 56f8434..ab3157b 100644
--- a/fer/ccr/linux_routines_c.c
+++ b/fer/ccr/linux_routines_c.c
@@ -35,6 +35,7 @@
 */
 
 #include <stdio.h>
+#include "ferret.h"
 
 /*
  * Routine needed only for linux.  nag F90 didn't have a perror routine,
@@ -43,7 +44,7 @@
  * kob 3/97
  */
          
-void linux_perror_(char *string)
+void FORTRAN(linux_perror)(char *string)
 {
   perror(string);
 }
diff --git a/fer/ccr/list.c b/fer/ccr/list.c
index 2ab6a0c..95e8ed8 100644
--- a/fer/ccr/list.c
+++ b/fer/ccr/list.c
@@ -54,28 +54,26 @@
  *       char *data;
  */
 
-static char brag[] = "$$Version: list-2.1 Copyright (C) 1992 Bradley C. Spatz";
-
 /* *acm   9/06 v600 - add stdlib.h wherever there is stdio.h for altix build*/ 
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include "ferret.h"
+#include "FerMem.h"
 #include "list.h"
 
-/*char *malloc();*/
-
 
-LIST *list_init(void)
+LIST *list_init(char *filename, int linenum)
 {
    LIST *list;
 
    /* Allocate, initialize, and return a new list. */
-   list = (LIST *) malloc(sizeof(LIST));
+   list = (LIST *) FerMem_Malloc(sizeof(LIST), filename, linenum);
    list->size = 0;
-   list->front = NULL;;
-   list->rear = NULL;;
-   list->curr = NULL;;
+   list->front = NULL;
+   list->rear = NULL;
+   list->curr = NULL;
    return(list);
 }
 
@@ -169,14 +167,14 @@ int list_size(LIST *list)
  * #endif
  */
 
-static LIST_ELEMENT *list_create_element(char *data, int bytes)
+static LIST_ELEMENT *list_create_element(char *data, int bytes, char *filename, int linenum)
 {
    LIST_ELEMENT *new;
 
    /* Allocate storage for the new node and its data.  Return NULL if
     * unable to allocate.
     */
-   new = (LIST_ELEMENT *) malloc(sizeof(LIST_ELEMENT));
+   new = (LIST_ELEMENT *) FerMem_Malloc(sizeof(LIST_ELEMENT), filename, linenum);
    if (new == NULL) {
       return(NULL);
    }
@@ -185,8 +183,9 @@ static LIST_ELEMENT *list_create_element(char *data, int bytes)
     * Then either copy the data or just the reference into the node.
     */
    if (bytes > 0) {
-      new->data = (char *) malloc(bytes);
+      new->data = (char *) FerMem_Malloc(bytes, filename, linenum);
       if (new->data == NULL) {
+         FerMem_Free(new, filename, linenum);
 	 return(NULL);
       }
       (void) memcpy(new->data, data, bytes);
@@ -199,12 +198,12 @@ static LIST_ELEMENT *list_create_element(char *data, int bytes)
 }
 
 
-char *list_insert_before(LIST *list, char *data, int bytes)
+char *list_insert_before(LIST *list, char *data, int bytes, char *filename, int linenum)
 {
    LIST_ELEMENT *new;
 
    /* Allocate storage for the new element and its data.*/
-   new = list_create_element(data, bytes);
+   new = list_create_element(data, bytes, filename, linenum);
    if (new == NULL)
       return(NULL);
 
@@ -240,12 +239,12 @@ char *list_insert_before(LIST *list, char *data, int bytes)
 }
 
 
-char *list_insert_after(LIST *list, char *data, int bytes)
+char *list_insert_after(LIST *list, char *data, int bytes, char *filename, int linenum)
 {
    LIST_ELEMENT *new;
 
    /* Allocate storage for the new element and its data.*/
-   new = list_create_element(data, bytes);
+   new = list_create_element(data, bytes, filename, linenum);
    if (new == NULL)
       return(NULL);
 
@@ -281,20 +280,20 @@ char *list_insert_after(LIST *list, char *data, int bytes)
 }
 
 
-static char *list_remove_single(LIST *list)
+static char *list_remove_single(LIST *list, char *filename, int linenum)
 {
    char *data;
 
    /* The list has one element.  Easy. */
    data = list->curr->data;
-   free(list->curr);
+   FerMem_Free(list->curr, filename, linenum);
    list->front = list->rear = list->curr = NULL;
    list->size--;
    return (data);
 }
 
 
-char *list_remove_front(LIST *list)
+char *list_remove_front(LIST *list, char *filename, int linenum)
 {
    LIST_ELEMENT *temp;
    char *data;
@@ -308,7 +307,7 @@ char *list_remove_front(LIST *list)
    }
    else if (list->front == list->rear) {
       /* List has only one element.  Easy. */
-      data = list_remove_single(list);
+      data = list_remove_single(list, filename, linenum);
    }
    else {
       /* List has more than one element.  Make sure to check if curr
@@ -320,7 +319,7 @@ char *list_remove_front(LIST *list)
       list->front = temp->next;
       if (list->curr == temp)
 	 list->curr = temp->next;
-      free(temp);
+      FerMem_Free(temp, filename, linenum);
       list->size--;
    }
 
@@ -328,7 +327,7 @@ char *list_remove_front(LIST *list)
 }
 
 
-char *list_remove_rear(LIST *list)
+char *list_remove_rear(LIST *list, char *filename, int linenum)
 {
    LIST_ELEMENT *temp;
    char *data;
@@ -342,7 +341,7 @@ char *list_remove_rear(LIST *list)
    }
    else if (list->front == list->rear) {
       /* List has only one element.  Easy. */
-      data = list_remove_single(list);
+      data = list_remove_single(list, filename, linenum);
    }
    else {
       /* List has more than one element.  Make sure to check if curr
@@ -354,7 +353,7 @@ char *list_remove_rear(LIST *list)
       list->rear = temp->prev;
       if (list->curr == temp)
 	 list->curr = temp->prev;
-      free(temp);
+      FerMem_Free(temp, filename, linenum);
       list->size--;
    }
 
@@ -362,7 +361,7 @@ char *list_remove_rear(LIST *list)
 }
 
 
-char *list_remove_curr(LIST *list)
+char *list_remove_curr(LIST *list, char *filename, int linenum)
 {
    LIST_ELEMENT *temp;
    char *data;
@@ -378,15 +377,15 @@ char *list_remove_curr(LIST *list)
    }
    else if (list->front == list->rear) {
       /* The list has one element.  Easy. */
-      data = list_remove_single(list);
+      data = list_remove_single(list, filename, linenum);
    }
    else if (list->curr == list->front) {
       /* Removing front element.  Easy. */
-      data = list_remove_front(list);
+      data = list_remove_front(list, filename, linenum);
    }
    else if (list->curr == list->rear) {
       /* Removing from the rear.  Easy.*/
-      data = list_remove_rear(list);
+      data = list_remove_rear(list, filename, linenum);
    }
    else {
       /* Otherwise.  Must be inside a 3-element or larger list. */
@@ -395,7 +394,7 @@ char *list_remove_curr(LIST *list)
       temp->next->prev = temp->prev;
       temp->prev->next = temp->next;
       list->curr = temp->next;
-      free(temp);
+      FerMem_Free(temp, filename, linenum);
       list->size--;
    }
 
@@ -459,7 +458,7 @@ int list_traverse(LIST *list, char *data, int (*func)(char *, char *), int opts)
 }
 
 
-void list_free(LIST *list, void (*dealloc)(char *))
+void list_free(LIST *list, void (*dealloc)(char *), char *filename, int linenum)
 {
    char *data;
 
@@ -470,13 +469,13 @@ void list_free(LIST *list, void (*dealloc)(char *))
     */
    list_mvfront(list);
    while (! list_empty(list)) {
-      data = list_remove_front(list);
+      data = list_remove_front(list, filename, linenum);
       /* Apply either no deallocation function to each node, our own, or
        * a user-supplied version.
        */
       if ( dealloc != LIST_NODEALLOC ) {
 	 if ( dealloc == LIST_DEALLOC ) {
-	    free(data);
+	    FerMem_Free(data, filename, linenum);
 	 }
 	 else {
 	    (*dealloc)(data);
@@ -484,5 +483,5 @@ void list_free(LIST *list, void (*dealloc)(char *))
       }
    }
 
-   free(list);
+   FerMem_Free(list, filename, linenum);
 }
diff --git a/fer/ccr/nullify_mr.c b/fer/ccr/nullify_mr.c
index 3cf87a0..f813191 100644
--- a/fer/ccr/nullify_mr.c
+++ b/fer/ccr/nullify_mr.c
@@ -9,31 +9,18 @@
 
 
 #include <stdlib.h>
-/*  the relevant definition of "FORTRAN" pulled from
- *   #include "../common/ferret.h"
- */
-#ifndef FORTRAN
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-#endif
-
-
-void FORTRAN(nullify_mr)( int *mr )
+#include "ferret.h"
 
+void FORTRAN(nullify_mr)(int *mr)
 /*
   input  - mr:  Ferret mr index at which to store the array pointer
 */
-
 {
-
   double *nul_ptr;
 
   nul_ptr = (double *) NULL;
 
-  FORTRAN(store_nul_mr_ptr) (mr, nul_ptr);
+  FORTRAN(store_nul_mr_ptr)(mr, nul_ptr);
 
   return;
 }
diff --git a/fer/ccr/nullify_ws.c b/fer/ccr/nullify_ws.c
index def9ee9..8c60838 100644
--- a/fer/ccr/nullify_ws.c
+++ b/fer/ccr/nullify_ws.c
@@ -9,26 +9,13 @@
 
 
 #include <stdlib.h>
-/*  the relevant definition of "FORTRAN" pulled from
- *   #include "../common/ferret.h"
- */
-#ifndef FORTRAN
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-#endif
-
-
-void FORTRAN(nullify_ws)( int *ws )
+#include "ferret.h"
 
+void FORTRAN(nullify_ws)(int *ws)
 /*
   input  - ws:  Ferret ws index at which to store the array pointer
 */
-
 {
-
   double *nul_ptr;
 
   nul_ptr = (double *) NULL;
diff --git a/fer/ccr/put_frame.c b/fer/ccr/put_frame.c
index 0898212..2625508 100644
--- a/fer/ccr/put_frame.c
+++ b/fer/ccr/put_frame.c
@@ -62,29 +62,15 @@
 #include <stdio.h>
 #include <string.h>
 #include "gks_implem.h"
-#include "wslist.h"
-#include "cgm/cgm.h"
-#include "cgm/cgm_implem.h"
 #include "ferret.h"
 
-FORTRAN(put_frame)( ws_id, filename, errstr, format, status )
-
-   char *filename, *errstr, *format;
-   int *ws_id, *status;
-
+void FORTRAN(put_frame)(int *ws_id, char *filename, char *errstr, char *format, int *status)
 {
   WS_STATE_ENTRY *ws;
-  Display *mydisplay;
-  Window   mywindow;
 
 /* determine the XGKS ws state entry structure from ws_id */
   ws  = OPEN_WSID (*ws_id);	
 
-/* the next 2 lines are diagnostic
-     mydisplay = ws->dpy;
-     mywindow  = ws->win;
-*/
-
 /* call up the capture routine */
 /* Errors internal to Window_Dump com out in errstr */
    Window_Dump(ws->win,ws->dpy,filename,format);
@@ -96,10 +82,9 @@ FORTRAN(put_frame)( ws_id, filename, errstr, format, status )
 /*  acm create separate GIFFlush routines for transparency. Passing the argumetns transp, red, green, blue
     in direcly into GIFFlush as arguments did not work on porter.
 */
-void FORTRAN(put_frame_batch)(int *ws_id, char *filename, char *format, int *transp, DFTYPE *red, DFTYPE *green,
-                              DFTYPE *blue, char *errmsg, int *status)
+void FORTRAN(put_frame_batch)(int *ws_id, char *filename, char *format, int *transp, 
+                              DFTYPE *red, DFTYPE *green, DFTYPE *blue, char *errmsg, int *status)
 {
-  char oldfilename[BUFSIZ];
   WS_STATE_ENTRY *ws = OPEN_WSID(*ws_id);
   *status = 0;
 
diff --git a/fer/ccr/recover_cached_2d_array_point.c b/fer/ccr/recover_cached_2d_array_point.c
index 51197a6..e905662 100644
--- a/fer/ccr/recover_cached_2d_array_point.c
+++ b/fer/ccr/recover_cached_2d_array_point.c
@@ -51,16 +51,11 @@
 #include <stdlib.h>
 #include "ferret.h"
  
-void FORTRAN(recover_cached_2d_array_point)(
-					 double *array, int *dim1, int *dim2, 
-                                         int *i, int *j,
-					 double **pointer_val )
-
+void FORTRAN(recover_cached_2d_array_point)(double *array, int *dim1, int *dim2, int *i, int *j, double **pointer_val)
 /*
   see related routine recover_cached_full_array.c
   FORTRAN subscripting reversed from C, and indexed to 1 instead of 0
 */
-
 {
   double *ptr;
   int index;
diff --git a/fer/ccr/recover_cached_full_array.c b/fer/ccr/recover_cached_full_array.c
index 51e9844..f060e4d 100644
--- a/fer/ccr/recover_cached_full_array.c
+++ b/fer/ccr/recover_cached_full_array.c
@@ -50,12 +50,10 @@
 #include <stdlib.h>
 #include "ferret.h"
  
-void FORTRAN(recover_cached_full_array)( double *array, int *alen, double **pointer_val )
-
+void FORTRAN(recover_cached_full_array)(double *array, int *alen, double **pointer_val)
 /*
   see complementary routine cache_full_array.c
 */
-
 {
   double *ptr;
   int i;
diff --git a/fer/ccr/replace_bad_data_sub.c b/fer/ccr/replace_bad_data_sub.c
index 1348132..38650ce 100644
--- a/fer/ccr/replace_bad_data_sub.c
+++ b/fer/ccr/replace_bad_data_sub.c
@@ -50,12 +50,9 @@
 #include <math.h>
 #include "ferret.h"
 
-void FORTRAN(replace_bad_data_sub)( DFTYPE *old_bad, DFTYPE *src, 
-			   int *size, DFTYPE *new_bad )
-
+void FORTRAN(replace_bad_data_sub)(DFTYPE *old_bad, DFTYPE *src, int *size, DFTYPE *new_bad)
 {
   int i;
-  double tmp;
   
   if (isnan(*old_bad)) {
     for (i=0; i<*size; i++)
diff --git a/fer/ccr/replaceable_bad_flags.c b/fer/ccr/replaceable_bad_flags.c
index 0f8454b..6fff1f3 100644
--- a/fer/ccr/replaceable_bad_flags.c
+++ b/fer/ccr/replaceable_bad_flags.c
@@ -36,7 +36,7 @@
 
 /*
  * replaceable_bad_flags :
- *  check for a missing or bad value flag of NaN.  if either flag is Nan,
+ *  check for a missing or bad value flag of NaN.  if either flag is NaN,
  *  or if the flags differ, return a true. otherwise, if both flags are the 
  *  same and not NaN, no need to replace them, so return a false
  *
@@ -48,9 +48,7 @@
 #include <math.h>
 #include "ferret.h"
 
-int FORTRAN(replaceable_bad_flags)(bad1, bad2)
-     DFTYPE *bad1, *bad2;
-
+int FORTRAN(replaceable_bad_flags)(DFTYPE *bad1, DFTYPE *bad2)
 {
   if (isnan(*bad1) || isnan(*bad2))
     return 1; 
diff --git a/fer/ccr/run_thredds_browser.h b/fer/ccr/run_thredds_browser.h
deleted file mode 100644
index 9567ddb..0000000
--- a/fer/ccr/run_thredds_browser.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef RUNTHREDDSBROWSER_H_
-#define RUNTHREDDSBROWSER_H_
-
-#include <sys/types.h>
-#include <stdio.h>
-
-/* 
- * Interface to the FORTRAN function:
- * INTEGER FUNCTION RUN_THREDDS_BROWSER(DATASET_NAME, ERR_WARN_MSG)
- *         CHARACTER*(*) DATASET_NAME, ERR_WARN_MSG
- */
-extern int run_thredds_browser_(char dataset_name[], char err_warn_msg[], 
-                                int max_len_data_set, int max_len_err_warn_msg);
-
-/* Standard C functions */
-extern int   runThreddsBrowser(char datasetName[], char errWarn[]);
-extern int   getJavaVersion(char javaExeName[], char errMsg[]);
-extern FILE *executableOutput(char *exeArgv[], pid_t *childPidPtr, char errMsg[]);
-
-#endif /* RUNTHREDDSBROWSER_H_ */
diff --git a/fer/ccr/save_arg_pointers.c b/fer/ccr/save_arg_pointers.c
index 70f576e..e5027bf 100644
--- a/fer/ccr/save_arg_pointers.c
+++ b/fer/ccr/save_arg_pointers.c
@@ -59,7 +59,6 @@
 DFTYPE *xpos_cache, *ypos_cache;
 
 void FORTRAN(save_arg_pointers)( DFTYPE *xpos_arr, DFTYPE *ypos_arr )
-
 {
   extern DFTYPE *xpos_cache, *ypos_cache;
   xpos_cache = xpos_arr;
@@ -94,7 +93,6 @@ arrays of X and Y positions available
 
 void FORTRAN(curv_coord)(DFTYPE *xi, DFTYPE *yi, int *n,
 		DFTYPE *xinv, DFTYPE *yinv, int *status)
-
 {
   extern DFTYPE *xpos_cache, *ypos_cache;
   FORTRAN(curv_coord_sub)( xi, yi, n, xpos_cache, ypos_cache, xinv, yinv, status );
@@ -109,7 +107,6 @@ arrays of X and Y positions available, with an offset in the X coords
 
 void FORTRAN(curv_coord_add)(DFTYPE *xi, DFTYPE *yi, int *n,
 		 DFTYPE *xinv, DFTYPE *yinv, DFTYPE *xadd, int *first, int*xfield_is_modulo, int *status)
-
 {
   extern DFTYPE *xpos_cache, *ypos_cache;
   FORTRAN(curv_coord_add_sub)(  xi, yi, n, xpos_cache, ypos_cache, xinv, yinv, xadd, first, xfield_is_modulo, status );
@@ -125,7 +122,6 @@ void FORTRAN(curv_coord_add)(DFTYPE *xi, DFTYPE *yi, int *n,
  */
 
 void FORTRAN(curv_coord_range)(DFTYPE *uc, int *ilo, int *ihi, int *jlo, int *jhi, int *status)
-
 {
   extern DFTYPE *xpos_cache, *ypos_cache;
   FORTRAN(curv_coord_range_sub)(uc, xpos_cache, ypos_cache, ilo, ihi, jlo, jhi, status );
diff --git a/fer/ccr/save_c_string.c b/fer/ccr/save_c_string.c
index 4a99d35..28cc27b 100644
--- a/fer/ccr/save_c_string.c
+++ b/fer/ccr/save_c_string.c
@@ -39,19 +39,16 @@
  */
 
 #include <stdlib.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void save_c_string_(string, inlen, fer_ptr, offset, stat)
-     char* string;
-     int* inlen;
-     char*** fer_ptr;
-     int* offset;
-     int* stat;
+void FORTRAN(save_c_string)(char *string, int *inlen, char ***fer_ptr, int *offset, int *stat)
 {
    int i;
    char* ptr;
    char** each_str_ptr;
 
-   ptr = (char *) malloc(sizeof(char) * (*inlen + 1));
+   ptr = (char *) FerMem_Malloc(sizeof(char) * (*inlen + 1), __FILE__, __LINE__);
    if ( ptr != NULL ) {
       for (i=0; i<*inlen; i++)
          ptr[i] = string[i];
@@ -60,8 +57,8 @@ void save_c_string_(string, inlen, fer_ptr, offset, stat)
       /* save the pointer to the string */
       each_str_ptr = *fer_ptr;   /* holds pointer to the first string */
       each_str_ptr += *offset * 8/sizeof(char**); /* point to the desired string */ 
-      if ( *each_str_ptr != NULL )
-         free( *each_str_ptr );
+      if ( (*each_str_ptr != NULL) && (*each_str_ptr != STRING_MISSING_VALUE) )
+         FerMem_Free( *each_str_ptr, __FILE__, __LINE__ );
       *each_str_ptr = ptr;
 
       *stat = 0;
diff --git a/fer/ccr/set_nan.c b/fer/ccr/set_nan.c
index e938150..c3ecefd 100644
--- a/fer/ccr/set_nan.c
+++ b/fer/ccr/set_nan.c
@@ -52,7 +52,7 @@
 #include <math.h>
 #include "ferret.h"
 
-void FORTRAN(set_nan) (DFTYPE *val)
+void FORTRAN(set_nan)(DFTYPE *val)
 {
   sigset_t block_fpe;
 
diff --git a/fer/ccr/set_null_c_string.c b/fer/ccr/set_null_c_string.c
index a67462c..2ad8c49 100644
--- a/fer/ccr/set_null_c_string.c
+++ b/fer/ccr/set_null_c_string.c
@@ -40,15 +40,12 @@
  */
 
 #include <stdlib.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void set_null_c_string_(out_ptr)
-     char** out_ptr;
+void FORTRAN(set_null_c_string)(char **out_ptr)
 {
-   if ( *out_ptr != NULL )
-      free(*out_ptr);
-
-   *out_ptr = (char *) malloc(sizeof(char));
-   if ( *out_ptr == NULL )
-      abort();
-   **out_ptr = '\0';
+   if ( (*out_ptr != NULL) && (*out_ptr != STRING_MISSING_VALUE) )
+      FerMem_Free(*out_ptr, __FILE__, __LINE__);
+   *out_ptr = STRING_MISSING_VALUE;
 }
diff --git a/fer/ccr/set_null_c_string_array.c b/fer/ccr/set_null_c_string_array.c
index f6587bf..b43d625 100644
--- a/fer/ccr/set_null_c_string_array.c
+++ b/fer/ccr/set_null_c_string_array.c
@@ -39,10 +39,10 @@
  */
  
 #include <stdlib.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void set_null_c_string_array_(fer_ptr, nstr)
-     char*** fer_ptr;
-     int* nstr;
+void FORTRAN(set_null_c_string_array)(char ***fer_ptr, int *nstr)
 {
    char** each_str_ptr;
    int i;
@@ -50,13 +50,9 @@ void set_null_c_string_array_(fer_ptr, nstr)
    each_str_ptr = *fer_ptr;   /* holds pointer to the first string */
 
    for (i=0; i<*nstr; i++) {
-      if ( *each_str_ptr != NULL )
-         free(*each_str_ptr);
-      *each_str_ptr = (char *) malloc(sizeof(char));
-      if ( *each_str_ptr == NULL )
-         abort();
-      **each_str_ptr = '\0';
-
+      if ( (*each_str_ptr != NULL) && (*each_str_ptr != STRING_MISSING_VALUE) )
+         FerMem_Free(*each_str_ptr, __FILE__, __LINE__);
+      *each_str_ptr = STRING_MISSING_VALUE;
       each_str_ptr += 8/sizeof(char**);
    }
 }
diff --git a/fer/ccr/sizeof_pointer.c b/fer/ccr/sizeof_pointer.c
index 0079214..b8b2e4a 100644
--- a/fer/ccr/sizeof_pointer.c
+++ b/fer/ccr/sizeof_pointer.c
@@ -33,12 +33,13 @@
 *  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.  
 */
 
+#include "ferret.h"
 
 /* 
  *  return the size (in units of bytes) of a pointer to a character
  */
 
-int sizeof_pointer_()
+int FORTRAN(sizeof_pointer)(void)
 {
   return (int) sizeof(char*);
 }
diff --git a/fer/ccr/unmap_animate_window.c b/fer/ccr/unmap_animate_window.c
index d4cedc9..7fcb320 100644
--- a/fer/ccr/unmap_animate_window.c
+++ b/fer/ccr/unmap_animate_window.c
@@ -42,14 +42,9 @@
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include "gks_implem.h"
-#include "wslist.h"
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-unmap_animate_window()
-#else
-unmap_animate_window_()
-#endif
+#include "ferret.h"
 
+void FORTRAN(unmap_animate_window)(void)
 {
   WindowMapping(0);
 }
diff --git a/fer/ccr/wgif.c b/fer/ccr/wgif.c
index c583904..9e36da3 100644
--- a/fer/ccr/wgif.c
+++ b/fer/ccr/wgif.c
@@ -93,30 +93,27 @@ typedef        unsigned char   char_type;
 /**************************************************************************/
 /* static char_type	*data; */
 static char_type	*data;
-static int		iwidth, iheight, image_offset;
+static int		iwidth, iheight;
 /**************************************************************************/
-typedef int (* ifunptr)();                              /* Pointer to function returning an int */
- 
-int GetPixel( int, int );
-
-static Putword( int, FILE *);
-static cl_block ();   
-static cl_hash(register count_int);
-static writeerr();
-static char_init();
-static char_out( int );
-static flush_char();
-static output( code_int );
+typedef int (* ifunptr)(int,int);                              /* Pointer to function returning an int */
+ 
+static void GIFEncode( FILE *, int, int, int, int, int, int[], int[], int[], ifunptr );
+static int  GetPixel( int, int );
+static void Putword( int, FILE * );
+static void wcompress( int, FILE *, ifunptr );
+static void cl_block( void );   
+static void cl_hash( register count_int );
+static void writeerr( void );
+static void char_init( void );
+static void char_out( int );
+static void flush_char( void );
+static void output( code_int );
 
 
 
-void wGIF(fp, image,r,g,b)
-     FILE *fp;
-     XImage *image;
-     int r[],g[],b[];
+void wGIF(FILE *fp, XImage *image, int r[], int g[], int b[])
 {
-
-     int x,y;
+     int x;
 
 /* Set global variables needed for GetPixel routine */
 /* cast image-> data to unsigned character ptr. 6/12/96 *kob* */
@@ -156,7 +153,7 @@ static long CountDown;
 static int Pass = 0;
 static int Interlace;
  
-static BumpPixel() /* Bump the 'curx' and 'cury' to point to the next pixel */
+static void BumpPixel() /* Bump the 'curx' and 'cury' to point to the next pixel */
 {
     curx++;         /* Bump the current X position */
  
@@ -211,7 +208,7 @@ static BumpPixel() /* Bump the 'curx' and 'cury' to point to the next pixel */
 }
  
  
-GIFGetPixel( getpixel )                        /* Return the next pixel from the image */
+static int GIFGetPixel( getpixel )                        /* Return the next pixel from the image */
 ifunptr getpixel;
 {
         int r;
@@ -231,8 +228,8 @@ ifunptr getpixel;
  
  
  
-GIFEncode( fp, GWidth, GHeight, GInterlace, Background,
-           BitsPerPixel, Red, Green, Blue, GetPixel )
+static void GIFEncode( fp, GWidth, GHeight, GInterlace, Background,
+           BitsPerPixel, Red, Green, Blue, GetPixelFunc )
  
 FILE *fp;
 int GWidth;
@@ -241,7 +238,7 @@ int GInterlace;
 int Background;
 int BitsPerPixel;
 int Red[], Green[], Blue[];
-ifunptr GetPixel;
+ifunptr GetPixelFunc;
  
 {
         int B;
@@ -311,7 +308,7 @@ ifunptr GetPixel;
         fputc( InitCodeSize, fp );                      /* Write out the initial code size */
  
  /* renamed from compress because of conflict under x86-64_linux with  /usr/lib64/libz.a(compress.o) */
-        wcompress( InitCodeSize+1, fp, GetPixel );               /* Actually compress data */
+        wcompress( InitCodeSize+1, fp, GetPixelFunc );               /* Actually compress data */
  
  
  
@@ -323,7 +320,7 @@ ifunptr GetPixel;
  
  
  
-static Putword( w, fp )                                 /* Write out a word to the GIF file */
+static void Putword( w, fp )                                 /* Write out a word to the GIF file */
 int w;
 FILE *fp;
 {
@@ -376,7 +373,6 @@ static unsigned short codetab [HSIZE];
 #define CodeTabOf(i)    codetab[i]
  
 static code_int hsize = HSIZE;                 /* for dynamic table sizing */
-static count_int fsize;
  
 /*
  * To save much memory, we overlay the table used by compress() with those
@@ -392,7 +388,6 @@ static count_int fsize;
 #define de_stack               ((char_type *)&tab_suffixof((code_int)1<<BITS))
  
 static code_int free_ent = 0;                  /* first unused entry */
-static int exit_stat = 0;
  
 /*
  * block compression parameters -- after all codes are used up,
@@ -426,7 +421,7 @@ static FILE *g_outfile;
 static int ClearCode;
 static int EOFCode;
  
-wcompress( init_bits, outfile, ReadValue )
+static void wcompress( init_bits, outfile, ReadValue )
 int init_bits;
 FILE *outfile;
 ifunptr ReadValue;
@@ -555,7 +550,7 @@ unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F,
  
  
  
-static output( code )
+static void output( code )
 code_int  code;
 {
     cur_accum &= masks[ cur_bits ];
@@ -617,7 +612,7 @@ code_int  code;
  
  
  
-static cl_block ()             /* table clear for block compress */
+static void cl_block (void)             /* table clear for block compress */
 {
  
         cl_hash ( (count_int) hsize );
@@ -629,7 +624,7 @@ static cl_block ()             /* table clear for block compress */
  
  
  
-static cl_hash(hsize)                                                                   /* reset code table */
+static void cl_hash(hsize)                                                                   /* reset code table */
 register count_int hsize;
 {
  
@@ -666,7 +661,7 @@ register count_int hsize;
  
  
  
-static writeerr()
+static void writeerr()
 {
         printf( "error writing output file\n" );
         exit(1);
@@ -682,7 +677,7 @@ static int a_count;                     /* Number of characters so far in this '
  
  
  
-static char_init()                      /* Set up the 'byte output' routine */
+static void char_init()                      /* Set up the 'byte output' routine */
 {
         a_count = 0;
 }
@@ -693,7 +688,7 @@ static char accum[ 256 ];       /* Define the storage for the packet accumulator
  
  
  
-static char_out( c )                    /* Add character to end, if 254 characters, flush */
+static void char_out( c )                    /* Add character to end, if 254 characters, flush */
 int c;
 {
         accum[ a_count++ ] = c;
@@ -703,7 +698,7 @@ int c;
  
  
  
-static flush_char() /* Flush the packet to disk, and reset the accumulator */
+static void flush_char() /* Flush the packet to disk, and reset the accumulator */
 {
         if( a_count > 0 )
                 {
@@ -714,7 +709,7 @@ static flush_char() /* Flush the packet to disk, and reset the accumulator */
 }
  
 /*************************************************************************/
-int GetPixel( x, y )
+static int GetPixel( x, y )
 int x, y;
 {
       return data[ y*iwidth + x];
diff --git a/fer/ccr/whdf.c b/fer/ccr/whdf.c
index 3711db7..efc16ca 100644
--- a/fer/ccr/whdf.c
+++ b/fer/ccr/whdf.c
@@ -60,10 +60,7 @@
 #include <stdio.h>
 
 
-void wHDF(file, image,r,g,b)
-     char *file;
-     XImage *image;
-     int r[],g[],b[];
+void wHDF(char *file, XImage *image, int r[], int g[], int b[])
 {
   fputs("**ERROR: wHDF not supported on this platform\n", stderr);
   exit(1);
diff --git a/fer/ccr/write_dods.c b/fer/ccr/write_dods.c
index 3b0e673..64f6e7e 100644
--- a/fer/ccr/write_dods.c
+++ b/fer/ccr/write_dods.c
@@ -4,6 +4,8 @@
 #include <errno.h>
 #include <netinet/in.h> /* for htonl; header probably varies by platform */
 #include <assert.h>
+#include "ferret.h"
+#include "FerMem.h"
 
 /*
  * if clobber == 0, open filename for overwriting.
@@ -36,14 +38,7 @@
  *                          fine as long as length is less than 2e31.
  */
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-
-int write_dods_(char*filename, int* slen, int *clobber, int *swap, 
-                int *length, float *data) 
+int FORTRAN(write_dods)(char*filename, int* slen, int *clobber, int *swap, int *length, float *data) 
 {
   FILE *f;
   int i, length_n, result = 0;
@@ -60,7 +55,8 @@ int write_dods_(char*filename, int* slen, int *clobber, int *swap,
 
   /* allocate memory and save the filename to null-terminated string */
 
-  if ( fileptr = (char *) malloc(sizeof(char) * (*slen + 1) ) ) {
+  fileptr = (char *) FerMem_Malloc(sizeof(char) * (*slen + 1), __FILE__, __LINE__);
+  if ( fileptr != NULL ) {
     strncpy (fileptr, filename, *slen);
     fileptr[*slen] = 0;    /* null-terminate the stored string */
   } else goto cleanup;
@@ -90,7 +86,7 @@ int write_dods_(char*filename, int* slen, int *clobber, int *swap,
   }
 
 cleanup:
-  if (fileptr) free(fileptr);
+  if (fileptr) FerMem_Free(fileptr, __FILE__, __LINE__);
   result = errno;
   if (f) {
     if (errno) {             /* preserve original error even if close fails */
@@ -104,8 +100,7 @@ cleanup:
 }
 
 
-int write_dods_double_(char*filename, int* slen, int *clobber, int *swap, 
-                       int *length, double *data) 
+int FORTRAN(write_dods_double)(char*filename, int* slen, int *clobber, int *swap, int *length, double *data) 
 {
   FILE *f;
   int i, length_n, result = 0;
@@ -122,7 +117,8 @@ int write_dods_double_(char*filename, int* slen, int *clobber, int *swap,
 
   /* allocate memory and save the filename to null-terminated string */
 
-  if ( fileptr = (char *) malloc(sizeof(char) * (*slen + 1) ) ) {
+  fileptr = (char *) FerMem_Malloc(sizeof(char) * (*slen + 1), __FILE__, __LINE__);
+  if ( fileptr != NULL ) {
     strncpy (fileptr, filename, *slen);
     fileptr[*slen] = 0;    /* null-terminate the stored string */
   } else goto cleanup;
@@ -155,7 +151,7 @@ int write_dods_double_(char*filename, int* slen, int *clobber, int *swap,
   }
 
 cleanup:
-  if (fileptr) free(fileptr);
+  if (fileptr) FerMem_Free(fileptr, __FILE__, __LINE__);
   result = errno;
   if (f) {
     if (errno) {             /* preserve original error even if close fails */
diff --git a/fer/ccr/xfer_c_ptrs.c b/fer/ccr/xfer_c_ptrs.c
index 68125f4..92c2c91 100644
--- a/fer/ccr/xfer_c_ptrs.c
+++ b/fer/ccr/xfer_c_ptrs.c
@@ -40,16 +40,11 @@
  */
 
 #include <stdlib.h>
+#include "ferret.h"
+#include "FerMem.h"
 
-void xfer_c_ptrs_(src_ptr, src_del, src_offset,
-		  dst_ptr, dst_del, dst_offset, nptr)
-     char*** src_ptr;
-     int* src_del;
-     int* src_offset;
-     char*** dst_ptr;
-     int* dst_del;
-     int* dst_offset;
-     int* nptr;
+void FORTRAN(xfer_c_ptrs)(char ***src_ptr, int *src_del, int *src_offset,
+		          char ***dst_ptr, int *dst_del, int *dst_offset, int *nptr)
 {
    int src_delta = *src_del ? 8/sizeof(char**) : 1;
    int dst_delta = *dst_del ? 8/sizeof(char**) : 1;
@@ -59,7 +54,7 @@ void xfer_c_ptrs_(src_ptr, src_del, src_offset,
 
    for (i=0; i<*nptr; i++) {
       if ( *dst != NULL )
-         free(*dst);
+         FerMem_Free(*dst, __FILE__, __LINE__);
       *dst = *src;
       src += src_delta;
       dst += dst_delta;
diff --git a/fer/common/EF_Util.h b/fer/common/EF_Util.h
index ef49952..1930d03 100644
--- a/fer/common/EF_Util.h
+++ b/fer/common/EF_Util.h
@@ -137,14 +137,22 @@ extern DFTYPE *GLOBAL_bad_flag_ptr;
 
 /* prototypes of external function used in ef funtions and PyFerret C functions */
 extern ExternalFunction *ef_ptr_from_id_ptr(int *id_ptr);
-extern void FORTRAN(ef_get_arg_subscripts_6d)(int *id, int steplo[][6], int stephi[][6], int incr[][6]);
-/* the coords argument in ef_get_coordinates is explicitly real*8  */
+extern void FORTRAN(ef_err_bail_out)(int *, char *);
+extern void FORTRAN(ef_get_bad_flags)(int *id_ptr, DFTYPE *resbadflag, DFTYPE *argbadflag);
+
+    /* up to nine argument arrays at this time */
+extern void FORTRAN(ef_get_arg_mem_subscripts_6d)(int *id, int memlo[9][6], int memhi[9][6]);
+extern void FORTRAN(ef_get_arg_subscripts_6d)(int *id, int steplo[9][6], int stephi[9][6], int incr[9][6]);
+    /* only one result array at this time */
+extern void FORTRAN(ef_get_res_mem_subscripts_6d)(int *id, int memlo[6], int memhi[6]);
+extern void FORTRAN(ef_get_res_subscripts_6d)(int *id, int steplo[6], int stephi[6], int incr[6]);
+
+    /* the coords argument in ef_get_coordinates is explicitly real*8  */
 extern void FORTRAN(ef_get_coordinates)(int *id, int *arg, int *axis, int *lo, int *hi, double coords[]);
 extern void FORTRAN(ef_get_box_size)(int *id, int *arg, int *axis, int *lo, int *hi, DFTYPE sizes[]);
-/* the lo_lims and hi_lims arguments in ef_get_box_limits is explicitly real*8 */
-extern void FORTRAN(ef_get_box_limits)(int *id, int *arg, int *axis, int *lo, int *hi, 
-                                       double lo_lims[], double hi_lims[]);
-/* the modlen argument in ef_get_axis_modulo_len is explicitly real*8 */
+    /* the lo_lims and hi_lims arguments in ef_get_box_limits is explicitly real*8 */
+extern void FORTRAN(ef_get_box_limits)(int *id, int *arg, int *axis, int *lo, int *hi, double lo_lims[], double hi_lims[]);
+    /* the modlen argument in ef_get_axis_modulo_len is explicitly real*8 */
 extern void FORTRAN(ef_get_axis_modulo_len)(int *id, int *arg, int *axis, double *modlen);
 
 extern void FORTRAN(ef_get_one_val_sub)(int *id_ptr, int *arg_ptr, DFTYPE *val_ptr);
diff --git a/fer/common/FerMem.h b/fer/common/FerMem.h
new file mode 100644
index 0000000..c1c7587
--- /dev/null
+++ b/fer/common/FerMem.h
@@ -0,0 +1,58 @@
+#ifndef _FERMEM_H_
+#define _FERMEM_H_
+
+#include <stdlib.h> /* for size_t */
+
+#ifdef MEMORYDEBUG
+void FerMem_WriteDebugMessage(void *startptr, void *endptr, const char *msg, const char *filename, int linenum);
+int  ReportAnyMemoryLeaks(void);
+#endif
+
+/*
+ * Pointer to the string used for missing value for strings.
+ * Since this string is often used, eliminate allocating and 
+ * freeing memory for this string by using this one global
+ * instance.
+ */
+extern char *STRING_MISSING_VALUE;
+
+/*
+ * Allocates memory like malloc.  If (and only if) the compile flag MEMORYDEBUG is defined, 
+ * prints a line to memorydebug.txt with the allocation information.  The value of filename 
+ * should be __FILE__ and the value of linenumber should be __LINE__ in the source file 
+ * calling this routine.
+ *
+ * So: 
+ *     myptr = malloc(mysize);
+ * should be turned into: 
+ *     myptr = FerMem_Malloc(mysize, __FILE__, __LINE__);
+ */
+void *FerMem_Malloc(size_t size, char *filename, int linenumber);
+
+/*
+ * Reallocates memory like realloc.  If (and only if) the compile flag MEMORYDEBUG is defined, 
+ * prints a line to memorydebug.txt with the allocation information.  The value of filename 
+ * should be __FILE__ and the value of linenumber should be __LINE__ in the source file 
+ * calling this routine.
+ *
+ * So: 
+ *     newptr = realloc(myptr, newsize);
+ * should be turned into: 
+ *     newptr = FerMem_Realloc(myptr, newsize, __FILE__, __LINE__);
+ */
+void *FerMem_Realloc(void *ptr, size_t size, char *filename, int linenumber);
+
+/*
+ * Frees memory like free.  If (and only if) the compile flag MEMORYDEBUG is defined, 
+ * prints a line to memorydebug.txt with the allocation information.  The value of filename 
+ * should be __FILE__ and the value of linenumber should be __LINE__ in the source file 
+ * calling this routine.
+ *
+ * So: 
+ *     free(mymem);
+ * should be turned into: 
+ *     FerMem_Free(mymem, __FILE__, __LINE__);
+ */
+void FerMem_Free(void *ptr, char *filename, int linenumber);
+
+#endif
diff --git a/fer/ccr/binaryRead.h b/fer/common/binaryRead.h
similarity index 85%
rename from fer/ccr/binaryRead.h
rename to fer/common/binaryRead.h
index 2ff80cb..cf8457e 100644
--- a/fer/ccr/binaryRead.h
+++ b/fer/common/binaryRead.h
@@ -3,7 +3,7 @@
 /*
  * Utility functions for reading binary data
  *
- * $Id: binaryRead.h 14256 2012-06-29 21:30:01Z ansley $
+ * $Id$
  *
  * *acm*  5/07 v603 - fix prototype of createBinaryRead to use MAXDIMS rather 
  *                    than hardwired to 4; to match what is in .c file.
@@ -67,4 +67,13 @@ typedef struct _FileInfo {
 #define FORTRAN(a) a##_
 #endif
 
+int  FORTRAN(br_add_var)(DFTYPE *data, int *doRead);
+void FORTRAN(br_close)(void);
+void FORTRAN(br_get_error)(char *buf);
+void FORTRAN(br_get_permutes)(int *permutes);
+int  FORTRAN(br_open)(char *name, int lengths[MAXDIMS], int permutes[MAXDIMS], int *iskip);
+int  FORTRAN(br_read)(void);
+void FORTRAN(br_set_atts)(int *permutes, int *swap);
+int  FORTRAN(br_set_type)(char *type);
+
 #endif
diff --git a/fer/common/dsimple.h b/fer/common/dsimple.h
deleted file mode 100644
index a95f8ce..0000000
--- a/fer/common/dsimple.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $XConsortium: dsimple.h,v 1.3 90/04/28 12:07:00 rws Exp $ */
-/*
- * Just_display.h: This file contains the definitions needed to use the
- *                 functions in just_display.c.  It also declares the global
- *                 variables dpy, screen, and program_name which are needed to
- *                 use just_display.c.
- *
- * Written by Mark Lillibridge.   Last updated 7/1/87
- *
- * Send bugs, etc. to chariot at athena.mit.edu.
- */
-
-    /* Global variables used by routines in just_display.c */
-
-char *program_name = "unknown_program";       /* Name of this program */
-Display *dpy;                                 /* The current display */
-int screen;                                   /* The current screen */
-
-#define INIT_NAME program_name=argv[0]        /* use this in main to setup
-                                                 program_name */
-
-    /* Declaritions for functions in just_display.c */
-
-void Fatal_Error();
-char *Malloc();
-char *Realloc();
-char *Get_Display_Name();
-Display *Open_Display();
-void Setup_Display_And_Screen();
-XFontStruct *Open_Font();
-void Beep();
-Pixmap ReadBitmapFile();
-void WriteBitmapFile();
-Window Select_Window_Args();
-
-#define X_USAGE "[host:display]"              /* X arguments handled by
-						 Get_Display_Name */
-#define SELECT_USAGE "[-root|-id <id>|-name <name>]"
-
-/*
- * Other_stuff.h: Definitions of routines in other_stuff.
- *
- * Written by Mark Lillibridge.   Last updated 7/1/87
- *
- * Send bugs, etc. to chariot at athena.mit.edu.
- */
-
-unsigned long Resolve_Color();
-Pixmap Bitmap_To_Pixmap();
-Window Select_Window();
-void out();
-void blip();
-Window Window_With_Name();
diff --git a/fer/common/ferret.h b/fer/common/ferret.h
index e683724..294b921 100644
--- a/fer/common/ferret.h
+++ b/fer/common/ferret.h
@@ -1,60 +1,24 @@
 #ifndef _FERRET_H 
 #define _FERRET_H
 
+#include <sys/types.h>
+#include <stdio.h>
 
-/* non-ANSI function prototypes */
-#ifdef NO_ENTRY_NAME_UNDERSCORES      /*added ifdef for HP port *kob* 6.95*/
+#include <X11/Xlib.h>
 
-void ctrlc_ast();   /* pointer to ^C interrupt routine */
-void initialize();
-void set_ctrl_c(); /* void set_ctrl_c_( void (*CTRLC_AST_)() ); */ 
-void help_text();
-void init_journal( );
-void no_journal( );
-void proclaim_c( );
-void init_memory( );
-void ferret_dispatch( );
-void save_ppl_memory_size( );
-void get_ppl_memory_size( );
-void reallo_ppl_memory();
-void ferret_dispatch_c();
-void WindowMapping();
-void mode_gui_on();
-void secs_to_date_c();
-double tm_secs_from_bc();
-void xgks_x_events();
-void gescinqxattr();
+#include "ferret_shared_buffer.h"
 
+/* Easier way of handling FORTRAN calls with underscore/no underscore */
+#ifndef FORTRAN
+#ifdef NO_ENTRY_NAME_UNDERSCORES
+#define FORTRAN(a) a
 #else
-
-void ctrlc_ast_();   /* pointer to ^C interrupt routine */
-void initialize_();
-void set_ctrl_c_(); /* void set_ctrl_c_( void (*CTRLC_AST_)() ); */ 
-void help_text();
-void init_journal_( );
-void no_journal_( );
-void proclaim_c_( );
-void init_memory_( );
-void ferret_dispatch_( );
-void save_ppl_memory_size_( );
-void get_ppl_memory_size_( );
-void ferret_dispatch_c();
-void WindowMapping();
-void mode_gui_on();
-void secs_to_date_c();
-double tm_secs_from_bc_();
-void xgks_x_events();
-void gescinqxattr();
-
+#define FORTRAN(a) a##_
+#endif
 #endif
 
 #define NFERDIMS 6
-
-/* memory configuration defaults */
-/* NOTE!! PMEM_BLK_SIZE must match pmem_blk_size in xvariables.cmn */
-/* * V62  2/09 *acm*  increase initial memory by 4. */
-#define PMEM_BLK_SIZE 2*(160*100*4/10)  /*  2* 9/01 *sh* */
-#define PMAX_MEM_BLKS 2000
+#define NFERDIMSP1 7
 
 /* from XPROG_STATE COMMON */
 #define TTOUT_LUN 6
@@ -68,16 +32,6 @@ void gescinqxattr();
 #define FRTN_IDATA2   6    /* 7 in FORTRAN */
 #define FRTN_IDATA3   7    /* 8 in FORTRAN */
 
-/* who is in control according to return_buff(frtn_control) ?
-when the GUI is running FERRET control may return to the GUI at times
-other than at the completion of a command - for example, when FERRET
-is requesting that a warning message be displayed or that memory be
-reconfigured.  These codes indicate why FERRET has returned.
-FERRET will reset the control variable to "ctrl_not_finished" if
-the given command was really multiple commands and they are not yet complete*/
-#define FCTRL_BACK_TO_GUI  1
-#define FCTRL_IN_FERRET    2
-
 /* what special action has FERRET requested in return_buff(frtn_action) ? */
 #define FACTN_NO_ACTION        0
 #define FACTN_MEM_RECONFIGURE  1
@@ -90,23 +44,110 @@ the given command was really multiple commands and they are not yet complete*/
 #define FACTN_SYNCH_WINDOW     8
 #define FACTN_PAUSE           10
 
-/* Easier way of handling FORTRAN calls with underscore/no underscore */
-#ifndef FORTRAN
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-#endif
-
 /* *acm*  1/12 - Ferret 6.8 double-precision ferret */
 /* Easier way of handling single/double floating-point declarations */
 
+#ifndef DFTYPE
 #ifdef double_p
 #define DFTYPE double
 #else
 #define DFTYPE float
 #endif
+#endif
 
-#endif /* _FERRET_H */
+/* Prototypes for C functions */
+FILE *executableOutput(char *exeArgv[], pid_t *childPidPtr, char errMsg[]);
+void ferret_dispatch_c(char *init_command, smPtr sBuffer);
+int  getJavaVersion(char javaExeName[], char errMsg[]);
+int  runThreddsBrowser(char datasetName[], char errWarn[]);
+void set_secure(void);
+void set_server(void);
+
+void Window_Dump(Window window, Display *dpy, char *outfile, char *type);
+void wGIF(FILE *fp, XImage *image, int r[], int g[], int b[]);
+void wHDF(char *file, XImage *image, int r[], int g[], int b[]);
+
+void FORTRAN(c_dncase)(char **in_ptr, char **out_ptr);
+void FORTRAN(c_strcat)(char **in_ptr1, char **in_ptr2, char **out_ptr);
+void FORTRAN(c_strcmp)(char **in_ptr1, char **in_ptr2, int *out_ptr);
+void FORTRAN(c_strfloat)(char **in_ptr, DFTYPE *out_ptr, DFTYPE *bad_ptr);
+void FORTRAN(c_strindex)(char **in_ptr1, char **in_ptr2, int *out_ptr);
+void FORTRAN(c_strlen)(char **in_ptr, int *out_ptr);
+void FORTRAN(c_strrindex)(char **in_ptr1, char **in_ptr2, int *out_ptr);
+void FORTRAN(c_substr)(char **in_ptr, int *offset, int *length, char **out_ptr);
+void FORTRAN(c_upcase)(char **in_ptr, char **out_ptr);
+void FORTRAN(cache_full_array)(double *array, int *alen, double **pointer_val);
+int  FORTRAN(compare_c_strings)(char **ptr_1, char **ptr_2);
+void FORTRAN(copy_c_string)(char **in_ptr, char **out_ptr);
+void FORTRAN(create_utf8_str)(const int *codepoint, char *utf8str, int *utf8strlen);
+void FORTRAN(date_decode)(char *strdate, DFTYPE *rdum);
+void FORTRAN(dynmem_free_ptr_array)(DFTYPE ***mr_ptrs_ptr);
+void FORTRAN(dynmem_make_ptr_array)(int* n, DFTYPE ***mr_ptrs_ptr, int* status);
+void FORTRAN(dynmem_pass_1_ptr)(int* iarg, DFTYPE* arg_ptr, DFTYPE ***mr_ptrs_ptr);
+void FORTRAN(efcn_list_clear)(void);
+void FORTRAN(free_c_pointer)(char ***fer_ptr);
+void FORTRAN(free_c_string_array)(char ***fer_ptr, int *length);
+void FORTRAN(free_cached_full_array)(double **pointer_val);
+void FORTRAN(free_dyn_mem)(double *mvar);
+void FORTRAN(get_c_pointer)(char** mr_ptr, char** mr_ptr_val);
+void FORTRAN(get_c_string)(char **ptr_ptr, char *outstring, int *maxlen);
+int  FORTRAN(get_c_string_len)(char **ptr_ptr);
+int  FORTRAN(get_max_c_string_len)(char ***fer_ptr, int *nstr);
+void FORTRAN(get_mr_mem)(double *index, long *alen, int *status);
+void FORTRAN(get_offset_c_string)(char ***fer_ptr, int *offset, char *outstring, int *maxlen);
+int  FORTRAN(get_offset_c_string_len)(char ***fer_ptr, int *offset);
+void FORTRAN(get_sys_cmnd)(char ***fer_ptr, int *nlines, char *cmd, int *stat);
+void FORTRAN(get_ws_mem)(int *index, int *alen, int *status);
+void FORTRAN(init_c_string_array)(int *length, char **mr_blk1, char ***fer_ptr);
+int  FORTRAN(is_secure)(void);
+int  FORTRAN(is_server)(void);
+void FORTRAN(linux_perror)(char *string);
+void FORTRAN(nullify_mr)(int *mr);
+void FORTRAN(nullify_ws)(int *ws);
+void FORTRAN(put_frame)(int *ws_id, char *filename, char *errstr, char *format, int *status);
+void FORTRAN(put_frame_batch)(int *ws_id, char *filename, char *format, int *transp, 
+                              DFTYPE *red, DFTYPE *green, DFTYPE *blue, char *errmsg, int *status);
+void FORTRAN(recover_cached_2d_array_point)(double *array, int *dim1, int *dim2, int *i, int *j, double **pointer_val);
+void FORTRAN(recover_cached_full_array)(double *array, int *alen, double **pointer_val);
+int  FORTRAN(replaceable_bad_flags)(DFTYPE *bad1, DFTYPE *bad2);
+void FORTRAN(replace_bad_data_sub)(DFTYPE *old_bad, DFTYPE *src, int *size, DFTYPE *new_bad);
+int  FORTRAN(run_thredds_browser)(char dataset_name[], char err_warn_msg[], int max_len_data_set, int max_len_err_warn_msg);
+void FORTRAN(save_c_string)(char *string, int *inlen, char ***fer_ptr, int *offset, int *stat);
+void FORTRAN(save_metafile_name)(char *outfile, int *length, int *bat_mode);
+void FORTRAN(set_batch_graphics)(char *outfile, int *batmode);
+void FORTRAN(set_nan)(DFTYPE *val);
+void FORTRAN(set_null_c_string)(char **out_ptr);
+void FORTRAN(set_null_c_string_array)(char ***fer_ptr, int *nstr);
+int  FORTRAN(sizeof_pointer)(void);
+void FORTRAN(store_mr_ptr)(double *index, long *alen, double *pointer);
+void FORTRAN(store_nul_mr_ptr)(int *mr, double *nul_ptr);
+void FORTRAN(store_nul_ws_ptr)(int *ws, double *nul_ptr);
+void FORTRAN(store_ws_ptr)(int *index, int *alen, double *pointer);
+void FORTRAN(text_to_utf8)(const char *text, const int *textlen, char *utf8str, int *utf8strlen);
+DFTYPE FORTRAN(time_decode)(char *strtime);
+void FORTRAN(us2i_str_cmp)(char *str1, char *str2, int *ival);
+void FORTRAN(us2i_compare_string_list)(char* compare_string, int *str_seq);
+void FORTRAN(us2i_string_list_free)(void);
+int  FORTRAN(write_dods)(char*filename, int* slen, int *clobber, int *swap, int *length, float *data);
+int  FORTRAN(write_dods_double)(char*filename, int* slen, int *clobber, int *swap, int *length, double *data);
+void FORTRAN(xfer_c_ptrs)(char ***src_ptr, int *src_del, int *src_offset,
+		          char ***dst_ptr, int *dst_del, int *dst_offset, int *nptr);
+
+/* Prototypes for Fortran functions called by C functions */
+void FORTRAN(ctrlc_ast)(void);
+DFTYPE FORTRAN(days_from_day0)(double *days1900, int* iyr, int* imon, int* iday, DFTYPE* rdum, int* status);
+void FORTRAN(ferret_dispatch)(char *init_command, int *rtn_flags, int *nflags, char *rtn_chars, int *nchars, int *nerrlines);
+void FORTRAN(finalize_ferret)(void);
+void FORTRAN(init_journal)(int *status);
+void FORTRAN(init_memory)(DFTYPE *vmem_size_arg);
+void FORTRAN(initialize_ferret)(void);
+void FORTRAN(no_journal)(void);
+void FORTRAN(save_frame_name)(char *outfile,  int *length);
+void FORTRAN(save_scriptfile_name)(char *name, int *clen, int *status);
+void FORTRAN(set_ctrl_c)(void (*func)(void));
+void FORTRAN(proclaim_c)(int *lun, char *leader);
+void FORTRAN(get_scriptfile_name)(char *name, int *ipath, int name_size);
+void FORTRAN(turnoff_verify)(int *status);
+void FORTRAN(version_only)(void);
 
+#endif /* _FERRET_H */
diff --git a/fer/common/ferret_query.parm b/fer/common/ferret_query.parm
deleted file mode 100644
index e994a84..0000000
--- a/fer/common/ferret_query.parm
+++ /dev/null
@@ -1,17 +0,0 @@
-* status codes returned by ferret_query_F
-* negative codes are FERRET status codes ferr_xxx...
-
-	INTEGER
-     .       QSTAT_OK,
-     .       QSTAT_UNKNOWN_QUERY,
-     .       QSTAT_BUFF_OVFLOW,
-     .       QSTAT_INVALID_ARG,
-     .       QSTAT_INTERNAL_ERROR
-
-	PARAMETER (
-     .       QSTAT_OK = 0,
-     .       QSTAT_UNKNOWN_QUERY = 1,
-     .       QSTAT_BUFF_OVFLOW = 2,
-     .       QSTAT_INVALID_ARG = 3,
-     .       QSTAT_INTERNAL_ERROR = 4 )
-
diff --git a/fer/common/ferret_shared_buffer.h b/fer/common/ferret_shared_buffer.h
index e9a3249..a2d8989 100644
--- a/fer/common/ferret_shared_buffer.h
+++ b/fer/common/ferret_shared_buffer.h
@@ -11,7 +11,6 @@
  * 	  if ( sBuffer->flags[FRTN_CONTROL] == FCTRL_IN_FERRET ) 
  *
  * V702 *sh* 2/2017 - eliminated global "memory" - using individual mallocs now
-
  */
 
 #ifndef _FERRET_SHARED_BUFFER_H 
@@ -22,8 +21,6 @@
 #define TEXTLENGTH 500
 #define NUMDOUBLES 2048
 
-#include "ferret.h"
-
 typedef struct sharedStruct {
 	int flags[NUMFLAGS];
 	char text[TEXTLENGTH];
@@ -34,23 +31,9 @@ typedef struct sharedStruct {
 
 typedef sharedMem *smPtr;
 
-/*
- * Exactly one module must define __globalDefs.
- * All others will reference sBuffer as "extern".
- */
-
-#ifdef __globalDefs
-#define __global
-#else
-#define __global extern
-#endif
-
-__global smPtr sBuffer;
-
-__global float *ppl_memory;
-
+extern smPtr sBuffer;
 
-#undef __global
+extern float *ppl_memory;
 
 
 #endif /* _FERRET_SHARED_BUFFER_H */
diff --git a/fer/common/list.h b/fer/common/list.h
index 2ae4168..d704f05 100644
--- a/fer/common/list.h
+++ b/fer/common/list.h
@@ -1,3 +1,6 @@
+#ifndef _LIST_H_
+#define _LIST_H_
+
 /* list.h -- data structures and such for generic list package
  * 
  * Last edited: Tue Jul 28 15:29:56 1992 by bcs (Bradley C. Spatz) on wasp
@@ -64,17 +67,21 @@ typedef struct list_element_t LIST_ELEMENT;
 #define LIST_OK         1
 #define LIST_EXTENT     2
 
-/* prototypes */
-LIST *list_init(void);
+/*
+ * list function prototypes - 
+ * filename and linenum are for debugging (MEMORYDEBUG) and 
+ * should be __FILE__ and __LINE__ where these are called 
+ */
+LIST *list_init(char *filename, int linenum);
 LIST *list_mvprev(LIST *list);
 LIST *list_mvnext(LIST *list);
-char *list_insert_before(LIST *list, char *data, int bytes);
-char *list_insert_after(LIST *list, char *data, int bytes);
-char *list_remove_front(LIST *list);
-char *list_remove_rear(LIST *list);
-char *list_remove_curr(LIST *list);
+char *list_insert_before(LIST *list, char *data, int bytes, char *filename, int linenum);
+char *list_insert_after(LIST *list, char *data, int bytes, char *filename, int linenum);
+char *list_remove_front(LIST *list, char *filename, int linenum);
+char *list_remove_rear(LIST *list, char *filename, int linenum);
+char *list_remove_curr(LIST *list, char *filename, int linenum);
 int   list_traverse(LIST *list, char *data, int (*func)(char *, char *), int opts);
-void  list_free(LIST *list, void (*dealloc)(char *));
+void  list_free(LIST *list, void (*dealloc)(char *), char *filename, int linenum);
 
 /* Yet more prototypes - previously were possibly macros */
 LIST *list_mvfront(LIST *list);
@@ -85,5 +92,4 @@ char *list_curr(LIST *list);
 char *list_rear(LIST *list);
 int   list_size(LIST *list);
 
-
-
+#endif
diff --git a/fer/common/posix_signal.h b/fer/common/posix_signal.h
deleted file mode 100644
index a480b93..0000000
--- a/fer/common/posix_signal.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Our own header, to be included *after* all standard system headers */
-
-#ifndef	__ourhdr_h
-#define	__ourhdr_h
-
-#include	<sys/types.h>	/* required for some of our prototypes */
-#include	<stdio.h>		/* for convenience */
-#include	<stdlib.h>		/* for convenience */
-#include	<string.h>		/* for convenience */
-#include	<unistd.h>		/* for convenience */
-
-#define	MAXLINE	4096			/* max line length */
-
-#define	FILE_MODE	(S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
-					/* default file access permissions for new files */
-#define	DIR_MODE	(FILE_MODE | S_IXUSR | S_IXGRP | S_IXOTH)
-					/* default permissions for new directories */
-
-typedef	void	Sigfunc(int);	/* for signal handlers */
-
-					/* 4.3BSD Reno <signal.h> doesn't define SIG_ERR */
-#if	defined(SIG_IGN) && !defined(SIG_ERR)
-#define	SIG_ERR	((Sigfunc *)-1)
-#endif
-
-#define	min(a,b)	((a) < (b) ? (a) : (b))
-#define	max(a,b)	((a) > (b) ? (a) : (b))
-
-					/* prototypes for our own functions */
-char	*path_alloc(int *);			/* {Prog pathalloc} */
-int		 open_max(void);			/* {Prog openmax} */
-void	 clr_fl(int, int);			/* {Prog setfl} */
-void	 set_fl(int, int);			/* {Prog setfl} */
-void	 pr_exit(int);				/* {Prog prexit} */
-void	 pr_mask(const char *);		/* {Prog prmask} */
-Sigfunc	*signal_intr(int, Sigfunc *);/* {Prog signal_intr_function} */
-
-int		 tty_cbreak(int);			/* {Prog raw} */
-int		 tty_raw(int);				/* {Prog raw} */
-int		 tty_reset(int);			/* {Prog raw} */
-void	 tty_atexit(void);			/* {Prog raw} */
-#ifdef	ECHO	/* only if <termios.h> has been included */
-struct termios	*tty_termios(void);	/* {Prog raw} */
-#endif
-
-void	 sleep_us(unsigned int);	/* {Ex sleepus} */
-ssize_t	 readn(int, void *, size_t);/* {Prog readn} */
-ssize_t	 writen(int, const void *, size_t);/* {Prog writen} */
-int		 daemon_init(void);			/* {Prog daemoninit} */
-
-int		 s_pipe(int *);				/* {Progs svr4_spipe bsd_spipe} */
-int		 recv_fd(int, ssize_t (*func)(int, const void *, size_t));
-									/* {Progs recvfd_svr4 recvfd_43bsd} */
-int		 send_fd(int, int);			/* {Progs sendfd_svr4 sendfd_43bsd} */
-int		 send_err(int, int, const char *);/* {Prog senderr} */
-int		 serv_listen(const char *);	/* {Progs servlisten_svr4 servlisten_44bsd} */
-int		 serv_accept(int, uid_t *);	/* {Progs servaccept_svr4 servaccept_44bsd} */
-int		 cli_conn(const char *);	/* {Progs cliconn_svr4 cliconn_44bsd} */
-int		 buf_args(char *, int (*func)(int, char **));
-									/* {Prog bufargs} */
-
-int		 ptym_open(char *);			/* {Progs ptyopen_svr4 ptyopen_44bsd} */
-int		 ptys_open(int, char *);	/* {Progs ptyopen_svr4 ptyopen_44bsd} */
-#ifdef	TIOCGWINSZ
-pid_t	 pty_fork(int *, char *, const struct termios *,
-				  const struct winsize *);	/* {Prog ptyfork} */
-#endif
-
-int		lock_reg(int, int, int, off_t, int, off_t);
-									/* {Prog lockreg} */
-#define	read_lock(fd, offset, whence, len) \
-			lock_reg(fd, F_SETLK, F_RDLCK, offset, whence, len)
-#define	readw_lock(fd, offset, whence, len) \
-			lock_reg(fd, F_SETLKW, F_RDLCK, offset, whence, len)
-#define	write_lock(fd, offset, whence, len) \
-			lock_reg(fd, F_SETLK, F_WRLCK, offset, whence, len)
-#define	writew_lock(fd, offset, whence, len) \
-			lock_reg(fd, F_SETLKW, F_WRLCK, offset, whence, len)
-#define	un_lock(fd, offset, whence, len) \
-			lock_reg(fd, F_SETLK, F_UNLCK, offset, whence, len)
-
-pid_t	lock_test(int, int, off_t, int, off_t);
-									/* {Prog locktest} */
-
-#define	is_readlock(fd, offset, whence, len) \
-			lock_test(fd, F_RDLCK, offset, whence, len)
-#define	is_writelock(fd, offset, whence, len) \
-			lock_test(fd, F_WRLCK, offset, whence, len)
-
-void	err_dump(const char *, ...);	/* {App misc_source} */
-void	err_msg(const char *, ...);
-void	err_quit(const char *, ...);
-void	err_ret(const char *, ...);
-void	err_sys(const char *, ...);
-
-void	log_msg(const char *, ...);		/* {App misc_source} */
-void	log_open(const char *, int, int);
-void	log_quit(const char *, ...);
-void	log_ret(const char *, ...);
-void	log_sys(const char *, ...);
-
-void	TELL_WAIT(void);		/* parent/child from {Sec race_conditions} */
-void	TELL_PARENT(pid_t);
-void	TELL_CHILD(pid_t);
-void	WAIT_PARENT(void);
-void	WAIT_CHILD(void);
-
-#endif	/* __ourhdr_h */
diff --git a/fer/common/run_thredds_browser.h b/fer/common/run_thredds_browser.h
new file mode 100644
index 0000000..9951db9
--- /dev/null
+++ b/fer/common/run_thredds_browser.h
@@ -0,0 +1,20 @@
+#ifndef RUNTHREDDSBROWSER_H_
+#define RUNTHREDDSBROWSER_H_
+
+#include <sys/types.h>
+#include <stdio.h>
+#include "ferret.h" /* for FORTRAN */
+
+/* 
+ * Interface to the FORTRAN function:
+ * INTEGER FUNCTION RUN_THREDDS_BROWSER(DATASET_NAME, ERR_WARN_MSG)
+ *         CHARACTER*(*) DATASET_NAME, ERR_WARN_MSG
+ */
+int FORTRAN(run_thredds_browser)(char dataset_name[], char err_warn_msg[], int max_len_data_set, int max_len_err_warn_msg);
+
+/* Standard C functions */
+int   runThreddsBrowser(char datasetName[], char errWarn[]);
+int   getJavaVersion(char javaExeName[], char errMsg[]);
+FILE *executableOutput(char *exeArgv[], pid_t *childPidPtr, char errMsg[]);
+
+#endif /* RUNTHREDDSBROWSER_H_ */
diff --git a/fer/ctx/get_context_grid.F b/fer/ctx/get_context_grid.F
index 43a3ef9..fa411bf 100644
--- a/fer/ctx/get_context_grid.F
+++ b/fer/ctx/get_context_grid.F
@@ -118,7 +118,7 @@
 *		  into implicit grid
 *	 1/96	- idim subscripting bug fixed 1/96 ... how did it escape?
 
-* $Id: get_context_grid.F 21539 2016-03-29 00:35:18Z hankin $ 
+* $Id$ 
 *       - add check on cx_calendar rather than cx_lo/hi_ww to indicate whether time
 *         is date or timesteps
 * V500 *kob* 3/99- up VAR_CODE decl from 8 to 64 chars
diff --git a/fer/dat/xrevision_data.F b/fer/dat/xrevision_data.F
index 37f53fc..55903ca 100644
--- a/fer/dat/xrevision_data.F
+++ b/fer/dat/xrevision_data.F
@@ -144,7 +144,7 @@
 
 	DATA program_name	/ 'FERRET' /
 	DATA len_program_name	/  6       /
-	DATA revision_level	/  7.20   /
+	DATA revision_level	/  7.21   /
 
 ! Note we can put a debug title in the Ferret startup header lines
 ! by putting a title into the Makefile: $(MAKE) "DEBUG_TITLE=beta" update
diff --git a/fer/doo/do_sum_sub.F b/fer/doo/do_sum_sub.F
index 7c07e00..c00f94d 100644
--- a/fer/doo/do_sum_sub.F
+++ b/fer/doo/do_sum_sub.F
@@ -52,6 +52,7 @@
 *                 separately from IS_TRANS
 *                 Counts are saved for the finalization step, to distinguish
 *                 between sum of zero and result that indicates all-missing-data.
+* v7.21 *acm*  9/17 Fix ticket 2560: count is sum of "ok" not "sum" for sum in X
 
         include 'tmap_dims.parm'
 	include	'ferret.parm'
@@ -102,7 +103,7 @@
                  ok = ok + 1.
  100	      CONTINUE
 	      res(pt,j,k,l,m,n) = res(pt,j,k,l,m,n) + sum
-	      counts(pt,j,k,l,m,n) = counts(pt,j,k,l,m,n) + sum
+	      counts(pt,j,k,l,m,n) = counts(pt,j,k,l,m,n) + ok
  110	   CONTINUE
 
 * ALONG Y AXIS
diff --git a/fer/ef_utility/ef_get_arg_type.c b/fer/ef_utility/ef_get_arg_type.c
index 82e5668..75cdc95 100644
--- a/fer/ef_utility/ef_get_arg_type.c
+++ b/fer/ef_utility/ef_get_arg_type.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 /*
diff --git a/fer/ef_utility/ef_get_bad_flags.c b/fer/ef_utility/ef_get_bad_flags.c
index 67d87f7..86423af 100644
--- a/fer/ef_utility/ef_get_bad_flags.c
+++ b/fer/ef_utility/ef_get_bad_flags.c
@@ -1,3 +1,4 @@
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_get_bad_flags)(int *id_ptr, DFTYPE bad_flag[EF_MAX_ARGS], DFTYPE *bad_flag_result)
diff --git a/fer/ef_utility/ef_get_cx_list.c b/fer/ef_utility/ef_get_cx_list.c
index fd8da4b..45d4fad 100644
--- a/fer/ef_utility/ef_get_cx_list.c
+++ b/fer/ef_utility/ef_get_cx_list.c
@@ -1,3 +1,4 @@
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_get_cx_list)(int cx_list[EF_MAX_ARGS])
diff --git a/fer/ef_utility/ef_get_mr_list.c b/fer/ef_utility/ef_get_mr_list.c
index 4c265b1..9b0adf0 100644
--- a/fer/ef_utility/ef_get_mr_list.c
+++ b/fer/ef_utility/ef_get_mr_list.c
@@ -1,4 +1,4 @@
-#include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_get_mr_list)(int mr_list[EF_MAX_ARGS])
diff --git a/fer/ef_utility/ef_get_mres.c b/fer/ef_utility/ef_get_mres.c
index d769636..e50a5de 100644
--- a/fer/ef_utility/ef_get_mres.c
+++ b/fer/ef_utility/ef_get_mres.c
@@ -1,3 +1,4 @@
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_get_mres)(int *mres)
diff --git a/fer/ef_utility/ef_get_one_val.c b/fer/ef_utility/ef_get_one_val.c
index c5f2d5c..d161902 100644
--- a/fer/ef_utility/ef_get_one_val.c
+++ b/fer/ef_utility/ef_get_one_val.c
@@ -1,3 +1,4 @@
+#include "ferret.h"
 #include "EF_Util.h"
 
 /*
diff --git a/fer/ef_utility/ef_get_result_type.c b/fer/ef_utility/ef_get_result_type.c
index e12bb28..0c551a3 100644
--- a/fer/ef_utility/ef_get_result_type.c
+++ b/fer/ef_utility/ef_get_result_type.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_get_result_type)(int *id_ptr, int *type)
diff --git a/fer/ef_utility/ef_put_string.c b/fer/ef_utility/ef_put_string.c
index 7160624..5cb1d91 100644
--- a/fer/ef_utility/ef_put_string.c
+++ b/fer/ef_utility/ef_put_string.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
-#include "EF_Util.h"
+#include "ferret.h"
+#include "FerMem.h"
 
 /* 
  *  Make a copy of a string up to a given length
@@ -10,9 +11,9 @@ void FORTRAN(ef_put_string)(char* text, int* inlen, char** out_ptr)
    int i;
 
    if ( *out_ptr != NULL )
-      free(*out_ptr);
+      FerMem_Free(*out_ptr, __FILE__, __LINE__);
 
-   *out_ptr = (char *) malloc(sizeof(char) * (*inlen+1));
+   *out_ptr = (char *) FerMem_Malloc(sizeof(char) * (*inlen+1), __FILE__, __LINE__);
    if ( *out_ptr == NULL ) {
       abort();
    }
diff --git a/fer/ef_utility/ef_put_string_ptr.c b/fer/ef_utility/ef_put_string_ptr.c
index bfc3647..43792b2 100644
--- a/fer/ef_utility/ef_put_string_ptr.c
+++ b/fer/ef_utility/ef_put_string_ptr.c
@@ -1,6 +1,8 @@
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
 #include "EF_Util.h"
+#include "FerMem.h"
 
 /* 
  *  Make a copy of a null-terminated string
@@ -9,9 +11,9 @@
 void FORTRAN(ef_put_string_ptr)(char **in_ptr, char **out_ptr)
 {
   if ( *out_ptr != NULL )
-     free(*out_ptr);
+     FerMem_Free(*out_ptr, __FILE__, __LINE__);
 
-  *out_ptr = (char *) malloc(sizeof(char) * (strlen(*in_ptr)+1));
+  *out_ptr = (char *) FerMem_Malloc(sizeof(char) * (strlen(*in_ptr)+1), __FILE__, __LINE__);
   if ( *out_ptr == NULL ) {
      abort();
   }
diff --git a/fer/ef_utility/ef_set_alt_fcn_name_sub.c b/fer/ef_utility/ef_set_alt_fcn_name_sub.c
index 68a5bc2..010e7bb 100644
--- a/fer/ef_utility/ef_set_alt_fcn_name_sub.c
+++ b/fer/ef_utility/ef_set_alt_fcn_name_sub.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_alt_fcn_name_sub)(int *id_ptr, char *text)
diff --git a/fer/ef_utility/ef_set_arg_desc_sub.c b/fer/ef_utility/ef_set_arg_desc_sub.c
index 42a9f7c..3d9500d 100644
--- a/fer/ef_utility/ef_set_arg_desc_sub.c
+++ b/fer/ef_utility/ef_set_arg_desc_sub.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_arg_desc_sub)(int *id_ptr, int *arg_ptr, char *text)
diff --git a/fer/ef_utility/ef_set_arg_name_sub.c b/fer/ef_utility/ef_set_arg_name_sub.c
index d431695..f46d69a 100644
--- a/fer/ef_utility/ef_set_arg_name_sub.c
+++ b/fer/ef_utility/ef_set_arg_name_sub.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_arg_name_sub)(int *id_ptr, int *arg_ptr, char *text)
diff --git a/fer/ef_utility/ef_set_arg_type.c b/fer/ef_utility/ef_set_arg_type.c
index bf4956d..b23a558 100644
--- a/fer/ef_utility/ef_set_arg_type.c
+++ b/fer/ef_utility/ef_set_arg_type.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_arg_type)(int *id_ptr, int *arg, int *arg_type)
diff --git a/fer/ef_utility/ef_set_arg_unit_sub.c b/fer/ef_utility/ef_set_arg_unit_sub.c
index dd928e1..d5eac4d 100644
--- a/fer/ef_utility/ef_set_arg_unit_sub.c
+++ b/fer/ef_utility/ef_set_arg_unit_sub.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_arg_unit_sub)(int *id_ptr, int *arg_ptr, char *text)
diff --git a/fer/ef_utility/ef_set_axis_extend.c b/fer/ef_utility/ef_set_axis_extend.c
index 7262f65..63807ca 100644
--- a/fer/ef_utility/ef_set_axis_extend.c
+++ b/fer/ef_utility/ef_set_axis_extend.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_axis_extend)(int *id_ptr, int *arg, int *axis, int *lo, int *hi)
diff --git a/fer/ef_utility/ef_set_axis_influence.c b/fer/ef_utility/ef_set_axis_influence.c
index 0b50dbd..1b26fc6 100644
--- a/fer/ef_utility/ef_set_axis_influence.c
+++ b/fer/ef_utility/ef_set_axis_influence.c
@@ -1,3 +1,4 @@
+#include "ferret.h"
 #include "EF_Util.h"
 
 /* calls the 6D function with NO for the E and F axes */
diff --git a/fer/ef_utility/ef_set_axis_influence_6d.c b/fer/ef_utility/ef_set_axis_influence_6d.c
index 0b42fe5..9516819 100644
--- a/fer/ef_utility/ef_set_axis_influence_6d.c
+++ b/fer/ef_utility/ef_set_axis_influence_6d.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_axis_influence_6d)(int *id_ptr, int *arg,
diff --git a/fer/ef_utility/ef_set_axis_inheritance.c b/fer/ef_utility/ef_set_axis_inheritance.c
index 47c481f..b2e765c 100644
--- a/fer/ef_utility/ef_set_axis_inheritance.c
+++ b/fer/ef_utility/ef_set_axis_inheritance.c
@@ -1,3 +1,4 @@
+#include "ferret.h"
 #include "EF_Util.h"
 
 /* Calls the 6D version with NORMAL for the E and F axis */
diff --git a/fer/ef_utility/ef_set_axis_inheritance_6d.c b/fer/ef_utility/ef_set_axis_inheritance_6d.c
index 7907fe1..3ec49af 100644
--- a/fer/ef_utility/ef_set_axis_inheritance_6d.c
+++ b/fer/ef_utility/ef_set_axis_inheritance_6d.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_axis_inheritance_6d)(int *id_ptr,
diff --git a/fer/ef_utility/ef_set_axis_limits.c b/fer/ef_utility/ef_set_axis_limits.c
index f9b8d27..e31bfba 100644
--- a/fer/ef_utility/ef_set_axis_limits.c
+++ b/fer/ef_utility/ef_set_axis_limits.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_axis_limits)(int *id_ptr, int *axis, int *lo, int *hi)
diff --git a/fer/ef_utility/ef_set_axis_reduction.c b/fer/ef_utility/ef_set_axis_reduction.c
index f1a445e..e8b45fe 100644
--- a/fer/ef_utility/ef_set_axis_reduction.c
+++ b/fer/ef_utility/ef_set_axis_reduction.c
@@ -1,3 +1,4 @@
+#include "ferret.h"
 #include "EF_Util.h"
 
 /* Calls the 6D version with RETAINED for the E and F axes */
diff --git a/fer/ef_utility/ef_set_axis_reduction_6d.c b/fer/ef_utility/ef_set_axis_reduction_6d.c
index 83cff1a..c85af44 100644
--- a/fer/ef_utility/ef_set_axis_reduction_6d.c
+++ b/fer/ef_utility/ef_set_axis_reduction_6d.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_axis_reduction_6d)(int *id_ptr, int *xax, int *yax, int *zax,
diff --git a/fer/ef_utility/ef_set_custom_axis_sub.c b/fer/ef_utility/ef_set_custom_axis_sub.c
index 19ac412..d7d83d9 100644
--- a/fer/ef_utility/ef_set_custom_axis_sub.c
+++ b/fer/ef_utility/ef_set_custom_axis_sub.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_custom_axis_sub)(int *id_ptr, int *axis_ptr, DFTYPE *lo_ptr,
diff --git a/fer/ef_utility/ef_set_desc_sub.c b/fer/ef_utility/ef_set_desc_sub.c
index 0cb1c04..5a7c27d 100644
--- a/fer/ef_utility/ef_set_desc_sub.c
+++ b/fer/ef_utility/ef_set_desc_sub.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_desc_sub)(int *id_ptr, char *text)
diff --git a/fer/ef_utility/ef_set_freq_axis_sub.c b/fer/ef_utility/ef_set_freq_axis_sub.c
index aadbe9e..11da9f5 100644
--- a/fer/ef_utility/ef_set_freq_axis_sub.c
+++ b/fer/ef_utility/ef_set_freq_axis_sub.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_freq_axis_sub)(int *id_ptr, int *axis_ptr, int *npts,
diff --git a/fer/ef_utility/ef_set_has_vari_args.c b/fer/ef_utility/ef_set_has_vari_args.c
index 8cf71cb..31b2783 100644
--- a/fer/ef_utility/ef_set_has_vari_args.c
+++ b/fer/ef_utility/ef_set_has_vari_args.c
@@ -1,10 +1,11 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 /*
  * Set the "variable arguments" flag for a function.
  */
-void ef_set_has_vari_args_(int *id_ptr, int *has_vari_args)
+void FORTRAN(ef_set_has_vari_args)(int *id_ptr, int *has_vari_args)
 {
   ExternalFunction *ef_ptr;
 
diff --git a/fer/ef_utility/ef_set_num_args.c b/fer/ef_utility/ef_set_num_args.c
index eb28775..dadbc7a 100644
--- a/fer/ef_utility/ef_set_num_args.c
+++ b/fer/ef_utility/ef_set_num_args.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <stdio.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 /*
diff --git a/fer/ef_utility/ef_set_num_work_arrays.c b/fer/ef_utility/ef_set_num_work_arrays.c
index 0a7df69..c9c122e 100644
--- a/fer/ef_utility/ef_set_num_work_arrays.c
+++ b/fer/ef_utility/ef_set_num_work_arrays.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 /*
diff --git a/fer/ef_utility/ef_set_piecemeal_ok.c b/fer/ef_utility/ef_set_piecemeal_ok.c
index c0635e7..5bed8ba 100644
--- a/fer/ef_utility/ef_set_piecemeal_ok.c
+++ b/fer/ef_utility/ef_set_piecemeal_ok.c
@@ -1,3 +1,4 @@
+#include "ferret.h"
 #include "EF_Util.h"
 
 /* Calls the 6D function with YES for the E and F axes */
diff --git a/fer/ef_utility/ef_set_piecemeal_ok_6d.c b/fer/ef_utility/ef_set_piecemeal_ok_6d.c
index 27fb42a..87d2865 100644
--- a/fer/ef_utility/ef_set_piecemeal_ok_6d.c
+++ b/fer/ef_utility/ef_set_piecemeal_ok_6d.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_piecemeal_ok_6d)(int *id_ptr, int *xax, int *yax, int *zax,
diff --git a/fer/ef_utility/ef_set_result_type.c b/fer/ef_utility/ef_set_result_type.c
index 2d64ed3..8561735 100644
--- a/fer/ef_utility/ef_set_result_type.c
+++ b/fer/ef_utility/ef_set_result_type.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 void FORTRAN(ef_set_result_type)(int *id_ptr, int *type)
diff --git a/fer/ef_utility/ef_set_work_array_dims.c b/fer/ef_utility/ef_set_work_array_dims.c
index 8ec62ad..b564662 100644
--- a/fer/ef_utility/ef_set_work_array_dims.c
+++ b/fer/ef_utility/ef_set_work_array_dims.c
@@ -1,3 +1,4 @@
+#include "ferret.h"
 #include "EF_Util.h"
 
 /* Calls the 6D function with 1 for the low and high dimensions of the E and F axes */
diff --git a/fer/ef_utility/ef_set_work_array_dims_6d.c b/fer/ef_utility/ef_set_work_array_dims_6d.c
index d0ce292..b324c38 100644
--- a/fer/ef_utility/ef_set_work_array_dims_6d.c
+++ b/fer/ef_utility/ef_set_work_array_dims_6d.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 /*
diff --git a/fer/ef_utility/ef_set_work_array_lens.c b/fer/ef_utility/ef_set_work_array_lens.c
index 749194f..0a567bf 100644
--- a/fer/ef_utility/ef_set_work_array_lens.c
+++ b/fer/ef_utility/ef_set_work_array_lens.c
@@ -1,3 +1,4 @@
+#include "ferret.h"
 #include "EF_Util.h"
 
 /*
diff --git a/fer/ef_utility/ef_set_work_array_lens_6d.c b/fer/ef_utility/ef_set_work_array_lens_6d.c
index aadc89f..b05bc17 100644
--- a/fer/ef_utility/ef_set_work_array_lens_6d.c
+++ b/fer/ef_utility/ef_set_work_array_lens_6d.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 /*
diff --git a/fer/ef_utility/ef_version_test.c b/fer/ef_utility/ef_version_test.c
index d41bbb2..887eb22 100644
--- a/fer/ef_utility/ef_version_test.c
+++ b/fer/ef_utility/ef_version_test.c
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <stdio.h>
+#include "ferret.h"
 #include "EF_Util.h"
 
 /*
diff --git a/fer/efi/date_decode.c b/fer/efi/date_decode.c
index 7078ef1..a9db854 100644
--- a/fer/efi/date_decode.c
+++ b/fer/efi/date_decode.c
@@ -44,29 +44,22 @@
   5/2007 *acm* Fixing bug 1510.  Return the result as an argument rather
                than a return from function; under 64-bit the return
 			   always yielded 0.
-/* *acm*  1/12      - Ferret 6.8 ifdef double_p for double-precision ferret, see the
+* *acm*  1/12      - Ferret 6.8 ifdef double_p for double-precision ferret, see the
 *					 definition of macro DFTYPE in ferret.h.
 */
 
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include "fmtprotos.h"
 #include "ferret.h"
 
-
-DFTYPE FORTRAN(days_from_day0) (double* days_1900, int* iyr, int* imon,
-                               int* iday, DFTYPE* rdum);
-void FORTRAN(date_decode) (char *strdate, DFTYPE *rdum);
-
-
-
-void FORTRAN(date_decode) (char *strdate, DFTYPE *res)
+void FORTRAN(date_decode)(char *strdate, DFTYPE *res)
 {
-
-  int id,im,iy, ok;
+  int id,im,iy, ok, status;
   char str3[4],str1[2];
   char months[13][4] = {"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"};
-  DFTYPE rdum, adate;
+  DFTYPE rdum;
   double days_1900 = 59958230400.0 / (60.*60.*24.);
 
   if (sscanf(strdate,"%d/%d/%d%1s",&im,&id,&iy,str1) == 3)
@@ -106,7 +99,7 @@ void FORTRAN(date_decode) (char *strdate, DFTYPE *res)
     }    
 
   if (ok) {
-    adate = days_from_day0_(&days_1900,&iy,&im,&id,&rdum); 
+    FORTRAN(days_from_day0)(&days_1900,&iy,&im,&id,&rdum,&status); 
     *res = rdum;
   }
   else
diff --git a/fer/efi/maxminmax.F b/fer/efi/maxminmax.F
index e09cd25..f8fcb1d 100644
--- a/fer/efi/maxminmax.F
+++ b/fer/efi/maxminmax.F
@@ -7,7 +7,7 @@ C  From the NCAR graphics library at http://ngwww.ucar.edu version 4.2
 C  Modified by Ansley Manke to regurn only the maxima for subroutine findhi.F
 C
 C-------------------------------------------------------------
-C	$Id: maxminmax.F 9377 2006-04-05 16:34:02Z ansley $
+C	$Id$
 C                                                                      
 C                Copyright (C)  2000
 C        University Corporation for Atmospheric Research
diff --git a/fer/efi/minminmax.F b/fer/efi/minminmax.F
index 4b4ed76..bc25f7c 100644
--- a/fer/efi/minminmax.F
+++ b/fer/efi/minminmax.F
@@ -5,7 +5,7 @@ C  based on NCAR routine MINMAX, return minima
 C  From the NCAR graphics library at http://ngwww.ucar.edu version 4.2
 C  Modified by Ansley Manke to regurn only the minima for subroutine findlo.F
 C-------------------------------------------------------------
-C	$Id: minminmax.F 12378 2011-06-28 20:07:59Z ksmith $
+C	$Id$
 C                                                                      
 C                Copyright (C)  2000
 C        University Corporation for Atmospheric Research
diff --git a/fer/efi/svdeof-4.F b/fer/efi/svdeof-4.F
index d75992b..42c4286 100644
--- a/fer/efi/svdeof-4.F
+++ b/fer/efi/svdeof-4.F
@@ -100,7 +100,8 @@ c........IF-block to work with either usual or reversed EOFs
 c........find out whether NX or NT is smaller
 	if (nt.ge.nx) then		! more times than locations = usual EOFs
 
-		call svdeof(a, nt, nx, w, v, pct, work2, work3, ier)		! do the work
+C...............do the work
+		CALL SVDEOF(a, nt, nx, w, v, pct, work2, work3, ier)	! Yes, work3 is array of REAL used in the subroutine as an array of INTEGER
 		IF (ier .NE. 0) RETURN
 
 c...........NEOF=NX nonzero EOFs 
@@ -117,8 +118,8 @@ c..........after transpose, A is used as A(NT,NX)=(time,space)
 c..........(but this can only be done in a sub call where A is just an address)
 		call MATRIXTRANS(a,nx,nt,nt*nx,move,iwrk,iok)	
 
-c............now call the SVD calculation with transposed data array A
-		call svdeof(a, nx, nt, w, v, pct, work2, work3, ier)
+c...............now call the SVD calculation with transposed data array A
+		CALL SVDEOF(a, nx, nt, w, v, pct, work2, work3, ier)	! Yes, work3 is an array of REAL used in the subroutine as an array of INTEGER
 		IF (ier .NE. 0) RETURN
 		
 c......There are NEOF=NT nonzero EOFs (note NT < NX). 
diff --git a/fer/efi/time_decode.c b/fer/efi/time_decode.c
index 466047f..f28b3bc 100644
--- a/fer/efi/time_decode.c
+++ b/fer/efi/time_decode.c
@@ -48,9 +48,8 @@
 #include <stdio.h>
 #include "ferret.h"
 
-DFTYPE FORTRAN(time_decode) (char *strtime)
+DFTYPE FORTRAN(time_decode)(char *strtime)
 {
-
   int ih,im, ok;
   double ss;  /* pointer to double expected by %lf in sscanf */
   char str1[2];
@@ -75,6 +74,5 @@ DFTYPE FORTRAN(time_decode) (char *strtime)
     return  im + 60.*ih + ss/60.;
   else
     return -1.e34;
-
 }
 
diff --git a/fer/efi/us2i_compare_string_list.c b/fer/efi/us2i_compare_string_list.c
index 652fd21..3a8d626 100644
--- a/fer/efi/us2i_compare_string_list.c
+++ b/fer/efi/us2i_compare_string_list.c
@@ -44,7 +44,8 @@
 
 #include <stdio.h>
 #include <string.h>
-#include "list.h"  /* locally added list library */
+#include "ferret.h"
+#include "list.h"
 
 /* max length of a path */
 #define MAX_NAME 512
@@ -55,19 +56,8 @@ typedef struct  {
     int seq;
 } strngs;
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-
-/* .... Functions called by Fortran .... */
-void FORTRAN(us2i_compare_string_list)(char *, int *);
-void FORTRAN(us2i_str_cmp)(char *, char *, int *);
-
 /* .... Static Variables ............... */
-static LIST *GLOBAL_unique_us2i_List;
-static int us2i_list_initialized = 0;
+static LIST *GLOBAL_unique_us2i_List = NULL;
 
 /* .... Functions called internally .... */
 static int add_us2i_string(char *);
@@ -75,18 +65,6 @@ static int ListTraverse_FoundString( char *, char * );
 
 
 /* ----
- * Deallocate GLOBAL_unique_us2i_List
- *
- *
- * int FORTRAN(end_us2i_list)
- * {
- *    list_free(GLOBAL_unique_us2i_List, LIST_DEALLOC);
- *    us2i_list_initialized = 0;
- * }
- */
-
-
-/* ----
  * Call C strcmp function.
  */
 void FORTRAN(us2i_str_cmp)(char *str1, char *str2, int *ival)
@@ -106,7 +84,9 @@ void FORTRAN(us2i_compare_string_list)(char* compare_string, int *str_seq)
    strngs *str_ptr;
    int status;
 
-   if ( ! us2i_list_initialized ) {
+
+
+   if ( GLOBAL_unique_us2i_List == NULL ) {
       /*
        * no list yet; initialize the list and add the string to it;
        * send back the new sequence number of this string
@@ -130,6 +110,18 @@ void FORTRAN(us2i_compare_string_list)(char* compare_string, int *str_seq)
 }
 
 
+/*
+ * Free any memory associated with GLOBAL_unique_us2i_List
+ */
+void FORTRAN(us2i_string_list_free)(void)
+{
+   if ( GLOBAL_unique_us2i_List != NULL ) {
+      list_free(GLOBAL_unique_us2i_List, LIST_DEALLOC, __FILE__, __LINE__);
+      GLOBAL_unique_us2i_List = NULL;
+   }
+}
+
+
 /* ----
  * Add a string to GLOBAL_unique_us2i_List, initializing the list if necessary.
  * Returns the sequence number of this new string, or 0 if an error occurs.
@@ -141,13 +133,12 @@ static int add_us2i_string(char addstring[])
    int iseq;
 
    /* Create the list if required */
-   if ( ! us2i_list_initialized ) {
-      GLOBAL_unique_us2i_List = list_init();
+   if ( GLOBAL_unique_us2i_List == NULL ) {
+      GLOBAL_unique_us2i_List = list_init(__FILE__, __LINE__);
       if ( GLOBAL_unique_us2i_List == NULL ) {
          fprintf(stderr, "ERROR: unique_str2int: Unable to initialize GLOBAL_unique_us2i_List.\n");
          return 0;
       }
-      us2i_list_initialized = 1;
    }
 
    /* Add to global linked list*/ 
@@ -157,7 +148,7 @@ static int add_us2i_string(char addstring[])
    this_string.seq = iseq;
    strcpy(this_string.astring, addstring);
 
-   list_insert_after(GLOBAL_unique_us2i_List, (char *) &this_string, sizeof(this_string));
+   list_insert_after(GLOBAL_unique_us2i_List, (char *) &this_string, sizeof(this_string), __FILE__, __LINE__);
 
    return iseq;
 }
diff --git a/fer/gnl/SOURCE_FILES b/fer/gnl/SOURCE_FILES
index 38876e3..824b8e1 100644
--- a/fer/gnl/SOURCE_FILES
+++ b/fer/gnl/SOURCE_FILES
@@ -40,7 +40,7 @@ equal_val_int.F\
 errmsg.F\
 escape_for_xml.F\
 fill_fmrc_time_gaps.F\
-finalize.F\
+finalize_ferret.F\
 float2string_for_xml.F\
 get_dataset_name.F\
 get_fer_command.F\
@@ -58,7 +58,7 @@ init_memory.F\
 init_t_aggregate_dset.F\
 init_t_agg_mc_dset.F\
 init_u_aggregate_dset.F\
-initialize.F\
+initialize_ferret.F\
 is_agg_member.F\
 isit_const_arr_var.F\
 isit_coord_var.F\
diff --git a/fer/gnl/cancel_data_set.F b/fer/gnl/cancel_data_set.F
index a51d4c8..b092b6e 100644
--- a/fer/gnl/cancel_data_set.F
+++ b/fer/gnl/cancel_data_set.F
@@ -71,7 +71,7 @@
  
 * initialize
 	status = ferr_ok
-	IF (ds_name(dset) .EQ. char_init1024) RETURN  ! already deleted
+	IF (ds_name(dset) .EQ. char_init2048) RETURN  ! already deleted
 	more = .TRUE.
 
 * is the requested dataset part of an aggregation?
@@ -101,7 +101,7 @@
 	   DO imemb = 1, nmemb
 	      CALL CD_GET_AGG_DSET_MEMBER (dset, imemb, membset, status)
 	      IF (status .NE. ferr_ok)  CALL WARN('crptn: cancel_data_set')
-	      IF (ds_name(membset) .EQ. char_init1024) CYCLE ! already deleted?
+	      IF (ds_name(membset) .EQ. char_init2048) CYCLE ! already deleted?
 
 * ... if not a member of some other aggregation: cancel the hidden member
 	      is_member = IS_AGG_MEMBER(membset, 1, parent, more)
diff --git a/fer/gnl/check_member_sets.F b/fer/gnl/check_member_sets.F
index 8b43874..fbd7695 100644
--- a/fer/gnl/check_member_sets.F
+++ b/fer/gnl/check_member_sets.F
@@ -136,7 +136,7 @@
 * ... check for valid number given
 	      IF   ( dset .LT. 1
      .	      .OR.   dset .GT. maxdsets )	  GOTO 5200
-	      IF (ds_name(dset).EQ.char_init1024) GOTO 5200
+	      IF (ds_name(dset).EQ.char_init2048) GOTO 5200
 	      GOTO 750
 	   ENDIF
 
diff --git a/fer/gnl/do_query.F b/fer/gnl/do_query.F
index e793085..d2ad7ce 100644
--- a/fer/gnl/do_query.F
+++ b/fer/gnl/do_query.F
@@ -141,12 +141,12 @@
 *   ... count data sets
  	   n = 0
 	   DO 310 i = 1,  maxdsets
- 310	   IF ( ds_name(i) .NE. char_init1024) n = n + 1
+ 310	   IF ( ds_name(i) .NE. char_init2048) n = n + 1
 *   ... list 'em
 	   WRITE (risc_buff, fmt ) n, queries(query), tag
 	   CALL SPLIT_LIST(pttmode_explct, chout, risc_buff, 0)
 	   DO 320 i = 1,  maxdsets
-	      IF (ds_name(i).NE.char_init1024) THEN
+	      IF (ds_name(i).NE.char_init2048) THEN
 	         WRITE (risc_buff,'(A)')
      .			ds_name(i)(1:TM_LENSTR1(ds_name(i)))
 	         CALL SPLIT_LIST(pttmode_explct, chout, risc_buff, 0)
@@ -318,7 +318,7 @@
  1900	CONTINUE
 	done = .FALSE.
 	DO 1910 dset = 1, maxdsets
-           IF ( ds_name(dset) .EQ. char_init1024) GOTO 1910
+           IF ( ds_name(dset) .EQ. char_init2048) GOTO 1910
 	   IF ( dset .EQ. cx_data_set(cx_last) ) THEN
 	      WRITE (risc_buff, fmt ) 1, queries(query), tag
 	      CALL SPLIT_LIST(pttmode_explct, chout, risc_buff, 0)
diff --git a/fer/gnl/finalize.F b/fer/gnl/finalize.F
deleted file mode 100644
index e4bff80..0000000
--- a/fer/gnl/finalize.F
+++ /dev/null
@@ -1,73 +0,0 @@
-	SUBROUTINE FINALIZE
-
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-*  free allocated memory held in global variables/lists
-*       *acm* 3/12 cleanup ifdefs and unnecessary include files
-
-        include 'tmap_errors.parm'  ! error codes
-	include 'tmap_dims.parm'
-	include 'xio.cmn_text'
-        include 'xdset_info.cmn_text'
-	external xio_data
-	include 'xtm_grid.cmn_text'
-	external xgt_grid_data
-	include	'ferret.parm'
-	include	'gfdl_vms.parm'
-	include	'errmsg.parm'
-	include	'gfdl.parm'			! from phil/sieg
-	include	'xonedim.cmn'		! from phil.sieg
-	include 'xprog_state.cmn'
-        include 'xalgebra.cmn'
-	include 'xvariables.cmn'
-	include 'xtoday.cmn'
-
-        CALL string_array_clear(alg_pvar_head)
-
-        CALL string_array_clear(countervar_name_head)
-
-        CALL string_array_clear(uvar_name_code_head)
- 
-        CALL string_array_clear(ds_var_code_head)
-
-        CALL deleted_list_clear(uvar_num_items_head)
-
-        CALL ncf_datasets_list_clear()
-
-	RETURN
-
-	END
-
diff --git a/fer/gnl/finalize_ferret.F b/fer/gnl/finalize_ferret.F
new file mode 100644
index 0000000..393dd9f
--- /dev/null
+++ b/fer/gnl/finalize_ferret.F
@@ -0,0 +1,199 @@
+        SUBROUTINE FINALIZE_FERRET
+
+*
+*
+*  This software was developed by the Thermal Modeling and Analysis
+*  Project(TMAP) of the National Oceanographic and Atmospheric
+*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
+*  hereafter referred to as NOAA/PMEL/TMAP.
+*
+*  Access and use of this software shall impose the following
+*  obligations and understandings on the user. The user is granted the
+*  right, without any fee or cost, to use, copy, modify, alter, enhance
+*  and distribute this software, and any derivative works thereof, and
+*  its supporting documentation for any purpose whatsoever, provided
+*  that this entire notice appears in all copies of the software,
+*  derivative works and supporting documentation.  Further, the user
+*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
+*  the use of this software or in any product that includes this
+*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
+*  in any advertising or publicity to endorse or promote any products
+*  or commercial entity unless specific written permission is obtained
+*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
+*  is not obligated to provide the user with any support, consulting,
+*  training or assistance of any kind with regard to the use, operation
+*  and performance of this software nor to provide the user with any
+*  updates, revisions, new versions or "bug fixes".
+*
+*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
+*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
+*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
+*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
+*
+*
+*  free allocated memory held in global variables/lists
+*       *acm* 3/12 cleanup ifdefs and unnecessary include files
+
+        include 'tmap_errors.parm'  ! error codes
+        include 'tmap_dims.parm'
+#include "tmap_dset.parm"
+        include 'xio.cmn_text'
+        include 'xdset_info.cmn_text'
+        external xio_data
+        include 'xtm_grid.cmn_text'
+        external xgt_grid_data
+        include 'ferret.parm'
+        include 'gfdl_vms.parm'
+        include 'errmsg.parm'
+        include 'gfdl.parm'   ! from phil/sieg
+        include 'xonedim.cmn'  ! from phil.sieg
+        include 'xfr_grid.cmn'
+        include 'xprog_state.cmn'
+        include 'xplot_state.cmn'
+        include 'xalgebra.cmn'
+        include 'xvariables.cmn'
+        include 'xtoday.cmn'
+
+        INTEGER ITS_BATCH_GRAPHICS
+
+C       Local variables
+        INTEGER j, k, istatus, cmnd_stack_level
+
+C       Silently process commands to clean everything up 
+C       (primarily for PyFerret, but also memory leak detection)
+
+C       Close some files that could still be open
+        IF ( jrnl_lun .NE. unspecified_int4 ) THEN
+            CLOSE(UNIT=jrnl_lun)
+            jrnl_lun = unspecified_int4
+        ENDIF
+
+C       Reset some MODE values throughout the stack.  These actually 
+C       should all be reinitialized at the end of this routine to the 
+C       values in xprog_state_data.F 
+        DO k = 1, mode_stack_size
+            mode_state(pmode_diagnostic,k) = .FALSE.
+            mode_state(pmode_verify,k) = .FALSE.
+            mode_state(pmode_journal,k) = .FALSE.
+        ENDDO
+
+        cmnd_buff = 'CANCEL REDIRECT'
+        CALL GET_FER_COMMAND(cmnd_buff, istatus, *100)
+        CALL XEQ_CANCEL
+  100   CALL CLEANUP_LAST_CMND(cmnd_stack_level)
+
+        cmnd_buff = 'SET GRID ABSTRACT'
+        CALL GET_FER_COMMAND(cmnd_buff, istatus, *200)
+        CALL XEQ_SET
+  200   CALL CLEANUP_LAST_CMND(cmnd_stack_level)
+
+        IF ( pplus_started ) THEN
+            IF ( mode_gks .AND. (ITS_BATCH_GRAPHICS() .EQ. 0) ) THEN
+                cmnd_buff = 'CANCEL WINDOW /ALL'
+                CALL GET_FER_COMMAND(cmnd_buff, istatus, *300)
+                CALL XEQ_CANCEL
+  300           CALL CLEANUP_LAST_CMND(cmnd_stack_level)
+            ENDIF
+            CALL CLSPPL
+            pplus_started = .FALSE. 
+        ENDIF
+
+        cmnd_buff = 'CANCEL VARIABLE /ALL'
+        CALL GET_FER_COMMAND(cmnd_buff, istatus, *400)
+        CALL XEQ_CANCEL
+  400   CALL CLEANUP_LAST_CMND(cmnd_stack_level)
+
+        cmnd_buff = 'CANCEL ALIAS /ALL'
+        CALL GET_FER_COMMAND(cmnd_buff, istatus, *500)
+        CALL XEQ_CANCEL
+  500   CALL CLEANUP_LAST_CMND(cmnd_stack_level)
+
+        cmnd_buff = 'CANCEL LIST /ALL'
+        CALL GET_FER_COMMAND(cmnd_buff, istatus, *600)
+        CALL XEQ_CANCEL
+  600   CALL CLEANUP_LAST_CMND(cmnd_stack_level)
+
+        cmnd_buff = 'CANCEL REGION /ALL'
+        CALL GET_FER_COMMAND(cmnd_buff, istatus, *700)
+        CALL XEQ_CANCEL
+  700   CALL CLEANUP_LAST_CMND(cmnd_stack_level)
+
+        cmnd_buff = 'CANCEL SYMBOL /ALL'
+        CALL GET_FER_COMMAND(cmnd_buff, istatus, *800)
+        CALL XEQ_CANCEL
+  800   CALL CLEANUP_LAST_CMND(cmnd_stack_level)
+
+C       "CANCEL DATA /ALL"
+C       Code pulled from xeq_cancel
+        DO k = 1, maxdsets
+           IF ( ds_name(k) .NE. char_init2048 ) THEN
+              CALL CANCEL_ONE_DATA_SET(k, istatus)
+           ENDIF
+        ENDDO
+
+C       "CANCEL GRID /ALL"
+C       Code pulled from xeq_cancel in order to do complete clean up silently
+        DO k = 1, grid_ceiling
+           IF (grid_name(k) .NE. char_init16) THEN
+              grid_use_cnt(k) = 0
+              IF ( k .LE. max_grids ) THEN
+                 grid_name(k) = char_init16
+              ELSE
+                 CALL TM_DEALLO_DYN_GRID(k)
+              ENDIF
+           ENDIF
+        ENDDO
+
+C       "CANCEL AXIS /ALL"
+C       Code pulled from DEALLO_ALL_AXES in order to do complete clean up silently
+        DO k = 1, line_ceiling
+           IF (line_name(k) .NE. char_init16) THEN
+              line_use_cnt(k) = 0
+              line_keep_flag(k) = .FALSE.
+              IF ( k .LE. max_lines ) THEN
+                 IF ( .NOT. line_regular(k) ) 
+     .              CALL PACK_LINE_STORAGE(k)
+                 line_name(k) = char_init16
+              ELSE
+                 CALL TM_DEALLO_DYN_LINE(k)
+              ENDIF
+           ENDIF
+        ENDDO
+
+C       "CANCEL MEMORY /ALL"
+C       pulled from xeq_cancel in order to do complete clean up silently
+        DO k = 1, max_mr_avail
+            IF ( mr_protected(k) .NE. mr_deleted ) THEN
+                IF ( mr_protected(k) .EQ. mr_perm_protected ) THEN
+                    permanent_mem = permanent_mem - mr_size(k)
+                ENDIF
+                CALL DELETE_VARIABLE(k)
+            ENDIF
+        ENDDO
+        peak_mem = 0
+        peak_essential_mem = 0
+
+        CALL us2i_string_list_free()
+
+        CALL efcn_list_clear()
+
+        CALL string_array_clear(alg_pvar_head)
+
+        CALL string_array_clear(countervar_name_head)
+
+        CALL string_array_clear(uvar_name_code_head)
+ 
+        CALL string_array_clear(ds_var_code_head)
+
+        CALL deleted_list_clear(uvar_num_items_head)
+
+        CALL ncf_datasets_list_clear()
+
+        RETURN
+
+        END
+
diff --git a/fer/gnl/get_fer_command.F b/fer/gnl/get_fer_command.F
index 47e22ea..a182c24 100644
--- a/fer/gnl/get_fer_command.F
+++ b/fer/gnl/get_fer_command.F
@@ -156,6 +156,7 @@
 	max_context = max_noframe_context  ! 2/2014
 	len_cmnd_copy = 0
 	appending_cmnd = .FALSE.
+        do_verify = .FALSE.
 
 * if a command was given then execute it immediately
 	IF ( called_string .NE. ' ' ) THEN
@@ -234,8 +235,6 @@
 *************** COMMAND FILE AS SOURCE OF COMMAND LINE ***********************
 
  200	READ  (cmnd_lun, '(A)', END=210) cmnd_buff
-c 200	CALL my_readline(cmnd_lun,cmnd_buff,LEN(cmnd_buff),has_more)
-c        IF(has_more.NE.1) goto 210
 
 	cmnd_len_w_cmnt = TM_LENSTR1( cmnd_buff )
 	IF (cmnd_buff(cmnd_len_w_cmnt:cmnd_len_w_cmnt) .EQ. pCR ) THEN
diff --git a/fer/gnl/init_ef_aggregate_dset.F b/fer/gnl/init_ef_aggregate_dset.F
index f8bf618..41a1e5e 100644
--- a/fer/gnl/init_ef_aggregate_dset.F
+++ b/fer/gnl/init_ef_aggregate_dset.F
@@ -185,7 +185,7 @@
 * Assign aggregate data set number, exiting if maximum number 
 * of data sets are open
 	DO iset = 1,maxdsets
-	  IF (ds_name(iset) .EQ. char_init1024) THEN
+	  IF (ds_name(iset) .EQ. char_init2048) THEN
 	    agg_dset = iset
 	    GOTO 220
 	  ENDIF
@@ -358,7 +358,7 @@
 	   iset = member_sets(ii)
 	   IF (iset .EQ. pdset_dummy
      .    .OR. iset .EQ. unspecified_int4) CYCLE
-	   IF (ds_name(iset) .EQ. char_init1024) CYCLE ! already deleted
+	   IF (ds_name(iset) .EQ. char_init2048) CYCLE ! already deleted
 	   IF (ds_hide (iset)) CALL CANCEL_ONE_DATA_SET( iset, ignored_status )
 	ENDDO
  6000	RETURN	
diff --git a/fer/gnl/init_u_aggregate_dset.F b/fer/gnl/init_u_aggregate_dset.F
index 0ca8301..191ca3d 100644
--- a/fer/gnl/init_u_aggregate_dset.F
+++ b/fer/gnl/init_u_aggregate_dset.F
@@ -153,7 +153,7 @@
 * Assign aggregate data set number, exiting if maximum number 
 * of data sets are open
 	DO iset = 1,maxdsets
-	  IF (ds_name(iset) .EQ. char_init1024) THEN
+	  IF (ds_name(iset) .EQ. char_init2048) THEN
 	    agg_dset = iset
 	    GOTO 220
 	  ENDIF
@@ -307,7 +307,7 @@
 	   iset = member_sets(ii)
 	   IF (iset .EQ. pdset_dummy
      .    .OR. iset .EQ. unspecified_int4) CYCLE
-	   IF (ds_name(iset) .EQ. char_init1024) CYCLE ! already deleted
+	   IF (ds_name(iset) .EQ. char_init2048) CYCLE ! already deleted
 	   IF (ds_hide (iset)) CALL CANCEL_ONE_DATA_SET( iset, ignored_status )
 	ENDDO
  6000	RETURN	
diff --git a/fer/gnl/initialize.F b/fer/gnl/initialize_ferret.F
similarity index 99%
rename from fer/gnl/initialize.F
rename to fer/gnl/initialize_ferret.F
index 4230de2..bbfa832 100644
--- a/fer/gnl/initialize.F
+++ b/fer/gnl/initialize_ferret.F
@@ -1,4 +1,4 @@
-	SUBROUTINE INITIALIZE
+	SUBROUTINE INITIALIZE_FERRET
 
 *
 *
diff --git a/fer/gnl/is_agg_member.F b/fer/gnl/is_agg_member.F
index 6bff220..2290f79 100644
--- a/fer/gnl/is_agg_member.F
+++ b/fer/gnl/is_agg_member.F
@@ -77,7 +77,7 @@
 * check all of the aggregations currently open
 ! note: extremely inefficient loop.  Should use List of aggs
 	DO iset = 1, maxdsets
-	   IF ( ds_name(iset) .EQ. char_init1024) CYCLE
+	   IF ( ds_name(iset) .EQ. char_init2048) CYCLE
 	   IF (iset .EQ. dset) CYCLE
 	   IF ( ds_type(iset).NE.'ENS' .AND. ds_type(iset).NE.'FCT' 
      .		.AND. ds_type(iset).NE.'UNI') CYCLE 
diff --git a/fer/gnl/redefine_ax_att.F b/fer/gnl/redefine_ax_att.F
index e428821..f0b1289 100644
--- a/fer/gnl/redefine_ax_att.F
+++ b/fer/gnl/redefine_ax_att.F
@@ -93,7 +93,7 @@ c    user-defined axes. See if name exists as an axis name.
          IF (dset .EQ. pdset_irrelevant) GOTO 100
 
          IF (dset .GT. 0) THEN
-            IF ( ds_name(dset) .EQ. char_init1024) GOTO 100
+            IF ( ds_name(dset) .EQ. char_init2048) GOTO 100
          ENDIF
 
          CALL CD_GET_VAR_ID (dset, name, varid, status)
diff --git a/fer/gnl/reset_ax_att.F b/fer/gnl/reset_ax_att.F
index f96bcca..1046ca7 100644
--- a/fer/gnl/reset_ax_att.F
+++ b/fer/gnl/reset_ax_att.F
@@ -86,7 +86,7 @@ c    user-defined axes. See if name exists as an axis name.
          IF (dset.EQ.pdset_uvars .OR. dset.EQ.pdset_irrelevant) GOTO 100
          
          IF (dset .GT. 0) THEN
-            IF ( ds_name(dset) .EQ. char_init256) GOTO 100
+            IF ( ds_name(dset) .EQ. char_init2048) GOTO 100
          ENDIF
 
          CALL CD_GET_VAR_ID (dset, name, varid, status)
diff --git a/fer/gnl/show_data.F b/fer/gnl/show_data.F
index a13ad59..deefdc6 100644
--- a/fer/gnl/show_data.F
+++ b/fer/gnl/show_data.F
@@ -135,7 +135,7 @@
 	   IF ( interrupted ) CALL ERRMSG
      .			( ferr_interrupt, status, ' ', *5000 )
 
-	   IF ( ds_name(iset) .EQ. char_init1024
+	   IF ( ds_name(iset) .EQ. char_init2048
      .	   .OR. (only_1 .AND. iset .NE. dset) ) GOTO 790
 
            IF ( ds_hide(iset) .AND. .NOT.un_hide) GOTO 790
diff --git a/fer/gnl/show_line_xml.F b/fer/gnl/show_line_xml.F
index eaa1dde..d071fed 100644
--- a/fer/gnl/show_line_xml.F
+++ b/fer/gnl/show_line_xml.F
@@ -221,7 +221,7 @@ C New form for attribute output, list values separately.
 
         vname = line_name_orig(line)
 	DO 300 iset = 1, maxdsets
-	   IF ( ds_name(iset) .EQ. char_init1024) GOTO 400
+	   IF ( ds_name(iset) .EQ. char_init2048) GOTO 400
            CALL CD_GET_VAR_ID (iset, vname, varid, status)
            IF (status .EQ. ferr_ok) GOTO 50
   300   CONTINUE
diff --git a/fer/gnl/special_symbol.F b/fer/gnl/special_symbol.F
index 9964ae1..76ca8fb 100644
--- a/fer/gnl/special_symbol.F
+++ b/fer/gnl/special_symbol.F
@@ -304,7 +304,7 @@ c        CALL DTIME(TArray)
  
 	count = 0.
 	DO 2690 iset = 1, maxdsets
-	   IF ( ds_name(iset) .NE. char_init1024) count = count + 1.
+	   IF ( ds_name(iset) .NE. char_init2048) count = count + 1.
  2690	CONTINUE
 
 	value =  TM_FMT(count, 10, 10, slen)
diff --git a/fer/ino/find_dset_number.F b/fer/ino/find_dset_number.F
index 30e17ea..714e895 100644
--- a/fer/ino/find_dset_number.F
+++ b/fer/ino/find_dset_number.F
@@ -119,7 +119,7 @@ c *kob* 4/97
 	      agg  = dset
 * ... check for valid aggregation parent dset
 	      IF ( agg .LT. 1 .OR. agg .GT. maxdsets ) GOTO 500
-	      IF ( ds_name(agg) .EQ. char_init40 ) GOTO 500
+	      IF ( ds_name(agg) .EQ. char_init2048 ) GOTO 500
               IF (ds_type(agg).NE.'ENS'
      .	    .AND. ds_type(agg).NE.'FCT' 
      .      .AND. ds_type(agg).NE.'UNI') GOTO 500
@@ -177,7 +177,7 @@ c *kob* 4/97
 * compare with filenames stored by the TMAP library
 	   DO 100 dset = 1, maxdsets
 
-	      IF ( ds_name(dset) .EQ. char_init1024) GOTO 100
+	      IF ( ds_name(dset) .EQ. char_init2048) GOTO 100
 
 * special name match checks to account for implied .cdf or .des   5/93
 ** what about aggregate datasets?
@@ -210,7 +210,7 @@ c *kob* 4/97
 
 	   DO 200 dset = 1, maxdsets
 
-	      IF ( ds_des_name(dset) .EQ. char_init1024) GOTO 200
+	      IF ( ds_des_name(dset) .EQ. char_init2048) GOTO 200
 
 * special name match checks to account for implied .cdf or .des   5/93
 	      IF ( TM_HAS_STRING(ds_type(dset),'CDF')) THEN
@@ -244,7 +244,7 @@ c *kob* 4/97
 
 	   DO 300 dset = 1, maxdsets
 
-	      IF ( ds_des_name(dset) .EQ. char_init1024) GOTO 300
+	      IF ( ds_des_name(dset) .EQ. char_init2048) GOTO 300
 	      vax_code = STR_CASE_BLIND_COMPARE( ds_des_name(dset),
      .						    buff )
 
@@ -254,7 +254,7 @@ c *kob* 4/97
 
 * check for valid number given
  400	IF ( dset .LT. 1 .OR. dset .GT. maxdsets ) GOTO 500
-	IF ( ds_name(dset) .EQ. char_init40 ) GOTO 500
+	IF ( ds_name(dset) .EQ. char_init2048 ) GOTO 500
 
 * success
 	FIND_DSET_NUMBER = dset
diff --git a/fer/ino/init_ez_dset.F b/fer/ino/init_ez_dset.F
index 1c03243..683b376 100644
--- a/fer/ino/init_ez_dset.F
+++ b/fer/ino/init_ez_dset.F
@@ -180,7 +180,7 @@
 	   IF   ( dset .LT. 1
      .	   .OR.   dset .GT. maxdsets
      .	   .OR.   dset .GT. max_gfdl_dsets )		GOTO 5300
-	   IF ( ds_name( dset ) .EQ. char_init40 )	GOTO 5300
+	   IF ( ds_name( dset ) .EQ. char_init2048 )	GOTO 5300
 	ENDIF
 
 * already initialized ? - cancel it
diff --git a/fer/mem/create_dyn_wrkspc.F b/fer/mem/create_dyn_wrkspc.F
index 6160073..73be3b0 100644
--- a/fer/mem/create_dyn_wrkspc.F
+++ b/fer/mem/create_dyn_wrkspc.F
@@ -1,4 +1,4 @@
-	SUBROUTINE CREATE_DYN_WRKSPC( rqst_size, ws, status )
+	SUBROUTINE CREATE_DYN_WRKSPC( i8_rqst_size, ws, status )
 
 *  This software was developed by the Thermal Modeling and Analysis
 *  Project(TMAP) of the National Oceanographic and Atmospheric
@@ -50,7 +50,7 @@
 
 * calling argument declarations:
 	INTEGER	ws, status
-	INTEGER*8 rqst_size
+	INTEGER*8 i8_rqst_size
 
 * internal variable declarations:
 
@@ -64,7 +64,7 @@
 	CALL ERRMSG( ferr_internal, status, 'create_dyn_wrkspc', *5000)
 
 * allocate the memory
- 10	CALL GET_WS_DYNMEM( rqst_size, ws, status )
+ 10	CALL GET_WS_DYNMEM( i8_rqst_size, ws, status )
 
  5000	RETURN
 
diff --git a/fer/mem/dynmem_mrlist_c.F b/fer/mem/dynmem_mrlist_c.F
index 22de8ec..d5d851d 100644
--- a/fer/mem/dynmem_mrlist_c.F
+++ b/fer/mem/dynmem_mrlist_c.F
@@ -51,6 +51,7 @@
 
 * calling argument declarations:
 	INTEGER	n, mrlist(n), status
+* any type that has 8 btyes will work
         INTEGER*8 c_ptr_array
 
 * internal variable declarations:
diff --git a/fer/mem/find_mr_slot.F b/fer/mem/find_mr_slot.F
index 8e45b0e..a6ef528 100644
--- a/fer/mem/find_mr_slot.F
+++ b/fer/mem/find_mr_slot.F
@@ -66,7 +66,7 @@
 	mr = mv_flink( 0 )
 
 * if it isn't free, then free the most vulnerable mr on the delete chain
-	IF ( mr . EQ. 0 ) THEN
+	IF ( mr .EQ. 0 ) THEN
 	   mr = mr_del_blink(0)
 	   IF ( mr .EQ. 0 ) GOTO 5010
 	   CALL DELETE_VARIABLE( mr )
diff --git a/fer/mem/get_dyn_work_space.F b/fer/mem/get_dyn_work_space.F
index b5aa390..281ac22 100644
--- a/fer/mem/get_dyn_work_space.F
+++ b/fer/mem/get_dyn_work_space.F
@@ -1,4 +1,4 @@
-	SUBROUTINE GET_DYN_WORK_SPACE( rqst_size, status )
+	SUBROUTINE GET_DYN_WORK_SPACE( i8_rqst_size, status )
 
 *  This software was developed by the Thermal Modeling and Analysis
 *  Project(TMAP) of the National Oceanographic and Atmospheric
@@ -51,7 +51,7 @@
 
 * calling argument declarations:
 	INTEGER status
-	INTEGER*8 rqst_size
+	INTEGER*8 i8_rqst_size
 
 
 * slot 1 of working storage is managed specially
@@ -59,7 +59,7 @@
 
 * If the work space that is currently allocated is already large enough, then
 * we will simply let it be re-used
-	IF (ws_size(plegacy_work_buffer) .GE. rqst_size) THEN
+	IF (ws_size(plegacy_work_buffer) .GE. i8_rqst_size) THEN
 	   status = ferr_ok
 	   RETURN
 	ELSEIF (ws_size(plegacy_work_buffer) .NE. 0) THEN
@@ -67,7 +67,7 @@
 	ENDIF
 
 * get the requested memory
-	CALL GET_WS_DYNMEM(rqst_size, plegacy_work_buffer, status)
+	CALL GET_WS_DYNMEM(i8_rqst_size, plegacy_work_buffer, status)
 
 	END
 
diff --git a/fer/mem/get_mr_dynmem.F b/fer/mem/get_mr_dynmem.F
index adfb1d3..1bea651 100644
--- a/fer/mem/get_mr_dynmem.F
+++ b/fer/mem/get_mr_dynmem.F
@@ -1,4 +1,4 @@
-	SUBROUTINE GET_MR_DYNMEM( rqst_size, mr, status )
+	SUBROUTINE GET_MR_DYNMEM( i8_rqst_size, mr, status )
 
 *  This software was developed by the Thermal Modeling and Analysis
 *  Project(TMAP) of the National Oceanographic and Atmospheric
@@ -50,7 +50,7 @@
 
 * calling argument declarations:
 	INTEGER	mr, status
-	INTEGER*8 rqst_size
+	INTEGER*8 i8_rqst_size
 
 * internal variable declarations:
 	INTEGER	num_slen, mr_del
@@ -58,15 +58,15 @@
 	CHARACTER  LEFINT8*20, TM_FMT*12, num_str*20
 
 * Check for unspecified limits on abstract axis
-	IF ( rqst_size .EQ. 99999999 ) GOTO 5100
+	IF ( i8_rqst_size .EQ. 99999999 ) GOTO 5100
 
 * if we know there isn't room to accommodate this new object then
 * we can error out without compromising the current contents of the cache
 	available_mem = max_mem_allowed-(permanent_mem+essential_mem)
-	IF ( rqst_size .GT. available_mem) GOTO 5200
+	IF ( i8_rqst_size .GT. available_mem) GOTO 5200
 
 * will this new allocation push us over the specified memory size limit?
-	IF (total_mem+rqst_size .GT. max_mem_allowed) THEN
+	IF (total_mem+i8_rqst_size .GT. max_mem_allowed) THEN
 * ... delete from tail of deletion priority chain until there's room
  100	  mr_del = mr_del_blink(0)
 	    IF ( mr_del .EQ. 0 ) THEN
@@ -76,16 +76,16 @@
 	      GOTO 5200   ! abort
 	    ENDIF
 	    CALL DELETE_VARIABLE( mr_del )   ! reduces total_mem
-	  IF  (total_mem+rqst_size .GT. max_mem_allowed) GOTO 100 !delete more 
+	  IF  (total_mem+i8_rqst_size .GT. max_mem_allowed) GOTO 100 !delete more 
 	ENDIF
 
 * allocate the dynamic memory
- 200	CALL GET_MR_MEM(mr, rqst_size, status)
+ 200	CALL GET_MR_MEM(mr, i8_rqst_size, status)
         IF (status .NE. ferr_ok) GOTO 5300
 
 * bookkeeping
-        mr_size(mr) = rqst_size
-        total_mem = total_mem + rqst_size
+        mr_size(mr) = i8_rqst_size
+        total_mem = total_mem + i8_rqst_size
 	IF (total_mem .GT. peak_mem) peak_mem = total_mem
 	RETURN
 
@@ -93,7 +93,7 @@
 ***********************
 * error exits
  5000	RETURN
- 5100	num_str = LEFINT8(rqst_size,num_slen)
+ 5100	num_str = LEFINT8(i8_rqst_size,num_slen)
 	CALL ERRMSG( ferr_dim_underspec, status,
      .    num_str(:num_slen)//' words were requested. ', *5110)
  5110	CALL SPLIT_LIST(pttmode_explct, show_lun,
@@ -108,13 +108,13 @@
      .		'    To fulfill this request would exceed the current '//
      .		  'SET MEMORY/SIZE= limit of '//num_str(:num_slen)
      .	          //' megawords',0 )
-	CALL SHOW_ABORTED_MEM_STATE(rqst_size)
+	CALL SHOW_ABORTED_MEM_STATE(i8_rqst_size)
         GOTO 5000
 
  5300	CALL ERRMSG( ferr_insuff_memory,status,' ', *5310)
  5310	CALL SPLIT_LIST(pttmode_explct, show_lun,
      .		'    The OS refuses to supply this much memory',0 )
-	CALL SHOW_ABORTED_MEM_STATE(rqst_size)
+	CALL SHOW_ABORTED_MEM_STATE(i8_rqst_size)
         GOTO 5000
 
 	END
diff --git a/fer/mem/get_ws_dynmem.F b/fer/mem/get_ws_dynmem.F
index fa5c35e..4c8271a 100644
--- a/fer/mem/get_ws_dynmem.F
+++ b/fer/mem/get_ws_dynmem.F
@@ -1,4 +1,4 @@
-	SUBROUTINE GET_WS_DYNMEM( rqst_size, ws, status )
+	SUBROUTINE GET_WS_DYNMEM( i8_rqst_size, ws, status )
 
 *  This software was developed by the Thermal Modeling and Analysis
 *  Project(TMAP) of the National Oceanographic and Atmospheric
@@ -50,34 +50,34 @@
 
 * calling argument declarations:
 	INTEGER	ws, status
-	INTEGER*8 rqst_size
+	INTEGER*8 i8_rqst_size
 
 * internal variable declarations:
 	INTEGER	mr_del, num_slen
 	CHARACTER  LEFINT8*20, num_str*20
 
 * Check for unspecified limits on abstract axis
-	IF ( rqst_size .EQ. 99999999 ) GOTO 5100
+	IF ( i8_rqst_size .EQ. 99999999 ) GOTO 5100
 
 * allocate the dynamic memory
- 200	CALL GET_WS_MEM(ws, rqst_size, status)
+ 200	CALL GET_WS_MEM(ws, i8_rqst_size, status)
         IF (status .NE. ferr_ok) GOTO 5300
 
 * bookkeeping
-        ws_size(ws) = rqst_size
+        ws_size(ws) = i8_rqst_size
 	RETURN
 
 ***********************
 * error exits
  5000	RETURN
- 5100	num_str = LEFINT8(rqst_size,num_slen)
+ 5100	num_str = LEFINT8(i8_rqst_size,num_slen)
 	CALL ERRMSG( ferr_dim_underspec, status,
      .    num_str(:num_slen)//' words were requested. ', *5110)
  5110	CALL WARN('Check for unspecified limits on an ABSTRACT axis')
 	CALL WARN('Use the SHOW GRID command to see the axes')
 	GOTO 5000
 
- 5300	num_str = LEFINT8(rqst_size,num_slen)
+ 5300	num_str = LEFINT8(i8_rqst_size,num_slen)
 	CALL ERRMSG( ferr_insuff_memory,status,
      .	  num_str(:num_slen)//' words were requested. ', *5310)
  5310	CALL WARN('The system is refusing to supply this much memory')
diff --git a/fer/mem/purge_mr_grid.F b/fer/mem/purge_mr_grid.F
index 869fa35..f6ef00e 100644
--- a/fer/mem/purge_mr_grid.F
+++ b/fer/mem/purge_mr_grid.F
@@ -78,7 +78,7 @@
 !	INTEGER	TM_LENSTR1, mr, ivar, cvar, dset, glen, done_dset
 
 * the lowest grids are protected
-	IF ( grid .LE. mgrid_tabstract ) GOTO 5200
+	IF ( grid .LE. mgrid_fabstract ) GOTO 5200
 
 * initialize
 	done_dset = 0
diff --git a/fer/mem/r_cgrid_size_delta.F b/fer/mem/r_cgrid_size_delta.F
index ef4675b..ceccb43 100644
--- a/fer/mem/r_cgrid_size_delta.F
+++ b/fer/mem/r_cgrid_size_delta.F
@@ -60,8 +60,12 @@
 	  ELSE
 	    delta = 1.
 	  ENDIF
-	  size = size * 
-     .        (FLOAT(cx_hi_ss(cx,idim)-cx_lo_ss(cx,idim))/delta + 1.)
+          IF ( (cx_hi_ss(cx,idim) .GE. cx_lo_ss(cx,idim)) .AND.
+     .         (cx_hi_ss(cx,idim) .NE. unspecified_int4)  .AND.
+     .         (cx_lo_ss(cx,idim) .NE. unspecified_int4)  ) THEN
+              size = size * 
+     .          (FLOAT(cx_hi_ss(cx,idim)-cx_lo_ss(cx,idim))/delta + 1.)
+          ENDIF
  10 	CONTINUE
 
 * the result
diff --git a/fer/mem/show_aborted_mem_state.F b/fer/mem/show_aborted_mem_state.F
index bee7c4f..d8dc8af 100644
--- a/fer/mem/show_aborted_mem_state.F
+++ b/fer/mem/show_aborted_mem_state.F
@@ -1,4 +1,4 @@
-	SUBROUTINE SHOW_ABORTED_MEM_STATE(rqst_size)
+	SUBROUTINE SHOW_ABORTED_MEM_STATE(i8_rqst_size)
 
 *
 *
@@ -49,7 +49,7 @@
 	include 'xinterrupt.cmn'
 
 * calling argument declarations:
-	INTEGER*8 rqst_size
+	INTEGER*8 i8_rqst_size
 
 * local variable declarations:
 	INTEGER UVAR_NUMBER, TM_LENSTR1, uvar, slen, slen2, slen3
@@ -106,8 +106,8 @@
 
 
 * Report the size of the requested object
-	mem_int = LEFINT8(rqst_size, slen2)
-	percent = TM_FMT (rqst_size/rmax_mem*100, 2, 8, slen3)
+	mem_int = LEFINT8(i8_rqst_size, slen2)
+	percent = TM_FMT (i8_rqst_size/rmax_mem*100, 2, 8, slen3)
 	CALL SPLIT_LIST(pttmode_explct, show_lun,
      .		'    The size of the requested object was: '//
      .		': '//mem_int(:slen2)//' ('//percent(:slen3)//'%)' ,0 )
diff --git a/fer/mem/store_mr_ptr.F b/fer/mem/store_mr_ptr.F
index 10b841a..e0002b0 100644
--- a/fer/mem/store_mr_ptr.F
+++ b/fer/mem/store_mr_ptr.F
@@ -1,4 +1,4 @@
-        SUBROUTINE STORE_MR_PTR(mr, size, array)
+        SUBROUTINE STORE_MR_PTR(mr, i8_size, array)
 
 *  This software was developed by the Thermal Modeling and Analysis
 *  Project(TMAP) of the National Oceanographic and Atmospheric
@@ -41,8 +41,9 @@
         IMPLICIT NONE
 
 * calling argumemnts
-        INTEGER mr, size
-        REAL(8), TARGET :: array(size)
+        INTEGER*8 i8_size
+        INTEGER mr
+        REAL(8), TARGET :: array(i8_size)
 
         include 'tmap_dims.parm'
 	include	'ferret.parm'
diff --git a/fer/plt/movie_frame_ris8.F_unused b/fer/plt/movie_frame_ris8.F_unused
deleted file mode 100644
index b62b26d..0000000
--- a/fer/plt/movie_frame_ris8.F_unused
+++ /dev/null
@@ -1,88 +0,0 @@
-        SUBROUTINE MOVIE_FRAME_RIS8 (ws_id,frm_status,ris_file,
-     .  do_palette,rle,xdim,ydim,scan_line,pixmap)
-
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-*       Modification of original MOVIE_FRAME to capture GKS graphical output
-*       in a pixmap.  This routine stores images in HDF RIS8 format for
-*       playback by X Data Slice (XDS) or Ximage
-
-*       J Davison 12.23.92
-* Linux Port *kob* 1/97 - added check for type byte, because fortran 90 
-*                         does not accept this type.
-
-#ifdef unix
-        include 'errmsg.parm'
-#else
-        INCLUDE 'FERRET_CMN:ERRMSG.PARM'
-#endif
-
-	integer		error_status,ws_id
-	integer		xdim,ydim,x_pixel_dim,y_pixel_dim
-	integer	        frm_status,rle
-	integer	        scan_line(xdim,1)
-#ifdef NEED_BYTE
-	byte            pixmap(xdim,ydim)
-#else
-        integer*1       pixmap(xdim,ydim)
-#endif
-	logical		do_palette
-        character*80    ris_file
-
-******************************************************************************
-
-*	CHECK THAT FRAME SIZE IS AS EXPECTED
-	call get_frame_size (ws_id,error_status,x_pixel_dim,y_pixel_dim)
-	if (error_status .ne. ferr_ok .or.
-     .	    xdim .ne. x_pixel_dim .or. ydim .ne. y_pixel_dim) goto 1000
-
-*	STORE THE PRESENT COLOR MAP?
-	if (do_palette) call store_palette (ws_id)
-
-*	CALL SNAPIT TO CAPTURE THE PIXMAP
-	call snapit_ris8 (ws_id,rle,xdim,ydim,error_status,ris_file,
-     .	scan_line,pixmap)
-
-	if (error_status .ne. 0) goto 1000
-        frm_status = ferr_ok
-        return
-
-*	GKS ERROR EXIT
-1000	frm_status = ferr_tmap_error
-	return
-
-	end
-
diff --git a/fer/special/FerMem_routines.c b/fer/special/FerMem_routines.c
new file mode 100644
index 0000000..a6f0ef6
--- /dev/null
+++ b/fer/special/FerMem_routines.c
@@ -0,0 +1,358 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "FerMem.h"
+
+/*
+ * Pointer to the (global) string used as the missing value for strings.
+ * Since this string is often used, eliminate allocating and freeing 
+ * memory for this string by using this one global instance.  Note that 
+ * this string is NULL ('\0') terminated.
+ */
+char *STRING_MISSING_VALUE = "";
+
+/*
+ * Functions that just forward to the appropriate malloc, realloc, and free functions.
+ * This is done to remove differences in code for Ferret and PyFerret in that all the
+ * differences should be contained in this files.  This also allows an easy method of 
+ * "old-fashioned" debugging (print statements) of memory issues with the appropriate 
+ * compiler flag.  Optimization should inline these functions, so the extra layer of 
+ * function calls should not cost time in optimized code.
+ *
+ * A calloc equivalent is intentionally not provided.
+ * To replicate calloc: ptr = FerMem_Malloc(size); memset(ptr, 0, size);
+ *
+ * 07/2017 *KMS* - Initial version
+ */
+
+#ifdef MEMORYDEBUG
+
+#define DEBUGFILENAME "memorydebug.txt"
+static int initialized = 0;
+/*
+ * Add the debug message "<startptr> - <endptr> : <msg>" to the memorydebug 
+ * file.  If <endptr> is NULL, blanks are printed instead of the NULL 
+ * address.  For consistency, use format "%016p" to print pointers in msg.
+ * The given source filename ('__FILE__') and line number ('__LINE__') are 
+ * appended to the end of the message.
+ */
+void FerMem_WriteDebugMessage(void *startptr, void *endptr, const char *msg, const char *filename, int linenum)
+{
+    FILE *debugfile;
+
+    if ( ! initialized ) {
+        initialized = 1;
+        debugfile = fopen(DEBUGFILENAME, "w");
+    }
+    else {
+        debugfile = fopen(DEBUGFILENAME, "a");
+    }
+    if ( debugfile == NULL ) {
+        perror("Unable to open memory debug file " DEBUGFILENAME);
+        exit(127);
+    }
+    if ( endptr != NULL ) {
+        fprintf(debugfile, "%016p - %016p : %s : file %s : line %d\n", startptr, endptr, msg, filename, linenum);
+    }
+    else {
+        fprintf(debugfile, "%016p -                    : %s : file %s : line %d\n", startptr, msg, filename, linenum);
+    }
+    fclose(debugfile);
+}
+
+#define FERMEM_BUFSIZE 8
+#define FERMEM_BUFVALUE 0xAAAAAAAA
+#define FERMEM_MAXLEN 128
+
+typedef struct _MemInfo_ {
+    char    filename[FERMEM_MAXLEN];
+    size_t  linenum;
+    size_t  size;
+    struct _MemInfo_ *next;
+    size_t *headbufptr;
+    size_t *tailbufptr;
+    void   *memory;
+    size_t  dummy[2*FERMEM_BUFSIZE];
+} MemInfo;
+
+static MemInfo *MemInfoList = NULL;
+
+/*
+ * Checks if the buffers surrounding the user memory have been altered,
+ * indicating writing to memory not allocated.  If an alteration is
+ * detected, this function causes the abort function to end the process
+ * and produce a core dump.
+ */
+static void CheckMemInfoList(void)
+{
+    MemInfo *memptr;
+    int      k;
+
+    for (memptr = MemInfoList; memptr != NULL; memptr = memptr->next) {
+        for (k = 0; k < FERMEM_BUFSIZE; k++) {
+            if ( memptr->headbufptr[k] != FERMEM_BUFVALUE ) {
+                fprintf(stderr, "Memory underwrite detected for allocation %016p of %ld bytes\n", memptr->memory, memptr->size);
+                abort();
+            }
+        }
+        for (k = 0; k < FERMEM_BUFSIZE; k++) {
+            if ( memptr->tailbufptr[k] != FERMEM_BUFVALUE ) {
+                fprintf(stderr, "Memory overwrite detected for allocation %016p of %ld bytes\n", memptr->memory, memptr->size);
+                abort();
+            }
+        }
+    }
+}
+
+/*
+ * Adds the given pointer to the linked list of memory pointers.
+ * Assumes the given pointer is allocated for 
+ *     'size' + sizeof(MemInfo)
+ * bytes of memory; the pointer to 'size' bytes of user memory 
+ * (the memory to be used as desired) is returned.
+ * The values filename and linenumber should be the compiler values 
+ * __FILE__ and __LINE__ of the original allocation memory call.
+ */
+static void *AddToMemInfoList(void *memplus, size_t size, char *filename, int linenumber)
+{
+    MemInfo *memptr;
+    int      k;
+    void    *ptr;
+
+    /* Check if anything has been corrupted */
+    CheckMemInfoList();
+
+    if ( MemInfoList == NULL ) {
+        /* No list so make this memory the start of the list */
+        MemInfoList = (MemInfo *) memplus;
+    }
+    else {
+        /* Add this memory to the end of the list */
+        for (memptr = MemInfoList; ; memptr = memptr->next) {
+            if ( memptr->next == NULL ) {
+                memptr->next = memplus;
+                break;
+            }
+        }
+    }
+
+    /* Initialize the MemInfo block */
+    memptr = (MemInfo *) memplus;
+    strncpy(memptr->filename, filename, FERMEM_MAXLEN);
+    memptr->filename[FERMEM_MAXLEN - 1] = '\0';
+    memptr->linenum = linenumber;
+    memptr->next = NULL;
+    memptr->size = size;
+    ptr = memptr;
+    ptr += FERMEM_MAXLEN * sizeof(char);
+    ptr += sizeof(size_t);
+    ptr += sizeof(size_t);
+    ptr += sizeof(MemInfo *);
+    ptr += sizeof(size_t *);
+    ptr += sizeof(size_t *);
+    ptr += sizeof(void *);
+    memptr->headbufptr = (size_t *) ptr;
+    ptr += FERMEM_BUFSIZE * sizeof(size_t);
+    memptr->memory = ptr;
+    ptr += size;
+    memptr->tailbufptr = (size_t *) ptr;
+    for (k = 0; k < FERMEM_BUFSIZE; k++)
+        memptr->headbufptr[k] = FERMEM_BUFVALUE;
+    for (k = 0; k < FERMEM_BUFSIZE; k++)
+        memptr->tailbufptr[k] = FERMEM_BUFVALUE;
+    /* Return the pointer to part of the memory to be used */
+    return memptr->memory;
+}
+
+/*
+ * Removes the memory list entry associated with the given user memory pointer
+ * and returns the pointer to the original allocated memory.
+ * The size of the user memory that was allocated is returned as the value 
+ * pointed to by sizeptr.
+ */
+static void *RemoveFromMemInfoList(void *ptr, size_t *sizeptr)
+{
+    MemInfo *prevptr;
+    MemInfo *memptr;
+    int      k;
+
+    /* Check if anything has been corrupted */
+    CheckMemInfoList();
+
+    for (prevptr = NULL, memptr = MemInfoList; memptr != NULL; prevptr = memptr, memptr = memptr->next) {
+        if ( memptr->memory == ptr ) {
+            /* remove this MemInfo from the list */
+            if ( prevptr != NULL )
+                prevptr->next = memptr->next;
+            else
+                MemInfoList = memptr->next;
+            memptr->next = NULL;
+            /* assign the size of the user memory and return the pointer to the original memory */
+            *sizeptr = memptr->size;
+            return memptr;
+        }
+    }
+    fprintf(stderr, "Attempt to free unallocated memory %016p\n", ptr);
+    abort();
+}
+
+/*
+ * Called after shutting down to report any allocated memory not freed.
+ * Messages are written to stderr.  Returns zero if all allocated memory
+ * has been freed; 127 if not.
+ */
+int ReportAnyMemoryLeaks(void)
+{
+    MemInfo *memptr;
+
+    if ( MemInfoList == NULL ) {
+        fputs("All FerMem allocated memory has been FerMem freed\n", stderr);
+        return 0;
+    }
+
+    /* Check if anything has been corrupted */
+    CheckMemInfoList();
+    /* Report anything still in MemInfoList */
+    for (memptr = MemInfoList; memptr != NULL; memptr = memptr->next)
+        fprintf(stderr, "Memory %016p of %ld bytes allocated at line %ld of file %s was not freed\n", 
+                memptr->memory, memptr->size, memptr->linenum, memptr->filename);
+    return 127;
+}
+
+#endif
+
+/*
+ * Allocates memory like malloc.  If (and only if) the compile flag MEMORYDEBUG is defined, 
+ * prints a line to memorydebug.txt with the allocation information.  The value of filename 
+ * should be __FILE__ and the value of linenumber should be __LINE__ in the source file 
+ * calling this routine.
+ *
+ * So: 
+ *     myptr = malloc(mysize);
+ * should be turned into: 
+ *     myptr = FerMem_Malloc(mysize, __FILE__, __LINE__);
+ */
+void *FerMem_Malloc(size_t size, char *filename, int linenumber) 
+{
+    void *ptr;
+
+#ifdef MEMORYDEBUG
+    char msg[256];
+
+    /* allocate required memory as well as for the surrounding MemInfo block */
+    ptr = malloc(size + sizeof(MemInfo));
+    ptr = AddToMemInfoList(ptr, size, filename, linenumber);
+    /* initialize to non-zero junk to catch uninitialized memory usage */
+    memset(ptr, 0x6B, size);
+    sprintf(msg, "memory malloc allocated for %ld bytes", size);
+    FerMem_WriteDebugMessage(ptr, ptr + size, msg, filename, linenumber);
+
+#else
+
+    ptr = malloc(size);
+
+#endif
+
+    return ptr;
+}
+
+/*
+ * Reallocates memory like realloc.  If (and only if) the compile flag MEMORYDEBUG is defined, 
+ * prints a line to memorydebug.txt with the allocation information.  The value of filename 
+ * should be __FILE__ and the value of linenumber should be __LINE__ in the source file 
+ * calling this routine.
+ *
+ * So: 
+ *     newptr = realloc(myptr, newsize);
+ * should be turned into: 
+ *     newptr = FerMem_Realloc(myptr, newsize, __FILE__, __LINE__);
+ */
+void *FerMem_Realloc(void *ptr, size_t size, char *filename, int linenumber) 
+{
+    void *newptr;
+
+#ifdef MEMORYDEBUG
+    void  *origptr;
+    size_t oldsize;
+    char   msg[256];
+
+    if ( ptr == NULL ) {
+        fprintf(stderr, "Realloc given a NULL pointer at line %d of file %s", linenumber, filename);
+        oldsize = 0;
+        newptr = malloc(size + sizeof(MemInfo));
+    }
+    else if ( ptr == STRING_MISSING_VALUE ) {
+        fprintf(stderr, "Realloc given STRING_MISSING_VALUE at line %d of file %s", linenumber, filename);
+        oldsize = 0;
+	newptr = malloc(size + sizeof(MemInfo));
+    }
+    else {
+        origptr = RemoveFromMemInfoList(ptr, &oldsize);
+        sprintf(msg, "memory to be realloc freed for %ld bytes", oldsize);
+        FerMem_WriteDebugMessage(ptr, ptr + oldsize, msg, filename, linenumber);
+        newptr = realloc(origptr, size + sizeof(MemInfo));
+    }
+
+    newptr = AddToMemInfoList(newptr, size, filename, linenumber);
+    /* initialize new memory to non-zero junk to catch uninitialized memory usage */
+    if ( size > oldsize )
+       memset(newptr + oldsize, 0x6B, size - oldsize);
+    sprintf(msg, "memory realloc allocated for %ld bytes", size);
+    FerMem_WriteDebugMessage(newptr, newptr + size, msg, filename, linenumber);
+
+#else
+
+    if ( (ptr != NULL) && (ptr != STRING_MISSING_VALUE) ) {
+        newptr = realloc(ptr, size);
+    }
+    else {
+        newptr = malloc(size);
+    }
+
+#endif
+
+    return newptr;
+}
+
+/*
+ * Frees memory like free.  If (and only if) the compile flag MEMORYDEBUG is defined, 
+ * prints a line to memorydebug.txt with the allocation information.  The value of filename 
+ * should be __FILE__ and the value of linenumber should be __LINE__ in the source file 
+ * calling this routine.
+ *
+ * So: 
+ *     free(mymem);
+ * should be turned into: 
+ *     FerMem_Free(mymem, __FILE__, __LINE__);
+ */
+void FerMem_Free(void *ptr, char *filename, int linenumber) 
+{
+#ifdef MEMORYDEBUG
+    void  *origptr;
+    size_t size;
+    char   msg[256];
+
+    if ( ptr == NULL ) {
+        fprintf(stderr, "Attempt to free a NULL pointer at line %d of file %s", linenumber, filename);
+        return;
+    }
+    if ( ptr == STRING_MISSING_VALUE ) {
+        fprintf(stderr, "Attempt to free STRING_MISSING_VALUE at line %d of file %s", linenumber, filename);
+        return;
+    }
+
+    origptr = RemoveFromMemInfoList(ptr, &size);
+    sprintf(msg, "memory to be free freed for %ld bytes", size);
+    FerMem_WriteDebugMessage(ptr, ptr + size, msg, filename, linenumber);
+
+    free(origptr);
+
+#else
+
+    if ( (ptr != NULL) && (ptr != STRING_MISSING_VALUE) ) {
+        free(ptr);
+    }
+
+#endif
+}
+
diff --git a/fer/special/SOURCE_FILES b/fer/special/SOURCE_FILES
index fd91a4f..dd45e6e 100644
--- a/fer/special/SOURCE_FILES
+++ b/fer/special/SOURCE_FILES
@@ -5,10 +5,12 @@ fake_ppl.F\
 fake_tmio.F\
 fakes3.F\
 ferret_dispatch.F\
-ferret_query_f.F\
 gui_fakes.F\
 linux_routines.F\
 xmake_date_data.F\
 xrevision_type_data.F\
 xplatform_type_data.F
 
+SRCS_C = \
+FerMem_routines.c
+
diff --git a/fer/special/ferret_dispatch.F b/fer/special/ferret_dispatch.F
index 18b483e..ee271b7 100644
--- a/fer/special/ferret_dispatch.F
+++ b/fer/special/ferret_dispatch.F
@@ -316,8 +316,8 @@ c	DO 2 i = 1, 200
 	   RETURN
 	ENDIF
 	   
-* exit the dispatch loop - if from pfyrret, to return control to python
-*                          if from ferret_c, just re-enter the dispatch loop
+* exit the dispatch loop - if from PyFerret, return control to python
+*                          if from Ferret, just re-enter the dispatch loop
  450    rtn_flags(frtn_control) = fctrl_in_ferret
         rtn_flags(frtn_status) = gui_status
         rtn_flags(frtn_action) = factn_no_action
diff --git a/fer/special/ferret_query_f.F b/fer/special/ferret_query_f.F
deleted file mode 100644
index 4d503bb..0000000
--- a/fer/special/ferret_query_f.F
+++ /dev/null
@@ -1,535 +0,0 @@
-    	SUBROUTINE FERRET_QUERY_F( query, flags, nflags, ctext, ntext,
-     .				   num_strings, num_vals, nums, nnums,
-     .				   arg1, arg2, arg3, arg4, arg5, qstatus )
-
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-* respond to the GUI query API call
-
-* programmer - steve hankin
-* NOAA/PMEL, Seattle, WA - Tropical Modeling and Analysis Program
-
-* for FERRET V400: 8/94
-*   3/15/95 - fixed error in "strides" for query GCOORDS
-* V402: "temporary ferret_query.inc" changed to ferret_cmn/ferret_query.parm
-* V420: bug fix: query would crash if grid was unknown
-*Linux Port 1/97 *kob* - Added a preprocessor include for tmap_dset.parm
-*			  because it needed a preprocessor.
-*	    4/97 *kob* - added ifdef for MANDATORY_FORMAT_WIDTHS on internal
-*			 read because linux/nag f90 needed a format width.
-*           12/00*acm* - cleanup: TM_DATE_OK declared but never called
-* V533      8/01 *acm* - calendar axis additions: SECS_FROM_BC needs cal_id
-* v540 *acm* 10/01 increase length of ds_name
-* v540 *acm* 10/01  remove VMS include statements
-* v604 *acm* 7/07 increase length of ds_name
-*       *acm* 3/12 Add E and F dimensions (use nferdims in tmap_dims.parm)
-*       *acm* 4/12 6D Ferret: time axis may be in t or f direction.
-
-        include 'tmap_dims.parm'
-#       include "tmap_dset.parm"
-        include 'xdset_info.cmn_text'
-        external xdset_info_data
-        include 'xtm_grid.cmn_text'
-        external xgt_grid_data
-	include	'ferret.parm'
-	include 'errmsg.parm'
-	include 'gfdl_vms.parm'
-	include 'ferret_query.parm'
-	include 'xprog_state.cmn'
-	include 'xcommand.cmn'
-	include 'xtext_info.cmn'
-	include 'xcontext.cmn'
-	include 'xalgebra.cmn'
-	include 'xgui.cmn'
-	include 'xvariables.cmn' ! JC_ADDITION
-
-
-* calling argument declarations
-	INTEGER query, nflags, flags(nflags), num_strings, num_vals, ntext,
-     .		nnums, qstatus
-* ... c-type Hollerith string buffers
-#ifdef NEED_BYTE
-        BYTE      ctext(ntext), arg1(*), arg2(*), arg3(*), arg4(*), arg5(*)
-#else
-        INTEGER*1 ctext(ntext), arg1(*), arg2(*), arg3(*), arg4(*), arg5(*)
-#endif
-	REAL*8	nums(nnums)
-
-* local variable declarations:
-	LOGICAL GEOG_LABEL
-	INTEGER	TM_LENSTR1, FIND_DSET_NUMBER, IGRID, TM_GET_LINENUM,
-     .		TM_GET_GRIDNUM, TM_GET_CALENDAR_ID,
-     .		i, i2, n, dim, dset, cat, var, axis, grid,
-     .		slen, insert_pt, stride, status, cal_id,
-     .          j, num_indices
-	REAL*8	TWORLD, TM_WORLD, SECS_FROM_BC, lo, hi, delta
-	CHARACTER AX_TITLE*32, TM_FMT*16, buff1*32,
-     .		  farg1*80, farg2*80, farg3*80, farg4*80, farg5*80
-
-* local parameter declarations:
-	CHARACTER*4 notext
-	PARAMETER ( notext = '****')
-
-* legal query ?
-	IF ( query .GT. max_queries ) THEN
-	   qstatus = QSTAT_UNKNOWN_QUERY
-	   RETURN
-	ENDIF
-
-* initialize
-	qstatus = QSTAT_OK
-	insert_pt = 1
-	num_strings = 0
-	num_vals = 0
-	DO 10 i = 1, nflags
- 10	flags(i) = 0
-	ctext(1) = 0
-
-* convert arguments to FORTRAN character arrays
-	CALL TM_CTOF_STRNG(arg1, farg1, 80) 
-	CALL TM_CTOF_STRNG(arg2, farg2, 80) 
-	CALL TM_CTOF_STRNG(arg3, farg3, 80) 
-	CALL TM_CTOF_STRNG(arg4, farg4, 80) 
-	CALL TM_CTOF_STRNG(arg5, farg5, 80) 
-
-* respond to the appropriate query
-	GOTO ( 100, 200, 300, 400, 500, 600, 700, 800, 900,1000,
-     .	      1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,
-     .	      2100,2200,2300,2400,2500,2600,2700,2800,2900,3000 ) query
-	
-* STATUS
-* error status of last command
- 100	CONTINUE
-	qstatus = QSTAT_UNKNOWN_QUERY
-	RETURN
-
-* MESSAGE
-* messages from last command
- 200	CONTINUE
-	qstatus = QSTAT_UNKNOWN_QUERY
-	RETURN
-
-* DSET
-* list of open data sets
- 300	DO 310 i = 1,  maxdsets
-	   IF ( ds_name(i) .NE. char_init1024) THEN
-	      slen = TM_LENSTR1(ds_name(i))
-	      CALL CSTRING_INSERT( ds_name(i),
-     .				slen, ctext, ntext, insert_pt)
-	      IF ( insert_pt .GT. ntext ) THEN
-	         qstatus = QSTAT_BUFF_OVFLOW
-	         RETURN
-	      ENDIF
-	      num_strings = num_strings + 1
-	   ENDIF
- 310	CONTINUE
-	RETURN
-
-* VARIABLE dset
-* return the variables in a data set
-* ... identify the data set
- 400	dset = FIND_DSET_NUMBER(farg1)
-	IF ( dset .EQ. unspecified_int4 ) THEN
-	   qstatus = QSTAT_INVALID_ARG
-	   RETURN
-	ENDIF
-	DO 410 var = 1, maxvars
-	   IF ( ds_var_setnum(var) .NE. dset ) GOTO 410
-	   IF ( ds_var_code(var) .EQ. '-' ) GOTO 410
-*	   slen = TM_LENSTR1(ds_var_code(var))
-           CALL string_array_get_strlen1(ds_var_code_head,
-     .                                    var,  slen)
-	   CALL CSTRING_INSERT( ds_var_code(var),
-     .				slen, ctext, ntext, insert_pt)
-	   IF ( insert_pt .GT. ntext ) THEN
-	      qstatus = QSTAT_BUFF_OVFLOW
-	      RETURN
-	   ENDIF
-	   num_strings = num_strings + 1
- 410	CONTINUE
-	RETURN
-
-* GRID dset variable
-* 4-axis description of grid for given variable
-* ... identify the data set, then variable, then its grid
- 500	dset = FIND_DSET_NUMBER(farg1)
-	IF ( dset .EQ. unspecified_int4 ) THEN
-	   qstatus = QSTAT_INVALID_ARG
-	   RETURN
-	ENDIF
-	CALL FIND_VAR_NAME( dset, farg2, cat, var )
-	IF ( dset .EQ. unspecified_int4 ) THEN
-	   qstatus = QSTAT_INVALID_ARG
-	   RETURN
-	ENDIF
-	grid = IGRID ( dset, cat, var, status )
-	IF ( grid.EQ.unspecified_int4 .OR. status.NE.ferr_ok) THEN
-	   qstatus = -1 * status
-	   RETURN
-	ENDIF
-* ... first return the grid name
-	slen = TM_LENSTR1(grid_name(grid))
-	CALL CSTRING_INSERT( grid_name(grid),
-     .			     slen, ctext, ntext, insert_pt)
-* ... then the 4 axis names
-	DO 510 dim = 1, nferdims
-	   axis = grid_line( dim, grid )
-	   IF ( axis .EQ. munknown ) THEN
-	      CALL CSTRING_INSERT( 'UNKNOWN',
-     .				   7, ctext, ntext, insert_pt)
-	   ELSEIF( axis .EQ. mnormal ) THEN
-	      CALL CSTRING_INSERT( 'NORMAL',
-     .				   6, ctext, ntext, insert_pt)
-	   ELSE
-	      slen = TM_LENSTR1(line_name(axis))
-	      CALL CSTRING_INSERT( line_name(axis),
-     .				   slen, ctext, ntext, insert_pt)
-	   ENDIF
-	   IF ( insert_pt .GT. ntext ) THEN
-	      qstatus = QSTAT_BUFF_OVFLOW
-	      RETURN
-	   ENDIF
- 510    CONTINUE
-* ... then the 4 axis orientation codes
-	DO 520 dim = 1, nferdims
-	   axis = grid_line( dim, grid )
-	   IF ( axis .EQ. munknown .OR. axis .EQ. mnormal ) THEN
-	      CALL CSTRING_INSERT( '**',
-     .				   2, ctext, ntext, insert_pt)
-	   ELSE
-	      CALL CSTRING_INSERT( line_direction(axis),
-     .				   2, ctext, ntext, insert_pt)
-	   ENDIF
-	   IF ( insert_pt .GT. ntext ) THEN
-	      qstatus = QSTAT_BUFF_OVFLOW
-	      RETURN
-	   ENDIF
- 520    CONTINUE
-	num_strings = 9	! 1 + 4 + 4
-	RETURN
-
-* AXIS  (args?)
- 600	qstatus = QSTAT_UNKNOWN_QUERY
-	RETURN
-
-* COORDS axis
-* coordinates of (irregular) axis
- 700	CONTINUE
-
-* TRANS  *************
-* list of transforms
- 800	CONTINUE
-	qstatus = QSTAT_UNKNOWN_QUERY
-	RETURN
-
-* TRNARG (trans) ****will not be used!!*************
-* argument description for given transform
- 900	CONTINUE
-* LVARS  *************
-* list of LET-defined variables
- 1000	CONTINUE
-
-* DVARS (dset) *************
-* list of LET-defined variables defined for data set
-* ... identify the data set
-*
-* first attempt at an upgrade by JC (3/1/96)
-*
- 1100	dset = FIND_DSET_NUMBER(farg1)
-	IF ( dset .EQ. unspecified_int4 ) THEN
-	   qstatus = QSTAT_INVALID_ARG
-	   RETURN
-	ENDIF
-*	DO 1110 var = 1, max_uvar
-*           IF (uvar_num_items(var) .EQ. uvar_deleted  ) GOTO 1110
-        CALL deleted_list_get_undel(uvar_num_items_head,
-     .                              deleted_list_result(1),
-     .                              max_uvar, num_indices )
-        DO 1110 j = 1, num_indices
-           var = deleted_list_result(j)
-           IF (uvar_name_code(var)(1:3) .EQ. 'EX#'    ) GOTO 1110
-           IF ( dset .NE. uvar_dset(var)         ) GOTO 1110
-*           slen = TM_LENSTR1(uvar_name_code(var))
-           CALL string_array_get_strlen1(uvar_name_code_head, var, slen)
-	   CALL CSTRING_INSERT( uvar_name_code(var),
-     .				slen, ctext, ntext, insert_pt)
-
-	   IF ( insert_pt .GT. ntext ) THEN
-	      qstatus = QSTAT_BUFF_OVFLOW
-	      RETURN
-	   ENDIF
-	   num_strings = num_strings + 1
- 1110	CONTINUE
-	RETURN
-
-* VBACKGROUND  (dset variable) *************
-* background info about this variable
- 1200	CONTINUE
-* DBACKGROUND (dset) *************
-* background info about this data set
- 1300	CONTINUE
-* WINDOWS  *************
-* list of open windows
- 1400	CONTINUE
-* WCURRENT  *************
-* name of current window
- 1500	CONTINUE
-* VPORTS  *************
-* list of defined viewports
- 1600	CONTINUE
-* VCURRENT  *************o
-* name of current viewport
- 1700	CONTINUE
-* VIEW  (vport) *************
-* definition of indicated viewport
- 1800	CONTINUE
-	qstatus = QSTAT_UNKNOWN_QUERY
-	RETURN
-
-* DCURRENT
-* name of current data set
- 1900	DO 1910 dset = 1, maxdsets
-           IF ( ds_name(dset) .EQ. char_init1024) GOTO 1910
-	   IF ( dset .EQ. cx_data_set(cx_last) ) THEN
-	      slen = TM_LENSTR1(ds_name(dset))
-	      CALL CSTRING_INSERT( ds_name(dset),
-     .				   slen, ctext, ntext, insert_pt)
-	      num_strings = 1
-	      RETURN
-	   ENDIF
- 1910	CONTINUE
-* ... there is no current data set
-	CALL CSTRING_INSERT( '*', 1, ctext, ntext, insert_pt)
-	num_strings = 1
-	RETURN
-
-* SPAN  dset variable
-* grid name and axis limits for a variable
- 2000	dset = FIND_DSET_NUMBER(farg1)
-	IF ( dset .EQ. unspecified_int4 ) THEN
-	   qstatus = QSTAT_INVALID_ARG
-	   RETURN
-	ENDIF
-	CALL FIND_VAR_NAME( dset, farg2, cat, var )
-	IF ( dset .EQ. unspecified_int4 ) THEN
-	   qstatus = QSTAT_INVALID_ARG
-	   RETURN
-	ENDIF
-	grid = IGRID ( dset, cat, var, status )
-	IF ( status .NE. ferr_ok ) THEN
-	   qstatus = -1 * status
-	   RETURN
-	ENDIF
-* ... first return the grid name
-	slen = TM_LENSTR1(grid_name(grid))
-	CALL CSTRING_INSERT( grid_name(grid),
-     .			     slen, ctext, ntext, insert_pt)
-* ... then the 4 axis spans
-* ... loss,hiss,loww,hiww (all presented as floating point)
-	DO 2010 dim = 1, nferdims
-	   axis = grid_line( dim, grid )
-	   i = (dim-1) * 4
-	   IF ( axis .EQ. munknown
-     .	   .OR. axis .EQ. mnormal  ) THEN
-	      nums(i+1) = DBLE( unspecified_int4 ) 
-	      nums(i+2) = DBLE( unspecified_int4 ) 
-	      nums(i+3) = DBLE(bad_val4)
-	      nums(i+4) = DBLE(bad_val4)
-	   ELSE
-! 4/4/96 - return grid limits rather than span limits (which are meaningful
-!               only for file variables)
-              nums(i+1) = 1.0D0
-              nums(i+2) = DBLE(line_dim(axis))
-              nums(i+3) = TM_WORLD( 1,
-     .                              grid, dim, box_middle)
-              nums(i+4) = TM_WORLD( line_dim(axis),
-     .                              grid, dim, box_middle)
-	   ENDIF
- 2010    CONTINUE
-	num_strings = 1
-	num_vals = 16
-	RETURN
-
-* GAXIS grid orientation(1-4)
- 2100	grid = TM_GET_GRIDNUM( farg1 )
-	IF ( grid .EQ. unspecified_int4 ) THEN
-	   qstatus = QSTAT_INVALID_ARG
-	   RETURN
-	ENDIF
-* *kob* 4/97
-#ifdef MANDATORY_FORMAT_WIDTHS
-	READ( farg2,* ) dim
-#else
-	READ( farg2,'(I)' ) dim
-#endif
-	axis = grid_line(dim, grid)
-* ... first return the axis title (units are appended already ...)
-	IF ( axis .NE. mnormal ) THEN
-	   buff1 = AX_TITLE(dim, grid, slen)
-	ELSE
-	   buff1 = notext
-	   slen = 4
-	ENDIF
-	CALL CSTRING_INSERT( buff1,
-     .			     slen, ctext, ntext, insert_pt)
-* ... then the axis units
-	IF ( axis .NE. mnormal ) THEN
-	   buff1 = line_units(axis)
-	   slen = TM_LENSTR1(buff1)
-	ELSE
-	   buff1 = notext
-	   slen = 4
-	ENDIF
-	CALL CSTRING_INSERT( buff1,
-     .			     slen, ctext, ntext, insert_pt)
-* ... now return some flags:
-	IF ( line_modulo(axis) ) THEN		! modulo ?
-	   flags(1) = 1
-	ELSE
-	   flags(1) = 0
-	ENDIF
-	IF ( GEOG_LABEL( dim, grid ) ) THEN	! fancy labeling ?
-	   flags(2) = 1
-	ELSE
-	   flags(2) = 0
-	ENDIF
-	IF ( line_regular(axis) ) THEN		! regular spacing ?
-	   flags(3) = 1
-	ELSE
-	   flags(3) = 0
-	ENDIF
-	flags(4) = line_unit_code(axis)		! unit code
-* ... some low:high:delta information
-	nums(1) = DBLE( line_dim(axis) )
-	nums(2) = line_start(axis)
-	nums(3) = line_delta(axis)
-	num_strings = 2
-	num_vals = 3
-* ... and finially special stuff for calendar axis formatting
-	IF ( (dim.EQ.t_dim .OR. dim.EQ.f_dim) .AND. flags(2).EQ.1 ) THEN
-
-*  See if we can find out the calendar, if grid/axis is known
-	IF (grid .EQ. unspecified_int4  .AND.  
-     .	    axis .EQ. unspecified_int4)  THEN 
-	   cal_id = 1
-	ELSE
-	   IF (axis .EQ. unspecified_int4) axis = grid_line(dim, grid)
-	   cal_id = TM_GET_CALENDAR_ID ( line_cal_name(axis) )
-	ENDIF
-
-	   nums(4) = SECS_FROM_BC( line_t0(axis), cal_id, status )
-	   nums(5) = line_tunit(axis)
-	ENDIF
-	RETURN
-
-* GCOORDS grid orientation(1-4)   offset   stride
-* ... the variable num_valstoj will tell the number of values returned
- 2200	grid = TM_GET_GRIDNUM( farg1 )
-	IF ( grid .EQ. unspecified_int4 ) THEN
-	   qstatus = QSTAT_INVALID_ARG
-	   RETURN
-	ENDIF
-* *kob* 4/97 include axis...line in below ifdef just for simplicity
-#ifdef MANDATORY_FORMAT_WIDTHS
-	READ( farg2,* ) dim
-	axis = grid_line(dim, grid)
-	READ( farg3,* ) i2       ! offset
-	READ( farg4,* ) stride
-#else
-	READ( farg2,'(I)' ) dim
-	axis = grid_line(dim, grid)
-	READ( farg3,'(I)' ) i2       ! offset
-	READ( farg4,'(I)' ) stride
-#endif
-	i2 = i2 + 1
-	num_strings = 0
-	DO 2210 i = 1, nnums
-	   IF ( i2 .GT. line_dim(axis) ) RETURN
-	   nums( i ) = TM_WORLD( i2, grid, dim, box_middle)
-	   num_vals = i
-	   i2 = i2 + stride
- 2210	CONTINUE
-	RETURN
-
-* SSPOINT grid orientation delta_index index
- 2300	CONTINUE
-
-* WWPOINT grid orientation delta_index coordinate
- 2400	CONTINUE
-
-* UVAR_DEFINITION dset variable
-* text of the algebraic expression defining the variable
- 2500	dset = FIND_DSET_NUMBER(farg1)
-	IF ( dset .EQ. unspecified_int4 ) THEN
-	   qstatus = QSTAT_INVALID_ARG
-	   RETURN
-	ENDIF
-	CALL FIND_VAR_NAME( dset, farg2, cat, var )
-	IF ( dset .EQ. unspecified_int4 ) THEN
-	   qstatus = QSTAT_INVALID_ARG
-	   RETURN
-	ENDIF
-
-* ... return the definition
-	slen = TM_LENSTR1(uvar_text(var))
-	CALL CSTRING_INSERT( uvar_text(var),
-     .			     slen, ctext, ntext, insert_pt)
-* ... the title
-	slen = TM_LENSTR1(uvar_title(var))
-	CALL CSTRING_INSERT( uvar_title(var),
-     .			     slen, ctext, ntext, insert_pt)
-* ... and the units
-	slen = TM_LENSTR1(uvar_units(var))
-	CALL CSTRING_INSERT( uvar_units(var),
-     .			     slen, ctext, ntext, insert_pt)
-	num_strings = 3
-	RETURN
-
-
-* ****  *************
- 2600	CONTINUE
-* ****  *************
- 2700	CONTINUE
-* ****  *************
- 2800	CONTINUE
-* ****  *************
- 2900	CONTINUE
-* ****  *************
- 3000	CONTINUE
-	qstatus = QSTAT_UNKNOWN_QUERY
-	RETURN
-
-	END
diff --git a/fer/stk/is_attrib_val.F b/fer/stk/is_attrib_val.F
index 69e4cce..ad1320c 100644
--- a/fer/stk/is_attrib_val.F
+++ b/fer/stk/is_attrib_val.F
@@ -54,6 +54,8 @@
 *                  return info about coordinate-variables in datasets
 * V710 9/16  *acm* ticket 2465: Parsing expressions including attribute references.
 * 712 2/17 *sh* fix latent bug when shifting an array of attribute values
+* 73  7/17 *acm fix ticket 2555, memory allocated for strings determined by the 
+*               context, is not generally the full nvatts, ngatts etc
 
         include 'tmap_dims.parm'
 #       include "tmap_dset.parm"
@@ -108,7 +110,10 @@
  100	CONTINUE
 
 * reserve and catalog space for the result
-
+C       KMS - The ammount of memory allocated is from R_CGRID_SIZE_DELTA.
+C       R_CGRID_SIZE_DELTA uses the product over idim of
+C           cx_hi_ss(cx,idim - cx_lo_ss(cx,idim) / cx_delta(idim,cx)
+C       (using 1 if cx_delta not specified; yes, the index order change is correct)
 	CALL CREATE_TEMP_MEM_VAR( cx, mr, status )
 	IF ( status .NE. ferr_ok ) GOTO 5000
 
@@ -236,7 +241,8 @@
               IF (ngatts .GT. 0) THEN
                  CALL CD_GET_VAR_ID (dset, '.', varid, status)
 
-	         CALL INIT_C_STRING_ARRAY( ngatts,
+	         n = i2-i1+1
+		 CALL INIT_C_STRING_ARRAY( n,
      .				     memry(mr)%ptr,
      .				     mr_c_pointer(mr)    )
                  n = 0
@@ -344,7 +350,8 @@
               IF (STR_SAME(attname, 'attnames') .EQ. 0 ) THEN
                  IF (nvatts .GT. 0) THEN
 
-	           CALL INIT_C_STRING_ARRAY( nvatts,
+	           n = i2-i1+1
+		   CALL INIT_C_STRING_ARRAY( n,
      .				     memry(mr)%ptr,
      .				     mr_c_pointer(mr)    )
                    n = 0
@@ -363,8 +370,9 @@
 * Get the datset dimension names - not all dimensions are a coordinate variable.
 
                 IF (nvdims .GT. 0) THEN
-
-	           CALL INIT_C_STRING_ARRAY( nvdims,
+		
+	           n = i2-i1+1
+	           CALL INIT_C_STRING_ARRAY( n,
      .				     memry(mr)%ptr,
      .				     mr_c_pointer(mr)    )
                 IF (ds_type(dset).NE.'CDF' .AND. ds_type(dset).NE.'ECDF') GOTO 5200
diff --git a/fer/utl/get_unique_dset_name.F b/fer/utl/get_unique_dset_name.F
index c265c8f..ae51ff6 100644
--- a/fer/utl/get_unique_dset_name.F
+++ b/fer/utl/get_unique_dset_name.F
@@ -61,10 +61,10 @@
 * If no name, return.
 
 	 GET_UNIQUE_DSET_NAME = dset_name
-	 IF ( ds_name(dset) .EQ. char_init40 ) GOTO 120
+	 IF ( ds_name(dset) .EQ. char_init2048 ) GOTO 120
 
          DO 110 iset = 1,maxdsets
-           IF (ds_name(iset) .EQ. char_init1024) GOTO 110
+           IF (ds_name(iset) .EQ. char_init2048) GOTO 110
 	   IF (iset .EQ. dset) GOTO 110
 	   ic = STR_SAME (dset_name, ds_name(iset))
            IF (ic .EQ. 0) THEN
diff --git a/fer/utl/transfer_axis.F b/fer/utl/transfer_axis.F
index f4adaf4..ea61879 100644
--- a/fer/utl/transfer_axis.F
+++ b/fer/utl/transfer_axis.F
@@ -43,7 +43,7 @@
 * written for VAX computer under VMS operating system
 *
 * V200:  5/31/89 - extracted from TRANSFER_CONTEXT
-* $Id: transfer_axis.F 19184 2015-02-18 18:53:21Z ansley $ 
+* $Id$ 
 *       - *kob* need to now copy cx_calender as well
 * v580 *acm* 11/04 transfer cx_cal_id, the calendar ID used when  
 *                  computing world coordinates
diff --git a/fer/utl/transfer_cx_axis_to_uv.F b/fer/utl/transfer_cx_axis_to_uv.F
index 0568aca..6ddc582 100644
--- a/fer/utl/transfer_cx_axis_to_uv.F
+++ b/fer/utl/transfer_cx_axis_to_uv.F
@@ -39,7 +39,7 @@
 * NOAA/PMEL, Seattle, WA - Tropical Modeling and Analysis Program
 
 * V510 *sh*
-* $Id: transfer_cx_axis_to_uv.F 14256 2012-06-29 21:30:01Z ansley $ 
+* $Id$ 
 *       *acm* 3/12 6D Ferret (common uses nferdims in tmap_dims.parm)
 
 	include 'tmap_dims.parm'
diff --git a/fer/utl/transfer_uv_axis_to_uv.F b/fer/utl/transfer_uv_axis_to_uv.F
index 534a0b7..eecb313 100644
--- a/fer/utl/transfer_uv_axis_to_uv.F
+++ b/fer/utl/transfer_uv_axis_to_uv.F
@@ -39,7 +39,7 @@
 * NOAA/PMEL, Seattle, WA - Tropical Modeling and Analysis Program
 
 * V510 *sh*
-* $Id: transfer_uv_axis_to_uv.F 14256 2012-06-29 21:30:01Z ansley $ 
+* $Id$ 
 *       *acm* 3/12 cleanup ifdefs and unnecessary include files
 
 	include 'tmap_dims.parm'
diff --git a/fer/xeq/xeq_cancel.F b/fer/xeq/xeq_cancel.F
index 70a0bbb..a2094ab 100644
--- a/fer/xeq/xeq_cancel.F
+++ b/fer/xeq/xeq_cancel.F
@@ -358,7 +358,7 @@
 
 * ... check for valid number given
 	         IF ( iset .LT. 1 .OR. iset .GT. maxdsets ) GOTO 5030
-	         IF (  ds_name( iset ) .EQ. char_init1024) THEN
+	         IF (  ds_name( iset ) .EQ. char_init2048) THEN
 	            IF ( report_error ) THEN
 	               GOTO 5030
 	            ELSE
@@ -398,7 +398,7 @@
 * ... if only one set remains then point to it
 	   iset = unspecified_int4
 	   DO 715 i = 1, maxdsets
-	     IF ( ds_name(i) .EQ. char_init1024) GOTO 715
+	     IF ( ds_name(i) .EQ. char_init2048) GOTO 715
 	     IF ( iset .EQ. unspecified_int4 ) THEN
 	         iset = i
 	     ELSE
@@ -413,8 +413,8 @@
 ! an earlier version of this code prioritized the canceling of aggregations
 ! before other datasets.  Might be learning the hard way why this was so ...
 	   DO iset = 1, maxdsets
-	      IF ( ds_name(iset) .EQ. char_init1024) CYCLE
-	      CALL CANCEL_ONE_DATA_SET( iset, status )
+             IF ( ds_name(iset) .NE. char_init2048 )
+     .         CALL CANCEL_ONE_DATA_SET( iset, status )
 	   ENDDO
 
 	ELSE
@@ -488,7 +488,7 @@
 		    jrnl_lun = unspecified_int4
 * ... mode ppllist - restore PPLUS listings to screen
                  ELSEIF ( mode .EQ. pmode_ppllist ) THEN
-	            IF ( jrnl_lun .NE. 6 )
+	            IF ( lttout .NE. 6 )
      .                  CLOSE( UNIT=lttout, ERR = 5830 )
 		    lttout = 6
 * ... mode graticule - turn off automatic graticules
@@ -838,11 +838,11 @@
 	      CALL PURGE_MR_GRID(grid, status)
 	      IF ( status .NE. ferr_ok ) THEN
 	          CALL WARN( 'Not deleted: '//grid_name(grid))
-	          RETURN
+	          GOTO 1330
 	      ENDIF
 * ... grids created by data sets without associated vars may get deleted by
 *     PURGE_MR_GRID (e.g. handled as climatological_axes.cdf handles axes)
-	      IF (grid_name(grid) .EQ. char_init16) RETURN
+	      IF (grid_name(grid) .EQ. char_init16) GOTO 1330
 	   ENDIF
 * ... remove the grid if possible
 	   IF (grid_use_cnt(grid) .LE. 0) THEN
@@ -1116,10 +1116,12 @@ c	ENDIF
            IF ( redirect_stderr_flags .NE. redirect_none ) THEN
               redir_cancel_stderr = .TRUE.
            ENDIF
-           IF ( (.NOT. redir_cancel_stdout) .AND. 
-     .          (.NOT. redir_cancel_stderr) ) THEN
-              CALL WARN('No active redirects to cancel')
-           ENDIF
+*          Silently ignore cancellation of all redirects 
+*          when nothing redirected (primarily for shutdown).
+*           IF ( (.NOT. redir_cancel_stdout) .AND. 
+*     .          (.NOT. redir_cancel_stderr) ) THEN
+*              CALL WARN('No active redirects to cancel')
+*           ENDIF
         ENDIF
 *
         IF ( redir_cancel_stdout ) THEN
diff --git a/fer/xeq/xeq_exit.F b/fer/xeq/xeq_exit.F
index a68387a..efb7f4a 100644
--- a/fer/xeq/xeq_exit.F
+++ b/fer/xeq/xeq_exit.F
@@ -150,20 +150,14 @@
 * Exit to Ferret prompt or out of the ferret_dispatch loop
 	   pop = csp
 	   GOTO 400
-	ELSE IF (qual_given(slash_exit_topython) .GT. 0) THEN
-* Exit to the dispatch loop
-	   pop = csp
-	   GOTO 400
-	ELSE IF (qual_given(slash_exit_program) .GT. 0    .OR.
-     .  	  (qual_given(slash_exit_command) .GT. 0) .OR. 
-     .            .NOT. GO_FILE_INPUT()) THEN
+	ELSE IF ( (qual_given(slash_exit_program) .GT. 0) .OR.
+     .            (qual_given(slash_exit_command) .GT. 0) .OR. 
+     .            .NOT. GO_FILE_INPUT() ) THEN
 * Exit program completely 
 * *kob* new call to GO_FILE_INPUT to make sure were not in command file
-	   CALL CLSPPL		! close PLOT5
-           pplus_started = .FALSE.
-	   CALL TM_EXIT		! close TMAP data sets
+* *kms* 8/2017 - finalize_ferret handles all the shutdown details, 
+*                so do nothing here except use the first alternate return.
 	   RETURN 1
-!	   IF ( frame_on ) CALL MOVIE_CLOSE( frame_lun, status )! end movie
 	ELSE
 * no qualifier supplied on a "quit" in a command file: Exit current script
 	   CALL POP_CS
diff --git a/fer/xeq/xeq_go.F b/fer/xeq/xeq_go.F
index eb0bd88..6fb6f49 100644
--- a/fer/xeq/xeq_go.F
+++ b/fer/xeq/xeq_go.F
@@ -151,10 +151,6 @@
      .		STATUS='OLD',
      .		ERR=5010 )
 
-*  back out of yonghua's routine call because of 64bit problems *kob**     
-*        my_cbuff = cbuff
-*        CALL my_open(temp_lun,cbuff,LEN(cbuff),file_opened)
-*        if(file_opened.EQ.0) goto 5010
 * inform the control stack that it has taken control at a new level
 	CALL STACK_PTR_UP( csp, cs_max, status )
 	IF ( status .NE. ferr_ok ) GOTO 5000
diff --git a/fer/xeq/xeq_set.F b/fer/xeq/xeq_set.F
index 641b801..6e202f9 100644
--- a/fer/xeq/xeq_set.F
+++ b/fer/xeq/xeq_set.F
@@ -549,7 +549,7 @@ c *kob* 4/97
 	      IF   ( dset_num .LT. 1
      .	      .OR.   dset_num .GT. maxdsets
      .	      .OR.   dset_num .GT. max_gfdl_dsets )		GOTO 5110
-	      IF ( ds_name( dset_num ) .EQ. char_init1024)	GOTO 5110
+	      IF ( ds_name( dset_num ) .EQ. char_init2048)	GOTO 5110
 	      GOTO 745
 	   ENDIF
 
@@ -1098,7 +1098,7 @@ c *kob* 4/97
 	  IF (varid .GT. 0) CALL CD_RENAME_VAR(iset, varid, buff1, status)
 
 	   DO 1240 iset = 1, maxdsets
-	      IF ( ds_name(iset) .EQ. char_init1024) GOTO 1240
+	      IF ( ds_name(iset) .EQ. char_init2048) GOTO 1240
 	      CALL CD_GET_VAR_ID (iset, line_name(axis), varid, status )
               IF (varid .GT. 0) CALL CD_RENAME_VAR(iset, varid, buff1, status)
  1240	   CONTINUE
diff --git a/fer/xeq/xeq_show.F b/fer/xeq/xeq_show.F
index 7af4e1e..9fdced3 100644
--- a/fer/xeq/xeq_show.F
+++ b/fer/xeq/xeq_show.F
@@ -1139,7 +1139,7 @@ c                    ENDIF ! status from GET_SAVED_UVAR_AUX_INFO
      .			' Created by DEFINE VARIABLE:', 0)
 * ... locate the highest data set number in use
 	      DO 1035 i1 = maxdsets, 1, -1
-	         IF ( ds_name(i1) .NE. char_init1024) GOTO 1040
+	         IF ( ds_name(i1) .NE. char_init2048) GOTO 1040
  1035	      CONTINUE
  1040	      DO 1060 dset = 1, i1
 * ... loop through the currently initialized data sets
diff --git a/fmt/cmn/NCF_Util.h b/fmt/cmn/NCF_Util.h
index 233ab78..f5f1d48 100644
--- a/fmt/cmn/NCF_Util.h
+++ b/fmt/cmn/NCF_Util.h
@@ -56,6 +56,7 @@
 #define _NCF_UTIL_H_
 
 #include <netcdf.h>   /* for many NC_... values */
+#include "ferret.h"   /* for NFERDIMS and NFERDIMSP1 */
 
 /* .................... Defines ..................... */
 
@@ -79,18 +80,9 @@
 #define MAX_FER_SETNAME	256	 /* max length of a path */
 #define MAX_FER_SETNAME	256	 /* max length of a path */
 
-
 /* .................... Typedefs .................... */
 
 
-/* dataset */
-/*
-typedef struct  {			
-    char fername[MAX_FER_SETNAME];
-	int fer_dsetnum;
-} ncdset;
-*/
-
 typedef struct  {			/* dimension */
     char name[NC_MAX_NAME];
     size_t size;
@@ -172,11 +164,5 @@ typedef struct {     /* for uvars: grid/dataset pairs*/
         int auxVar[NFERDIMS];
 } uvarGrid;
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-
 #endif   /* _NCF_UTIL_H_ */
 
diff --git a/fmt/src/deleted_list.h b/fmt/cmn/deleted_list.h
similarity index 100%
rename from fmt/src/deleted_list.h
rename to fmt/cmn/deleted_list.h
diff --git a/fmt/cmn/ez_delimited_read.h b/fmt/cmn/ez_delimited_read.h
index a3b6fca..561ce66 100644
--- a/fmt/cmn/ez_delimited_read.h
+++ b/fmt/cmn/ez_delimited_read.h
@@ -1,3 +1,6 @@
+#ifndef _EZ_DELIMITED_READ_H_
+#define _EZ_DELIMITED_READ_H_
+
 /* delimitedRead.h
  *
  * Steve Hankin
@@ -7,12 +10,11 @@
  * by the Ferret program
  * v600 *acm* change call to days_from_day0 needed for 64-bit build
  *
- /*  *acm*  1/12      - Ferret 6.8 ifdef double_p for double-precision ferret.
+ *  *acm*  1/12      - Ferret 6.8 ifdef double_p for double-precision ferret.
 
   V701 7/16 *acm*   ticket 2450: add date-time and euro-date-time field types
                     ticket 2449: report incorrect choice of date/ eurodate as an error
  */
-#include "ferretmacros.h"
 
 #define FTYP_MISSING 1
 #define FTYP_NUMERIC 2
@@ -36,57 +38,9 @@ typedef struct _DelimFileInfo {
 } DelimFileInfo;
 
 
-char *nexstrtok(char *s1, char *s2);
-void analRec(char *recptr, char *delims, int* nfields, int field_type[],
-	    int max_fields);
-
-#ifdef double_p
-int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
-	      int nrec,
-	      double** numeric_fields, char*** text_fields, double bad_flags[], 
-	      int* status);
-int decode_file (char* fname, char *recptr, char *delims, int* skip,
-	       int *maxrec, int* reclen, int* nfields, int field_type[],
-	       int* nrec,
-	       double** numeric_fields, char*** text_fields, double bad_flags[], 
-	      int* status);
-
-double FORTRAN(days_from_day0) (double *days1900, int* iyr, int* imon, int* iday, double* rdum, 
-	      int* status);
+/* prototypes that use DelimFileInfo */
+void FORTRAN(save_delimited_info)(int *nfields, int field_type[], char *delims, DelimFileInfo **ptr);
+void FORTRAN(get_delimited_info)(int *nfields, int field_type[], char *delim, DelimFileInfo **ptr);
+void FORTRAN(delete_delimited_info)(DelimFileInfo **ptr);
 
-void FORTRAN(decode_file_jacket)
-		( char* fname, char *recptr, char *delims, int *skip,
-		  int* maxrec, int* reclen, int* nfields,
-		  int field_type[], int* nrec,
-		  int mrlist[], long* mr_ptrs_val,
-		  double mr_bad_flags[], char ***mr_c_ptr, int* status);
-#else
-int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
-	      int nrec,
-	      float** numeric_fields, char*** text_fields, float bad_flags[], 
-		  int* status);
-int decode_file (char* fname, char *recptr, char *delims, int* skip,
-	       int *maxrec, int* reclen, int* nfields, int field_type[],
-	       int* nrec,
-	       float** numeric_fields, char*** text_fields, float bad_flags[], 
-		   int* status);
-
-float FORTRAN(days_from_day0) (double *days1900, int* iyr, int* imon, int* iday, 
-	      float* rdum, int* status);
-
-void FORTRAN(decode_file_jacket)
-		( char* fname, char *recptr, char *delims, int *skip,
-		  int* maxrec, int* reclen, int* nfields,
-		  int field_type[], int* nrec,
-		  int mrlist[], int* mr_ptrs_val,
-		  float mr_bad_flags[], char ***mr_c_ptr, int* status);
 #endif
-
-int FORTRAN(anal_file) (char *fname, char *recptr, char *delims, int *skip,
-	     int *maxrec, int* reclen, int* nfields, int field_type[],
-	     int *max_fields);
-void FORTRAN(save_delimited_info) (int *nfields, int field_type[],
-				   char *delims, DelimFileInfo **ptr);
-void FORTRAN(get_delimited_info) (int *nfields, int field_type[],
-				   char *delim, DelimFileInfo **ptr);
-void FORTRAN(delete_delimited_info) (DelimFileInfo **ptr);
diff --git a/fmt/src/fbits.h b/fmt/cmn/fbits.h
similarity index 91%
rename from fmt/src/fbits.h
rename to fmt/cmn/fbits.h
index d860064..db60b99 100644
--- a/fmt/src/fbits.h
+++ b/fmt/cmn/fbits.h
@@ -2,7 +2,7 @@
  *   Copyright 1995, University Corporation for Atmospheric Research
  *   See top level COPYRIGHT file for copying and redistribution conditions.
  */
-/* $Id: fbits.h 9399 2006-04-25 19:48:34Z ansley $ */
+/* $Id$ */
 
 #ifndef _FBITS_H_
 #define _FBITS_H_
diff --git a/fmt/cmn/ferretmacros.h b/fmt/cmn/ferretmacros.h
deleted file mode 100644
index b295a27..0000000
--- a/fmt/cmn/ferretmacros.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ferretmacros.h in fmt/cmn 
-
-   Define macros for handling underscores on c-to-fortran calls
-   and the ifdef for double-precision Ferret.
-/* acm 12/2012 */
-
-/* Easier way of handling FORTRAN calls with underscore/no underscore */
-#ifndef FORTRAN
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-#endif
-
-/* Easier way of handling single/double floating-point declarations */
-
-#ifdef double_p
-#define DFTYPE double
-#else
-#define DFTYPE float
-#endif
-
-/* Also define the max number of dimensions in Ferret grids */
-
-#define NFERDIMS 6
-#define NFERDIMSP1 7
diff --git a/fmt/cmn/fmtprotos.h b/fmt/cmn/fmtprotos.h
new file mode 100644
index 0000000..1253a6b
--- /dev/null
+++ b/fmt/cmn/fmtprotos.h
@@ -0,0 +1,158 @@
+#ifndef _FMTPROTOS_H_
+#define _FMTPROTOS_H_
+
+/* Better if these were defined in only one include file, but .... */
+#ifndef FORTRAN
+#ifdef NO_ENTRY_NAME_UNDERSCORES
+#define FORTRAN(a) a
+#else
+#define FORTRAN(a) a##_
+#endif
+#endif
+
+#ifndef DFTYPE
+#ifdef double_p
+#define DFTYPE double
+#else
+#define DFTYPE float
+#endif
+#endif
+
+int  high_ver_name(char *name, char *path);
+int  string_array_hash(unsigned char *key, unsigned long int length, unsigned long int initval, int range);
+void tm_blockify_ferret_strings(char **mr_blk1, char *pblock, int bufsiz, int outstrlen);
+void tm_unblockify_ferret_strings(char **mr_blk1, char *pblock, int bufsiz, int filestrlen);
+
+int FORTRAN(anal_file)(char *fname, char *recptr, char *delims, int *skip, int *maxrec, 
+                       int* reclen, int* nfields, int field_type[], int *max_fields);
+void FORTRAN(cd_read_scale)(int *cdfid, int *varid, int *dims, DFTYPE *offset, DFTYPE *scale, DFTYPE* bad,
+                            int *tmp_start, int *tmp_count, int *tmp_stride, int *tmp_imap, 
+                            void *dat, int *permuted, int *strided, int *already_scaled, int *cdfstat, int *status);
+void FORTRAN(cd_read_sub)(int *cdfid, int *varid, int *dims, 
+                          int *tmp_start, int *tmp_count, int *tmp_stride, int *tmp_imap, 
+                          char **dat, int *permuted, int *strided, int *cdfstat);
+void FORTRAN(cd_write_att_dp_sub)(int *cdfid, int *varid, char* attname, int *attype, int *nval, void *val, int *status);
+void FORTRAN(cd_write_att_sub)(int *cdfid, int *varid, char* attname, int *attype, int *nval, void *val, int *status);
+void FORTRAN(cd_write_var_sub)(int *cdfid, int *varid, int *vartyp, int *dims, 
+                               int *tmp_start, int *tmp_count, int *strdim, void *dat, int *cdfstat);
+void FORTRAN(deleted_list_clear)(void **deleted_list_header);
+void FORTRAN(deleted_list_get_del)(void **deleted_list_header, int *result_array, int *result_array_size, int *num_indices);
+void FORTRAN(deleted_list_get_undel)(void **deleted_list_header, int *result_array, int *result_array_size, int *num_indices);
+void FORTRAN(deleted_list_init)(void **deleted_list_header, int *int_array, int *int_array_size, int *deleted_value);
+void FORTRAN(deleted_list_modify)(void **deleted_list_header, int *index, int *new_value);
+void FORTRAN(decode_file_jacket)(char* fname, char *recptr, char *delims, int *skip, int* maxrec, int* reclen, 
+                                 int* nfields, int field_type[], int* nrec, int mrlist[], DFTYPE ***mr_ptrs_ptr, 
+                                 DFTYPE mr_bad_flags[], char ***mr_c_ptr, int* status);
+void FORTRAN(str_case_blind_compare_sub)(char *test_name, int *len_test, char *model_name, int *len_model, int *result);
+void FORTRAN(str_dncase_sub)(char *out_string, int *out_len, char *in_string, int *in_len);
+void FORTRAN(string_array_clear)(void **string_array_header);
+void FORTRAN(string_array_find)(void **string_array_header, char *test_string, int *test_len, 
+                                int *result_array, int *result_array_size, int *num_indices);
+void FORTRAN(string_array_find_caseblind)(void **string_array_header, char *test_string, int *test_len, 
+                                          int *result_array, int *result_array_size, int *num_indices);
+void FORTRAN(string_array_find_exact)(void **string_array_header, char *test_string, int *test_len, 
+                                      int *result_array, int *result_array_size, int *num_indices);
+void FORTRAN(string_array_find_quoted)(void **string_array_header, char *test_string, int *test_len, 
+                                       int *result_array, int *result_array_size, int *num_indices);
+void FORTRAN(string_array_get_strlen)(void **string_array_header, int *index, int *true_strlen);
+void FORTRAN(string_array_get_strlen1)(void **string_array_header, int *index, int *true_strlen);
+void FORTRAN(string_array_init)(void **string_array_header, int *array_size, int *string_size, char *string_array);
+void FORTRAN(string_array_modify)(void **string_array_header, int *index, char *new_string, int *new_string_size);
+void FORTRAN(string_array_modify_upcase)(void **string_array_header, int *index, char *new_string, int *new_string_size);
+void FORTRAN(str_upcase_sub)(char *out_string, int *out_len, char *in_string, int* in_len);
+void FORTRAN(switch_nan)(DFTYPE *bad, DFTYPE *missing, DFTYPE *bad_val);
+int  FORTRAN(tm_break_fmt_date_c)(char *date, int *year, int *month, int *day, int *hour, int *minute, DFTYPE *second);
+void FORTRAN(tm_c_rename)(char *oldname, char *newname, int *status);
+char *FORTRAN(tm_c_ver_name)(char *name, char *next_name, char *path);
+int  FORTRAN(tm_check_inf)(DFTYPE *src);
+int  FORTRAN(tm_check_nan)(DFTYPE *src);
+void FORTRAN(tm_ep_time_convrt)(int *epjday, int *epmsec, int *mon, int *day, int *yr, int *hour, int *min, DFTYPE *sec);
+int  FORTRAN(tm_ftoc_readline)(char *prompt, char *buff);
+void FORTRAN(tm_get_strlen)(int *len_str, int *whole_len, char *in_string);
+void FORTRAN(tm_make_relative_ver)(char *curr_ver, char *fname, char *path, int *real_ver);
+void FORTRAN(tm_match_captial_name)(char *test_name, char *model_name, int *len_str, int *result);
+void FORTRAN(tm_number_sub)(char *string, int *result);
+void FORTRAN(tm_set_free_event)(int *n);
+double FORTRAN(tm_world_recur)(int *isubscript, int *iaxis, int *where_in_box, int *max_lines, 
+                               double line_mem[], int line_parent[], int line_class[], int line_dim[], 
+                               double line_start[], double line_delta[], int line_subsc1[], 
+                               int line_modulo[], double line_modulo_len[], int line_regular[]);
+int  FORTRAN(url_encode)(char *str, char *outstr, int *outlen);
+
+/* defined in NCF_Util.c */
+int  FORTRAN(ncf_inq_ds)( int *, int *, int *, int *, int *);
+int  FORTRAN(ncf_inq_ds_dims)( int *, int *, char *, int *, int *);
+int  FORTRAN(ncf_inq_var) (int *, int *, char *, int *, int *, int *, int *, int *, int *, int * );
+
+int  FORTRAN(ncf_inq_var_att)( int *, int *, int *, char *, int *, int *, int *, int *);
+
+int  FORTRAN(ncf_get_dsnum)( char * );
+int  FORTRAN(ncf_get_dsname)( int *, char *);
+int  FORTRAN(ncf_get_dim_id)( int *, char *);
+
+int  FORTRAN(ncf_get_var_name)( int *, int *, char *, int *);
+int  FORTRAN(ncf_get_var_id)( int *, int*, char *);
+int  FORTRAN(ncf_get_var_id_case)( int *, int*, char *);
+int  FORTRAN(ncf_get_var_axflag)( int *, int *, int *, int *);
+int  FORTRAN(ncf_get_var_attr_name) (int *, int *, int *, int *, char*);
+int  FORTRAN(ncf_get_var_attr_id) (int *, int *, char* , int*);
+int  FORTRAN(ncf_get_var_attr_id_case) (int *, int *, char* , int*);
+int  FORTRAN(ncf_get_var_attr) (int *, int *, char* , char* , int *, double *);
+int  FORTRAN(ncf_get_attr_from_id) (int *, int *, int * , int *, double* );
+
+int  FORTRAN(ncf_get_var_outflag) (int *, int *, int *);
+int  FORTRAN(ncf_get_var_outtype) (int *, int *, int *);
+int  FORTRAN(ncf_get_var_type) (int *, int *, int *);
+int  FORTRAN(ncf_get_var_uvflag) (int *, int *, int *);
+
+int  FORTRAN(ncf_init_uvar_dset)( int *);
+int  FORTRAN(ncf_init_uax_dset)( int *);
+void FORTRAN(ncf_datasets_list_clear)(void);
+int  FORTRAN(ncf_add_dset)( int *, int *, char *, char *);
+int  FORTRAN(ncf_init_other_dset)( int *, char *, char *);
+int  FORTRAN(ncf_delete_dset)( int *);
+int  FORTRAN(ncf_delete_var_att)( int *, int *, char *);
+int  FORTRAN(ncf_delete_var)( int *, char *);
+
+int  FORTRAN(ncf_add_var)( int *, int *, int *, int *, char *, char *, char *, double *);
+int  FORTRAN(ncf_add_coord_var)( int *, int *, int *, int *, char *, char *, double *);
+
+int  FORTRAN(ncf_add_var_num_att)( int *, int *, char *, int *, int *, int *, DFTYPE *);
+int  FORTRAN(ncf_add_var_num_att_dp)( int *, int *, char *, int *, int *, int *, double *);
+int  FORTRAN(ncf_add_var_str_att)( int *, int *, char *, int *, int *, int *, char *);
+
+int  FORTRAN(ncf_rename_var)( int *, int *, char *);
+int  FORTRAN(ncf_rename_dim)( int *, int *, char *);
+
+int  FORTRAN(ncf_repl_var_att)( int *, int *, char *, int *, int *, DFTYPE *, char *);
+int  FORTRAN(ncf_repl_var_att_dp)( int *, int *, char *, int *, int *, double *, char *);
+int  FORTRAN(ncf_set_att_flag)( int *, int *, char *, int *);
+int  FORTRAN(ncf_set_var_out_flag)( int *, int *, int *);
+int  FORTRAN(ncf_set_var_outtype)( int *, int *, int *);
+int  FORTRAN(ncf_set_axdir)(int *, int *, int *);
+int  FORTRAN(ncf_transfer_att)(int *, int *, int *, int *, int *);
+
+int  FORTRAN(ncf_init_agg_dset)( int *, char *);
+int  FORTRAN(ncf_add_agg_member)( int *, int *, int *);
+int  FORTRAN(ncf_get_agg_count)( int *, int *);
+int  FORTRAN(ncf_get_agg_member)( int *, int *, int *);
+int  FORTRAN(ncf_get_agg_var_info)( int *, int *, int *, int *, int *, int *, int *, int *);
+int  FORTRAN(ncf_put_agg_memb_grid)( int *, int *, int *, int *);
+
+/* uvar grid management functions */
+int  FORTRAN(ncf_free_uvar_grid_list)( int *, int *);
+int  FORTRAN(ncf_set_uvar_grid)( int *, int *, int *, int *, int *);
+int  FORTRAN(ncf_get_uvar_grid)( int *, int *, int *, int *, int *);
+int  FORTRAN(ncf_set_uvar_aux_info)( int *, int *, int *, int *, int *);
+int  FORTRAN(ncf_get_uvar_aux_info)( int *, int *, int *, int *, int *);
+int  FORTRAN(ncf_get_uvar_grid_list_len)( int *, int *, int *);
+int  FORTRAN(ncf_delete_uvar_grid)( int *, int *, int *);
+int  FORTRAN(ncf_next_uvar_grid_in_list)( int *, int *, int *, int *);
+
+/* Fortran functions called by C functions */
+int  FORTRAN(free_time)(void);
+int  FORTRAN(tm_its_subspan_modulo_int)(int *axis);
+void FORTRAN(tm_ww_axlims)(int *axis, double *lo, double *hi);
+double FORTRAN(tm_modulo_axlen)(int *axis);
+
+#endif
diff --git a/fmt/src/string_array.h b/fmt/cmn/string_array.h
similarity index 95%
rename from fmt/src/string_array.h
rename to fmt/cmn/string_array.h
index a1c0084..27f3d99 100644
--- a/fmt/src/string_array.h
+++ b/fmt/cmn/string_array.h
@@ -58,6 +58,10 @@
    };
    typedef struct String_Array_Header SA_Head;
 
+/*
+ * The following is only good for English ANSI characters.
+ * Instead, toupper should be used; but leaving it for now.
+ */
 #define uc(a) ((a>='a'&&a<='z')?((a)&0xDF):(a))
 
 #endif /*_STRING_ARRAY.H_*/
diff --git a/fmt/src/NCF_Util.c b/fmt/src/NCF_Util.c
index d16f078..e61aca1 100644
--- a/fmt/src/NCF_Util.c
+++ b/fmt/src/NCF_Util.c
@@ -99,9 +99,6 @@
 /* *kms* 8/16         Rework the entire file to remove memory leaks and improve consistent initialization */
 /* *acm* 10/16        ncf_get_uvar_grid now returns the datatype as well as the grid  */
 
-
-#include "ferretmacros.h"
-
 #include <stddef.h>             /* size_t, ptrdiff_t; gfortran on linux rh5*/
 #include <wchar.h>
 #include <unistd.h>             /* for convenience */
@@ -113,88 +110,17 @@
 #include <sys/types.h>          /* required for some of our prototypes */
 #include <sys/stat.h>
 #include <sys/errno.h>
+#include <netcdf.h>
 
-#include "netcdf.h"
-#include "nc.h"
+#include "fmtprotos.h"
 #include "list.h"               /* locally added list library */
 #include "NCF_Util.h"
+#include "FerMem.h"
 
 /* List of all datasets (static, so only visible locally) */
 static LIST *GLOBAL_ncdsetList = NULL;
 
-/* .... Functions called by Ferret .... */
-int  FORTRAN(ncf_inq_ds)( int *, int *, int *, int *, int *);
-int  FORTRAN(ncf_inq_ds_dims)( int *, int *, char *, int *, int *);
-int  FORTRAN(ncf_inq_var) (int *, int *, char *, int *, int *, int *, int *, int *, int *, int * );
-
-int  FORTRAN(ncf_inq_var_att)( int *, int *, int *, char *, int *, int *, int *, int *);
-
-int  FORTRAN(ncf_get_dsnum)( char * );
-int  FORTRAN(ncf_get_dsname)( int *, char *);
-int  FORTRAN(ncf_get_dim_id)( int *, char *);
-
-int  FORTRAN(ncf_get_var_name)( int *, int *, char *, int *);
-int  FORTRAN(ncf_get_var_id)( int *, int*, char *);
-int  FORTRAN(ncf_get_var_id_case)( int *, int*, char *);
-int  FORTRAN(ncf_get_var_axflag)( int *, int *, int *, int *);
-int  FORTRAN(ncf_get_var_attr_name) (int *, int *, int *, int *, char*);
-int  FORTRAN(ncf_get_var_attr_id) (int *, int *, char* , int*);
-int  FORTRAN(ncf_get_var_attr_id_case) (int *, int *, char* , int*);
-int  FORTRAN(ncf_get_var_attr) (int *, int *, char* , char* , int *, double *);
-int  FORTRAN(ncf_get_var_attr) (int *, int *, char* , char* , int *, double *);
-int  FORTRAN(ncf_get_attr_from_id) (int *, int *, int * , int *, double* );
-
-int  FORTRAN(ncf_get_var_outflag) (int *, int *, int *);
-int  FORTRAN(ncf_get_var_outtype) (int *, int *, int *);
-int  FORTRAN(ncf_get_var_type) (int *, int *, int *);
-int  FORTRAN(ncf_get_var_uvflag) (int *, int *, int *);
-
-int  FORTRAN(ncf_init_uvar_dset)( int *);
-int  FORTRAN(ncf_init_uax_dset)( int *);
-void FORTRAN(ncf_datasets_list_clear)(void);
-int  FORTRAN(ncf_add_dset)( int *, int *, char *, char *);
-int  FORTRAN(ncf_init_other_dset)( int *, char *, char *);
-int  FORTRAN(ncf_delete_dset)( int *);
-int  FORTRAN(ncf_delete_var_att)( int *, int *, char *);
-int  FORTRAN(ncf_delete_var)( int *, char *);
-
-int  FORTRAN(ncf_add_var)( int *, int *, int *, int *, char *, char *, char *, double *);
-int  FORTRAN(ncf_add_coord_var)( int *, int *, int *, int *, char *, char *, double *);
-
-int  FORTRAN(ncf_add_var_num_att)( int *, int *, char *, int *, int *, int *, DFTYPE *);
-int  FORTRAN(ncf_add_var_num_att_dp)( int *, int *, char *, int *, int *, int *, double *);
-int  FORTRAN(ncf_add_var_str_att)( int *, int *, char *, int *, int *, int *, char *);
-
-int  FORTRAN(ncf_rename_var)( int *, int *, char *);
-int  FORTRAN(ncf_rename_dim)( int *, int *, char *);
-
-int  FORTRAN(ncf_repl_var_att)( int *, int *, char *, int *, int *, DFTYPE *, char *);
-int  FORTRAN(ncf_repl_var_att_dp)( int *, int *, char *, int *, int *, double *, char *);
-int  FORTRAN(ncf_set_att_flag)( int *, int *, char *, int *);
-int  FORTRAN(ncf_set_var_out_flag)( int *, int *, int *);
-int  FORTRAN(ncf_set_var_outtype)( int *, int *, int *);
-int  FORTRAN(ncf_set_axdir)(int *, int *, int *);
-int  FORTRAN(ncf_transfer_att)(int *, int *, int *, int *, int *);
-
-int  FORTRAN(ncf_init_agg_dset)( int *, char *);
-int  FORTRAN(ncf_add_agg_member)( int *, int *, int *);
-int  FORTRAN(ncf_get_agg_count)( int *, int *);
-int  FORTRAN(ncf_get_agg_member)( int *, int *, int *);
-int  FORTRAN(ncf_get_agg_var_info)( int *, int *, int *, int *, int *, int *, int *, int *);
-int  FORTRAN(ncf_put_agg_memb_grid)( int *, int *, int *, int *);
-
-/* uvar grid management functions */
-int  FORTRAN(ncf_free_uvar_grid_list)( int *, int *);
-int  FORTRAN(ncf_set_uvar_grid)( int *, int *, int *, int *, int *);
-int  FORTRAN(ncf_get_uvar_grid)( int *, int *, int *, int *, int *);
-int  FORTRAN(ncf_set_uvar_aux_info)( int *, int *, int *, int *, int *);
-int  FORTRAN(ncf_get_uvar_aux_info)( int *, int *, int *, int *, int *);
-int  FORTRAN(ncf_get_uvar_grid_list_len)( int *, int *, int *);
-int  FORTRAN(ncf_delete_uvar_grid)( int *, int *, int *);
-int  FORTRAN(ncf_next_uvar_grid_in_list)( int *, int *, int *, int *);
-
 /* .... Functions only called internally (thus static) .... */
-
 static ncdset *ncf_get_ds_ptr(int *);
 static LIST *ncf_get_ds_varlist(int *);
 static ncvar *ncf_get_ds_var_ptr(int *, int *);
@@ -448,7 +374,7 @@ int FORTRAN(ncf_get_var_name)( int *dset, int* ivar, char* string, int* len_name
         return ATOM_NOT_FOUND;
 
     strcpy(string, var_ptr->name);
-	*len_name = strlen(string);
+    *len_name = strlen(string);
 
     return FERR_OK;
 }
@@ -799,7 +725,7 @@ int FORTRAN(ncf_init_uvar_dset)( int *setnum )
     var.outtype = NC_CHAR;
     var.varid = 0;
     var.natts = 1;
-    var.varattlist = list_init();
+    var.varattlist = list_init(__FILE__, __LINE__);
     if ( var.varattlist == NULL ) {
         fprintf(stderr, "ERROR: ncf_init_uvar_dset: Unable to initialize GLOBAL attributes list.\n");
         return -1;
@@ -811,31 +737,31 @@ int FORTRAN(ncf_init_uvar_dset)( int *setnum )
     att.outtype = NC_CHAR;
     att.len = 21;
     strcpy(att.name, "FerretUserVariables" );
-    att.string = (char*)malloc(2*sizeof(char));
+    att.string = (char*)FerMem_Malloc(2*sizeof(char), __FILE__, __LINE__);
     strcpy(att.string, " ");
 
     /* Save attribute in linked list of attributes for variable */
-    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
 
     /* global attributes list complete */
 
     /*Save variable in linked list of variables for this dataset */
-    nc.dsetvarlist = list_init();
+    nc.dsetvarlist = list_init(__FILE__, __LINE__);
     if ( nc.dsetvarlist == NULL ) {
         fprintf(stderr, "ERROR: ncf_init_uvar_dset: Unable to initialize variable list.\n");
         return -1;
     }
-    list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar));
+    list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar), __FILE__, __LINE__);
 
     /* Add dataset to global nc dataset linked list*/
     if ( GLOBAL_ncdsetList == NULL ) {
-        GLOBAL_ncdsetList = list_init();
+        GLOBAL_ncdsetList = list_init(__FILE__, __LINE__);
         if ( GLOBAL_ncdsetList == NULL ) {
             fprintf(stderr, "ERROR: ncf_init_uvar_dset: Unable to initialize GLOBAL_ncDsetList.\n");
             return -1;
         }
     }
-    list_insert_after(GLOBAL_ncdsetList, (char *) &nc, sizeof(ncdset));
+    list_insert_after(GLOBAL_ncdsetList, (char *) &nc, sizeof(ncdset), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -871,36 +797,36 @@ int FORTRAN(ncf_init_uax_dset)( int *setnum )
     att.outtype = NC_CHAR;
     att.len = 21;
     strcpy(att.name, "FerretUserCoordVariables" );
-    att.string = (char*)malloc(2*sizeof(char));
+    att.string = (char*)FerMem_Malloc(2*sizeof(char), __FILE__, __LINE__);
     strcpy(att.string, " ");
 
     /* Save attribute in linked list of attributes. */
-    var.varattlist = list_init();
+    var.varattlist = list_init(__FILE__, __LINE__);
     if ( var.varattlist == NULL ) {
         fprintf(stderr, "ERROR: ncf_init_uax_dset: Unable to initialize GLOBAL attributes list.\n");
         return -1;
     }
-    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
 
     /* global attributes list complete */
 
     /* Save variable in linked list of variables for this dataset */
-    nc.dsetvarlist = list_init();
+    nc.dsetvarlist = list_init(__FILE__, __LINE__);
     if ( nc.dsetvarlist == NULL ) {
         fprintf(stderr, "ERROR: ncf_init_uax_dset: Unable to initialize variable list.\n");
         return -1;
     }
-    list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar));
+    list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar), __FILE__, __LINE__);
 
     /* Add dataset to global nc dataset linked list*/
     if ( GLOBAL_ncdsetList == NULL ) {
-        GLOBAL_ncdsetList = list_init();
+        GLOBAL_ncdsetList = list_init(__FILE__, __LINE__);
         if ( GLOBAL_ncdsetList == NULL ) {
             fprintf(stderr, "ERROR: ncf_init_uax_dset: Unable to initialize GLOBAL_ncDsetList.\n");
             return -1;
         }
     }
-    list_insert_after(GLOBAL_ncdsetList, (char *) &nc, sizeof(ncdset));
+    list_insert_after(GLOBAL_ncdsetList, (char *) &nc, sizeof(ncdset), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -952,7 +878,7 @@ int FORTRAN(ncf_add_dset)( int *ncid, int *setnum, char name[], char path[] )
     }
 
     /* Go ahead and create the variable list - dataset with nothing not very likely */
-    nc.dsetvarlist = list_init();
+    nc.dsetvarlist = list_init(__FILE__, __LINE__);
     if ( nc.dsetvarlist == NULL ) {
         fprintf(stderr, "ERROR: ncf_add_dset: Unable to initialize variable list.\n");
         return -1;
@@ -972,7 +898,7 @@ int FORTRAN(ncf_add_dset)( int *ncid, int *setnum, char name[], char path[] )
         var.ndims = 1;
         var.dims[0] = 1;
         /* Create the list of attributes since there are going to be attributes added */
-        var.varattlist = list_init();
+        var.varattlist = list_init(__FILE__, __LINE__);
         if ( var.varattlist == NULL ) {
             fprintf(stderr, "ERROR: ncf_add_dset: Unable to initialize GLOBAL attributes list.\n");
             return -1;
@@ -996,19 +922,19 @@ int FORTRAN(ncf_add_dset)( int *ncid, int *setnum, char name[], char path[] )
                         att.type = NC_CHAR;
                         att.outtype = NC_CHAR;
                         att.len = 1;
-                        att.string = (char *) malloc(2* sizeof(char));
+                        att.string = (char *) FerMem_Malloc(2* sizeof(char), __FILE__, __LINE__);
                         strcpy(att.string, " ");
                     }
                     else {
                         switch (att.type) {
                         case NC_CHAR:
-                            att.string = (char *) malloc((att.len+1)* sizeof(char));
+                            att.string = (char *) FerMem_Malloc((att.len+1)* sizeof(char), __FILE__, __LINE__);
                             nc_status = nc_get_att_text(*ncid, NC_GLOBAL, att.name, att.string);
                             if ( nc_status != NC_NOERR )
                                 return nc_status;
                             break;
                         default:
-                            att.vals = (double *) malloc(att.len * sizeof(double));
+                            att.vals = (double *) FerMem_Malloc(att.len * sizeof(double), __FILE__, __LINE__);
                             nc_status = nc_get_att_double(*ncid, NC_GLOBAL, att.name, att.vals);
                             if ( nc_status != NC_NOERR )
                                 return nc_status;
@@ -1018,11 +944,11 @@ int FORTRAN(ncf_add_dset)( int *ncid, int *setnum, char name[], char path[] )
                 }    /* end of the    if (nc_status == NC_NOERR) */
             }
             /*Save attribute in linked list of attributes for variable . (global attributes)*/
-            list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+            list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
         }        /* global attributes list complete */
 
         /*Save variable in linked list of variables for this dataset */
-        list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar));
+        list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar), __FILE__, __LINE__);
     }
 
     /* get info on variables */
@@ -1102,7 +1028,7 @@ int FORTRAN(ncf_add_dset)( int *ncid, int *setnum, char name[], char path[] )
         var.all_outflag = 1;
 
         /* Go ahead and create the list for variable attributes */
-        var.varattlist = list_init();
+        var.varattlist = list_init(__FILE__, __LINE__);
         if ( var.varattlist == NULL ) {
             fprintf(stderr, "ERROR: ncf_add_dset: Unable to initialize variable attributes list.\n");
             return -1;
@@ -1126,14 +1052,14 @@ int FORTRAN(ncf_add_dset)( int *ncid, int *setnum, char name[], char path[] )
                         att.type = NC_CHAR;
                         att.outtype = NC_CHAR;
                         att.len = 1;
-                        att.string = (char *) malloc(2*sizeof(char));
+                        att.string = (char *) FerMem_Malloc(2*sizeof(char), __FILE__, __LINE__);
                         strcpy(att.string," ");
                     }
                     else {
                         switch ( att.type ) {
                         case NC_CHAR:
                             /* Plus one for end-of-string delimiter. */
-                            att.string = (char *) malloc((att.len+1)*sizeof(char));
+                            att.string = (char *) FerMem_Malloc((att.len+1)*sizeof(char), __FILE__, __LINE__);
                             strcpy (att.string, " ");
                             nc_status = nc_get_att_text(*ncid, iv, att.name, att.string);
                             if ( nc_status != NC_NOERR ) {    /* on error set attr to empty string*/
@@ -1163,15 +1089,15 @@ int FORTRAN(ncf_add_dset)( int *ncid, int *setnum, char name[], char path[] )
 #else
                             att.outtype = NC_FLOAT;
 #endif
-                            att.vals = (double *) malloc(att.len * sizeof(double));
+                            att.vals = (double *) FerMem_Malloc(att.len * sizeof(double), __FILE__, __LINE__);
                             nc_status = nc_get_att_double(*ncid, iv, att.name, att.vals);
                             if ( nc_status != NC_NOERR ) {    /* on error set attr to empty string*/
-                                free(att.vals);
+                                FerMem_Free(att.vals, __FILE__, __LINE__);
                                 att.vals = NULL;
                                 att.type = NC_CHAR;
                                 att.outtype = NC_CHAR;
                                 att.len = 1;
-                                att.string = (char *) malloc((att.len+1)* sizeof(char));
+                                att.string = (char *) FerMem_Malloc((att.len+1)* sizeof(char), __FILE__, __LINE__);
                                 strcpy (att.string, " ");
                                 return_val = bad_file_attr;
                             }
@@ -1188,7 +1114,7 @@ int FORTRAN(ncf_add_dset)( int *ncid, int *setnum, char name[], char path[] )
             }
 
             /*Save attribute in linked list of attributes for this variable */
-            list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+            list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
         }        /* variable attributes from file complete */
 
         /* If this is a coordinate variable, add an attribute orig_file_axname which
@@ -1201,7 +1127,7 @@ int FORTRAN(ncf_add_dset)( int *ncid, int *setnum, char name[], char path[] )
             att.attid = ia+1;
             att.type = NC_CHAR;
             att.len = strlen(var.name);
-            att.string = (char *) malloc((att.len+1)*sizeof(char));
+            att.string = (char *) FerMem_Malloc((att.len+1)*sizeof(char), __FILE__, __LINE__);
             strcpy (att.string,var.name);
 
             /* Ensure end-of-string delimiter because Netcdf API doesn't store automatically; it's up to the file's author. */
@@ -1211,22 +1137,22 @@ int FORTRAN(ncf_add_dset)( int *ncid, int *setnum, char name[], char path[] )
             att.outflag = -1;
 
             /*Save attribute in linked list of attributes for this variable */
-            list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+            list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
         }
 
         /*Save variable in linked list of variables for this dataset */
-        list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar));
+        list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar), __FILE__, __LINE__);
     }        /* variables list complete */
 
     /* Add dataset to global nc dataset linked list*/
     if ( GLOBAL_ncdsetList == NULL ) {
-        GLOBAL_ncdsetList = list_init();
+        GLOBAL_ncdsetList = list_init(__FILE__, __LINE__);
         if ( GLOBAL_ncdsetList == NULL ) {
             fprintf(stderr, "ERROR: ncf_add_dset: Unable to initialize GLOBAL_ncDsetList.\n");
             return -1;
         }
     }
-    list_insert_after(GLOBAL_ncdsetList, (char *) &nc, sizeof(ncdset));
+    list_insert_after(GLOBAL_ncdsetList, (char *) &nc, sizeof(ncdset), __FILE__, __LINE__);
 
     return return_val;
 }
@@ -1265,36 +1191,36 @@ int FORTRAN(ncf_init_other_dset)( int *setnum, char name[], char path[] )
     att.attid = 1;
     att.len = strlen(name);
     strcpy(att.name, "history");
-    att.string = (char *) malloc((att.len+1)* sizeof(char));
+    att.string = (char *) FerMem_Malloc((att.len+1)* sizeof(char), __FILE__, __LINE__);
     strcpy(att.string, name);
 
     /* Save attribute in linked list of attributes for variable */
-    var.varattlist = list_init();
+    var.varattlist = list_init(__FILE__, __LINE__);
     if ( var.varattlist == NULL ) {
         fprintf(stderr, "ERROR: ncf_init_other_dset: Unable to initialize GLOBAL attributes list.\n");
         return -1;
     }
-    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
 
     /* global attributes list complete */
 
     /*Save variable in linked list of variables for this dataset */
-    nc.dsetvarlist = list_init();
+    nc.dsetvarlist = list_init(__FILE__, __LINE__);
     if ( nc.dsetvarlist == NULL ) {
         fprintf(stderr, "ERROR: ncf_init_uvar_dset: Unable to initialize variable list.\n");
         return -1;
     }
-    list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar));
+    list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar), __FILE__, __LINE__);
 
     /* Add dataset to global nc dataset linked list */
     if ( GLOBAL_ncdsetList == NULL ) {
-        GLOBAL_ncdsetList = list_init();
+        GLOBAL_ncdsetList = list_init(__FILE__, __LINE__);
         if ( GLOBAL_ncdsetList == NULL ) {
             fprintf(stderr, "ERROR: ncf_init_uvar_dset: Unable to initialize GLOBAL_ncDsetList.\n");
             return -1;
         }
     }
-    list_insert_after(GLOBAL_ncdsetList, (char *) &nc, sizeof(ncdset));
+    list_insert_after(GLOBAL_ncdsetList, (char *) &nc, sizeof(ncdset), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -1372,14 +1298,16 @@ static void ncf_free_attribute( char *attptr ) {
 
     att = (ncatt *)attptr;
     if ( att->string != NULL ) {
-        free(att->string);
+        FerMem_Free(att->string, __FILE__, __LINE__);
         att->string = NULL;
     }
     if ( att->vals != NULL ) {
-        free(att->vals);
+        FerMem_Free(att->vals, __FILE__, __LINE__);
         att->vals = NULL;
     }
-    free(att);
+    /* paranoia */
+    memset(att, 0, sizeof(ncatt));
+    FerMem_Free(att, __FILE__, __LINE__);
 }
 
 /* ----
@@ -1396,7 +1324,7 @@ static void ncf_free_attlist( ncvar* varptr )
      * Free the attribute list using ncf_free_attribute
      * to free each data element in the list
      */
-    list_free(varptr->varattlist, ncf_free_attribute);
+    list_free(varptr->varattlist, ncf_free_attribute, __FILE__, __LINE__);
     varptr->varattlist = NULL;
     varptr->natts = 0;
 }
@@ -1434,17 +1362,20 @@ static void ncf_free_variable( char *varptr )
     var = (ncvar *)varptr;
     /* Free the list of attributes */
     ncf_free_attlist(var);
+    /* Free the list of ncagg_var_descr */
     if ( var->varagglist != NULL ) {
-        list_free(var->varagglist, LIST_DEALLOC);
+        list_free(var->varagglist, LIST_DEALLOC, __FILE__, __LINE__);
         var->varagglist = NULL;
     }
     /* Free the list of uvarGrids */
     if ( var->uvarGridList != NULL ) {
-        list_free(var->uvarGridList, LIST_DEALLOC);
+        list_free(var->uvarGridList, LIST_DEALLOC, __FILE__, __LINE__);
         var->uvarGridList = NULL;
     }
-    /* Free thr variable itself */
-    free(var);
+    /* paranoia */
+    memset(var, 0, sizeof(ncvar));
+    /* Free the variable itself */
+    FerMem_Free(var, __FILE__, __LINE__);
 }
 
 /* ----
@@ -1468,21 +1399,27 @@ static void ncf_init_dataset( ncdset *dset_ptr )
 static void ncf_free_dataset( char *nc_ptr )
 {
     ncdset *nc;
-    LIST *varlist;
 
     if ( nc_ptr == NULL )
         return;
     nc = (ncdset *) nc_ptr;
 
     /* Free the ncvar's associated with this dataset */
-    varlist = nc->dsetvarlist;
-    list_free(varlist, ncf_free_variable);
-    nc->dsetvarlist = NULL;
-    nc->nvars = 0;
-    nc->ngatts = 0;
+    if ( nc->dsetvarlist != NULL ) {
+       list_free(nc->dsetvarlist, ncf_free_variable, __FILE__, __LINE__);
+       nc->dsetvarlist = NULL;
+    }
 
+    /* Free any ncagg structs about aggregated dataset members */
+    if ( nc->agg_dsetlist != NULL ) {
+       list_free(nc->agg_dsetlist, LIST_DEALLOC, __FILE__, __LINE__);
+       nc->agg_dsetlist = NULL;
+    }
+
+    /* paranoia */
+    memset(nc, 0, sizeof(ncdset));
     /* Free the ncdset itself */
-    free(nc);
+    FerMem_Free(nc, __FILE__, __LINE__);
 }
 
 /* ----
@@ -1491,8 +1428,10 @@ static void ncf_free_dataset( char *nc_ptr )
  */
 void FORTRAN(ncf_datasets_list_clear)( void )
 {
-     list_free(GLOBAL_ncdsetList, ncf_free_dataset);
-     GLOBAL_ncdsetList = NULL;
+    if ( GLOBAL_ncdsetList != NULL ) {
+        list_free(GLOBAL_ncdsetList, ncf_free_dataset, __FILE__, __LINE__);
+        GLOBAL_ncdsetList = NULL;
+    }
 }
 
 /* ----
@@ -1501,7 +1440,6 @@ void FORTRAN(ncf_datasets_list_clear)( void )
 int FORTRAN(ncf_delete_dset)( int *dset )
 {
     ncdset *nc_ptr;
-    LIST *varlist;
 
     /* Find the dataset */
     nc_ptr = ncf_get_ds_ptr(dset);
@@ -1509,20 +1447,30 @@ int FORTRAN(ncf_delete_dset)( int *dset )
         return ATOM_NOT_FOUND;
 
     /* Free the list of variables for this dataset */
-    varlist = nc_ptr->dsetvarlist;
-    list_free(varlist, ncf_free_variable);
-    nc_ptr->dsetvarlist = NULL;
+    if ( nc_ptr->dsetvarlist != NULL ) {
+        list_free(nc_ptr->dsetvarlist, ncf_free_variable, __FILE__, __LINE__);
+        nc_ptr->dsetvarlist = NULL;
+    }
     nc_ptr->nvars = 0;
     nc_ptr->ngatts = 0;
 
+    /* Free any ncagg structs about aggregated dataset members */
+    if ( nc_ptr->agg_dsetlist != NULL ) {
+       list_free(nc_ptr->agg_dsetlist, LIST_DEALLOC, __FILE__, __LINE__);
+       nc_ptr->agg_dsetlist = NULL;
+    }
+    nc_ptr->num_agg_members = 0;
+
     /* Remove the dataset from dataset list */
-    if ( nc_ptr != (ncdset *) list_remove_curr(GLOBAL_ncdsetList) ) {
+    if ( nc_ptr != (ncdset *) list_remove_curr(GLOBAL_ncdsetList, __FILE__, __LINE__) ) {
         fprintf(stderr, "ERROR: ncf_delete_dset: Unexpected mismatch of current dataset in global list.\n");
         return -1;
     }
 
+    /* paranoia */
+    memset(nc_ptr, 0, sizeof(ncdset));
     /* Free the ncdset itself */
-    free(nc_ptr);
+    FerMem_Free(nc_ptr, __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -1542,7 +1490,6 @@ int FORTRAN(ncf_add_var)( int *dset, int *varid, int *type, int *coordvar,
     int status;
     int newvar;
     LIST *vlist;
-    LIST_ELEMENT *lp;
 
     /*
      * Get the dataset pointer.
@@ -1603,7 +1550,7 @@ int FORTRAN(ncf_add_var)( int *dset, int *varid, int *type, int *coordvar,
     var.is_axis = *coordvar;
 
     /* Set up initial set of attributes*/
-    var.varattlist = list_init();
+    var.varattlist = list_init(__FILE__, __LINE__);
     if ( var.varattlist == NULL ) {
         fprintf(stderr, "ERROR: ncf_add_var: Unable to initialize attributes list.\n");
         return -1;
@@ -1621,10 +1568,10 @@ int FORTRAN(ncf_add_var)( int *dset, int *varid, int *type, int *coordvar,
     att.attid = var.natts;
     att.outflag = 1;
     att.len = strlen(title);
-    att.string = (char *) malloc((att.len+1)* sizeof(char));
+    att.string = (char *) FerMem_Malloc((att.len+1)* sizeof(char), __FILE__, __LINE__);
     strcpy(att.string, title);
     /* Save attribute in linked list of attributes for this variable */
-    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
 
     /* Now the units, if given
      * For the units string, allocate one more than the att.len,
@@ -1639,10 +1586,10 @@ int FORTRAN(ncf_add_var)( int *dset, int *varid, int *type, int *coordvar,
         att.outflag = 1;
         att.type = NC_CHAR;
         att.outtype = NC_CHAR;
-        att.string = (char *) malloc((att.len+1)* sizeof(char));
+        att.string = (char *) FerMem_Malloc((att.len+1)* sizeof(char), __FILE__, __LINE__);
         strcpy(att.string, units);
         /* Save attribute in linked list of attributes for this variable */
-        list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+        list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
     }
 
     /* Now the missing_value, for numeric variables */
@@ -1659,19 +1606,19 @@ int FORTRAN(ncf_add_var)( int *dset, int *varid, int *type, int *coordvar,
     att.type = NC_FLOAT;
     att.outtype = NC_FLOAT;
 #endif
-    att.vals = (double *) malloc(att.len * sizeof(double));
+    att.vals = (double *) FerMem_Malloc(att.len * sizeof(double), __FILE__, __LINE__);
     att.vals[0] = *bad;
     /* Initialize output flag. Attributes written by default by Ferret
      * will be set to outflag = 1.
      */
     att.outflag = initialize_output_flag (att.name, var.is_axis);
     /*Save attribute in linked list of attributes for this variable */
-    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
 
     /* If this is an aggregate dataset, initialize the list of member-info
      * for the variable. The values will be filled in later.
      */
-    var.varagglist = list_init();
+    var.varagglist = list_init(__FILE__, __LINE__);
     if ( var.varagglist == NULL ) {
         fprintf(stderr, "ERROR: ncf_add_var: Unable to initialize aggregate info list.\n");
         return -1;
@@ -1679,11 +1626,11 @@ int FORTRAN(ncf_add_var)( int *dset, int *varid, int *type, int *coordvar,
 
     vdescr.imemb = 0;
     vdescr.gnum = 0;
-    list_insert_after(var.varagglist, (char *) &vdescr, sizeof(ncatt));
+    list_insert_after(var.varagglist, (char *) &vdescr, sizeof(ncagg_var_descr), __FILE__, __LINE__);
 
     /* if it's a uvar, then initialize a grid LIST for it */
     if ( var.uvarid != 0 ) {
-        var.uvarGridList = list_init();
+        var.uvarGridList = list_init(__FILE__, __LINE__);
         if ( var.uvarGridList == NULL ) {
             fprintf(stderr, "ERROR: ncf_add_var: Unable to initialize uvar grid list.\n");
             return -1;
@@ -1692,7 +1639,7 @@ int FORTRAN(ncf_add_var)( int *dset, int *varid, int *type, int *coordvar,
 
     /* Save variable in linked list of variables for this dataset */
     list_mvrear(nc_ptr->dsetvarlist);
-    list_insert_after(nc_ptr->dsetvarlist, (char *) &var, sizeof(ncvar));
+    list_insert_after(nc_ptr->dsetvarlist, (char *) &var, sizeof(ncvar), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -1733,7 +1680,7 @@ int FORTRAN(ncf_add_coord_var)( int *dset, int *varid, int *type, int *coordvar,
          * If this variable is not new, remove the old definition of it.
          * Do not decrement varids or nvars !
          */
-        var_ptr = (ncvar *) list_remove_curr(vlist);
+        var_ptr = (ncvar *) list_remove_curr(vlist, __FILE__, __LINE__);
         ncf_free_variable((char *) var_ptr);
     }
 
@@ -1751,7 +1698,7 @@ int FORTRAN(ncf_add_coord_var)( int *dset, int *varid, int *type, int *coordvar,
     *varid = nc_ptr->nvars;
     var.is_axis = *coordvar;
     var.fillval = *bad;
-    var.varattlist = list_init();
+    var.varattlist = list_init(__FILE__, __LINE__);
     if ( var.varattlist == NULL ) {
         fprintf(stderr, "ERROR: ncf_add_coord_var: Unable to initialize attributes list.\n");
         return -1;
@@ -1772,14 +1719,14 @@ int FORTRAN(ncf_add_coord_var)( int *dset, int *varid, int *type, int *coordvar,
         att.outflag = 1;
         att.type = NC_CHAR;
         att.outtype = NC_CHAR;
-        att.string = (char *) malloc((att.len+1)* sizeof(char));
+        att.string = (char *) FerMem_Malloc((att.len+1)* sizeof(char), __FILE__, __LINE__);
         strcpy(att.string, units);
-        list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+        list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
     }
 
     /* Save variable in linked list of variables for this dataset */
     list_mvrear(nc_ptr->dsetvarlist);
-    list_insert_after(nc_ptr->dsetvarlist, (char *) &var, sizeof(ncvar));
+    list_insert_after(nc_ptr->dsetvarlist, (char *) &var, sizeof(ncvar), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -1838,14 +1785,14 @@ int FORTRAN(ncf_add_var_num_att)( int *dset, int *varid, char attname[],
 #endif
     att.len = *attlen;
     att.outflag = *outflag;
-    att.vals = (double *) malloc(*attlen * sizeof(double));
+    att.vals = (double *) FerMem_Malloc(*attlen * sizeof(double), __FILE__, __LINE__);
 
     for (i = 0; i < *attlen; i++) {
         att.vals[i] = vals[i];
     }
 
     /* Save attribute in linked list of attributes for this variable */
-    list_insert_after(varattlist, (char *) &att, sizeof(ncatt));
+    list_insert_after(varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -1900,13 +1847,13 @@ int FORTRAN(ncf_add_var_num_att_dp)( int *dset, int *varid, char attname[],
     att.outtype = NC_DOUBLE;
     att.len = *attlen;
     att.outflag = *outflag;
-    att.vals = (double *) malloc(*attlen * sizeof(double));
+    att.vals = (double *) FerMem_Malloc(*attlen * sizeof(double), __FILE__, __LINE__);
     for (i = 0; i < *attlen; i++) {
         att.vals[i] = vals[i];
     }
 
     /*Save attribute in linked list of attributes for this variable */
-    list_insert_after(varattlist, (char *) &att, sizeof(ncatt));
+    list_insert_after(varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -1944,7 +1891,7 @@ int FORTRAN(ncf_add_var_str_att)( int *dset, int *varid, char attname[], int *at
 
     /* Save attribute in linked list of attributes for variable */
     if ( var_ptr->varattlist == NULL ) {
-        var_ptr->varattlist = list_init();
+        var_ptr->varattlist = list_init(__FILE__, __LINE__);
         if ( var_ptr->varattlist == NULL ) {
             fprintf(stderr, "ERROR: add_var_str_att: Unable to initialize attributes list.\n");
             return -1;
@@ -1983,11 +1930,11 @@ int FORTRAN(ncf_add_var_str_att)( int *dset, int *varid, char attname[], int *at
     att.outtype = NC_CHAR;
     att.len = *attlen;
     att.outflag = *outflag;
-    att.string = (char *) malloc((att.len+1)* sizeof(char));
+    att.string = (char *) FerMem_Malloc((att.len+1)* sizeof(char), __FILE__, __LINE__);
     strcpy(att.string, attstring);
 
     /*Save attribute in linked list of attributes for this variable */
-    list_insert_after(var_ptr->varattlist, (char *) &att, sizeof(ncatt));
+    list_insert_after(var_ptr->varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -2018,7 +1965,6 @@ int FORTRAN(ncf_rename_var)( int *dset, int *varid, char newvarname[] )
 int FORTRAN(ncf_rename_dim)( int *dset, int *dimid, char newdimname[] )
 {
     ncdset *nc_ptr;
-    int status;
 
      /*
      * Get the dataset pointer.
@@ -2071,11 +2017,11 @@ int FORTRAN(ncf_repl_var_att)( int *dset, int *varid, char attname[], int *attyp
      * Free the memory used by the string or values
      */
     if ( att_ptr->string != NULL ) {
-        free(att_ptr->string);
+        FerMem_Free(att_ptr->string, __FILE__, __LINE__);
         att_ptr->string = NULL;
     }
     if ( att_ptr->vals != NULL ) {
-        free(att_ptr->vals);
+        FerMem_Free(att_ptr->vals, __FILE__, __LINE__);
         att_ptr->vals = NULL;
     }
 
@@ -2091,17 +2037,17 @@ int FORTRAN(ncf_repl_var_att)( int *dset, int *varid, char attname[], int *attyp
         att_ptr->type = NC_CHAR;
         att_ptr->outtype = NC_CHAR;
         att_ptr->len = 1;
-        att_ptr->string = (char *) malloc(2*sizeof(char));
+        att_ptr->string = (char *) FerMem_Malloc(2*sizeof(char), __FILE__, __LINE__);
         strcpy(att_ptr->string," ");
     }
     else {
         switch (*attype) {
         case NC_CHAR:
-            att_ptr->string = (char *) malloc((*attlen+1)* sizeof(char));
+            att_ptr->string = (char *) FerMem_Malloc((*attlen+1)* sizeof(char), __FILE__, __LINE__);
             strcpy(att_ptr->string,attstring);
             break;
         default:
-            att_ptr->vals = (double *) malloc(*attlen * sizeof(double));
+            att_ptr->vals = (double *) FerMem_Malloc(*attlen * sizeof(double), __FILE__, __LINE__);
             for (i = 0; i < *attlen; i++) {
                 att_ptr->vals[i] = vals[i];
             }
@@ -2153,11 +2099,11 @@ int FORTRAN(ncf_repl_var_att_dp)( int *dset, int *varid, char attname[], int *at
      * Free the memory used by the string or values
      */
     if ( att_ptr->string != NULL ) {
-        free(att_ptr->string);
+        FerMem_Free(att_ptr->string, __FILE__, __LINE__);
         att_ptr->string = NULL;
     }
     if ( att_ptr->vals != NULL ) {
-        free(att_ptr->vals);
+        FerMem_Free(att_ptr->vals, __FILE__, __LINE__);
         att_ptr->vals = NULL;
     }
 
@@ -2179,17 +2125,17 @@ int FORTRAN(ncf_repl_var_att_dp)( int *dset, int *varid, char attname[], int *at
         att_ptr->type = NC_CHAR;
         att_ptr->outtype = NC_CHAR;
         att_ptr->len = 1;
-        att_ptr->string = (char *) malloc(2* sizeof(char));
+        att_ptr->string = (char *) FerMem_Malloc(2* sizeof(char), __FILE__, __LINE__);
         strcpy(att_ptr->string," ");
     }
     else {
         switch (*attype) {
         case NC_CHAR:
-            att_ptr->string = (char *) malloc((*attlen+1)* sizeof(char));
+            att_ptr->string = (char *) FerMem_Malloc((*attlen+1)* sizeof(char), __FILE__, __LINE__);
             strcpy(att_ptr->string,attstring);
             break;
         default:
-            att_ptr->vals = (double *) malloc(*attlen * sizeof(double));
+            att_ptr->vals = (double *) FerMem_Malloc(*attlen * sizeof(double), __FILE__, __LINE__);
             for (i = 0; i < *attlen; i++) {
                 att_ptr->vals[i] = vals[i];
             }
@@ -2210,7 +2156,6 @@ int FORTRAN(ncf_delete_var_att)( int *dset, int *varid, char attname[] )
     ncvar *var_ptr;
     int status;
     int att_to_remove;
-    LIST *varlist;
     LIST *varattlist;
 
     /*
@@ -2238,7 +2183,7 @@ int FORTRAN(ncf_delete_var_att)( int *dset, int *varid, char attname[] )
         return ATOM_NOT_FOUND;
 
     /* Remove the attribute, saving its attribute number */
-    att_ptr = (ncatt *) list_remove_curr(varattlist);
+    att_ptr = (ncatt *) list_remove_curr(varattlist, __FILE__, __LINE__);
     att_to_remove = att_ptr->attid;
     ncf_free_attribute((char *) att_ptr);
 
@@ -2314,7 +2259,6 @@ int FORTRAN(ncf_set_var_out_flag)( int *dset, int *varid, int *all_outflag )
 {
     ncvar *var_ptr;
     ncatt *att_ptr;
-    int status;
     LIST *varattlist;
 
     /* Get the variable */
@@ -2444,7 +2388,6 @@ int FORTRAN(ncf_transfer_att)( int *dset1, int *varid1, int *iatt, int *dset2, i
     int status;
     int i;
     LIST *varattlist1;
-    LIST *varattlist2;
 
     /* Get the variable varid1 in dset1 */
     var_ptr1 = ncf_get_ds_var_ptr(dset1, varid1);
@@ -2474,13 +2417,12 @@ int FORTRAN(ncf_transfer_att)( int *dset1, int *varid1, int *iatt, int *dset2, i
      * Get the list of attributes for the variable varid2
      */
     if ( var_ptr2->varattlist == NULL ) {
-        var_ptr2->varattlist = list_init();
+        var_ptr2->varattlist = list_init(__FILE__, __LINE__);
         if ( var_ptr2->varattlist == NULL ) {
             fprintf(stderr, "ERROR: ncf_add_dset: Unable to initialize variable attributes list.\n");
             return -1;
         }
     }
-    varattlist2 = var_ptr2->varattlist;
 
     /* Increment number of attributes for varid2 */
     var_ptr2->natts = var_ptr2->natts + 1;
@@ -2500,18 +2442,18 @@ int FORTRAN(ncf_transfer_att)( int *dset1, int *varid1, int *iatt, int *dset2, i
     att.outflag = att_ptr1->outflag;
 
     if (att_ptr1->type == NC_CHAR) {
-        att.string = (char *) malloc((att_ptr1->len+1)* sizeof(char));
+        att.string = (char *) FerMem_Malloc((att_ptr1->len+1)* sizeof(char), __FILE__, __LINE__);
         strcpy(att.string, att_ptr1->string);
     }
     else {
-        att.vals = (double *) malloc(att_ptr1->len * sizeof(double));
+        att.vals = (double *) FerMem_Malloc(att_ptr1->len * sizeof(double), __FILE__, __LINE__);
         for (i = 0; i<att_ptr1->len;i++ ) {
             att.vals[i] = att_ptr1->vals[i];
         }
     }
 
     /* Save attribute in linked list of attributes for this variable */
-    list_insert_after(var_ptr2->varattlist, (char *) &att, sizeof(ncatt));
+    list_insert_after(var_ptr2->varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -2527,7 +2469,6 @@ int FORTRAN(ncf_delete_var)( int *dset, char *varname )
     int status;
     int ivar;
     LIST *varlist;
-    LIST *uvgridList;
 
     /* Find the dataset based on its integer ID */
     nc_ptr = ncf_get_ds_ptr(dset);
@@ -2546,7 +2487,7 @@ int FORTRAN(ncf_delete_var)( int *dset, char *varname )
      * Remove the variable from the dataset list and free it
      * (and its lists) after getting its varid
      */
-    var_ptr = (ncvar *) list_remove_curr(varlist);
+    var_ptr = (ncvar *) list_remove_curr(varlist, __FILE__, __LINE__);
     ivar = var_ptr->varid;
     ncf_free_variable((char *) var_ptr);
 
@@ -2602,34 +2543,34 @@ int FORTRAN(ncf_init_agg_dset)( int *setnum, char name[] )
     att.attid = 1;
     strcpy(att.name, "aggregate name" );
     att.len = strlen(name);
-    att.string = (char *) malloc((att.len+1)* sizeof(char));
+    att.string = (char *) FerMem_Malloc((att.len+1)* sizeof(char), __FILE__, __LINE__);
     strcpy(att.string, name);
 
     /*Save attribute in linked list of attributes for variable .*/
     if ( var.varattlist == NULL ) {
-        var.varattlist = list_init();
+        var.varattlist = list_init(__FILE__, __LINE__);
         if ( var.varattlist == NULL ) {
             fprintf(stderr, "ERROR: ncf_init_agg_dset: Unable to initialize GLOBAL attributes list.\n");
             return -1;
         }
     }
-    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt));
+    list_insert_after(var.varattlist, (char *) &att, sizeof(ncatt), __FILE__, __LINE__);
 
     /* global attributes list complete */
 
     /* Initialize linked list of variables for this dataset */
     if ( nc.dsetvarlist == NULL ) {
-        nc.dsetvarlist = list_init();
+        nc.dsetvarlist = list_init(__FILE__, __LINE__);
         if ( nc.dsetvarlist == NULL ) {
             fprintf(stderr, "ERROR: ncf_init_agg_dset: Unable to initialize variable list.\n");
             return -1;
         }
     }
-    list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar));
+    list_insert_after(nc.dsetvarlist, (char *) &var, sizeof(ncvar), __FILE__, __LINE__);
 
     /*Initialize list of aggregate members for this dataset */
     if ( nc.agg_dsetlist == NULL ) {
-        nc.agg_dsetlist = list_init();
+        nc.agg_dsetlist = list_init(__FILE__, __LINE__);
         if ( nc.agg_dsetlist == NULL ) {
             fprintf(stderr, "ERROR: ncf_init_agg_dset: Unable to initialize aggregate list.\n");
             return -1;
@@ -2638,13 +2579,13 @@ int FORTRAN(ncf_init_agg_dset)( int *setnum, char name[] )
 
     /* Add dataset to global nc dataset linked list*/
     if ( GLOBAL_ncdsetList == NULL ) {
-        GLOBAL_ncdsetList = list_init();
+        GLOBAL_ncdsetList = list_init(__FILE__, __LINE__);
         if ( GLOBAL_ncdsetList == NULL ) {
             fprintf(stderr, "ERROR: ncf_init_uvar_dset: Unable to initialize GLOBAL_ncDsetList.\n");
             return -1;
         }
     }
-    list_insert_after(GLOBAL_ncdsetList, (char *) &nc, sizeof(ncdset));
+    list_insert_after(GLOBAL_ncdsetList, (char *) &nc, sizeof(ncdset), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -2675,7 +2616,7 @@ int FORTRAN(ncf_add_agg_member)( int *dset, int *sequence_number, int *member_ds
     agg.dsetnum = *member_dset;
     agg.aggSeqNo = *sequence_number;
     list_mvrear(nc_ptr->agg_dsetlist);
-    list_insert_after(nc_ptr->agg_dsetlist, (char *) &agg, sizeof(agg));
+    list_insert_after(nc_ptr->agg_dsetlist, (char *) &agg, sizeof(agg), __FILE__, __LINE__);
     nc_ptr->num_agg_members = nc_ptr->num_agg_members + 1;
 
     return FERR_OK;
@@ -2772,7 +2713,7 @@ int FORTRAN(ncf_add_agg_var_info)( int *dset, int *varid, int *imemb,
     var_ptr->nmemb = var_ptr->nmemb + 1;
 
     /*Save grid number in linked list of grid for this variable */
-    list_insert_after(var_ptr->varagglist, (char *) &vdescr, sizeof(ncagg_var_descr));
+    list_insert_after(var_ptr->varagglist, (char *) &vdescr, sizeof(ncagg_var_descr), __FILE__, __LINE__);
 
     return FERR_OK;
 }
@@ -2946,8 +2887,10 @@ int FORTRAN(ncf_free_uvar_grid_list)( int *LIST_dset, int *uvarid )
     uvgridList = var_ptr->uvarGridList;
     if ( uvgridList != NULL ) {
         while ( ! list_empty(uvgridList) ) {
-            uvgrid_ptr = (uvarGrid *)list_remove_front(uvgridList);
-            free(uvgrid_ptr);
+            uvgrid_ptr = (uvarGrid *)list_remove_front(uvgridList, __FILE__, __LINE__);
+            /* paranoia */
+            memset(uvgrid_ptr, 0, sizeof(uvarGrid));
+            FerMem_Free(uvgrid_ptr, __FILE__, __LINE__);
         }
     }
 
@@ -2966,8 +2909,7 @@ int FORTRAN(ncf_next_uvar_grid_in_list)( int *LIST_dset, int *uvarid, int *ith,
     ncvar *var_ptr;
     LIST *uvgridList;
     uvarGrid *uvgrid_ptr;
-	int count;
-	int i;
+    int i;
 
     /*
      * Get the list of variables, find pointer to variable varid.
@@ -2991,11 +2933,10 @@ int FORTRAN(ncf_next_uvar_grid_in_list)( int *LIST_dset, int *uvarid, int *ith,
      * Return the ith grid
      */
     list_mvfront(uvgridList);
-	count = 1;
     for (i = 0; i < *ith; i++) {
-		uvgrid_ptr = (uvarGrid *) list_curr(uvgridList);
+        uvgrid_ptr = (uvarGrid *) list_curr(uvgridList);
         *grid = uvgrid_ptr->grid;
-		list_mvnext(uvgridList); 
+        list_mvnext(uvgridList); 
         } 
 
     }
@@ -3023,7 +2964,7 @@ int FORTRAN(ncf_set_uvar_grid)( int *LIST_dset, int *varid, int *grid, int *data
     LIST *uvgridlist;
     uvarGrid *uvgrid_ptr;
     uvarGrid uvgrid;
-	int uvgrid_list_len;
+    int uvgrid_list_len;
     int i;
 
     /*
@@ -3046,8 +2987,11 @@ int FORTRAN(ncf_set_uvar_grid)( int *LIST_dset, int *varid, int *grid, int *data
         return ATOM_NOT_FOUND;
     status = list_traverse(uvgridlist, (char *) context_dset, NCF_ListTraverse_FoundGridDset, (LIST_FRNT | LIST_FORW | LIST_ALTR));
     if ( status == LIST_OK ) {
-        uvgrid_ptr = (uvarGrid *) list_remove_curr(uvgridlist);
-        free(uvgrid_ptr);
+        uvgrid_ptr = (uvarGrid *) list_remove_curr(uvgridlist, __FILE__, __LINE__);
+        /* paranoia */
+        memset(uvgrid_ptr, 0, sizeof(uvarGrid));
+        FerMem_Free(uvgrid_ptr, __FILE__, __LINE__);
+        uvgrid_ptr = NULL;
     }
 
     /*
@@ -3068,12 +3012,12 @@ int FORTRAN(ncf_set_uvar_grid)( int *LIST_dset, int *varid, int *grid, int *data
     /*
      * Save it in the grid list of this uvar
      */
-    list_insert_after(uvgridlist, (char *) &uvgrid, sizeof(uvarGrid));
-	
+    list_insert_after(uvgridlist, (char *) &uvgrid, sizeof(uvarGrid), __FILE__, __LINE__);
+
     uvgrid_list_len = (int) list_size(uvgridlist);
-	if (uvgrid_list_len > 1)
-	{ i = 1;
-	}
+    if (uvgrid_list_len > 1) { 
+        i = 1;
+    }
 
     return FERR_OK;
 }
@@ -3252,7 +3196,6 @@ int FORTRAN(ncf_get_uvar_grid_list_len)( int *LIST_dset, int *uvarid, int *uvgri
     int status;
     LIST *varlist;
     LIST *uvgridlist;
-    uvarGrid *uvgrid_ptr;
 
     /*
      * Get the list of variables, find pointer to variable varid.
@@ -3311,8 +3254,10 @@ int FORTRAN(ncf_delete_uvar_grid)( int *LIST_dset, int *uvarid, int *context_dse
         return ATOM_NOT_FOUND;
 
     /* Remove this grid from uvaGridList list */
-    uvgrid_ptr = (uvarGrid *) list_remove_curr(uvgridlist);
-    free(uvgrid_ptr);
+    uvgrid_ptr = (uvarGrid *) list_remove_curr(uvgridlist, __FILE__, __LINE__);
+    /* paranoia */
+    memset(uvgrid_ptr, 0, sizeof(uvarGrid));
+    FerMem_Free(uvgrid_ptr, __FILE__, __LINE__);
 
     return FERR_OK;
 }
diff --git a/fmt/src/SOURCE_FILES b/fmt/src/SOURCE_FILES
index 1c9a510..0b9c295 100644
--- a/fmt/src/SOURCE_FILES
+++ b/fmt/src/SOURCE_FILES
@@ -194,7 +194,6 @@ tm_dset_number.F\
 tm_dset_deallo_grids.F\
 tm_dset_use_grids.F\
 tm_errmsg.F\
-tm_exit.F\
 tm_exp_code.F\
 tm_f7721bug_inquire.F\
 tm_ferret_vartype.F\
@@ -329,8 +328,6 @@ xsys_names_data.F\
 xunits_data.F 
 
 SRCS_C = \
-alloca.c\
-cd_rd_r8_as_r4.c\
 cd_read_scale.c\
 cd_read_sub.c\
 cd_write_att_sub.c\
@@ -342,9 +339,6 @@ deleted_list_get_undel.c\
 deleted_list_init.c\
 deleted_list_modify.c\
 ez_delimited_read.c\
-my_close.c\
-my_open.c\
-my_readline.c\
 NCF_Util.c\
 str_dncase_sub.c\
 str_case_blind_compare_sub.c\
@@ -360,10 +354,10 @@ string_array_hash.c\
 string_array_init.c\
 string_array_modify.c\
 string_array_modify_upcase.c\
+switch_nan.c\
 tm_blockify_ferret_strings.c\
 tm_break_fmt_date_c.c\
 tm_c_rename.c\
-tm_dfp_convert.c\
 tm_ep_time_convrt.c\
 tm_ftoc_readline.c\
 tm_get_strlen.c\
@@ -376,5 +370,4 @@ tm_unix_versions.c\
 tm_world_recur.c \
 tm_check_inf.c\
 tm_check_nan.c\
-tm_switch_nan.c\
 urlencode.c
diff --git a/fmt/src/alloca.c b/fmt/src/alloca.c
deleted file mode 100644
index 3229f4d..0000000
--- a/fmt/src/alloca.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.  
-*
-*/
-
-
-
-/*
-	alloca -- (mostly) portable public-domain implementation -- D A Gwyn
-
-	last edit:	86/05/30	rms
-	   include config.h, since on VMS it renames some symbols.
-	   Use xmalloc instead of malloc.
-
-	This implementation of the PWB library alloca() function,
-	which is used to allocate space off the run-time stack so
-	that it is automatically reclaimed upon procedure exit, 
-	was inspired by discussions with J. Q. Johnson of Cornell.
-
-	It should work under any C implementation that uses an
-	actual procedure stack (as opposed to a linked list of
-	frames).  There are some preprocessor constants that can
-	be defined when compiling for your specific system, for
-	improved efficiency; however, the defaults should be okay.
-
-	The general concept of this implementation is to keep
-	track of all alloca()-allocated blocks, and reclaim any
-	that are found to be deeper in the stack than the current
-	invocation.  This heuristic does not reclaim storage as
-	soon as it becomes invalid, but it will do so eventually.
-
-	As a special case, alloca(0) reclaims storage without
-	allocating any.  It is a good idea to use alloca(0) in
-	your main control loop, etc. to force garbage collection.
-*/
-
-#include <stdlib.h>
-
-#ifndef lint
-static char	SCCSid[] = "@(#)alloca.c	1.1";	/* for the "what" utility */
-#endif
-
-
-/* generic pointer type */
-typedef void *pointer;
-
-/*
-	Define STACK_DIRECTION if you know the direction of stack
-	growth for your system; otherwise it will be automatically
-	deduced at run-time.
-
-	STACK_DIRECTION > 0 => grows toward higher addresses
-	STACK_DIRECTION < 0 => grows toward lower addresses
-	STACK_DIRECTION = 0 => direction of growth unknown
-*/
-
-#ifndef STACK_DIRECTION
-#define	STACK_DIRECTION	0		/* direction unknown */
-#endif
-
-#if STACK_DIRECTION != 0 /* known at compile-time */
-
-#define	STACK_DIR STACK_DIRECTION
-
-#else	/* STACK_DIRECTION == 0; need run-time code */
-
-static int	stack_dir;		/* 1 or -1 once known */
-#define	STACK_DIR	stack_dir
-
-static void
-find_stack_direction (void)
-{
-  static char	*addr = NULL;	/* address of first
-				   `dummy', once known */
-  auto char	dummy;		/* to get stack address */
-
-  if (addr == NULL)
-    {				/* initial entry */
-      addr = &dummy;
-
-      find_stack_direction ();	/* recurse once */
-    }
-  else				/* second entry */
-    if (&dummy > addr)
-      stack_dir = 1;		/* stack grew upward */
-    else
-      stack_dir = -1;		/* stack grew downward */
-}
-
-#endif	/* STACK_DIRECTION == 0 */
-
-/*
-	An "alloca header" is used to:
-	(a) chain together all alloca()ed blocks;
-	(b) keep track of stack depth.
-
-	It is very important that sizeof(header) agree with malloc()
-	alignment chunk size.  The following default should work okay.
-*/
-
-#ifndef	ALIGN_SIZE
-#define	ALIGN_SIZE	sizeof(double)
-#endif
-
-typedef union hdr
-{
-  char	align[ALIGN_SIZE];	/* to force sizeof(header) */
-  struct
-    {
-      union hdr *next;		/* for chaining headers */
-      char *deep;		/* for stack depth measure */
-    } h;
-} header;
-
-/*
-	alloca( size ) returns a pointer to at least `size' bytes of
-	storage which will be automatically reclaimed upon exit from
-	the procedure that called alloca().  Originally, this space
-	was supposed to be taken from the current stack frame of the
-	caller, but that method cannot be made to work for some
-	implementations of C, for example under Gould's UTX/32.
-*/
-
-static header *last_alloca_header = NULL; /* -> last alloca header */
-
-#ifdef HP_CC
-pointer
-alloca (size)			/* returns pointer to storage */
-#else
-pointer
-trash_alloca(size)
-#endif
-     unsigned	size;		/* # bytes to allocate */
-{
-  auto char	probe;		/* probes stack depth: */
-  register char	*depth = &probe;
-
-#if STACK_DIRECTION == 0
-  if (STACK_DIR == 0)		/* unknown growth direction */
-    find_stack_direction ();
-#endif
-
-				/* Reclaim garbage, defined as all alloca()ed storage that
-				   was allocated from deeper in the stack than currently. */
-
-  {
-    register header	*hp;	/* traverses linked list */
-
-    for (hp = last_alloca_header; hp != NULL;)
-      if (STACK_DIR > 0 && hp->h.deep > depth
-	  || STACK_DIR < 0 && hp->h.deep < depth)
-	{
-	  register header	*np = hp->h.next;
-
-	  free ((pointer) hp);	/* collect garbage */
-
-	  hp = np;		/* -> next header */
-	}
-      else
-	break;			/* rest are not deeper */
-
-    last_alloca_header = hp;	/* -> last valid storage */
-  }
-
-  if (size == 0)
-    return NULL;		/* no allocation required */
-
-  /* Allocate combined header + user data storage. */
-
-  {
-    register pointer	new = malloc (sizeof (header) + size);
-    /* address of header */
-
-    ((header *)new)->h.next = last_alloca_header;
-    ((header *)new)->h.deep = depth;
-
-    last_alloca_header = (header *)new;
-
-    /* User storage begins just after header. */
-
-    return (pointer)((char *)new + sizeof(header));
-  }
-}
-
diff --git a/fmt/src/cd_close_set.F b/fmt/src/cd_close_set.F
index 46754bf..9e72861 100644
--- a/fmt/src/cd_close_set.F
+++ b/fmt/src/cd_close_set.F
@@ -46,6 +46,7 @@
 * V65  *acm* 1/10  Add #ifdef usingDODSf2cUnderscore, for 32-bit linux build
 *                  linked with OPeNDAP library.
 * V6.74 3/12 *acm* cleanup ifdefs and unnecessary include files
+* V7.21 8/17 *kms* ignore close errors - assume already closed
 
 * argument definitions:
 *       cdfid   - returned pointer to open CDF file
@@ -71,15 +72,17 @@
 #else
         cdfstat = NF_CLOSE( cdfid )
 #endif
-	IF ( cdfstat .NE. NF_NOERR ) GOTO 5100
+C assume any errors are because the file is already closed,
+C either from an error or from improper marking when previously closed
+C       IF ( cdfstat .NE. NF_NOERR ) GOTO 5100
 
 * successful completion
         status = merr_ok
         RETURN
 
 * error exit
- 5000   RETURN
- 5100   CALL TM_ERRMSG(pcdferr+pcdferrmax,
-     .         status, 'CD_CLOSE_SET', cdfid, -999,
-     .         no_errstring, no_errstring, *5000 )
+C 5000   RETURN
+C 5100   CALL TM_ERRMSG(pcdferr+pcdferrmax,
+C     .         status, 'CD_CLOSE_SET', cdfid, -999,
+C     .         no_errstring, no_errstring, *5000 )
 	END
diff --git a/fmt/src/cd_open_dset.F b/fmt/src/cd_open_dset.F
index c79046e..1d31e0c 100644
--- a/fmt/src/cd_open_dset.F
+++ b/fmt/src/cd_open_dset.F
@@ -121,7 +121,7 @@
      .        do_warn, file_exists
       PARAMETER (do_warn = .TRUE. )
       REAL val
-      INTEGER TM_HASH_NAME, TM_LENSTR1, STR_SAME, STR_UPCASE,
+      INTEGER TM_LENSTR1, STR_SAME, STR_UPCASE,
      .        ndims, nvars, ngatts, recdim, cdfstat, i, istep, 
      .        err_status, i1, i2
       INTEGER len, iin, iout, ilast, dlen
diff --git a/fmt/src/cd_rd_r8_as_r4.c b/fmt/src/cd_rd_r8_as_r4.c
deleted file mode 100644
index 6ca049e..0000000
--- a/fmt/src/cd_rd_r8_as_r4.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.  
-*
-*/
-/*  V674 2/12 *acm* 6D Ferret: use NFERDIMS rather than 4 for dimension indexing */
-
-
-
-/* Read a DOUBLE hyperslab from a netCDF file into a FLOAT array.
-   Since the array to be read is bigger than the amount of memory
-   we can count on being available in the calling program buffer
-   we will allocate temporary storage and use it to buffer the read.
-*/
-
-/* compilation may require "-I/usr/local/include" (to find netcdf.h) */
-
-/* Call from FORTRAN using
-
-     CALL CD_RD_R8_AS_R4( cdfid, varid, start, count, ndim, array, cdfstat )
-*/
-
-/*#include "tmap_format/netcdf.h"*/
-/* *kob* 10/03 v553 - gcc v3.x needs wchar.h included */
-
-#include <stddef.h>  /* size_t, ptrdiff_t  gfortran on linux rh5*/
-#include <wchar.h>
-#include <netcdf.h>      /* usually in /usr/local/include */
-/* Suns need to include stdio.h to get definition for NULL */
-/* *acm   9/06 v600 - add stdlib.h wherever there is stdio.h for altix build */
-#include <stdlib.h> 
-#include <stdio.h>
-#include "ferretmacros.h"  /* with NFERDIMS */
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-void cd_rd_r8_as_r4(cdfid,
-#else
-void cd_rd_r8_as_r4_(cdfid,
-#endif
-		    varid,
-		    start,
-		    count,
-		    ndim,
-		    values,
-		    cdfstat)
-
-int *cdfid;
-int *varid;
-int start[NFERDIMS];
-int count[NFERDIMS];
-int *ndim;
-float *values;
-int *cdfstat;/*returns one of: ncnoerr, netCDF status, or -1 (malloc failed)*/ 
-
-{
-
-  int  idim, i, npts, rcode;
-  long cstart[NFERDIMS], ccount[NFERDIMS];
-  double *dvals;
-
-/* change the start/count values to C ordering and the start to zero offset */
-  for (idim=0; idim<*ndim; idim++){
-    cstart[idim] = (long) (start[(*ndim)-1-idim] - 1);
-    ccount[idim] = (long) (count[(*ndim)-1-idim]);
-  }
-/* the total number of data points */
-  for (npts=1,idim=0; idim<*ndim; idim++) npts *= count[idim];
-
-/* allocate memory for the double precision hyperslab */
-  dvals = (double *) malloc(8*npts);
-  if ( dvals == NULL ) {
-    *cdfstat = -1;
-    return;
-  }
-
-/* read the data */
-  rcode = ncvarget(*cdfid,*varid-1,cstart,ccount,dvals);
-  if ( rcode == -1 ) {
-    free(dvals);
-    *cdfstat = ncerr;     /* global var from netcdf.h */
-    return;
-  }
-  
-/* convert to single precision */
-  for (i=0; i<npts; i++) values[i] = (float) dvals[i];
-
-/* successful completion */
-  free(dvals);
-  *cdfstat = NC_NOERR;
-  return;
-}
diff --git a/fmt/src/cd_read_scale.c b/fmt/src/cd_read_scale.c
index fefd7fd..2a6a221 100644
--- a/fmt/src/cd_read_scale.c
+++ b/fmt/src/cd_read_scale.c
@@ -55,23 +55,18 @@
 #include <stdlib.h>
 #include <netcdf.h>
 
-#include "ferretmacros.h"
+#include "fmtprotos.h"
 #include "list.h"
 #include "NCF_Util.h"
+#include "FerMem.h"
 
 
 /* prototype */
-void tm_scale_buffer(DFTYPE *dat, double *dbuff,
-			   DFTYPE *offset, DFTYPE *scale, DFTYPE *bad,
-			   int ntotal);
-
-void FORTRAN(cd_read_scale) (int *cdfid, int *varid, int *dims, 
-			   DFTYPE *offset, DFTYPE *scale, DFTYPE* bad,
-			   int *tmp_start, int *tmp_count, 
-			   int *tmp_stride, int *tmp_imap,
-			   void *dat, int *permuted, int *strided, int *already_scaled,
-			   int *cdfstat, int *status)
+static void tm_scale_buffer(DFTYPE *dat, double *dbuff, DFTYPE *offset, DFTYPE *scale, DFTYPE *bad, int ntotal);
 
+void FORTRAN(cd_read_scale)(int *cdfid, int *varid, int *dims, DFTYPE *offset, DFTYPE *scale, DFTYPE* bad,
+                            int *tmp_start, int *tmp_count, int *tmp_stride, int *tmp_imap,
+                            void *dat, int *permuted, int *strided, int *already_scaled, int *cdfstat, int *status)
 {
 
   /* convert FORTRAN-index-ordered, FORTRAN-1-referenced ids, count,
@@ -84,12 +79,10 @@ void FORTRAN(cd_read_scale) (int *cdfid, int *varid, int *dims,
   size_t start[NFERDIMSP1], count[NFERDIMSP1];
   ptrdiff_t stride[NFERDIMSP1], imap[NFERDIMSP1];
 
-  int tmp, i, maxstrlen, ndimsp, *dimids;
-  size_t bufsiz;
+  int tmp, i;
   int ndim = *dims - 1; /* C referenced to zero */
   int vid = *varid;
   nc_type vtyp;
-  int n_sections;
   int ntotal;
   int scale_it;
   double *data_double;
@@ -152,7 +145,7 @@ void FORTRAN(cd_read_scale) (int *cdfid, int *varid, int *dims,
 	   in variable dat
     */
 
-      data_double = (double *) malloc(ntotal * sizeof(double));
+      data_double = (double *) FerMem_Malloc(ntotal * sizeof(double), __FILE__, __LINE__);
       if ( data_double == NULL )
           abort();
 
@@ -177,7 +170,7 @@ void FORTRAN(cd_read_scale) (int *cdfid, int *varid, int *dims,
          scale, bad, ntotal);
 	  *already_scaled = 1;
 
-	  free(data_double);
+	  FerMem_Free(data_double, __FILE__, __LINE__);
                   
   }
    
@@ -220,10 +213,7 @@ void FORTRAN(cd_read_scale) (int *cdfid, int *varid, int *dims,
 }
 
 /*  */
-void tm_scale_buffer(DFTYPE *dat, double *dbuff,
-                     DFTYPE *offset, DFTYPE *scale, DFTYPE *bad,
-                     int ntotal)
-
+static void tm_scale_buffer(DFTYPE *dat, double *dbuff, DFTYPE *offset, DFTYPE *scale, DFTYPE *bad, int ntotal)
 {
         int j;
         double dbad;
diff --git a/fmt/src/cd_read_sub.c b/fmt/src/cd_read_sub.c
index 2b6b4c6..3e362fd 100644
--- a/fmt/src/cd_read_sub.c
+++ b/fmt/src/cd_read_sub.c
@@ -76,23 +76,16 @@
 
 #include <stddef.h>  /* size_t, ptrdiff_t; gfortran on linux rh5*/
 #include <wchar.h>
-/*#include <stdio.h>*/
 #include <stdlib.h>
 #include <netcdf.h>
-#include "ferretmacros.h"
+#include "fmtprotos.h"
 #include "list.h"
 #include "NCF_Util.h"
+#include "FerMem.h"
 
-
-/* prototype */
-void tm_unblockify_ferret_strings(void *dat, char *pbuff,
-				int bufsiz, int outstrlen);
-
-void FORTRAN(cd_read_sub) (int *cdfid, int *varid, int *dims, 
-			   int *tmp_start, int *tmp_count, 
-			   int *tmp_stride, int *tmp_imap,
-			   double *dat, int *permuted, int *strided,
-			   int *cdfstat )
+void FORTRAN(cd_read_sub)(int *cdfid, int *varid, int *dims, 
+                          int *tmp_start, int *tmp_count, int *tmp_stride, int *tmp_imap,
+                          char **dat, int *permuted, int *strided, int *cdfstat)
 {
 
   /* convert FORTRAN-index-ordered, FORTRAN-1-referenced ids, count,
@@ -105,7 +98,7 @@ void FORTRAN(cd_read_sub) (int *cdfid, int *varid, int *dims,
   ptrdiff_t stride[7], imap[7], tmp_ptrdiff_t;
 
   int i, ndimsp, *dimids;
-  size_t bufsiz, tmp, tmpstride, maxstrlen;
+  size_t bufsiz, tmp, maxstrlen;
   char *pbuff;
   int ndim = 0;
   int indim = *dims;
@@ -168,7 +161,7 @@ void FORTRAN(cd_read_sub) (int *cdfid, int *varid, int *dims,
       if (*cdfstat != NC_NOERR) {
           return;
       }
-      dimids = (int *) malloc(sizeof(int) * ndimsp);
+      dimids = (int *) FerMem_Malloc(sizeof(int) * ndimsp, __FILE__, __LINE__);
       if ( dimids == NULL )
           abort();
       ndimsp--;
@@ -180,12 +173,12 @@ void FORTRAN(cd_read_sub) (int *cdfid, int *varid, int *dims,
       if (*cdfstat != NC_NOERR) {
           return;
       }
-      free(dimids);
+      FerMem_Free(dimids, __FILE__, __LINE__);
       maxstrlen = bufsiz;
       if (indim > 0) {
          for (i=0; i<=ndim; i++) bufsiz *= count[i];
 	 }
-      pbuff = (char *) malloc(sizeof(char) * bufsiz);
+      pbuff = (char *) FerMem_Malloc(sizeof(char) * bufsiz, __FILE__, __LINE__);
       if ( pbuff == NULL )
          abort();
       /* update variable dimensions to include string dimension */
@@ -212,7 +205,7 @@ void FORTRAN(cd_read_sub) (int *cdfid, int *varid, int *dims,
 	  }
 
       tm_unblockify_ferret_strings(dat, pbuff, bufsiz, (int)maxstrlen);
-      free(pbuff);
+      FerMem_Free(pbuff, __FILE__, __LINE__);
 
   /* Numeric data. Read as double or float */
   } else
diff --git a/fmt/src/cd_write_att_dp_sub.c b/fmt/src/cd_write_att_dp_sub.c
index 911f5a4..3434a72 100644
--- a/fmt/src/cd_write_att_dp_sub.c
+++ b/fmt/src/cd_write_att_dp_sub.c
@@ -48,12 +48,7 @@
 #include <stdio.h>
 #include <netcdf.h>
 #include <assert.h>
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
+#include "fmtprotos.h"
 
 void FORTRAN(cd_write_att_dp_sub) (int *cdfid, int *varid, char* attname, int *attype,
 				                   int *nval, void *val, int *status )
diff --git a/fmt/src/cd_write_att_sub.c b/fmt/src/cd_write_att_sub.c
index d5b9dc1..9af8529 100644
--- a/fmt/src/cd_write_att_sub.c
+++ b/fmt/src/cd_write_att_sub.c
@@ -73,7 +73,7 @@
 #include <stdio.h>
 #include <netcdf.h>
 #include <assert.h>
-#include "ferretmacros.h"
+#include "fmtprotos.h"
 
 void FORTRAN(cd_write_att_sub) (int *cdfid, int *varid, char* attname, int *attype,
 				                int *nval, void *val, int *status )
diff --git a/fmt/src/cd_write_var_sub.c b/fmt/src/cd_write_var_sub.c
index c09bfa9..1b072e9 100644
--- a/fmt/src/cd_write_var_sub.c
+++ b/fmt/src/cd_write_var_sub.c
@@ -71,25 +71,18 @@
 /*					 definition of macro DFTYPE in ferretmacros.h. */ 
 /*  V674 2/12 *acm* 6D Ferret: use NFERDIMS rather than 4 for dimension indexing */
 
-
-#include "ferretmacros.h"
-
 #include <stddef.h>  /* size_t, ptrdiff_t; gfortran on linux rh5*/
 #include <stdlib.h>
 #include <wchar.h>
 #include <stdio.h>
 #include <netcdf.h>
 #include <assert.h>
+#include "fmtprotos.h"
+#include "ferret.h"  /* for NFERDIMSP1 */
+#include "FerMem.h"
 
-
-/* prototype */
-void tm_blockify_ferret_strings(void *dat, char *pbuff,
-				int bufsiz, int outstrlen);
-
-void FORTRAN(cd_write_var_sub) (int *cdfid, int *varid, int *vartyp,
-				int *dims, int *tmp_start, int *tmp_count, 
-				int *strdim, void *dat, int *cdfstat )
-
+void FORTRAN(cd_write_var_sub)(int *cdfid, int *varid, int *vartyp, int *dims, 
+                               int *tmp_start, int *tmp_count, int *strdim, void *dat, int *cdfstat)
 {
   /* convert FORTRAN-index-ordered, FORTRAN-1-referenced ids, count,
      and start to C equivalent
@@ -147,8 +140,7 @@ void FORTRAN(cd_write_var_sub) (int *cdfid, int *varid, int *vartyp,
 		}
 
   /* write out the data */
-  if (*vartyp == NC_CHAR)
-		{
+  if (*vartyp == NC_CHAR) {
 
     /* Create a buffer area with the multi-dimensiona array of strings
        packed into a block.
@@ -161,7 +153,7 @@ void FORTRAN(cd_write_var_sub) (int *cdfid, int *varid, int *vartyp,
       if (indim > 0) {
          for (i=0; i<=ndim; i++) bufsiz *= count[i];
        }
-      pbuff = (char *) malloc(sizeof(char) * bufsiz);
+      pbuff = (char *) FerMem_Malloc(sizeof(char) * bufsiz, __FILE__, __LINE__);
       if ( pbuff == NULL )
          abort();
       tm_blockify_ferret_strings(dat, pbuff, (int)bufsiz, (int)maxstrlen);
@@ -170,20 +162,18 @@ void FORTRAN(cd_write_var_sub) (int *cdfid, int *varid, int *vartyp,
       start[*dims] = (size_t)0;
       count[*dims] = maxstrlen;
 
-      *cdfstat = nc_put_vara_text(*cdfid, vid,
-				 start, count, pbuff);
-      free(pbuff);
-		} else
-		{
-			/* FLOAT data */
+      *cdfstat = nc_put_vara_text(*cdfid, vid, start, count, pbuff);
+      FerMem_Free(pbuff, __FILE__, __LINE__);
+
+  } else {
+      /* FLOAT data */
 #ifdef double_p
-			*cdfstat = nc_put_vara_double(*cdfid, vid,
-				 start, count, (DFTYPE*) dat);
+      *cdfstat = nc_put_vara_double(*cdfid, vid, start, count, (double*) dat);
 #else
-			*cdfstat = nc_put_vara_float(*cdfid, vid,
-				 start, count, (float*) dat);
+      *cdfstat = nc_put_vara_float(*cdfid, vid, start, count, (float*) dat);
 #endif
-		}
+
+  }
 
   return;
 }
diff --git a/fmt/src/deleted_list_clear.c b/fmt/src/deleted_list_clear.c
index 512a14b..67e8f7b 100644
--- a/fmt/src/deleted_list_clear.c
+++ b/fmt/src/deleted_list_clear.c
@@ -41,21 +41,28 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
+#include "fmtprotos.h"
 #include "deleted_list.h"
+#include "FerMem.h"
 
-void deleted_list_clear_(void * deleted_list_header)
+void FORTRAN(deleted_list_clear)(void **deleted_list_header)
 {
-   int i,j;
+   DLHead *head;
    int array_size;
-   DLHead * head;
+   int j;
 
-   head = *((DLHead**)deleted_list_header);
-   array_size = head->array_size;
-   if(head){
-       for(j=1;j<=array_size;j++)
-         free(head->ptr_table[j-1]);
-       free(head->ptr_table);
+   head = *deleted_list_header;
+   if ( head != NULL ) {
+       array_size = head->array_size;
+       for (j = 0; j < array_size; j++) {
+           FerMem_Free(head->ptr_table[j], __FILE__, __LINE__);
+           head->ptr_table[j] = NULL;
+       }
+       FerMem_Free(head->ptr_table, __FILE__, __LINE__);
+       memset(head, 0, sizeof(DLHead));
+       FerMem_Free(head, __FILE__, __LINE__);
+       *deleted_list_header = NULL;
    }
-   *((int*)deleted_list_header)=0;
 }
 
diff --git a/fmt/src/deleted_list_get_del.c b/fmt/src/deleted_list_get_del.c
index 17e3265..a3b8c2b 100644
--- a/fmt/src/deleted_list_get_del.c
+++ b/fmt/src/deleted_list_get_del.c
@@ -40,33 +40,28 @@
  */
 
 #include <stdio.h>
+#include "fmtprotos.h"
 #include "deleted_list.h"
 
-void deleted_list_get_del_( void *deleted_list_header,
-                             int *result_array,
-                             int *result_array_size,
-                             int *num_indices
-                           )
+void FORTRAN(deleted_list_get_del)(void **deleted_list_header, int *result_array, int *result_array_size, int *num_indices)
 {
-   int j=0;
+   DLHead *head;
    int array_size; 
-   DLHead * head;
    DL_Node *p;
+   int j = 0;
 
-   head = *((DLHead**)deleted_list_header);
-   if(head){
+   head = *deleted_list_header;
+   if ( head != NULL ) {
       array_size = *result_array_size;
-
-      for(p=head->deleted_list_head; p; p=p->next) {
-	if(j<array_size){
-	   result_array[j] = p->index;
-           j++;
-	}
-        else 
-	   break;
+      for (p = head->deleted_list_head; p != NULL; p = p->next) {
+	 if ( j < array_size ) {
+	    result_array[j] = p->index;
+            j++;
+	 }
+         else 
+	    break;
       }
    }
    *num_indices = j;
 }
 
-
diff --git a/fmt/src/deleted_list_get_undel.c b/fmt/src/deleted_list_get_undel.c
index 6d278e5..098e6e0 100644
--- a/fmt/src/deleted_list_get_undel.c
+++ b/fmt/src/deleted_list_get_undel.c
@@ -40,33 +40,28 @@
  */
 
 #include <stdio.h>
+#include "fmtprotos.h"
 #include "deleted_list.h"
 
-void deleted_list_get_undel_( void *deleted_list_header,
-                             int *result_array,
-                             int *result_array_size,
-                             int *num_indices
-                           )
+void FORTRAN(deleted_list_get_undel)(void **deleted_list_header, int *result_array, int *result_array_size, int *num_indices)
 {
-   int j=0;
+   DLHead *head;
    int array_size; 
-   DLHead * head;
    DL_Node *p;
+   int j = 0;
 
-   head = *((DLHead**)deleted_list_header);
-   if(head){
+   head = *deleted_list_header;
+   if ( head != NULL ) {
       array_size = *result_array_size;
-
-      for(p=head->undel_list_head; p; p=p->next) {
-	if(j<array_size){
-	   result_array[j] = p->index;
-           j++;
-	}
-        else 
-	   break;
+      for (p = head->undel_list_head; p != NULL; p = p->next) {
+	 if ( j < array_size ) {
+	    result_array[j] = p->index;
+            j++;
+	 }
+         else 
+	    break;
       }
    }
    *num_indices = j;
 }
 
-
diff --git a/fmt/src/deleted_list_init.c b/fmt/src/deleted_list_init.c
index 297ce07..bdd92f2 100644
--- a/fmt/src/deleted_list_init.c
+++ b/fmt/src/deleted_list_init.c
@@ -41,52 +41,50 @@
 /* *acm   9/06 v600 - add stdlib.h wherever there is stdio.h for altix build*/ 
 
 #include <stddef.h>  /* size_t, ptrdiff_t; gfortran on linux rh5*/
-# include <stdio.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "fmtprotos.h"
 #include "deleted_list.h"
+#include "FerMem.h"
 
-void deleted_list_init_(void *deleted_list_header,
-                         int *int_array,
-			 int *int_array_size,
-                         int *deleted_value 
-                        )
+void FORTRAN(deleted_list_init)(void **deleted_list_header, int *int_array, int *int_array_size, int *deleted_value)
 {
-   int i,j;
+   DLHead *head;
    int array_size;
-   DLHead * head;
-   DL_Node * p;
+   int j;
+   DL_Node *p;
 
-   head = (DLHead*)malloc(sizeof(DLHead));
-   *((DLHead**)deleted_list_header) = head;
+   head = (DLHead *) FerMem_Malloc(sizeof(DLHead), __FILE__, __LINE__);
+   *deleted_list_header = head;
    head->int_array = int_array;
    head->array_size = *int_array_size;
    head->deleted_value = *deleted_value;
    array_size = head->array_size;
 
-   head->ptr_table = (DL_Node**)malloc(array_size*sizeof(DL_Node*));
-   memset((void *)head->ptr_table, 0, array_size*sizeof(DL_Node*));
+   head->ptr_table = (DL_Node **) FerMem_Malloc(array_size * sizeof(DL_Node *), __FILE__, __LINE__);
+   memset(head->ptr_table, 0, array_size * sizeof(DL_Node *));
    head->deleted_list_head = NULL;
    head->undel_list_head = NULL;
 
-   for(j=array_size;j>=1;j--) {
-       head->ptr_table[j-1] = (DL_Node*)malloc(sizeof(DL_Node));
+   for (j = array_size; j > 0; j--) {
+       head->ptr_table[j-1] = (DL_Node *) FerMem_Malloc(sizeof(DL_Node), __FILE__, __LINE__);
        p = head->ptr_table[j-1];
        p->index = j;
 
-       if(head->int_array[j-1]==head->deleted_value){
+       if ( head->int_array[j-1] == head->deleted_value ) {
           p->prev = NULL;
           p->next = head->deleted_list_head;
           head->deleted_list_head = p;
-          if(p->next){
+          if ( p->next != NULL ) {
  	     p->next->prev = p;
           }
        }
-       else{
+       else {
           p->prev = NULL;
           p->next = head->undel_list_head;
           head->undel_list_head = p;
-          if(p->next){
+          if ( p->next != NULL ) {
  	     p->next->prev = p;
           }
        }
diff --git a/fmt/src/deleted_list_modify.c b/fmt/src/deleted_list_modify.c
index 49f48fe..e82850e 100644
--- a/fmt/src/deleted_list_modify.c
+++ b/fmt/src/deleted_list_modify.c
@@ -40,57 +40,54 @@
  */
 
 #include <stdio.h>
+#include "fmtprotos.h"
 #include "deleted_list.h"
 
-void deleted_list_modify_(void *deleted_list_header,
-                           int  *index,
-                           int  *new_value){
-   DLHead * head;
-   DL_Node * p;
+void FORTRAN(deleted_list_modify)(void **deleted_list_header, int *index, int *new_value)
+{
+   DLHead *head;
+   DL_Node *p;
    int old_value;
 
-   head = *((DLHead**) deleted_list_header);
+   head = *deleted_list_header;
+   if ( head != NULL ) {
+      old_value = head->int_array[*index - 1];
+      head->int_array[*index - 1] = *new_value;
+      p = head->ptr_table[*index - 1];
 
-   if(head){
-      old_value = head->int_array[*index-1];
-      head->int_array[*index-1]=*new_value;
-      p = head->ptr_table[*index-1];
-
-      if(old_value==head->deleted_value
-         && *new_value!=head->deleted_value){
-          if(p->prev){
+      if ( (old_value == head->deleted_value) && (*new_value != head->deleted_value) ) {
+          if ( p->prev != NULL ) {
 	     p->prev->next = p->next;
           }
-          if(p->next){
+          if ( p->next != NULL ) {
 	     p->next->prev = p->prev;
           }
-          if(head->deleted_list_head == p){
+          if ( head->deleted_list_head == p ) {
 	     head->deleted_list_head = p->next;
           }
 
           p->prev = NULL;
           p->next = head->undel_list_head;
           head->undel_list_head = p;
-          if(p->next){
+          if ( p->next != NULL ) {
  	      p->next->prev = p;
           }
       } 
-      else if(old_value!=head->deleted_value
-	      && *new_value==head->deleted_value){
-          if(p->prev){
+      else if ( (old_value != head->deleted_value) && (*new_value == head->deleted_value) ) {
+          if ( p->prev != NULL ) {
 	     p->prev->next = p->next;
           }
-          if(p->next){
+          if ( p->next != NULL ) {
 	     p->next->prev = p->prev;
           }
-          if(head->undel_list_head == p){
+          if ( head->undel_list_head == p ) {
 	     head->undel_list_head = p->next;
           }
 
           p->prev = NULL;
           p->next = head->deleted_list_head;
           head->deleted_list_head = p;
-          if(p->next){
+          if ( p->next != NULL ) {
  	      p->next->prev = p;
           }
       }
diff --git a/fmt/src/emacs_keymap.h b/fmt/src/emacs_keymap.h
deleted file mode 100644
index e3937b7..0000000
--- a/fmt/src/emacs_keymap.h
+++ /dev/null
@@ -1,472 +0,0 @@
-/* emacs_keymap.c -- the keymap for emacs_mode in readline (). */
-
-/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
-
-   This file is part of GNU Readline, a library for reading lines
-   of text with interactive input and history editing.
-
-   Readline is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 1, or (at your option) any
-   later version.
-
-   Readline is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with Readline; see the file COPYING.  If not, write to the Free
-   Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef BUFSIZ
-#include <stdio.h>
-#endif /* BUFSIZ */
-
-#include <readline/readline.h>
-
-/* An array of function pointers, one for each possible key.
-   If the type byte is ISKMAP, then the pointer is the address of
-   a keymap. */
-
-KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
-
-  /* Control keys. */
-  { ISFUNC, (Function *)0x0 },		/* Control-@ */
-  { ISFUNC, rl_beg_of_line },		/* Control-a */
-  { ISFUNC, rl_backward },		/* Control-b */
-  { ISFUNC, (Function *)0x0 },		/* Control-c */
-  { ISFUNC, rl_delete },		/* Control-d */
-  { ISFUNC, rl_end_of_line },		/* Control-e */
-  { ISFUNC, rl_forward },		/* Control-f */
-  { ISFUNC, rl_abort },			/* Control-g */
-  { ISFUNC, rl_rubout },		/* Control-h */
-  { ISFUNC, rl_complete },		/* Control-i */
-  { ISFUNC, rl_newline },		/* Control-j */
-  { ISFUNC, rl_kill_line },		/* Control-k */
-  { ISFUNC, rl_clear_screen },		/* Control-l */
-  { ISFUNC, rl_newline },		/* Control-m */
-  { ISFUNC, rl_get_next_history },	/* Control-n */
-  { ISFUNC, (Function *)0x0 },		/* Control-o */
-  { ISFUNC, rl_get_previous_history },	/* Control-p */
-  { ISFUNC, rl_quoted_insert },		/* Control-q */
-  { ISFUNC, rl_reverse_search_history }, /* Control-r */
-  { ISFUNC, rl_forward_search_history }, /* Control-s */
-  { ISFUNC, rl_transpose_chars },	/* Control-t */
-  { ISFUNC, rl_unix_line_discard },	/* Control-u */
-  { ISFUNC, rl_quoted_insert },		/* Control-v */
-  { ISFUNC, rl_unix_word_rubout },	/* Control-w */
-  { ISKMAP, (Function *)emacs_ctlx_keymap },	/* Control-x */
-  { ISFUNC, rl_yank },			/* Control-y */
-  { ISFUNC, (Function *)0x0 },		/* Control-z */
-  { ISKMAP, (Function *)emacs_meta_keymap }, /* Control-[ */
-  { ISFUNC, (Function *)0x0 },		/* Control-\ */
-  { ISFUNC, (Function *)0x0 },		/* Control-] */
-  { ISFUNC, (Function *)0x0 },		/* Control-^ */
-  { ISFUNC, rl_undo_command },		/* Control-_ */
-
-  /* The start of printing characters. */
-  { ISFUNC, rl_insert },	/* SPACE */
-  { ISFUNC, rl_insert },	/* ! */
-  { ISFUNC, rl_insert },	/* " */
-  { ISFUNC, rl_insert },	/* # */
-  { ISFUNC, rl_insert },	/* $ */
-  { ISFUNC, rl_insert },	/* % */
-  { ISFUNC, rl_insert },	/* & */
-  { ISFUNC, rl_insert },	/* ' */
-  { ISFUNC, rl_insert },	/* ( */
-  { ISFUNC, rl_insert },	/* ) */
-  { ISFUNC, rl_insert },	/* * */
-  { ISFUNC, rl_insert },	/* + */
-  { ISFUNC, rl_insert },	/* , */
-  { ISFUNC, rl_insert },	/* - */
-  { ISFUNC, rl_insert },	/* . */
-  { ISFUNC, rl_insert },	/* / */
-
-  /* Regular digits. */
-  { ISFUNC, rl_insert },	/* 0 */
-  { ISFUNC, rl_insert },	/* 1 */
-  { ISFUNC, rl_insert },	/* 2 */
-  { ISFUNC, rl_insert },	/* 3 */
-  { ISFUNC, rl_insert },	/* 4 */
-  { ISFUNC, rl_insert },	/* 5 */
-  { ISFUNC, rl_insert },	/* 6 */
-  { ISFUNC, rl_insert },	/* 7 */
-  { ISFUNC, rl_insert },	/* 8 */
-  { ISFUNC, rl_insert },	/* 9 */
-
-  /* A little more punctuation. */
-  { ISFUNC, rl_insert },	/* : */
-  { ISFUNC, rl_insert },	/* ; */
-  { ISFUNC, rl_insert },	/* < */
-  { ISFUNC, rl_insert },	/* = */
-  { ISFUNC, rl_insert },	/* > */
-  { ISFUNC, rl_insert },	/* ? */
-  { ISFUNC, rl_insert },	/* @ */
-
-  /* Uppercase alphabet. */
-  { ISFUNC, rl_insert },	/* A */
-  { ISFUNC, rl_insert },	/* B */
-  { ISFUNC, rl_insert },	/* C */
-  { ISFUNC, rl_insert },	/* D */
-  { ISFUNC, rl_insert },	/* E */
-  { ISFUNC, rl_insert },	/* F */
-  { ISFUNC, rl_insert },	/* G */
-  { ISFUNC, rl_insert },	/* H */
-  { ISFUNC, rl_insert },	/* I */
-  { ISFUNC, rl_insert },	/* J */
-  { ISFUNC, rl_insert },	/* K */
-  { ISFUNC, rl_insert },	/* L */
-  { ISFUNC, rl_insert },	/* M */
-  { ISFUNC, rl_insert },	/* N */
-  { ISFUNC, rl_insert },	/* O */
-  { ISFUNC, rl_insert },	/* P */
-  { ISFUNC, rl_insert },	/* Q */
-  { ISFUNC, rl_insert },	/* R */
-  { ISFUNC, rl_insert },	/* S */
-  { ISFUNC, rl_insert },	/* T */
-  { ISFUNC, rl_insert },	/* U */
-  { ISFUNC, rl_insert },	/* V */
-  { ISFUNC, rl_insert },	/* W */
-  { ISFUNC, rl_insert },	/* X */
-  { ISFUNC, rl_insert },	/* Y */
-  { ISFUNC, rl_insert },	/* Z */
-
-  /* Some more punctuation. */
-  { ISFUNC, rl_insert },	/* [ */
-  { ISFUNC, rl_insert },	/* \ */
-  { ISFUNC, rl_insert },	/* ] */
-  { ISFUNC, rl_insert },	/* ^ */
-  { ISFUNC, rl_insert },	/* _ */
-  { ISFUNC, rl_insert },	/* ` */
-
-  /* Lowercase alphabet. */
-  { ISFUNC, rl_insert },	/* a */
-  { ISFUNC, rl_insert },	/* b */
-  { ISFUNC, rl_insert },	/* c */
-  { ISFUNC, rl_insert },	/* d */
-  { ISFUNC, rl_insert },	/* e */
-  { ISFUNC, rl_insert },	/* f */
-  { ISFUNC, rl_insert },	/* g */
-  { ISFUNC, rl_insert },	/* h */
-  { ISFUNC, rl_insert },	/* i */
-  { ISFUNC, rl_insert },	/* j */
-  { ISFUNC, rl_insert },	/* k */
-  { ISFUNC, rl_insert },	/* l */
-  { ISFUNC, rl_insert },	/* m */
-  { ISFUNC, rl_insert },	/* n */
-  { ISFUNC, rl_insert },	/* o */
-  { ISFUNC, rl_insert },	/* p */
-  { ISFUNC, rl_insert },	/* q */
-  { ISFUNC, rl_insert },	/* r */
-  { ISFUNC, rl_insert },	/* s */
-  { ISFUNC, rl_insert },	/* t */
-  { ISFUNC, rl_insert },	/* u */
-  { ISFUNC, rl_insert },	/* v */
-  { ISFUNC, rl_insert },	/* w */
-  { ISFUNC, rl_insert },	/* x */
-  { ISFUNC, rl_insert },	/* y */
-  { ISFUNC, rl_insert },	/* z */
-
-  /* Final punctuation. */
-  { ISFUNC, rl_insert },	/* { */
-  { ISFUNC, rl_insert },	/* | */
-  { ISFUNC, rl_insert },	/* } */
-  { ISFUNC, rl_insert },	/* ~ */
-  { ISFUNC, rl_rubout }		/* RUBOUT */
-};
-
-KEYMAP_ENTRY_ARRAY emacs_meta_keymap = {
-
-  /* Meta keys.  Just like above, but the high bit is set. */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-@ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-a */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-b */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-c */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-d */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-e */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-f */
-  { ISFUNC, rl_abort },		/* Meta-Control-g */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-h */
-  { ISFUNC, rl_tab_insert },	/* Meta-Control-i */
-  { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-j */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-k */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-l */
-  { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-m */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-n */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-o */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-p */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-q */
-  { ISFUNC, rl_revert_line },	/* Meta-Control-r */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-s */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-t */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-u */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-v */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-w */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-x */
-  { ISFUNC, rl_yank_nth_arg },	/* Meta-Control-y */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-z */
-
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-[ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-\ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-] */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-^ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-Control-_ */
-
-  /* The start of printing characters. */
-  { ISFUNC, (Function *)0x0 },	/* Meta-SPACE */
-  { ISFUNC, (Function *)0x0 },	/* Meta-! */
-  { ISFUNC, (Function *)0x0 },	/* Meta-" */
-  { ISFUNC, (Function *)0x0 },	/* Meta-# */
-  { ISFUNC, (Function *)0x0 },	/* Meta-$ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-% */
-  { ISFUNC, (Function *)0x0 },	/* Meta-& */
-  { ISFUNC, (Function *)0x0 },	/* Meta-' */
-  { ISFUNC, (Function *)0x0 },	/* Meta-( */
-  { ISFUNC, (Function *)0x0 },	/* Meta-) */
-  { ISFUNC, (Function *)0x0 },	/* Meta-* */
-  { ISFUNC, (Function *)0x0 },	/* Meta-+ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-, */
-  { ISFUNC, rl_digit_argument }, /* Meta-- */
-  { ISFUNC, (Function *)0x0 },	/* Meta-. */
-  { ISFUNC, (Function *)0x0 },	/* Meta-/ */
-
-  /* Regular digits. */
-  { ISFUNC, rl_digit_argument }, /* Meta-0 */
-  { ISFUNC, rl_digit_argument }, /* Meta-1 */
-  { ISFUNC, rl_digit_argument }, /* Meta-2 */
-  { ISFUNC, rl_digit_argument }, /* Meta-3 */
-  { ISFUNC, rl_digit_argument }, /* Meta-4 */
-  { ISFUNC, rl_digit_argument }, /* Meta-5 */
-  { ISFUNC, rl_digit_argument }, /* Meta-6 */
-  { ISFUNC, rl_digit_argument }, /* Meta-7 */
-  { ISFUNC, rl_digit_argument }, /* Meta-8 */
-  { ISFUNC, rl_digit_argument }, /* Meta-9 */
-
-  /* A little more punctuation. */
-  { ISFUNC, (Function *)0x0 },		/* Meta-: */
-  { ISFUNC, (Function *)0x0 },		/* Meta-; */
-  { ISFUNC, rl_beginning_of_history },	/* Meta-< */
-  { ISFUNC, (Function *)0x0 },		/* Meta-= */
-  { ISFUNC, rl_end_of_history },	/* Meta-> */
-  { ISFUNC, rl_possible_completions },	/* Meta-? */
-  { ISFUNC, (Function *)0x0 },		/* Meta-@ */
-
-  /* Uppercase alphabet. */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-A */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-B */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-C */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-D */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-E */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-F */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-G */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-H */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-I */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-J */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-K */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-L */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-M */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-N */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-O */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-P */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-Q */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-R */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-S */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-T */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-U */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-V */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-W */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-X */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-Y */
-  { ISFUNC, rl_do_lowercase_version },	/* Meta-Z */
-
-  /* Some more punctuation. */
-  { ISFUNC, rl_arrow_keys },	/* Meta-[ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-\ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-] */
-  { ISFUNC, (Function *)0x0 },	/* Meta-^ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-_ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-` */
-
-  /* Lowercase alphabet. */
-  { ISFUNC, (Function *)0x0 },	/* Meta-a */
-  { ISFUNC, rl_backward_word },	/* Meta-b */
-  { ISFUNC, rl_capitalize_word }, /* Meta-c */
-  { ISFUNC, rl_kill_word },	/* Meta-d */
-  { ISFUNC, (Function *)0x0 },	/* Meta-e */
-  { ISFUNC, rl_forward_word },	/* Meta-f */
-  { ISFUNC, (Function *)0x0 },	/* Meta-g */
-  { ISFUNC, (Function *)0x0 },	/* Meta-h */
-  { ISFUNC, (Function *)0x0 },	/* Meta-i */
-  { ISFUNC, (Function *)0x0 },	/* Meta-j */
-  { ISFUNC, (Function *)0x0 },	/* Meta-k */
-  { ISFUNC, rl_downcase_word },	/* Meta-l */
-  { ISFUNC, (Function *)0x0 },	/* Meta-m */
-  { ISFUNC, (Function *)0x0 },	/* Meta-n */
-  { ISFUNC, rl_arrow_keys },	/* Meta-o */
-  { ISFUNC, (Function *)0x0 },	/* Meta-p */
-  { ISFUNC, (Function *)0x0 },	/* Meta-q */
-  { ISFUNC, rl_revert_line },	/* Meta-r */
-  { ISFUNC, (Function *)0x0 },	/* Meta-s */
-  { ISFUNC, rl_transpose_words }, /* Meta-t */
-  { ISFUNC, rl_upcase_word },	/* Meta-u */
-  { ISFUNC, (Function *)0x0 },	/* Meta-v */
-  { ISFUNC, (Function *)0x0 },	/* Meta-w */
-  { ISFUNC, (Function *)0x0 },	/* Meta-x */
-  { ISFUNC, rl_yank_pop },	/* Meta-y */
-  { ISFUNC, (Function *)0x0 },	/* Meta-z */
-
-  /* Final punctuation. */
-  { ISFUNC, (Function *)0x0 },	/* Meta-{ */
-  { ISFUNC, (Function *)0x0 },	/* Meta-| */
-  { ISFUNC, (Function *)0x0 },	/* Meta-} */
-  { ISFUNC, (Function *)0x0 },	/* Meta-~ */
-  { ISFUNC, rl_backward_kill_word } /* Meta-rubout */
-};
-
-KEYMAP_ENTRY_ARRAY emacs_ctlx_keymap = {
-
-  /* Control keys. */
-  { ISFUNC, (Function *)0x0 },		/* Control-@ */
-  { ISFUNC, (Function *)0x0 },		/* Control-a */
-  { ISFUNC, (Function *)0x0 },		/* Control-b */
-  { ISFUNC, (Function *)0x0 },		/* Control-c */
-  { ISFUNC, (Function *)0x0 },		/* Control-d */
-  { ISFUNC, (Function *)0x0 },		/* Control-e */
-  { ISFUNC, (Function *)0x0 },		/* Control-f */
-  { ISFUNC, rl_abort },			/* Control-g */
-  { ISFUNC, (Function *)0x0 },		/* Control-h */
-  { ISFUNC, (Function *)0x0 },		/* Control-i */
-  { ISFUNC, (Function *)0x0 },		/* Control-j */
-  { ISFUNC, (Function *)0x0 },		/* Control-k */
-  { ISFUNC, (Function *)0x0 },		/* Control-l */
-  { ISFUNC, (Function *)0x0 },		/* Control-m */
-  { ISFUNC, (Function *)0x0 },		/* Control-n */
-  { ISFUNC, (Function *)0x0 },		/* Control-o */
-  { ISFUNC, (Function *)0x0 },		/* Control-p */
-  { ISFUNC, (Function *)0x0 },		/* Control-q */
-  { ISFUNC, rl_re_read_init_file },	/* Control-r */
-  { ISFUNC, (Function *)0x0 },		/* Control-s */
-  { ISFUNC, (Function *)0x0 },		/* Control-t */
-  { ISFUNC, rl_undo_command },		/* Control-u */
-  { ISFUNC, (Function *)0x0 },		/* Control-v */
-  { ISFUNC, (Function *)0x0 },		/* Control-w */
-  { ISFUNC, (Function *)0x0 },		/* Control-x */
-  { ISFUNC, (Function *)0x0 },		/* Control-y */
-  { ISFUNC, (Function *)0x0 },		/* Control-z */
-  { ISFUNC, (Function *)0x0 },		/* Control-[ */
-  { ISFUNC, (Function *)0x0 },		/* Control-\ */
-  { ISFUNC, (Function *)0x0 },		/* Control-] */
-  { ISFUNC, (Function *)0x0 },		/* Control-^ */
-  { ISFUNC, (Function *)0x0 },		/* Control-_ */
-
-  /* The start of printing characters. */
-  { ISFUNC, (Function *)0x0 },		/* SPACE */
-  { ISFUNC, (Function *)0x0 },		/* ! */
-  { ISFUNC, (Function *)0x0 },		/* " */
-  { ISFUNC, (Function *)0x0 },		/* # */
-  { ISFUNC, (Function *)0x0 },		/* $ */
-  { ISFUNC, (Function *)0x0 },		/* % */
-  { ISFUNC, (Function *)0x0 },		/* & */
-  { ISFUNC, (Function *)0x0 },		/* ' */
-  { ISFUNC, rl_start_kbd_macro },	/* ( */
-  { ISFUNC, rl_end_kbd_macro  },	/* ) */
-  { ISFUNC, (Function *)0x0 },		/* * */
-  { ISFUNC, (Function *)0x0 },		/* + */
-  { ISFUNC, (Function *)0x0 },		/* , */
-  { ISFUNC, (Function *)0x0 },		/* - */
-  { ISFUNC, (Function *)0x0 },		/* . */
-  { ISFUNC, (Function *)0x0 },		/* / */
-
-  /* Regular digits. */
-  { ISFUNC, (Function *)0x0 },		/* 0 */
-  { ISFUNC, (Function *)0x0 },		/* 1 */
-  { ISFUNC, (Function *)0x0 },		/* 2 */
-  { ISFUNC, (Function *)0x0 },		/* 3 */
-  { ISFUNC, (Function *)0x0 },		/* 4 */
-  { ISFUNC, (Function *)0x0 },		/* 5 */
-  { ISFUNC, (Function *)0x0 },		/* 6 */
-  { ISFUNC, (Function *)0x0 },		/* 7 */
-  { ISFUNC, (Function *)0x0 },		/* 8 */
-  { ISFUNC, (Function *)0x0 },		/* 9 */
-
-  /* A little more punctuation. */
-  { ISFUNC, (Function *)0x0 },	/* : */
-  { ISFUNC, (Function *)0x0 },	/* ; */
-  { ISFUNC, (Function *)0x0 },	/* < */
-  { ISFUNC, (Function *)0x0 },	/* = */
-  { ISFUNC, (Function *)0x0 },	/* > */
-  { ISFUNC, (Function *)0x0 },	/* ? */
-  { ISFUNC, (Function *)0x0 },	/* @ */
-
-  /* Uppercase alphabet. */
-  { ISFUNC, rl_do_lowercase_version },	/* A */
-  { ISFUNC, rl_do_lowercase_version },	/* B */
-  { ISFUNC, rl_do_lowercase_version },	/* C */
-  { ISFUNC, rl_do_lowercase_version },	/* D */
-  { ISFUNC, rl_do_lowercase_version },	/* E */
-  { ISFUNC, rl_do_lowercase_version },	/* F */
-  { ISFUNC, rl_do_lowercase_version },	/* G */
-  { ISFUNC, rl_do_lowercase_version },	/* H */
-  { ISFUNC, rl_do_lowercase_version },	/* I */
-  { ISFUNC, rl_do_lowercase_version },	/* J */
-  { ISFUNC, rl_do_lowercase_version },	/* K */
-  { ISFUNC, rl_do_lowercase_version },	/* L */
-  { ISFUNC, rl_do_lowercase_version },	/* M */
-  { ISFUNC, rl_do_lowercase_version },	/* N */
-  { ISFUNC, rl_do_lowercase_version },	/* O */
-  { ISFUNC, rl_do_lowercase_version },	/* P */
-  { ISFUNC, rl_do_lowercase_version },	/* Q */
-  { ISFUNC, rl_do_lowercase_version },	/* R */
-  { ISFUNC, rl_do_lowercase_version },	/* S */
-  { ISFUNC, rl_do_lowercase_version },	/* T */
-  { ISFUNC, rl_do_lowercase_version },	/* U */
-  { ISFUNC, rl_do_lowercase_version },	/* V */
-  { ISFUNC, rl_do_lowercase_version },	/* W */
-  { ISFUNC, rl_do_lowercase_version },	/* X */
-  { ISFUNC, rl_do_lowercase_version },	/* Y */
-  { ISFUNC, rl_do_lowercase_version },	/* Z */
-
-  /* Some more punctuation. */
-  { ISFUNC, (Function *)0x0 },		/* [ */
-  { ISFUNC, (Function *)0x0 },		/* \ */
-  { ISFUNC, (Function *)0x0 },		/* ] */
-  { ISFUNC, (Function *)0x0 },		/* ^ */
-  { ISFUNC, (Function *)0x0 },		/* _ */
-  { ISFUNC, (Function *)0x0 },		/* ` */
-
-  /* Lowercase alphabet. */
-  { ISFUNC, (Function *)0x0 },		/* a */
-  { ISFUNC, (Function *)0x0 },		/* b */
-  { ISFUNC, (Function *)0x0 },		/* c */
-  { ISFUNC, (Function *)0x0 },		/* d */
-  { ISFUNC, rl_call_last_kbd_macro },	/* e */
-  { ISFUNC, (Function *)0x0 },		/* f */
-  { ISFUNC, (Function *)0x0 },		/* g */
-  { ISFUNC, (Function *)0x0 },		/* h */
-  { ISFUNC, (Function *)0x0 },		/* i */
-  { ISFUNC, (Function *)0x0 },		/* j */
-  { ISFUNC, (Function *)0x0 },		/* k */
-  { ISFUNC, (Function *)0x0 },		/* l */
-  { ISFUNC, (Function *)0x0 },		/* m */
-  { ISFUNC, (Function *)0x0 },		/* n */
-  { ISFUNC, (Function *)0x0 },		/* o */
-  { ISFUNC, (Function *)0x0 },		/* p */
-  { ISFUNC, (Function *)0x0 },		/* q */
-  { ISFUNC, (Function *)0x0 },		/* r */
-  { ISFUNC, (Function *)0x0 },		/* s */
-  { ISFUNC, (Function *)0x0 },		/* t */
-  { ISFUNC, (Function *)0x0 },		/* u */
-  { ISFUNC, (Function *)0x0 },		/* v */
-  { ISFUNC, (Function *)0x0 },		/* w */
-  { ISFUNC, (Function *)0x0 },		/* x */
-  { ISFUNC, (Function *)0x0 },		/* y */
-  { ISFUNC, (Function *)0x0 },		/* z */
-
-  /* Final punctuation. */
-  { ISFUNC, (Function *)0x0 },		/* { */
-  { ISFUNC, (Function *)0x0 },		/* | */
-  { ISFUNC, (Function *)0x0 },		/* } */
-  { ISFUNC, (Function *)0x0 },		/* ~ */
-  { ISFUNC, rl_backward_kill_line }	/* RUBOUT */
-};
diff --git a/fmt/src/ez_delimited_read.c b/fmt/src/ez_delimited_read.c
index 4ac3094..939025b 100644
--- a/fmt/src/ez_delimited_read.c
+++ b/fmt/src/ez_delimited_read.c
@@ -79,9 +79,18 @@
 #include <string.h>
 #include <stdio.h>
 
-#include "ferretmacros.h"
+#include "fmtprotos.h"
 #include "ez_delimited_read.h"
+#include "ferret.h"
+#include "FerMem.h"
 
+static int decode_file(char* fname, char *recptr, char *delims, int *skip, int* maxrec, int* reclen, 
+                       int* nfields, int field_type[], int* nrec, DFTYPE** numeric_fields, 
+                       char*** text_fields, DFTYPE bad_flags[], int* status);
+static void decodeRec(char *recptr, char *delims, int* nfields, int field_type[], int rec, 
+                     DFTYPE** numeric_fields, char*** text_fields, DFTYPE bad_flags[], int* status);
+static void analRec(char *recptr, char *delims, int* nfields, int field_type[], int max_fields);
+static char *nexstrtok(char *s1, char *s2);
 
 /*
  *
@@ -103,13 +112,9 @@
  *
  */
 
-
-void FORTRAN(decode_file_jacket)
-		( char* fname, char *recptr, char *delims, int *skip,
-		  int* maxrec, int* reclen, int* nfields,
-		  int field_type[], int* nrec,
-		  int mrlist[], long* mr_ptrs_val,
-		  DFTYPE mr_bad_flags[], char ***mr_c_ptr, int* status)
+void FORTRAN(decode_file_jacket)(char* fname, char *recptr, char *delims, int *skip, int* maxrec, int* reclen, 
+                                 int* nfields, int field_type[], int* nrec, int mrlist[], DFTYPE ***mr_ptrs_ptr, 
+                                 DFTYPE mr_bad_flags[], char ***mr_c_ptr, int* status)
 /* 1/17 --- pre-dynamic memory call
 void FORTRAN(decode_file_jacket)
 		( char* fname, char *recptr, char *delims, int *skip,
@@ -119,11 +124,11 @@ void FORTRAN(decode_file_jacket)
 		  DFTYPE mr_bad_flags[], char ***mr_c_ptr, int* status)
 */
 {
-  DFTYPE** mr_ptrs = (DFTYPE**) *mr_ptrs_val;
-  DFTYPE **numeric_fields  = (DFTYPE **) malloc(sizeof(DFTYPE*) * (*nfields));
-  DFTYPE *bad_flags        = (DFTYPE *)  malloc(sizeof(DFTYPE) * (*nfields));
+  DFTYPE** mr_ptrs = *mr_ptrs_ptr;
+  DFTYPE **numeric_fields  = (DFTYPE **) FerMem_Malloc(sizeof(DFTYPE*) * (*nfields), __FILE__, __LINE__);
+  DFTYPE *bad_flags        = (DFTYPE *)  FerMem_Malloc(sizeof(DFTYPE) * (*nfields), __FILE__, __LINE__);
 
-  char ***text_fields     = (char ***) malloc(sizeof(char**) * (*nfields));
+  char ***text_fields     = (char ***) FerMem_Malloc(sizeof(char**) * (*nfields), __FILE__, __LINE__);
   int i, mr;
   int pinc = 8/sizeof(char*);  /* pointers spaced 8 bytes apart */
 
@@ -160,14 +165,13 @@ void FORTRAN(decode_file_jacket)
   /*
     at last we actually read the file
   */
-  decode_file (fname, recptr, delims, skip, 
-	       maxrec, reclen, nfields,
-	       field_type, nrec,
-	       numeric_fields, text_fields, bad_flags, status);
+  decode_file(fname, recptr, delims, skip, maxrec, reclen, 
+	      nfields, field_type, nrec, numeric_fields, 
+              text_fields, bad_flags, status);
 
-  free(numeric_fields);
-  free(text_fields);
-  free(bad_flags);
+  FerMem_Free(numeric_fields, __FILE__, __LINE__);
+  FerMem_Free(text_fields, __FILE__, __LINE__);
+  FerMem_Free(bad_flags, __FILE__, __LINE__);
 
   return;
 }
@@ -196,11 +200,9 @@ void FORTRAN(decode_file_jacket)
  */
 
 
-int decode_file (char* fname, char *recptr, char *delims, int *skip, 
-			  int* maxrec, int* reclen, int* nfields,
-			  int field_type[], int* nrec, DFTYPE** numeric_fields,
-			  char*** text_fields, DFTYPE bad_flags[], int* status)
-
+static int decode_file(char* fname, char *recptr, char *delims, int *skip, int* maxrec, int* reclen, 
+                       int* nfields, int field_type[], int* nrec, DFTYPE** numeric_fields, 
+                       char*** text_fields, DFTYPE bad_flags[], int* status)
 {
 
   FILE *fp;
@@ -369,10 +371,8 @@ int FORTRAN(anal_file) (char* fname, char *recptr, char *delims, int* skip,
  *
  */
 
-int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
-	      int rec,
-	      DFTYPE** numeric_fields, char*** text_fields, DFTYPE bad_flags[],
-	      int* status)
+static void decodeRec(char *recptr, char *delims, int* nfields, int field_type[], int rec, 
+                     DFTYPE** numeric_fields, char*** text_fields, DFTYPE bad_flags[], int* status)
 {
 
   char *p, *pnext, str1[2], errstr[2];
@@ -405,7 +405,7 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
     } else if (p==NULL || *p == '\0') {
       /* missing data field */
       if ( field_type[i] == FTYP_CHARACTER ) {
-	(*(text_fields+i))[rec*pinc] = (char *) malloc(sizeof(char)*2);
+	(*(text_fields+i))[rec*pinc] = (char *) FerMem_Malloc(sizeof(char)*2, __FILE__, __LINE__);
 	strcpy( (*(text_fields+i))[rec*pinc], blankstr );
       }
       else {
@@ -463,7 +463,7 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 	  /* check for yyyy/mm/dd */
 	  if (idummy1 > 1800) {
 		  (*(numeric_fields+i))[rec] =
-		  days_from_day0_(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
+		  FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
 		  (*(numeric_fields+i))[rec] = rdum;
 		  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];
 		  break;
@@ -478,14 +478,14 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 	  }
 
 	  (*(numeric_fields+i))[rec] =
-	    days_from_day0_(&days_1900,&idummy3,&idummy1,&idummy2,&rdum,status);
+	    FORTRAN(days_from_day0)(&days_1900,&idummy3,&idummy1,&idummy2,&rdum,status);
 	  (*(numeric_fields+i))[rec] = rdum;
 	  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];
 	/* force dates with dashes "-" to be in yyyy-mm-dd format *kob* */
 	} else if (sscanf(p,"%4d-%2d-%2d%1s",
 			  &idummy1,&idummy2,&idummy3,errstr) == 3) {
 	  (*(numeric_fields+i))[rec] =
-	    days_from_day0_(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
+	    FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
 	  (*(numeric_fields+i))[rec] = rdum; 
 	  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];
 	  }
@@ -495,7 +495,7 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 	      && idummy2>=1 && idummy2<=12
 	      && idummy3>=1 && idummy3<=31 ) {
 	  (*(numeric_fields+i))[rec] =
-	    days_from_day0_(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
+	    FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
 	  (*(numeric_fields+i))[rec] = rdum; }
 	else
 	  (*(numeric_fields+i))[rec] = bad_flags[i];
@@ -525,7 +525,7 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 	  /* check for yyyy/mm/dd */
 	  if (idummy1 > 1800) {
 		  (*(numeric_fields+i))[rec] =
-		  days_from_day0_(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
+		  FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
 		  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];
 	  } else {
 
@@ -538,7 +538,7 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 		  }
 		  
 		  (*(numeric_fields+i))[rec] =
-		  days_from_day0_(&days_1900,&idummy3,&idummy1,&idummy2,&rdum,status);
+		  FORTRAN(days_from_day0)(&days_1900,&idummy3,&idummy1,&idummy2,&rdum,status);
 		  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];
 	  }
 
@@ -555,26 +555,20 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 		if (ndum == 5) tpart = idummy4 + idummy5/60.;
 
 	  (*(numeric_fields+i))[rec] =
-	    days_from_day0_(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
+	    FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
 	  (*(numeric_fields+i))[rec] = rdum + tpart/24.; 
 	  if (tpart == -999) (*(numeric_fields+i))[rec] = bad_flags[i];
 	  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];
 	  }
 
 	/* check for yyyymmdd date */
-	else if ( (sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,&idummy4,&idummy5,&dummy,str1) >= 4)
+	else if ( (sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,str1) == 3)
 	      && idummy1>0
 	      && idummy3>=1 && idummy3<=12
 	      && idummy2>=1 && idummy2<=31 ) {
-		ndum = sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,&idummy4,&idummy5,&dummy,str1);
-		tpart = -999;	
-		if (ndum == 6) tpart = idummy4 + idummy5/60. + dummy/3600.;
-		if (ndum == 5) tpart = idummy4 + idummy5/60.;	
-
 		(*(numeric_fields+i))[rec] =
-		days_from_day0_(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
-		(*(numeric_fields+i))[rec] = rdum + tpart/24.; 	
-	    if (tpart == -999) (*(numeric_fields+i))[rec] = bad_flags[i];
+		FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
+		(*(numeric_fields+i))[rec] = rdum;
 		if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];
 	  }
 	else
@@ -596,7 +590,7 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 	  /* check for yyyy/mm/dd */
 	  if (idummy1 > 1800) {
 		  (*(numeric_fields+i))[rec] =
-		  days_from_day0_(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
+		  FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
 		  (*(numeric_fields+i))[rec] = rdum;
 		  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];
 		  break;
@@ -611,14 +605,14 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 	  }
 
 	  (*(numeric_fields+i))[rec] =
-	    days_from_day0_(&days_1900,&idummy3,&idummy2,&idummy1,&rdum,status);
+	    FORTRAN(days_from_day0)(&days_1900,&idummy3,&idummy2,&idummy1,&rdum,status);
 	  (*(numeric_fields+i))[rec] = rdum;
 	  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];
 	  /* force dates with dashes "-" to be in yyyy-mm-dd format *kob* */
 	} else if (sscanf(p,"%4d-%2d-%2d%1s",
 			  &idummy1,&idummy2,&idummy3,errstr) == 3) {
 	  (*(numeric_fields+i))[rec] =
-	    days_from_day0_(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
+	    FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
 	  (*(numeric_fields+i))[rec] = rdum;
 	  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i]; }
 	/* add check for yyyyddmm euro date *kob* */
@@ -627,7 +621,7 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 	      && idummy3>=1 && idummy3<=12
 	      && idummy2>=1 && idummy2<=31 ) {
 	  (*(numeric_fields+i))[rec] =
-	    days_from_day0_(&days_1900,&idummy1,&idummy3,&idummy2,&rdum,status);
+	    FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy3,&idummy2,&rdum,status);
 	  (*(numeric_fields+i))[rec] = rdum;
 	  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i]; }
 	else
@@ -658,7 +652,7 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 	  /* check for yyyy/mm/dd */
 	  if (idummy1 > 1800) {
 		  (*(numeric_fields+i))[rec] =
-		  days_from_day0_(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
+		  FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
 
 	  } else {
 
@@ -671,7 +665,7 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 		  }
 		  
 		  (*(numeric_fields+i))[rec] =
-		  days_from_day0_(&days_1900,&idummy3,&idummy2,&idummy1,&rdum,status);
+		  FORTRAN(days_from_day0)(&days_1900,&idummy3,&idummy2,&idummy1,&rdum,status);
 	  }
 
 	  (*(numeric_fields+i))[rec] = rdum + tpart/24.;
@@ -688,26 +682,20 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 		if (ndum == 5) tpart = idummy4 + idummy5/60.;
 
 	  (*(numeric_fields+i))[rec] =
-	    days_from_day0_(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
+	    FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy2,&idummy3,&rdum,status);
 	  (*(numeric_fields+i))[rec] = rdum + tpart/24.; 
 	  if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];
 	  if (tpart == -999) (*(numeric_fields+i))[rec] = bad_flags[i];
 	  }
 
 	/* add check for yyyyddmm euro date *kob* */
-	else if ( (sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,&idummy4,&idummy5,&dummy,str1) >= 4)
+	else if ( (sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,str1) == 3)
 	      && idummy1>0
 	      && idummy3>=1 && idummy3<=12
 	      && idummy2>=1 && idummy2<=31 ) {
-		ndum = sscanf(p,"%4d%2d%2d%1s",&idummy1,&idummy2,&idummy3,&idummy4,&idummy5,&dummy,str1);
-		tpart = -999;	
-		if (ndum == 6) tpart = idummy4 + idummy5/60. + dummy/3600.;
-		if (ndum == 5) tpart = idummy4 + idummy5/60.;	
-
 		(*(numeric_fields+i))[rec] =
-		days_from_day0_(&days_1900,&idummy1,&idummy3,&idummy2,&rdum,status);
-		(*(numeric_fields+i))[rec] = rdum + tpart/24.;
-	    if (tpart == -999) (*(numeric_fields+i))[rec] = bad_flags[i];
+		FORTRAN(days_from_day0)(&days_1900,&idummy1,&idummy3,&idummy2,&rdum,status);
+		(*(numeric_fields+i))[rec] = rdum;
 	    if (*status != 3) (*(numeric_fields+i))[rec] = bad_flags[i];  }
 	else
 	  (*(numeric_fields+i))[rec] = bad_flags[i];
@@ -748,7 +736,7 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
 	    p++;
 	  }
 	  (*(text_fields+i))[rec*pinc] =
-	    (char *) malloc(sizeof(char)*(strlen(p)+1));
+	    (char *) FerMem_Malloc(sizeof(char)*(strlen(p)+1), __FILE__, __LINE__);
 	  strcpy( (*(text_fields+i))[rec*pinc], p );
 	}
 	break;
@@ -784,14 +772,13 @@ int decodeRec(char *recptr, char *delims, int* nfields, int field_type[],
  *
  */
 
-void analRec(char *recptr, char *delims, int* nfields, int field_type[],
-	    int max_fields)
+static void analRec(char *recptr, char *delims, int* nfields, int field_type[], int max_fields)
 {
 
   char *p, *pnext, pstart[256], str1[2], latlon1[2];
   double dummy;
 
-  int idummy1, idummy2, idummy3, i, nfields_in;
+  int idummy1, idummy2, idummy3, nfields_in;
 
   p = recptr;
   nfields_in = *nfields;
@@ -928,8 +915,7 @@ void analRec(char *recptr, char *delims, int* nfields, int field_type[],
  *
  */
 
-char *nexstrtok(char *s1, char *s2)
-
+static char *nexstrtok(char *s1, char *s2)
      /*
        like strtok but sensitive to multiple (non-white space) delimiters
        as significant. For example, 2 commas together indicate a missing field.
@@ -978,11 +964,13 @@ char *nexstrtok(char *s1, char *s2)
 void FORTRAN(save_delimited_info) (int *nfields, int field_type[],
 				   char *delim, DelimFileInfo **ptr)
 {
-  DelimFileInfo *fi = (DelimFileInfo *) calloc(1, sizeof(DelimFileInfo));
-  int* _field_type  = (int *) malloc(sizeof(int) * (*nfields));
-  char* _delim      = (char *) malloc(sizeof(char) * (int)strlen(delim));
+  DelimFileInfo *fi = (DelimFileInfo *) FerMem_Malloc(sizeof(DelimFileInfo), __FILE__, __LINE__);
+  int* _field_type  = (int *) FerMem_Malloc(sizeof(int) * (*nfields), __FILE__, __LINE__);
+  char* _delim      = (char *) FerMem_Malloc(sizeof(char) * (int)strlen(delim) + 1, __FILE__, __LINE__);
   int i;
 
+  memset(fi, 0, sizeof(DelimFileInfo));
+
   for (i=0; i<*nfields; i++)
     _field_type[i] = field_type[i];
 
@@ -1000,7 +988,7 @@ void FORTRAN(get_delimited_info) (int *nfields, int field_type[],
 				   char *delim, DelimFileInfo **ptr)
 {
 
-  int i,iout;
+  int i;
   DelimFileInfo *fi = *ptr;
 
   *nfields = fi->nfields;
@@ -1013,9 +1001,15 @@ void FORTRAN(get_delimited_info) (int *nfields, int field_type[],
 void FORTRAN(delete_delimited_info) (DelimFileInfo **ptr)
 {
   DelimFileInfo *fi = *ptr;
-  free(fi->fieldType);
-  free(fi->delim);
-  free(fi);
+  if ( fi != NULL ) {
+    if ( fi->fieldType != NULL )
+      FerMem_Free(fi->fieldType, __FILE__, __LINE__);
+    if ( fi->delim != NULL )
+      FerMem_Free(fi->delim, __FILE__, __LINE__);
+    memset(fi, 0, sizeof(DelimFileInfo));
+    FerMem_Free(fi, __FILE__, __LINE__);
+    *ptr = NULL;
+  }
   return;
 }
 
diff --git a/fmt/src/free_time.F b/fmt/src/free_time.F
index aa23811..1a1b414 100644
--- a/fmt/src/free_time.F
+++ b/fmt/src/free_time.F
@@ -1,4 +1,4 @@
-      subroutine free_time
+      INTEGER FUNCTION free_time()
 c
 c  this routine calls atc_update every fourth time to refresh a GKS graphics
 c  window.
@@ -45,7 +45,7 @@ c  kob 5/92
 * IBM PORT 14apr94 *kob* : IBM wouldn't allow c-like logical statment
 *		 	  had to use ".NEQV" instead.
 * IBM PORT 2jun94 *kob*  : Above change incorrect.  A mistake was made, the
-*			   comparison should be done with .NE.		
+*			   comparison should be done with .NE.
       integer count
 !      static count
       save count
@@ -61,6 +61,7 @@ c  call atc_update to refresh screen
          count = 0
       endif
 
+      free_time = 0
       return 
 
       end
diff --git a/fmt/src/my_open.c b/fmt/src/my_open.c
deleted file mode 100644
index 05f4931..0000000
--- a/fmt/src/my_open.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.  
-*
-*/
-/*
-   06/04 *ywei* -Created to read command file faster
- */
-/* *acm   9/06 v600 - add stdlib.h wherever there is stdio.h for altix build*/ 
-
-#include <stdlib.h>
-#include <stdio.h> 
-
-void my_open_(    void  **lun,
-                   char *fname,
-                   int  *len_fname,
-                   int  *is_success){
-
-   int true_len_fname, i;
-   char *c_fname,ch;
-   FILE * fp;
-
-   tm_get_strlen_(&true_len_fname, len_fname, fname);
-   if(true_len_fname<=0) return;
-
-   c_fname =(char *)malloc(true_len_fname+1);
-   for(i=0;i<true_len_fname;i++){
-      c_fname[i] = fname[i];
-   }
-   c_fname[true_len_fname] = 0;
-
-   fp = fopen(c_fname,"r");
-
-   if(fp)
-     *is_success = 1;
-   else
-     *is_success = 0;
-
-   free(c_fname);
- 
-   *((FILE**)lun) = fp;
-}
-
diff --git a/fmt/src/my_readline.c b/fmt/src/my_readline.c
deleted file mode 100644
index 1200157..0000000
--- a/fmt/src/my_readline.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.  
-*
-*/
-/*
-   06/04 *ywei* -Created to read command file faster
-*/
-
-#include <stdio.h>
-
-void my_readline_(  void **lun,
-                     char *out_string,
-                     int *len_out_string,
-                     int *status
-                   )
-{
-
-   int i, buff_size,fill;
-   FILE *fp;
-   char *pch,ch;
-
-   fp = *((FILE**)lun);
-
-   if(fp==NULL){
-     *status = -1;
-     return;
-   }
-   buff_size = *len_out_string;
-   
-   pch = fgets(out_string, buff_size, fp);
-   
-   if(pch==NULL){
-      *status = 0;
-   }
-   else{
-      *status = 1;
-      fill = 0;
-      for(i=0;i<buff_size;i++){
-	if(out_string[i]==0){
-	   fill =1;
-	}
-        if(fill||out_string[i]==10)
-	   out_string[i]=' ';
-      }
-   } 
-   
-}
-
-
diff --git a/fmt/src/nc.h b/fmt/src/nc.h
deleted file mode 100644
index e6bfeef..0000000
--- a/fmt/src/nc.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- *	Copyright 1996, University Corporation for Atmospheric Research
- *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
- */
-/* $Id: nc.h 14257 2012-06-29 21:30:31Z ansley $ */
-
-/* this include is not needed with current netCDF libraries. */
diff --git a/fmt/src/ncconfig.h b/fmt/src/ncconfig.h
deleted file mode 100644
index 5dce631..0000000
--- a/fmt/src/ncconfig.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* libsrc/ncconfig.h.  Generated automatically by configure.  */
-/* libsrc/ncconfig.in.  Generated automatically from configure.in by autoheader.  */
-/* $Id: ncconfig.h 14257 2012-06-29 21:30:31Z ansley $ */
-
-
-/* this include is not needed with current netCDF libraries. */
diff --git a/fmt/src/ncio.h b/fmt/src/ncio.h
deleted file mode 100644
index d17a912..0000000
--- a/fmt/src/ncio.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- *	Copyright 1996, University Corporation for Atmospheric Research
- *	See netcdf/COPYRIGHT file for copying and redistribution conditions.
- */
-/* $Id: ncio.h 14257 2012-06-29 21:30:31Z ansley $ */
-
-/* this include is not needed with current netCDF libraries. */
\ No newline at end of file
diff --git a/fmt/src/str_case_blind_compare_sub.c b/fmt/src/str_case_blind_compare_sub.c
index e596500..d4854f9 100644
--- a/fmt/src/str_case_blind_compare_sub.c
+++ b/fmt/src/str_case_blind_compare_sub.c
@@ -35,13 +35,10 @@
 *  ywei: 05/04 created to speed up uppercase string matching
 */
 
+#include "fmtprotos.h"
 #include <stdio.h>
 
-void str_case_blind_compare_sub_(char* test_name,
-                            int * len_test,
-                            char* model_name, 
-                            int * len_model, 
-                            int * result)
+void FORTRAN(str_case_blind_compare_sub)(char *test_name, int *len_test, char *model_name, int *len_model, int *result)
 {
      int i, ltest=*len_test, lmod=*len_model;
      char c1, c2;
diff --git a/fmt/src/str_dncase_sub.c b/fmt/src/str_dncase_sub.c
index e48adba..1846c70 100644
--- a/fmt/src/str_dncase_sub.c
+++ b/fmt/src/str_dncase_sub.c
@@ -39,8 +39,9 @@
 
 #include <ctype.h>
 #include <stdio.h>
+#include "fmtprotos.h"
 
-void str_dncase_sub_(char *out_string, int *out_len, char *in_string, int* in_len)
+void FORTRAN(str_dncase_sub)(char *out_string, int *out_len, char *in_string, int *in_len)
 {
     int min_len =(*out_len<*in_len)?(*out_len):(*in_len);
     int i;
diff --git a/fmt/src/str_upcase_sub.c b/fmt/src/str_upcase_sub.c
index 60901dd..242643f 100644
--- a/fmt/src/str_upcase_sub.c
+++ b/fmt/src/str_upcase_sub.c
@@ -38,10 +38,12 @@
  */
 
 #include <stdio.h>
+#include "fmtprotos.h"
 
+/* This only works for English ANSI characters; better to use toupper */
 #define uppercase(a) ((a>='a'&&a<='z')?((a)&0xDF):(a))
 
-void str_upcase_sub_(char *out_string, int *out_len, char *in_string, int* in_len)
+void FORTRAN(str_upcase_sub)(char *out_string, int *out_len, char *in_string, int* in_len)
 {
     int min_len =(*out_len<*in_len)?(*out_len):(*in_len);
     int i;
diff --git a/fmt/src/string_array_clear.c b/fmt/src/string_array_clear.c
index e9045b0..ac8f886 100644
--- a/fmt/src/string_array_clear.c
+++ b/fmt/src/string_array_clear.c
@@ -40,22 +40,28 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
+#include "fmtprotos.h"
 #include "string_array.h"
+#include "FerMem.h"
 
-void string_array_clear_(double * string_array_header)
+void FORTRAN(string_array_clear)(void **string_array_header)
 {
-    int i;
-    SA_Head * head; 
+    SA_Head *head; 
+    int j;
 
-    if(*(SA_Head**)string_array_header){
-       head = *((SA_Head**)string_array_header);
-       for(i=0;i<head->array_size;i++) {
-	 free(head->ptr_array[i]);
+    if ( *string_array_header != NULL ) {
+       head = *string_array_header;
+       for (j = 0; j < head->array_size; j++) {
+	  FerMem_Free(head->ptr_array[j], __FILE__, __LINE__);
+	  head->ptr_array[j] = NULL;
        }
-       free(head->ptr_array);
-       free(head->hash_table);
-       free(head);
+       FerMem_Free(head->ptr_array, __FILE__, __LINE__);
+       FerMem_Free(head->strlen_array, __FILE__, __LINE__);
+       FerMem_Free(head->hash_table, __FILE__, __LINE__);
+       memset(head, 0, sizeof(SA_Head));
+       FerMem_Free(head, __FILE__, __LINE__);
+       *string_array_header = NULL;
     }
-    *string_array_header = 0;
 }
 
diff --git a/fmt/src/string_array_find.c b/fmt/src/string_array_find.c
index 32ebe94..dd4f4b0 100644
--- a/fmt/src/string_array_find.c
+++ b/fmt/src/string_array_find.c
@@ -42,15 +42,12 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include "fmtprotos.h"
 #include "string_array.h"
 
-void string_array_find_(    double *string_array_header,
-			     char *test_string,
-                             int *test_len,
-                             int *result_array,
-                             int *result_array_size,
-                             int *num_indices
-                           )
+void FORTRAN(string_array_find)(void **string_array_header, char *test_string, int *test_len, 
+                                int *result_array, int *result_array_size, int *num_indices)
 {
    int i,j=0;
    int true_test_len, true_model_len, array_size, 
@@ -61,16 +58,13 @@ void string_array_find_(    double *string_array_header,
    int match=0;
 
  
-   if(*(SA_Head**)string_array_header){
-      head = *((SA_Head**)string_array_header);
+   head = *string_array_header;
+   if ( head != NULL ) {
       array_size = head->array_size;
       string_size = head->string_size;
  
-      tm_get_strlen_(&true_test_len, test_len, test_string);
- 
- 
+      FORTRAN(tm_get_strlen)(&true_test_len, test_len, test_string);
       hash_value = string_array_hash(test_string, true_test_len, 0, array_size);
-      
 
       if(true_test_len ==0){
 	 result_array_size1 = 5;
@@ -83,7 +77,7 @@ void string_array_find_(    double *string_array_header,
 
       for(p=bucket; p; p=p->next) {
 	  model_string=&(head->string_array[(p->index-1)*string_size]);
-          string_array_get_strlen_(string_array_header, &(p->index), &true_model_len);
+          FORTRAN(string_array_get_strlen)(string_array_header, &(p->index), &true_model_len);
 
           match = 0;
 
@@ -110,8 +104,8 @@ void string_array_find_(    double *string_array_header,
 	  }
       }
    }
-   else{
-       printf("\nString array not initialized yet!");
+   else {
+       printf("\nString array not initialized yet (string_array_find)!\n");
    }
    *num_indices = j;
 }
diff --git a/fmt/src/string_array_find_caseblind.c b/fmt/src/string_array_find_caseblind.c
index 97b2ce3..f9f234f 100644
--- a/fmt/src/string_array_find_caseblind.c
+++ b/fmt/src/string_array_find_caseblind.c
@@ -40,15 +40,12 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include "fmtprotos.h"
 #include "string_array.h"
 
-void string_array_find_caseblind_(  double *string_array_header,
-			            char *test_string,
-                                    int *test_len,
-                                    int *result_array,
-                                    int *result_array_size,
-                                    int *num_indices
-                                  )
+void FORTRAN(string_array_find_caseblind)(void **string_array_header, char *test_string, int *test_len, 
+                                          int *result_array, int *result_array_size, int *num_indices)
 {
    int i,j=0;
    int true_test_len, true_model_len, array_size, 
@@ -56,15 +53,14 @@ void string_array_find_caseblind_(  double *string_array_header,
    SA_Head * head;
    List_Node *bucket, *p;
    char * model_string;
-   int match=0, is_quoted=0;
+   int match;
 
- 
-   if(*(SA_Head**)string_array_header){
-      head = *((SA_Head**)string_array_header);
+   head = *string_array_header;
+   if( head != NULL ){
       array_size = head->array_size;
       string_size = head->string_size;
  
-      tm_get_strlen_(&true_test_len, test_len, test_string);
+      FORTRAN(tm_get_strlen)(&true_test_len, test_len, test_string);
  
  
       hash_value = string_array_hash(test_string, true_test_len, 0, array_size);
@@ -81,7 +77,7 @@ void string_array_find_caseblind_(  double *string_array_header,
 
       for(p=bucket; p; p=p->next) {
 	  model_string=&(head->string_array[(p->index-1)*string_size]);
-          string_array_get_strlen_(string_array_header, &(p->index), &true_model_len);
+          FORTRAN(string_array_get_strlen)(string_array_header, &(p->index), &true_model_len);
 
           match = 0;
 
@@ -108,7 +104,7 @@ void string_array_find_caseblind_(  double *string_array_header,
       }
    }
    else{
-       printf("\nString array not initialized yet!");
+       printf("\nString array not initialized yet (string_array_find_caseblind)!\n");
    }
    *num_indices = j;
 }
diff --git a/fmt/src/string_array_find_exact.c b/fmt/src/string_array_find_exact.c
index 71916b2..daaf790 100644
--- a/fmt/src/string_array_find_exact.c
+++ b/fmt/src/string_array_find_exact.c
@@ -40,15 +40,12 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include "fmtprotos.h"
 #include "string_array.h"
 
-void string_array_find_exact_(    double *string_array_header,
-			          char *test_string,
-                                  int *test_len,
-                                  int *result_array,
-                                  int *result_array_size,
-                                  int *num_indices
-                             )
+void FORTRAN(string_array_find_exact)(void **string_array_header, char *test_string, int *test_len, 
+                                      int *result_array, int *result_array_size, int *num_indices)
 {
    int i,j=0;
    int true_test_len, true_model_len, array_size, 
@@ -59,12 +56,12 @@ void string_array_find_exact_(    double *string_array_header,
    int match=0;
 
  
-   if(*(SA_Head**)string_array_header){
-      head = *((SA_Head**)string_array_header);
+   head = *string_array_header;
+   if( head != NULL ) {
       array_size = head->array_size;
       string_size = head->string_size;
  
-      tm_get_strlen_(&true_test_len, test_len, test_string);
+      FORTRAN(tm_get_strlen)(&true_test_len, test_len, test_string);
  
  
       hash_value = string_array_hash(test_string, true_test_len, 0, array_size);
@@ -81,7 +78,7 @@ void string_array_find_exact_(    double *string_array_header,
 
       for(p=bucket; p; p=p->next) {
 	  model_string=&(head->string_array[(p->index-1)*string_size]);
-          string_array_get_strlen_(string_array_header, &(p->index), &true_model_len);
+          FORTRAN(string_array_get_strlen)(string_array_header, &(p->index), &true_model_len);
 
           match = 0;
 
@@ -108,7 +105,7 @@ void string_array_find_exact_(    double *string_array_header,
       }
    }
    else{
-       printf("\nString array not initialized yet!");
+       printf("\nString array not initialized yet (string_array_find_exact)!\n");
    }
    *num_indices = j;
 }
diff --git a/fmt/src/string_array_find_quoted.c b/fmt/src/string_array_find_quoted.c
index e2930b3..17451b3 100644
--- a/fmt/src/string_array_find_quoted.c
+++ b/fmt/src/string_array_find_quoted.c
@@ -44,15 +44,12 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include "fmtprotos.h"
 #include "string_array.h"
 
-void string_array_find_quoted_(  double *string_array_header,
-			         char *test_string,
-                                 int *test_len,
-                                 int *result_array,
-                                 int *result_array_size,
-                                 int *num_indices
-                           )
+void FORTRAN(string_array_find_quoted)(void **string_array_header, char *test_string, int *test_len, 
+                                       int *result_array, int *result_array_size, int *num_indices)
 {
    int i,j=0;
    int true_test_len, true_model_len, array_size, 
@@ -63,14 +60,12 @@ void string_array_find_quoted_(  double *string_array_header,
    int match=0, quote_offset=0;
    const char *_SQ_ = "_SQ_";
 
-FILE *fp;
-   
-   if(*(SA_Head**)string_array_header){
-      head = *((SA_Head**)string_array_header);
+   head = *string_array_header;
+   if( head != NULL ) {
       array_size = head->array_size;
       string_size = head->string_size;
  
-      tm_get_strlen_(&true_test_len, test_len, test_string);
+      FORTRAN(tm_get_strlen)(&true_test_len, test_len, test_string);
  
 /* "'" encloses the string? */
       if(test_string[0]=='\''
@@ -112,7 +107,7 @@ FILE *fp;
 
           match = 0;
 	  model_string=&(head->string_array[(p->index-1)*string_size]);
-          string_array_get_strlen_(string_array_header, &(p->index), &true_model_len);
+          FORTRAN(string_array_get_strlen)(string_array_header, &(p->index), &true_model_len);
           if(quote_offset >= 1) {
 	      if(true_model_len == true_test_len){
 		  match = 1;
@@ -149,7 +144,7 @@ FILE *fp;
 
    }
    else{
-       printf("\nString array not initialized yet!");
+       printf("\nString array not initialized yet (string_array_find_quoted)!\n");
    }
   
    *num_indices = j;
diff --git a/fmt/src/string_array_get_strlen.c b/fmt/src/string_array_get_strlen.c
index ee7dbb8..60c6671 100644
--- a/fmt/src/string_array_get_strlen.c
+++ b/fmt/src/string_array_get_strlen.c
@@ -40,22 +40,21 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include "fmtprotos.h"
 #include "string_array.h"
 
-void string_array_get_strlen_( double * string_array_header, 
-                                int * index,
-                                int * true_strlen )
+void FORTRAN(string_array_get_strlen)(void **string_array_header, int *index, int *true_strlen)
 {
    SA_Head * head;
   
-   if(*(SA_Head**)string_array_header){
-      head = *((SA_Head**) string_array_header);
+   head = *string_array_header;
+   if( head != NULL ) {
       *true_strlen = head->strlen_array[*index-1];
    }
    else{
-      printf("\nString array not initialized yet!");
+      printf("\nString array not initialized yet (string_array_get_strlen)!\n");
       *true_strlen = -1;
    }
 }
 
-
diff --git a/fmt/src/string_array_get_strlen1.c b/fmt/src/string_array_get_strlen1.c
index b8c02b8..f6e497e 100644
--- a/fmt/src/string_array_get_strlen1.c
+++ b/fmt/src/string_array_get_strlen1.c
@@ -40,22 +40,22 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include "fmtprotos.h"
 #include "string_array.h"
 
-void string_array_get_strlen1_( double * string_array_header, 
-                                int * index,
-                                int * true_strlen )
+void FORTRAN(string_array_get_strlen1)(void **string_array_header, int *index, int *true_strlen)
 {
    SA_Head * head;
   
-   if(*(SA_Head**)string_array_header){
-      head = *((SA_Head**) string_array_header);
+   head = *string_array_header;
+   if( head != NULL ) {
       *true_strlen = head->strlen_array[*index-1];
       if(*true_strlen ==0)
          *true_strlen = 1;
    }
    else{
-      printf("\nString array not initialized yet!");
+      printf("\nString array not initialized yet (string_array_get_strlen1)!\n");
       *true_strlen = -1;
    }
 }
diff --git a/fmt/src/string_array_hash.c b/fmt/src/string_array_hash.c
index 8e7b4aa..db613fa 100644
--- a/fmt/src/string_array_hash.c
+++ b/fmt/src/string_array_hash.c
@@ -38,6 +38,7 @@
  */
 
 #include <stdio.h>
+#include "fmtprotos.h"
 #include "string_array.h"
 
 typedef  unsigned long  int  ub4;   /* unsigned 4-byte quantities */
@@ -115,11 +116,13 @@ acceptable.  Do NOT use for cryptographic purposes.
 --------------------------------------------------------------------
 */
 
-int string_array_hash( k, length, initval, range)
-register ub1 *k;        /* the key */
-register ub4  length;   /* the length of the key */
-register ub4  initval;  /* the previous hash, or an arbitrary value */
-register int range;
+int string_array_hash(ub1 *k, ub4 length, ub4 initval, int range)
+/*
+    k; pointer to the key
+    length;   the length of the key 
+    initval;  the previous hash, or an arbitrary value
+    range;
+ */
 {
    register ub4 a,b,c,len;
    register int result;
diff --git a/fmt/src/string_array_init.c b/fmt/src/string_array_init.c
index 8c08352..2e85b63 100644
--- a/fmt/src/string_array_init.c
+++ b/fmt/src/string_array_init.c
@@ -44,41 +44,39 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "fmtprotos.h"
 #include "string_array.h"
+#include "FerMem.h"
 
-void string_array_init_( double *string_array_header,
-                         int  *array_size,
-                         int  *string_size,
-                         char *string_array
-                        )
+void FORTRAN(string_array_init)(void **string_array_header, int *array_size, int *string_size, char *string_array)
 {
-   int i,j;
+   int j;
    int true_len, hash_value;
    SA_Head * head;
    List_Node * p;
    
-   head = (SA_Head*)malloc(sizeof(SA_Head));
-   *((SA_Head**)string_array_header) = head;
+   head = (SA_Head*)FerMem_Malloc(sizeof(SA_Head), __FILE__, __LINE__);
+   *string_array_header = head;
    head->array_size = *array_size;
    head->string_size = *string_size;
    head->string_array = string_array;
 
-   head->ptr_array = (List_Node**)malloc(head->array_size*sizeof(List_Node*));
+   head->ptr_array = (List_Node**)FerMem_Malloc(head->array_size*sizeof(List_Node*), __FILE__, __LINE__);
 
-   head->hash_table = (List_Node**)malloc(head->array_size*sizeof(List_Node*));
+   head->hash_table = (List_Node**)FerMem_Malloc(head->array_size*sizeof(List_Node*), __FILE__, __LINE__);
    memset((void*)head->hash_table, 0, head->array_size*sizeof(List_Node*));
 
-   head->strlen_array = (int*)malloc(head->array_size*sizeof(int));
+   head->strlen_array = (int*)FerMem_Malloc(head->array_size*sizeof(int), __FILE__, __LINE__);
 
    for(j=head->array_size;j>=1;j--) {
-       tm_get_strlen_(&true_len, &(head->string_size),
-		     &(head->string_array[(j-1)*head->string_size]));
+       FORTRAN(tm_get_strlen)(&true_len, &(head->string_size),
+		              &(head->string_array[(j-1)*head->string_size]));
        head->strlen_array[j-1]=true_len;
 
        hash_value = string_array_hash(&(head->string_array[(j-1)*head->string_size]),
                        true_len, 0, head->array_size);
 
-       head->ptr_array[j-1] = (List_Node*)malloc(sizeof(List_Node));
+       head->ptr_array[j-1] = (List_Node*)FerMem_Malloc(sizeof(List_Node), __FILE__, __LINE__);
        p = head->ptr_array[j-1];
        p->index = j;
        p->prev = NULL;
diff --git a/fmt/src/string_array_modify.c b/fmt/src/string_array_modify.c
index 5617273..0d176b4 100644
--- a/fmt/src/string_array_modify.c
+++ b/fmt/src/string_array_modify.c
@@ -41,13 +41,12 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include "fmtprotos.h"
 #include "string_array.h"
 
-void string_array_modify_(    double  *string_array_header,
-                              int  *index,
-                              char *new_string,
-                              int  *new_string_size){
-
+void FORTRAN(string_array_modify)(void **string_array_header, int *index, char *new_string, int *new_string_size)
+{
    int true_old_str_len, true_new_str_len,
        array_size, string_size, old_hash_value,
        new_hash_value;
@@ -55,18 +54,17 @@ void string_array_modify_(    double  *string_array_header,
    char * old_string;
    int i;
    List_Node * p;
- FILE *fp;
 
-   if(*(SA_Head**)string_array_header) {
-      head = *((SA_Head**)string_array_header);
+   head = *((SA_Head**)string_array_header);
+   if( head != NULL ) {
       array_size = head->array_size;
       string_size = head->string_size;
 
       old_string = &(head->string_array[(*index-1)*string_size]);
-      string_array_get_strlen_(string_array_header,index, &true_old_str_len);
+      FORTRAN(string_array_get_strlen)(string_array_header,index, &true_old_str_len);
       old_hash_value = string_array_hash(old_string, true_old_str_len, 0, array_size);
 
-      tm_get_strlen_(&true_new_str_len, new_string_size, new_string);
+      FORTRAN(tm_get_strlen)(&true_new_str_len, new_string_size, new_string);
       if(true_new_str_len>string_size)
 	true_new_str_len = string_size;
       new_hash_value = string_array_hash(new_string, true_new_str_len, 0, array_size);
@@ -96,5 +94,8 @@ void string_array_modify_(    double  *string_array_header,
       }
       head->strlen_array[*index-1]=true_new_str_len;
    }
+   else {
+       printf("\nString array not initialized yet (string_array_modify)!\n");
+   }
 }
 
diff --git a/fmt/src/string_array_modify_upcase.c b/fmt/src/string_array_modify_upcase.c
index d31de4f..d6877f5 100644
--- a/fmt/src/string_array_modify_upcase.c
+++ b/fmt/src/string_array_modify_upcase.c
@@ -41,13 +41,12 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include "fmtprotos.h"
 #include "string_array.h"
 
-void string_array_modify_upcase_(double  *string_array_header,
-                                 int  *index,
-                                 char *new_string,
-                                 int  *new_string_size){
-
+void FORTRAN(string_array_modify_upcase)(void **string_array_header, int *index, char *new_string, int *new_string_size)
+{
    int true_old_str_len, true_new_str_len,
        array_size, string_size, old_hash_value,
        new_hash_value;
@@ -55,18 +54,17 @@ void string_array_modify_upcase_(double  *string_array_header,
    char * old_string;
    int i;
    List_Node * p;
-FILE *fp;
 
-   if(*(SA_Head**)string_array_header) {
-      head = *((SA_Head**)string_array_header);
+   head = *string_array_header;
+   if( head != NULL ) {
       array_size = head->array_size;
       string_size = head->string_size;
 
       old_string = &(head->string_array[(*index-1)*string_size]);
-      string_array_get_strlen_(string_array_header,index, &true_old_str_len);
+      FORTRAN(string_array_get_strlen)(string_array_header,index, &true_old_str_len);
       old_hash_value = string_array_hash(old_string, true_old_str_len, 0, array_size);
 
-      tm_get_strlen_(&true_new_str_len, new_string_size, new_string);
+      FORTRAN(tm_get_strlen)(&true_new_str_len, new_string_size, new_string);
       if(true_new_str_len>string_size)
 	true_new_str_len = string_size;
       new_hash_value = string_array_hash(new_string, true_new_str_len, 0, array_size);
@@ -96,5 +94,8 @@ FILE *fp;
       }
       head->strlen_array[*index-1]=true_new_str_len;
    }
+   else {
+       printf("\nString array not initialized yet (string_array_modify_upcase)!\n");
+   }
 }
 
diff --git a/fmt/src/tm_switch_nan.c b/fmt/src/switch_nan.c
similarity index 87%
rename from fmt/src/tm_switch_nan.c
rename to fmt/src/switch_nan.c
index 3c749ae..f9f3488 100644
--- a/fmt/src/tm_switch_nan.c
+++ b/fmt/src/switch_nan.c
@@ -34,24 +34,22 @@
 *
 */
 
-/* tm_switch_nan :
+/* switch_nan : */
 /*  check for a missing or bad value flag of NaN.  if either flag is Nan, */
 /*  then make sure it's ds_missing_flag and if both are NaN, make sure to */
 /*  set ds_bad_flag to bad_val4     */
 
-/* *kob* - 2/18/99 *
+/* *kob* - 2/18/99 */
 /* *acm*  1/12      - Ferret 6.8 ifdef double_p for double-precision ferret, see the
-/*					 definition of macro DFTYPE in ferretmacros.h.
-/* *acm* V6931 12/14 Fix ticket 2223: need to use the Ferret missing-value flag
-/*					 which is now passed in as an argument.
-*/
+ *					 definition of macro DFTYPE in ferretmacros.h.
+ * *acm* V6931 12/14 Fix ticket 2223: need to use the Ferret missing-value flag
+ *					 which is now passed in as an argument.
+ */
 
-#include "ferretmacros.h"
+#include <math.h>
+#include "fmtprotos.h"
 
-void FORTRAN(switch_nan)(bad, missing, bad_val)
-     DFTYPE *bad;
-     DFTYPE *missing;
-     DFTYPE *bad_val;
+void FORTRAN(switch_nan)(DFTYPE *bad, DFTYPE *missing, DFTYPE *bad_val)
 {
   if (isnan(*bad) || isnan(*missing))
     { 
@@ -62,8 +60,4 @@ void FORTRAN(switch_nan)(bad, missing, bad_val)
 	}
     }
 }
-	
-
-
- 
 
diff --git a/fmt/src/tm_blockify_ferret_strings.c b/fmt/src/tm_blockify_ferret_strings.c
index decd005..c04b011 100644
--- a/fmt/src/tm_blockify_ferret_strings.c
+++ b/fmt/src/tm_blockify_ferret_strings.c
@@ -45,9 +45,9 @@
     This function copies the strings from mr_blk1 to pblock.
 */
 
+#include "fmtprotos.h"
 
-void tm_blockify_ferret_strings(char **mr_blk1, char *pblock,
-				int bufsiz, int outstrlen)
+void tm_blockify_ferret_strings(char **mr_blk1, char *pblock, int bufsiz, int outstrlen)
 {
   int i;
   char *poutchar, *poutstr, *pinchar, **pinstr;
diff --git a/fmt/src/tm_break_fmt_date_c.c b/fmt/src/tm_break_fmt_date_c.c
index e7be66f..c819b95 100644
--- a/fmt/src/tm_break_fmt_date_c.c
+++ b/fmt/src/tm_break_fmt_date_c.c
@@ -51,43 +51,16 @@ hh:mm:ss are optional (defaulting to 00:00:00) or seconds, alone may be omitted
   on non-ANSI compilers also use:
         -D_NO_PROTO
 
- *kob* 5/22/95 - need to add an ifdef check for NO_ENTRY_NAME_UNDERSCORES for
-                 those machines (like hp) that don't need the underscore 
-		 appended at the end of a routine call....
-
 */
 /* *acm*  1/12      - Ferret 6.8 ifdef double_p for double-precision ferret, see the
-/*					 definition of macro DFTYPE in ferretmacros.h.
+ *					 definition of macro DFTYPE in ferretmacros.h.
 */
 
 #include <stdio.h>
-#include "ferretmacros.h"
-
-
-#ifdef _NO_PROTO
-int FORTRAN(tm_break_fmt_date_c)(date,
-			year,
-			month,
-			day,
-			hour,
-			minute,
-			second)
-char *date;
-int *year, *month, *day, *hour, *minute;
-DFTYPE *second;
+#include "fmtprotos.h"
 
-#else
-int FORTRAN(tm_break_fmt_date_c)(char *date,
-			int *year,
-			int *month,
-			int *day,
-			int *hour,
-			int *minute,
-			DFTYPE *second)
-
-#endif
+int FORTRAN(tm_break_fmt_date_c)(char *date, int *year, int *month, int *day, int *hour, int *minute, DFTYPE *second)
 {
-
   int n;
   double dblsec; /* pointer to double expected by %lf in sscanf */
 
diff --git a/fmt/src/tm_c_rename.c b/fmt/src/tm_c_rename.c
index b69e3c7..bcebfdd 100644
--- a/fmt/src/tm_c_rename.c
+++ b/fmt/src/tm_c_rename.c
@@ -49,20 +49,12 @@
 
 /* *kob* had to add ifdef for sake of AIX  10/94 */
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-void tm_c_rename( oldname, newname, status )
-#else
-void tm_c_rename_( oldname, newname, status )
-#endif
-
-
-   char *oldname, *newname;
-   int *status;
-
-/* Unix system call to rename file */
+#include <stdio.h>
+#include "fmtprotos.h"
 
+void FORTRAN(tm_c_rename)(char *oldname, char *newname, int *status)
 {
-   *status = rename ( oldname, newname );
+   *status = rename(oldname, newname);
 
    return;
 }
diff --git a/fmt/src/tm_check_inf.c b/fmt/src/tm_check_inf.c
index 7b00992..4dd979e 100644
--- a/fmt/src/tm_check_inf.c
+++ b/fmt/src/tm_check_inf.c
@@ -34,18 +34,18 @@
 *
 */
 
-/* tm_check_inf.c :
+/* tm_check_inf.c : */
 /*  see if value is positive or negative Inf */
 
 /* *acm* - 11/03/05 */
 /* *acm*  1/12      - Ferret 6.8 ifdef double_p for double-precision ferret, see the
-/*					 definition of macro DFTYPE in ferretmacros.h.
-*/
-
-#include "ferretmacros.h"
+ *					 definition of macro DFTYPE in ferretmacros.h.
+ */
 
-int FORTRAN(tm_check_inf)( DFTYPE *src )
+#include <math.h>
+#include "fmtprotos.h"
 
+int FORTRAN(tm_check_inf)(DFTYPE *src)
 {
   int result = 0;
   
diff --git a/fmt/src/tm_check_nan.c b/fmt/src/tm_check_nan.c
index 2d15fb4..b4d21a6 100644
--- a/fmt/src/tm_check_nan.c
+++ b/fmt/src/tm_check_nan.c
@@ -34,7 +34,7 @@
 *
 */
 
-/* tm_check_nan.c :
+/* tm_check_nan.c : */
 /*  see if value is NaN */
 
 /* *acm* - 11/04/04 */
@@ -42,10 +42,10 @@
 *					 definition of macro DFTYPE in ferretmacros.h.
 */
 
-#include "ferretmacros.h"
-
-int FORTRAN(tm_check_nan)( DFTYPE *src )
+#include <math.h>
+#include "fmtprotos.h"
 
+int FORTRAN(tm_check_nan)(DFTYPE *src)
 {
   int result = 0;
   
diff --git a/fmt/src/tm_close_set_cond_deallo.F b/fmt/src/tm_close_set_cond_deallo.F
index e6d3426..4426d8d 100644
--- a/fmt/src/tm_close_set_cond_deallo.F
+++ b/fmt/src/tm_close_set_cond_deallo.F
@@ -173,6 +173,9 @@
 	ds_accepts_remote(ds_num)	= 	.FALSE.
 	ds_hide(ds_num)			=	.FALSE.
 
+* Delete any delimited file info given and reset to NULL
+        CALL delete_delimited_info(ds_file_info_ptr(ds_num))
+
 * Next clear variables associated with variable in that data set.
 	DO 130 ivar = 1,maxvars
 	  IF (ds_var_setnum(ivar) .NE. ds_num) GOTO 130
diff --git a/fmt/src/tm_dfp_convert.c b/fmt/src/tm_dfp_convert.c
deleted file mode 100644
index ea655eb..0000000
--- a/fmt/src/tm_dfp_convert.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.  
-*
-*/
-
-
-
-/* tm_dfp_convert_:
-/* convert VAX D or IEEE big/little endian double precision floating point */
-/* into the currently active CPU representation */
-/*** use the pre-processor to select the target word type ***   */
-
-/* *sh* - home brewed */
-/* rev. 0.0 2/14/92
-/* note: "_" is appended to TM_DFP1_CNVRT by f77 when calling this */
-/* replaced "elif" syntax with
-	else
-	   if
-  for SGI port	 - kob 4/8/92 */
-
-/* added ifdef check for underscore in routine name for aix *kob* 10/94 
-/* *acm*  1/12      - Ferret 6.8 ifdef double_p for double-precision ferret, see the
-/*					 definition of macro DFTYPE in ferretmacros.h.
-*/
-
-#include "ferretmacros.h"
-
-#define cptype_vax 0
-#define cptype_dec 1
-#define cptype_sun 2
-
-void FORTRAN(tm_dfp_convert)( dval, author_cpu )
-  double *dval;
-  int *author_cpu;
-  {
-
-/* internal variable declarations:   */
-/* e - exponent                      */
-/* f - fraction                      */
-/* f_shf - bits from f to be shifted */
-  char i1_tmp;
-  unsigned short int i2_tmp, e, f_shf, ieee_e;
-
-/* masks                                             */
-/* smsk        - sign bit mask                       */
-/* nsmsk       - sign bit removal mask               */
-/* vax_f1_msk  - f bits from INT*2 word 1 of VAX D   */
-/* vax_shf_msk - f bits to shift off right hand end  */
-/* for some reason, linux cc needed smsk and nsmsk declared
-     on seperate lines - 3/99 *kob* */
-  short int smsk =010000;
-  short int nsmsk=077777;
-  short int vax_f1_msk=0177, vax_shf_msk=07;
-        
-  union { double dum;
-	  unsigned short int i2[4];
-	  char i1[8];
-	} u;
-
-/* move the double precision word into the union */
-  u.dum = *dval;
-
-#ifdef sun
-/* SUN is the platform in use   */
-  if    ( *author_cpu == cptype_vax )           /* VAX -> SUN */
-/* pre-swap the bytes within each 16 bit word */   
-    {
-    i1_tmp   = u.i1[0];
-    u.i1[0]  = u.i1[1];
-    u.i1[1]  = i1_tmp;
-    i1_tmp   = u.i1[2];
-    u.i1[2]  = u.i1[3];
-    u.i1[3]  = i1_tmp;
-    i1_tmp   = u.i1[4];
-    u.i1[4]  = u.i1[5];
-    u.i1[5]  = i1_tmp;
-    i1_tmp   = u.i1[6];
-    u.i1[6]  = u.i1[7];
-    u.i1[7]  = i1_tmp;
-
-/* VAX 16-bit word 1 (with sign bit and exponent)   */
-    e = ((u.i2[0] & nsmsk)>>7) - 128;
-    ieee_e = (e + 1022)<<4;
-    i2_tmp = (u.i2[0] & vax_f1_msk)>>3;  /* bits from f that stay in word 1 */
-    f_shf  =  u.i2[0] & vax_shf_msk;     /* bits from f that shift to i2[2] */
-    u.i2[0]  = (u.i2[0] & smsk) | ieee_e | i2_tmp;
-
-/* 2nd VAX 16-bit word (all f bits - shift right by 3)   */
-    i2_tmp = ((u.i2[1])>>3) | f_shf<<13;
-    f_shf  = u.i2[1] & vax_shf_msk;
-    u.i2[1]  = i2_tmp;
-
-/* 3rd VAX 16-bit word (all f bits - shift right by 3)   */
-    i2_tmp = ((u.i2[2])>>3) | f_shf<<13;
-    f_shf  = u.i2[2] & vax_shf_msk;
-    u.i2[2]  = i2_tmp;
-
-/* 4th VAX 16-bit word 4 (all f bits - right bits drop off end)   */
-    u.i2[3]  = ((u.i2[3])>>3) | f_shf<<13;
-    }
-  else if ( *author_cpu == cptype_dec )         /* DECstation -> SUN */
-    {
-    i1_tmp   = u.i1[0];
-    u.i1[0]  = u.i1[7];
-    u.i1[7]  = i1_tmp;
-    i1_tmp   = u.i1[1];
-    u.i1[1]  = u.i1[6];
-    u.i1[6]  = i1_tmp;
-    i1_tmp   = u.i1[2];
-    u.i1[2]  = u.i1[5];
-    u.i1[5]  = i1_tmp;
-    i1_tmp   = u.i1[3];
-    u.i1[3]  = u.i1[4];
-    u.i1[4]  = i1_tmp;
-    }
- 
-#else
-#if unix
-/* DECstation is the platform in use   */
-
-  if ( *author_cpu == cptype_vax )    /* VAX --> DECstation */
-    {
-/* VAX 16-bit word 1 (with sign bit and exponent)   */
-    e = ((u.i2[0] & nsmsk)>>7) - 128;
-    ieee_e = (e + 1022)<<4;
-    i2_tmp = (u.i2[0] & vax_f1_msk)>>3;  /* bits from f that stay in word 1 */
-    f_shf  =  u.i2[0] & vax_shf_msk;     /* bits from f that shift to i2[2] */
-    u.i2[0]  = (u.i2[0] & smsk) | ieee_e | i2_tmp;
-
-/* 2nd VAX 16-bit word (all f bits - shift right by 3)   */
-    i2_tmp = ((u.i2[1])>>3) | f_shf<<13;
-    f_shf  = u.i2[1] & vax_shf_msk;
-    u.i2[1]  = i2_tmp;
-
-/* 3rd VAX 16-bit word (all f bits - shift right by 3)   */
-    i2_tmp = ((u.i2[2])>>3) | f_shf<<13;
-    f_shf  = u.i2[2] & vax_shf_msk;
-    u.i2[2]  = i2_tmp;
-
-/* 4th VAX 16-bit word 4 (all f bits - right bits drop off end)   */
-    u.i2[3]  = ((u.i2[3])>>3) | f_shf<<13;
-
-/* post-swap the 16-bit word order   */
-    i2_tmp   = u.i2[0];
-    u.i2[0]  = u.i2[3];
-    u.i2[3]  = i2_tmp;
-    i2_tmp   = u.i2[1];
-    u.i2[1]  = u.i2[2];
-    u.i2[2]  = i2_tmp;
-    }
-  else if ( *author_cpu == cptype_sun )     /* SUN -> DECstation */
-    {
-    i1_tmp   = u.i1[0];
-    u.i1[0]  = u.i1[7];
-    u.i1[7]  = i1_tmp;
-    i1_tmp   = u.i1[1];
-    u.i1[1]  = u.i1[6];
-    u.i1[6]  = i1_tmp;
-    i1_tmp   = u.i1[2];
-    u.i1[2]  = u.i1[5];
-    u.i1[5]  = i1_tmp;
-    i1_tmp   = u.i1[3];
-    u.i1[3]  = u.i1[4];
-    u.i1[4]  = i1_tmp;
-    }
-
-#else
-/* VAX is the platform in use   */
-     /* not yet figgered out */
-#endif   /* decstation */
-#endif   /* sun */
-
-/* return the value   */
-  *dval = u.dum;
-
-  return ;
-  }
diff --git a/fmt/src/tm_ep_time_convrt.c b/fmt/src/tm_ep_time_convrt.c
index b1f0e74..d653e46 100644
--- a/fmt/src/tm_ep_time_convrt.c
+++ b/fmt/src/tm_ep_time_convrt.c
@@ -45,14 +45,11 @@
 *					 definition of macro DFTYPE in ferretmacros.h.
 */
 
-#include "ferretmacros.h"
+#include "fmtprotos.h"
 
 #define JULGREG   2299161
 
-void ep_time_to_mdyhms(time, mon, day, yr, hour, min, sec)
-     long *time;
-     int *mon, *day, *yr, *hour, *min;
-     DFTYPE *sec;
+static void ep_time_to_mdyhms(long *time, int *mon, int *day, int *yr, int *hour, int *min, DFTYPE *sec)
 {
 /*
  * convert eps time format to mdy hms
@@ -99,31 +96,19 @@ void ep_time_to_mdyhms(time, mon, day, yr, hour, min, sec)
       epjday (input) - integer
       epmsec (input) - integer
       mon, day, yr, hr, min (output) - integer
-      sec (output) - REAL*4
+      sec (output) - DFTYPE
 
    *sh* 1/94
 */
 
-void FORTRAN(tm_ep_time_convrt)(epjday,
-			epmsec,
-			mon,
-			day,
-			yr,
-			hour,
-			min,
-			sec)
-
-/* prototypes not allowed on TMAP SUN cc compiler.  Need ANSI ?? */
-int *epjday, *epmsec, *mon, *day, *yr, *hour, *min;
-DFTYPE *sec;
-
+void FORTRAN(tm_ep_time_convrt)(int *epjday, int *epmsec, int *mon, int *day, int *yr, int *hour, int *min, DFTYPE *sec)
 {
 /*  this block added by *sh* 1/94 */
   long time[2];
   time[0] = (long)*epjday;
   time[1] = (long)*epmsec;
 
-  (void) ep_time_to_mdyhms(time, mon, day, yr, hour, min, sec);
+  ep_time_to_mdyhms(time, mon, day, yr, hour, min, sec);
 }
 
 
diff --git a/fmt/src/tm_exit.F b/fmt/src/tm_exit.F
deleted file mode 100644
index 4512732..0000000
--- a/fmt/src/tm_exit.F
+++ /dev/null
@@ -1,82 +0,0 @@
-	SUBROUTINE TM_EXIT ( )
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-
-* exit the TMAP library, closing all open files as we do so
-* V510 - *sh* 12/99 -- needed for netCDF caching to work right
-* v540 *acm* 10/01 increase length of ds_name
-* v540 *acm* 10/01  remove VMS include statements
-* v604 *acm* 7/07 increase length of ds_name, ds_des_name
-* V701  7/16 *kms* Compare ds_name to char_init2048 instead of char_init1024
-
-	include 'tmap_errors.parm'	! error code parameter defs
-#include "tmap_dset.parm"
-	include 'tmap_dims.parm'
-	include 'xstep_files.cmn_text'
-	external xstep_files_data
-	include 'xdset_info.cmn_text'
-	external xdset_info_data
-
-* internal variable declarations
-        LOGICAL   its_cdf
-	INTEGER   ds_num,status,f_num
-
-* loop over all data sets
-	DO 500 ds_num = 1, maxdsets
-	   IF (ds_name(ds_num) .EQ. char_init2048) GOTO 500
-
-* save the data format
-           its_cdf = ds_type(ds_num) .EQ. 'CDF'
-     .        .OR.   ds_type(ds_num) .EQ. 'ECDF' 
-
-* Now loop through stepfiles closing files
-	   DO 100 f_num = 1, maxstepfiles
-	     IF (sf_setnum(f_num) .NE. ds_num) GOTO 100
-
-* close step file or CDF file ?
-	    IF ( sf_lunit (f_num) .NE. file_not_open) THEN	! open ?
-               IF ( its_cdf ) THEN
-                  CALL CD_CLOSE_SET( sf_lunit(f_num), status )
-               ELSE
-	          CALL TM_CLOSE_STEP (f_num, status)
-               ENDIF
-	     ENDIF
-  100	   CONTINUE
-
- 500	CONTINUE
-
-	RETURN
-	END
diff --git a/fmt/src/tm_find_grid_slot.F_unused b/fmt/src/tm_find_grid_slot.F_unused
deleted file mode 100644
index 364f8f6..0000000
--- a/fmt/src/tm_find_grid_slot.F_unused
+++ /dev/null
@@ -1,81 +0,0 @@
-	INTEGER*4 FUNCTION TM_FIND_GRID_SLOT ( islot )
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-*
-* Locates an unused space in XGRID common for a new grid. If no space available,
-* returns error.
-*
-* revision 0.00 - 11/22/88
-* revision 1.00 - 12/13/88 - changed to reverse order search 
-* revision 1.01 - 07/13/89 - fixed missing comma in TM_ERROR call
-* *kob* 10/96 	- Linux port.  Linux didnt like tabs 
-*		  between "include"
-*	          and what was being included.  removed them
-*
-* Arguments
-	INTEGER*4	islot
-*
-* Parameters and commons
-        include 'tmap_dims.parm'
-#include "tmap_dset.parm"
-	include 'tmap_errors.parm'
-        include 'xtm_grid.cmn_text'
-        external xgt_grid_data
-*
-* Local declarations
-	CHARACTER*13	TM_STRING
-	INTEGER*4	igrd
-*
-	DO 100 igrd = max_grids,1,-1
-	  IF (grid_name(igrd) .NE. char_init16) THEN
-	    IF (igrd .EQ. max_grids) GOTO 9000
-	    islot = igrd + 1
-	    GOTO 200
-	  ENDIF
-  100	CONTINUE
-	islot = 1
-  200	TM_FIND_GRID_SLOT = merr_ok
-	GOTO 9999
-*
-* No slot available
- 9000	CALL TM_ERRMSG (merr_gridlim, TM_FIND_GRID_SLOT,
-     .	                'TM_FIND_GRID_SLOT', no_descfile, no_stepfile,
-     .	                'MAX='//TM_STRING(DBLE(max_grids)),
-     .			no_errstring, *9999)
-
-
- 9999	RETURN
-	END
diff --git a/fmt/src/tm_ftoc_readline.c b/fmt/src/tm_ftoc_readline.c
index 17c6e5d..b4fd606 100644
--- a/fmt/src/tm_ftoc_readline.c
+++ b/fmt/src/tm_ftoc_readline.c
@@ -57,71 +57,64 @@
 #include <stdio.h>
 #include <strings.h>
 #include <readline/readline.h>
+#include <readline/history.h>
+#include "fmtprotos.h"
+#include "ferret.h" /* for is_server */
 
-/* Easier way of handling FORTRAN calls with underscore/no underscore */
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-
-
-/* A static variable for holding the line. */
-static char *line_read = (char *)NULL;
+/* The string to assign and return if not using readline */
+static char linefromserver[2048];
 
 /* Read a string, and return a pointer to it.  Returns NULL on EOF. */
-char *do_gets ( prompt )
-  char *prompt;
-
+static char *do_gets(char *prompt)
 {
-  /* If the buffer has already been allocated, return the memory
-     to the free pool. */
-  if (line_read != (char *)NULL)
-    {
-      free (line_read);
-      line_read = (char *)NULL;
-    }
+  char *line_read;
+  char *loc;
 
-  /* Get a line from the user. */
-  /* If running in server mode, don't use fancy readline stuff */
+  if ( FORTRAN(is_server)() ) {
+    /* server mode - don't use fancy readline stuff */
 
-  if (!FORTRAN(is_server)()){
-    line_read = readline (prompt);
-  } else {
-    char* loc;
     fputs(prompt, stdout);
     fflush(stdout);
-    line_read = (char *)malloc(2048);
-    fgets(line_read, 2047, stdin);
-    loc = rindex(line_read, '\n');
-    if (loc != 0){
-      *loc = '\0';
+    line_read = linefromserver;
+    if ( fgets(line_read, 2048, stdin) != NULL ) {
+      /* Success - remove the terminal newline if it exists */
+      loc = rindex(line_read, '\n');
+      if ( loc != NULL )
+        *loc = '\0';
+    }
+    else {
+      /* Error - assume EOF */
+      line_read = NULL;
     }
-  }
 
-  /* If the line has any text in it, save it on the history. */
-  if (line_read && *line_read)
-    add_history (line_read);
+  } else {
+    /* use readline and its history */
 
-  return (line_read);
-}
+    line_read = readline(prompt);
+    /* If the line has any text in it, add it to the readline history. */
+    if ( (line_read != NULL) && (*line_read != '\0') )
+      add_history(line_read);
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-tm_ftoc_readline( prompt, buff )
-#else
-tm_ftoc_readline_( prompt, buff )
-#endif
-/* c jacket routine to make gnu readline callable from FORTRAN */
-  char *prompt, *buff;
-{
-  char *ptr;
+  }
 
-/* invoke gnu readline with line recall and editing */
-  ptr = do_gets ( prompt );
+  return line_read;
+}
 
-/* copy the line into the buffer provided from FORTRAN */
-  if (ptr != (char *)NULL) {
-    strcpy( buff, ptr );
+int FORTRAN(tm_ftoc_readline)(char *prompt, char *buff)
+{
+  char *line_read;
+
+  /* invoke gnu readline with line recall and editing (unless is_server) */
+  line_read = do_gets(prompt);
+
+  /* copy the string into the buffer provided from FORTRAN */
+  if ( line_read != NULL ) {
+    strcpy( buff, line_read );
+    if ( line_read != linefromserver ) {
+      /* the string was allocated by readline (not Ferret) so free it using free (not FerMem_Free) */
+      free(line_read);
+      line_read = NULL;
+    }
   }
   else {
     buff[0] = '\004';   /* ^D  */
diff --git a/fmt/src/tm_get_strlen.c b/fmt/src/tm_get_strlen.c
index 25cf49b..e718286 100644
--- a/fmt/src/tm_get_strlen.c
+++ b/fmt/src/tm_get_strlen.c
@@ -37,8 +37,9 @@
 
 #include <assert.h>
 #include <stdio.h>
+#include "fmtprotos.h"
 
-void tm_get_strlen_(int * len_str, int * whole_len, char * in_string)
+void FORTRAN(tm_get_strlen)(int *len_str, int *whole_len, char *in_string)
 {
    int i;
    assert(in_string);
diff --git a/fmt/src/tm_its_subspan_modulo.F b/fmt/src/tm_its_subspan_modulo.F
index faa7e16..1550fcb 100644
--- a/fmt/src/tm_its_subspan_modulo.F
+++ b/fmt/src/tm_its_subspan_modulo.F
@@ -69,3 +69,24 @@ C for ticket 2520: axis that is slightly too LONG, was marked as subspan!
 
 	RETURN
 	END
+
+C
+C
+C
+
+        INTEGER FUNCTION TM_ITS_SUBSPAN_MODULO_INT(axis)
+C
+C For calling from C since it is dangerous to assume 
+C what Fortran LOGICAL and their values are in C.
+C
+        INTEGER axis
+        LOGICAL TM_ITS_SUBSPAN_MODULO
+
+        IF ( TM_ITS_SUBSPAN_MODULO(axis) ) THEN
+            TM_ITS_SUBSPAN_MODULO_INT = 1
+        ELSE
+            TM_ITS_SUBSPAN_MODULO_INT = 0
+        ENDIF
+
+        RETURN
+        END
diff --git a/fmt/src/tm_make_relative_ver.c b/fmt/src/tm_make_relative_ver.c
index 0b60d00..76c1fc9 100644
--- a/fmt/src/tm_make_relative_ver.c
+++ b/fmt/src/tm_make_relative_ver.c
@@ -34,8 +34,6 @@
 *
 */
 
-
-
 /* *kob* 10/03 v553 - gcc v3.x needs wchar.h included */
 /* *acm   9/06 v600 - add stdlib.h wherever there is stdio.h for altix build*/ 
 /* V63  *acm* 10/09 Changes for gfortran build */
@@ -43,93 +41,37 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include "fmtprotos.h"
 
-/* 
-
-  this routine takes the relative verson number passed to it (eg, .~-3~) and
-    calls high_ver_name (passing filename and path) to get the proper
-    version number for the file. (eq, ~12~)
-    It then returns this value.
-
- version 0.0 -kob- 10/17/91
-
-*/
-
-/* had to add ifdef check for trailing underscore in routine name
-   for aix port *kob* 10/94 */
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-char *tm_make_relative_ver(curr_ver, fname,path,real_ver)
-#else
-char *tm_make_relative_ver_(curr_ver, fname,path,real_ver)
-#endif
-char *curr_ver,*fname, *path;
-int *real_ver;
-
+void FORTRAN(tm_make_relative_ver)(char *curr_ver, char *fname, char *path, int *real_ver)
 /*
-
  calling arguments :    
             curr_ver --> contains the relative version num. (eg. .~-3~)
-	    real_ver --> will contain and pass back proper version num. (eq. ~12~)
-	    fname -----> filename; needed for routine high_ver_name
-	    path ------> path to file, also needed for routine high_ver_name
-
+            fname -----> filename; needed for routine high_ver_name
+            path ------> path to file, also needed for routine high_ver_name
+            real_ver --> will contain and pass back proper version num. (eg. 12 for ~12~)
 */
-
 {
-  int i,j,int_ver, high_ver, ver_len;
-  char *temp_ver;
-
-/* allocate temporary memory */
-  temp_ver = malloc(20);
-
-/* get just the numeric part of the string, ignoring all else */
-  for (i=0,j=0; i<=strlen(curr_ver); i++)
-    {
-      if (*(curr_ver+i) != '.' && *(curr_ver+i) != '-' && *(curr_ver+i) != '~')
-	{
-	  *(temp_ver+j) = *(curr_ver+i);
-	  ++j;
-	}
-    }
-
-/* convert the string to an integer */ 
-  sscanf (temp_ver, "%d", real_ver);
-
-/* get the new version number by subtracting the relative version number -1
+  int i, j, cvlen, high_ver;
+  char temp_ver[32];
+
+  /* get just the numeric part of the string, ignoring all else */
+  cvlen = strlen(curr_ver);
+  for (i=0, j=0; (i < cvlen) && (j < 31); i++) {
+      if ( (curr_ver[i] != '.') && (curr_ver[i] != '-') && (curr_ver[i] != '~') ) {
+          temp_ver[j] = curr_ver[i];
+          j++;
+      }
+  }
+  temp_ver[j] = '\0';
+
+  /* convert the string to an integer */ 
+  sscanf(temp_ver, "%d", real_ver);
+
+  /* get the new version number by subtracting the relative version number -1
      from the highest version number          */
   *real_ver -= 1;
-  high_ver = high_ver_name (fname,path);
+  high_ver = high_ver_name(fname, path);
   *real_ver = high_ver - *real_ver;
-
-  
-
-/* convert that from integer to character string 
-  sprintf (temp_ver, "%d", int_ver);
-
- surround the new version number with tilda's 
-  strcat (real_ver, "~");
-  strcat (real_ver, temp_ver);
-  strcat (real_ver, "~");
-  
- append a null to the string 
-  ver_len = strlen(real_ver);
-  *(real_ver+ver_len) = '\0';  */
-
-/* return proper version extension */
-/*  return real_ver; 
- */
-
 }
 
-
-
-
-
-
-
-
-
-
-
-
diff --git a/fmt/src/tm_match_capital_name.c b/fmt/src/tm_match_capital_name.c
index b4243de..42dcae1 100644
--- a/fmt/src/tm_match_capital_name.c
+++ b/fmt/src/tm_match_capital_name.c
@@ -36,11 +36,9 @@
 */
 
 #include <stdio.h>
+#include "fmtprotos.h"
 
-void tm_match_captial_name_(char* test_name, 
-                            char* model_name, 
-                            int * len_str, 
-                            int * result)
+void FORTRAN(tm_match_captial_name)(char *test_name, char *model_name, int *len_str, int *result)
 {
      int i, len=*len_str;
      char c1, c2;
diff --git a/fmt/src/tm_number.F b/fmt/src/tm_number.F
index d5b46cf..5b19118 100644
--- a/fmt/src/tm_number.F
+++ b/fmt/src/tm_number.F
@@ -41,11 +41,7 @@
 	integer		length, tm_lenstr1
 	integer		result
 	
-#ifdef sun
-        byte      cstring(255)
-#else
-        integer*1 cstring(255)
-#endif
+        integer*1 cstring(2048)
 
 	character*(*)	string
 	
diff --git a/fmt/src/tm_number_sub.c b/fmt/src/tm_number_sub.c
index bb962a8..6b3158a 100644
--- a/fmt/src/tm_number_sub.c
+++ b/fmt/src/tm_number_sub.c
@@ -45,20 +45,13 @@
 */
 
 #include <stdio.h>
-#include "ferretmacros.h"
+#include "fmtprotos.h"
 
-#ifdef _NO_PROTO
-void FORTRAN(tm_number_sub)  (string, result) 
-
-char * string;
-int * result;
-#else /* NO_PROTO */
-void FORTRAN(tm_number_sub)  (char * string, int * result) 
-#endif  /* NO_PROTO */
+void FORTRAN(tm_number_sub)(char *string, int *result)
 {
   int num_read;
   double rval;  /* pointer to double expected by %lf in sscanf */
-  char kval[255];
+  char kval[2048];
 
   num_read = sscanf(string, "%lf%s", &rval, kval);
  
diff --git a/fmt/src/tm_set_free_event.c b/fmt/src/tm_set_free_event.c
index c8f40da..4afc85d 100644
--- a/fmt/src/tm_set_free_event.c
+++ b/fmt/src/tm_set_free_event.c
@@ -43,48 +43,16 @@
    while it is waiting for input.  If the routine is called with a 1, 
    rl_event_hook is set to free_time.  readline will process free_time. */
 
-/* had to add ifdef check for trailing underscore in routine name
-   for aix port *kob* 10/94 */
-/* 11/96 *kob* - Linux port - had to have double quotes around the STOP
-                              message */
 
-#ifdef unix
+#include <stdio.h>
+#include <readline/readline.h>
+#include "fmtprotos.h"
 
-/* this routine will only work on a unix system */
-
-#define NULL 0
-
-typedef int Function ();
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-void tm_set_free_event(n)
-#else
-void tm_set_free_event_(n)
-#endif
-int *n;
+void FORTRAN(tm_set_free_event)(int *n)
 {
-  extern Function *rl_event_hook;
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-  void free_time();
-#else
-  void free_time_();
-#endif
-
-
-
-  if (*n) 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-    rl_event_hook = (Function *)free_time;
-#else
-    rl_event_hook = (Function *)free_time_;
-#endif
+  if ( *n ) 
+    rl_event_hook = FORTRAN(free_time);
   else
-    rl_event_hook = (Function *)NULL;
-  
-
+    rl_event_hook = NULL;
 }
 
-#else
-    STOP "TM_SET_FREE_EVENT isn't used by VMS"
-
-#endif
-
diff --git a/fmt/src/tm_unblockify_ferret_strings.c b/fmt/src/tm_unblockify_ferret_strings.c
index b0afae7..4227f84 100644
--- a/fmt/src/tm_unblockify_ferret_strings.c
+++ b/fmt/src/tm_unblockify_ferret_strings.c
@@ -48,9 +48,10 @@
 */
 
 #include <stdlib.h>
+#include "fmtprotos.h"
+#include "FerMem.h"
 
-void tm_unblockify_ferret_strings(char **mr_blk1, char *pblock,
-				  int bufsiz, int filestrlen)
+void tm_unblockify_ferret_strings(char **mr_blk1, char *pblock, int bufsiz, int filestrlen)
 {
   int i, n;
   char *pinchar, *pinstr, *poutchar, **poutstr;
@@ -72,14 +73,14 @@ void tm_unblockify_ferret_strings(char **mr_blk1, char *pblock,
     pinstr += filestrlen;
 
     /* allocate memory for this string */
-    poutchar = (char *) malloc(sizeof(char) * (n+1));
+    poutchar = (char *) FerMem_Malloc(sizeof(char) * (n+1), __FILE__, __LINE__);
 
     /*
      * Free any existing string in the output array and then
      * assign this newly allocated memory to the output array.
      */
     if ( *poutstr != NULL )
-       free(*poutstr);
+       FerMem_Free(*poutstr, __FILE__, __LINE__);
     *poutstr = poutchar;
 
     /* increment poutstr to point to the next output string pointer position */
diff --git a/fmt/src/tm_unix_versions.c b/fmt/src/tm_unix_versions.c
index b34a0b6..f82aa67 100644
--- a/fmt/src/tm_unix_versions.c
+++ b/fmt/src/tm_unix_versions.c
@@ -61,21 +61,18 @@
    for aix port *kob* 10/94 */
 
 #include <sys/types.h>
+#include <ctype.h>
 #include <dirent.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include "fmtprotos.h"
 
 
-
-int tilda_strcmp( rootnam, testnam )
-
-   char rootnam[], testnam[];
-
+static int tilda_strcmp(char *rootnam, char *testnam)
 /* compare root name with test to see if they match apart from ".~nnn~"
    If they do, return nnn (0 for identical match).
    Else return -1  */
-
 {
    int rlen, tlen, i, tilda;
    char tbuff[4];
@@ -115,14 +112,11 @@ int tilda_strcmp( rootnam, testnam )
 }
 
 
-int high_ver_name(name,path)
-  char name[], path[];
+int high_ver_name(char *name, char *path)
 /* find the highest numbered version of file "name" in the given directory */
 /* if no directory is given then the current directory is used.         */
 /* Also, if given path does not exist, then the procedure is exited  */
 /* modified 10/91 to do this        <kob> */
-
-
 {
   int next, tilda=(-1);
   struct dirent *dp;
@@ -145,17 +139,10 @@ int high_ver_name(name,path)
   }
 
   return tilda; 
-	    
 }
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-char *tm_c_ver_name(name, next_name,path)
-#else
-char *tm_c_ver_name_(name, next_name,path)
-#endif
-  char name[], next_name[], path[];
+char *FORTRAN(tm_c_ver_name)(char *name, char *next_name, char *path)
 /* generate the name for the next version of a file in this directory */
-
 {
   int high, len;
 
@@ -180,5 +167,3 @@ char *tm_c_ver_name_(name, next_name,path)
   return next_name;
 }
 
-
-
diff --git a/fmt/src/tm_world_recur.c b/fmt/src/tm_world_recur.c
index 371c518..1f4a156 100644
--- a/fmt/src/tm_world_recur.c
+++ b/fmt/src/tm_world_recur.c
@@ -65,6 +65,8 @@
    (and use -D_NO_PROTO for non-ANSI compilers)
 */ 
 
+#include "fmtprotos.h"
+
 /* local macro definitions */
 #define PLINE_CLASS_BASIC   0
 #define PLINE_CLASS_STRIDE  1
@@ -78,30 +80,13 @@
 #define MIN(x, y) (( (x) < (y)) ? (x) : (y))
 #define MAX(x, y) (( (x) < (y)) ? (y) : (x))
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-#define FORTRAN(a) a
-#else
-#define FORTRAN(a) a##_
-#endif
-
-/* prototype for FORTRAN boolean function */
-int  FORTRAN(tm_its_subspan_modulo) (int *axis);
-void FORTRAN(tm_ww_axlims) (int *axis, double *lo, double *hi);
-double FORTRAN(tm_modulo_axlen) (int *axis);
-
-double FORTRAN(tm_world_recur)
-     ( int *isubscript, int *iaxis, int *where_in_box,
-       int *max_lines, double line_mem[], int line_parent[],
-       int line_class[], int line_dim[], 
-       double line_start[], double line_delta[],
-       int line_subsc1[], int line_modulo[], double line_modulo_len[],
-       int line_regular[] )
-
+double FORTRAN(tm_world_recur)(int *isubscript, int *iaxis, int *where_in_box, int *max_lines, 
+                               double line_mem[], int line_parent[], int line_class[], int line_dim[], 
+                               double line_start[], double line_delta[], int line_subsc1[], 
+                               int line_modulo[], double line_modulo_len[], int line_regular[])
 {
   double tempwld, tm_world;
   int isub, rmod;
-  double showd;
-  int showi;
   int axis = *iaxis;   /* these FORTRAN arrs start at 0 like C */
   int line_len = line_dim[axis];
   int is_subspan;
@@ -124,11 +109,6 @@ double FORTRAN(tm_world_recur)
 	new_ss = (int)line_start[axis]
 	             +(*isubscript-1)*(int)line_delta[axis];
 	
-	showi = axis;
-    showd = line_start[axis];
-	showd = line_delta[axis];
-	showi = new_ss;
-	showi = line_parent[axis];
 	if ( line_regular[axis] || *where_in_box==BOX_MIDDLE ) {
 
 	  tm_world = FORTRAN(tm_world_recur)
@@ -161,7 +141,7 @@ double FORTRAN(tm_world_recur)
    data from the cells at the defined axis edges the result doesn't stray into 
    the modulo void cell. Adaphed from logic for is_subspan in axis_intervals.F*/
 
-	  is_subspan = ( FORTRAN(tm_its_subspan_modulo) (&line_parent[axis]) );
+	  is_subspan = ( FORTRAN(tm_its_subspan_modulo_int) (&line_parent[axis]) );
 	  if (line_modulo[ line_parent[axis] ] && is_subspan)
 	  {
 		  if (lo_ss == 0 || lo_ss == -1)
@@ -265,7 +245,7 @@ double FORTRAN(tm_world_recur)
    not a recursive access - return the same result that TM_WORLD would have.
    Force given subsc to data range as appropriate for modulo or non-modulo axes
 */
-  if ( FORTRAN(tm_its_subspan_modulo) (&axis) ) line_len++;  /* 2/02 mod */
+  if ( FORTRAN(tm_its_subspan_modulo_int) (&axis) ) line_len++;  /* 2/02 mod */
   if ( line_modulo[axis] ) {
     isub = ((*isubscript-1)%line_len) + 1 ;  /* inserted "+1" 5/99 */
     if (isub <= 0)
@@ -278,7 +258,7 @@ double FORTRAN(tm_world_recur)
     the given index  falls in the "void" region of a subspan modulo axis
     ... get the box_hi_lim of the Nth point in the core region
 */
-  if  ( FORTRAN(tm_its_subspan_modulo) (&axis)
+  if  ( FORTRAN(tm_its_subspan_modulo_int) (&axis)
 	&& isub == line_len ) {
     double lo, hi;
     FORTRAN(tm_ww_axlims) (&axis,&lo, &hi);
diff --git a/fmt/src/urlencode.c b/fmt/src/urlencode.c
index 2d37790..abe83cd 100644
--- a/fmt/src/urlencode.c
+++ b/fmt/src/urlencode.c
@@ -34,7 +34,9 @@
 *
 */
 
+#include <ctype.h>
 #include <string.h>
+#include "fmtprotos.h"
 
 /* Code from http://geekhideout.com/urlcode.shtml
 Comments:
@@ -56,20 +58,15 @@ url_encode was edited to send input string and output string as
 arguments and to return the length of the encoded string.
 */
 
-/* Converts a hex character to its integer value */
-char from_hex(char ch) {
-  return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
-}
-
 /* Converts an integer value to its hex character*/
-char to_hex(char code) {
+static char to_hex(char code) {
   static char hex[] = "0123456789abcdef";
   return hex[code & 15];
 }
 
-/* Returns a url-encoded version of str */
-/* IMPORTANT: be sure to free() the returned string after use */
-void *url_encode_(char *str, char *outstr, int *outlen) {
+/* url-encodes str and returns in outstr which has length outlen */
+int FORTRAN(url_encode)(char *str, char *outstr, int *outlen)
+{
   char *pstr = str, *pbuf = outstr;
   while (*pstr) {
     if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~') 
@@ -85,24 +82,3 @@ void *url_encode_(char *str, char *outstr, int *outlen) {
   return 0;
 }
 
-/* Returns a url-decoded version of str */
-/* IMPORTANT: be sure to free() the returned string after use */
-int *url_decode(char *str, char *outstr) {
-  char *pstr = str, *pbuf = outstr;
-  while (*pstr) {
-    if (*pstr == '%') {
-      if (pstr[1] && pstr[2]) {
-        *pbuf++ = from_hex(pstr[1]) << 4 | from_hex(pstr[2]);
-        pstr += 2;
-      }
-    } else if (*pstr == '+') { 
-      *pbuf++ = ' ';
-    } else {
-      *pbuf++ = *pstr;
-    }
-    pstr++;
-  }
-  *pbuf = '\0';
-  return 0;
-}
-
diff --git a/gksm2ps/gksm.c b/gksm2ps/gksm.c
index 96ef882..0b8c4c4 100644
--- a/gksm2ps/gksm.c
+++ b/gksm2ps/gksm.c
@@ -54,7 +54,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: gksm.c 21932 2016-06-15 23:59:28Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 static Gint	gksm_version = 1;
diff --git a/gksm2ps/xpreview.c b/gksm2ps/xpreview.c
index 0ca7da6..59f4764 100644
--- a/gksm2ps/xpreview.c
+++ b/gksm2ps/xpreview.c
@@ -45,7 +45,7 @@
 
 
 #ifndef lint
-    static char	rcsid[]	= "$Id: xpreview.c 8482 2004-01-21 22:02:21Z kobrien $";
+    static char	rcsid[]	= "$Id$";
     static char	afsid[]	= "$__Header$";
 #endif
 
diff --git a/jnls/contrib/ratio_set.jnl b/jnls/contrib/ratio_set.jnl
index 2bfabf3..0bbe6f3 100644
--- a/jnls/contrib/ratio_set.jnl
+++ b/jnls/contrib/ratio_set.jnl
@@ -18,9 +18,9 @@
 !
 ! Author: Patrick Brockmann 
 ! Contact: Patrick.Brockmann at ipsl.jussieu.fr
-! $Date: 2005-01-07 10:54:00 -0800 (Fri, 07 Jan 2005) $ 
+! $Date$ 
 ! $Name$
-! $Revision: 8905 $
+! $Revision$
 ! History:
 ! Modification:
 !  * put ratio as optionnal
diff --git a/jnls/contrib/taylor_agraticule.jnl b/jnls/contrib/taylor_agraticule.jnl
index 44317bd..455b0e6 100644
--- a/jnls/contrib/taylor_agraticule.jnl
+++ b/jnls/contrib/taylor_agraticule.jnl
@@ -23,9 +23,9 @@
 !
 ! Author: Patrick Brockmann
 ! Contact: Patrick.Brockmann at ipsl.jussieu.fr
-! $Date: 2012-06-06 10:44:30 -0700 (Wed, 06 Jun 2012) $
+! $Date$
 ! $Name: FAST_672_1_0 $
-! $Revision: 14116 $
+! $Revision$
 ! History:
 ! Modification:
 !
diff --git a/jnls/contrib/taylor_example1.jnl b/jnls/contrib/taylor_example1.jnl
index 01b10a0..dea30eb 100644
--- a/jnls/contrib/taylor_example1.jnl
+++ b/jnls/contrib/taylor_example1.jnl
@@ -1,9 +1,9 @@
 !**************************************************************
 ! Author: Patrick Brockmann
 ! Contact: Patrick.Brockmann at ipsl.jussieu.fr
-! $Date: 2012-06-06 10:44:30 -0700 (Wed, 06 Jun 2012) $
+! $Date$
 ! $Name: FAST_608_1_3 $
-! $Revision: 14116 $
+! $Revision$
 ! History:
 ! Modification:
 !
diff --git a/jnls/contrib/taylor_frame.jnl b/jnls/contrib/taylor_frame.jnl
index 79fa289..8f6730e 100644
--- a/jnls/contrib/taylor_frame.jnl
+++ b/jnls/contrib/taylor_frame.jnl
@@ -29,9 +29,9 @@
 !
 ! Author: Patrick Brockmann
 ! Contact: Patrick.Brockmann at ipsl.jussieu.fr
-! $Date: 2012-06-06 10:44:30 -0700 (Wed, 06 Jun 2012) $
+! $Date$
 ! $Name: $
-! $Revision: 14116 $
+! $Revision$
 ! History:
 ! Modification:
 ! Original implentation: James.Orr at cea.fr 
diff --git a/jnls/contrib/taylor_label.jnl b/jnls/contrib/taylor_label.jnl
index 0881817..1b05633 100644
--- a/jnls/contrib/taylor_label.jnl
+++ b/jnls/contrib/taylor_label.jnl
@@ -14,9 +14,9 @@
 !
 ! Author: Patrick Brockmann
 ! Contact: Patrick.Brockmann at ipsl.jussieu.fr
-! $Date: 2012-06-06 10:44:30 -0700 (Wed, 06 Jun 2012) $
+! $Date$
 ! $Name: FAST_608_1_3 $
-! $Revision: 14116 $
+! $Revision$
 ! History:
 ! Modification:
 !
diff --git a/jnls/contrib/taylor_plot.jnl b/jnls/contrib/taylor_plot.jnl
index 0b212b4..a3dfc14 100644
--- a/jnls/contrib/taylor_plot.jnl
+++ b/jnls/contrib/taylor_plot.jnl
@@ -13,9 +13,9 @@
 !
 ! Author: Patrick Brockmann
 ! Contact: Patrick.Brockmann at ipsl.jussieu.fr
-! $Date: 2012-06-06 10:44:30 -0700 (Wed, 06 Jun 2012) $
+! $Date$
 ! $Name: FAST_608_1_3 $
-! $Revision: 14116 $
+! $Revision$
 ! History:
 ! Modification:
 !
diff --git a/jnls/contrib/taylor_polymark.jnl b/jnls/contrib/taylor_polymark.jnl
index 9a6a43b..2eca75f 100644
--- a/jnls/contrib/taylor_polymark.jnl
+++ b/jnls/contrib/taylor_polymark.jnl
@@ -13,9 +13,9 @@
 !
 ! Author: Patrick Brockmann
 ! Contact: Patrick.Brockmann at ipsl.jussieu.fr
-! $Date: 2012-06-06 10:44:30 -0700 (Wed, 06 Jun 2012) $
+! $Date$
 ! $Name: FAST_608_1_3 $
-! $Revision: 14116 $
+! $Revision$
 ! History:
 ! Modification:
 !
diff --git a/jnls/contrib/taylor_rgraticule.jnl b/jnls/contrib/taylor_rgraticule.jnl
index 357f652..3fa33f7 100644
--- a/jnls/contrib/taylor_rgraticule.jnl
+++ b/jnls/contrib/taylor_rgraticule.jnl
@@ -27,9 +27,9 @@
 !
 ! Author: Patrick Brockmann
 ! Contact: Patrick.Brockmann at ipsl.jussieu.fr
-! $Date: 2012-06-06 10:44:30 -0700 (Wed, 06 Jun 2012) $
+! $Date$
 ! $Name: $
-! $Revision: 14116 $
+! $Revision$
 ! History:
 ! Modification:
 !
diff --git a/jnls/contrib/taylor_wtarea.jnl b/jnls/contrib/taylor_wtarea.jnl
index ae40d56..940a8c8 100644
--- a/jnls/contrib/taylor_wtarea.jnl
+++ b/jnls/contrib/taylor_wtarea.jnl
@@ -28,9 +28,9 @@
 !
 ! Author: James Orr 
 ! Contact: James.Orr at cea.fr
-! $Date: 2012-03-19 17:11:04 -0700 (Mon, 19 Mar 2012) $ 
+! $Date$ 
 ! $Name$
-! $Revision: 13565 $
+! $Revision$
 ! History:
 ! Modification:
 ! 
diff --git a/platform_specific.mk.i386-apple-darwin b/platform_specific.mk.i386-apple-darwin
deleted file mode 100644
index 991e5e5..0000000
--- a/platform_specific.mk.i386-apple-darwin
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-# platform_specific_includes.mk.i386-apple-darwin
-#
-# This file is included in other Makefiles and defines
-# platform specific macros
-
-	GKS_INCLUDES	= -I../../ppl/include/xgks \
-			  -I../../xgks/src/lib \
-			  -Ipplinc/xgks \
-			  -I../../xgks/port 
-
-	INCLUDES        = -I. \
-			  -I../fmt/cmn/ \
-			  -I$(NETCDF4_DIR)/include \
-			  -I$(READLINE_DIR)/include \
-			  -I../common \
-			  -I../../fmt/cmn \
-			  -I../../ppl/include \
-			  -I../../fer/common \
-			  $(GKS_INCLUDES) \
-			  -I/usr/local/include
-
-	FINCLUDES	= -I../../ppl/tmap_inc \
-			  -I../include \
-			  -I../../fmt/cmn \
-			  -I../common \
-			  -I../../ppl/include \
-			  -I../../fer/common
-
-	PLATFORM = $(shell uname -s -r) 
-
-	CC              = gcc
-	CXX		= c++
-	FC		= gfortran
-	F77		= gfortran
-
-	RANLIB          = /usr/bin/ranlib
-
-	CPP		= /usr/bin/cpp
-
-	CPP_FLAGS       = $(INCLUDES) \
-			  -fPIC \
-			  -Dunix \
-			  -Dgfortran \
-			  -DNO_OPEN_SHARED \
-			  -DNO_OPEN_RECORDTYPE \
-			  -DNO_SNGL \
-			  -DX_REFRESH \
-			  -Dreclen_in_bytes \
-			  -DNO_OPEN_READONLY \
-			  -DMANDATORY_FORMAT_WIDTHS \
-			  -DNO_OPEN_CARRIAGECONTROL \
-			  -Dxgks \
-			  -DSTAR_1_SUPPORTED \
-			  -DFULL_GUI_VERSION \
-			  -DX_REFRESH \
-			  -DXT_CODE \
-			  -DLINUX \
-			  -DNO_PASSED_CONCAT \
-			  -Dcrptd_cat_argument \
-			  -DG77_SIGNAL \
-			  -DG77 \
-			  -DNEED_IAND \
-			  -DNO_PREPEND_STRING \
-			  -DNO_DOUBLE_ESCAPE_SLASH \
-			  -Ddouble_p/
-
-# -DusingDODSf2cUnderscore needed if using netcdf library...
-# also consider -ffloat-store.
-	CFLAGS	= \
-			  $(CPP_FLAGS) \
-			  -Dlint \
-			  -DVOID_SIGHANDLER \
-			  -D_POSIX_VERSION \
-			  -DLINUX \
-			  -DFULL_GUI_VERSION \
-			  -DX_REFRESH \
-			  -DXT_CODE \
-			  -Dsun4 
-
-	FFLAGS = $(CPP_FLAGS) \
-			  -fno-automatic \
-			  -fno-second-underscore \
-			  -fdollar-ok \
-			  -ffixed-line-length-132 \
-			  -ffpe-trap=overflow $(FINCLUDES) \
-			  -fdefault-real-8 \
-			  -fdefault-double-8
-
-	PPLUS_FFLAGS = \
-			  $(CPP_FLAGS) \
-			  -fno-automatic \
-			  -fno-second-underscore \
-			  -fdollar-ok \
-			  -ffixed-line-length-132 \
-			  $(FINCLUDES)
-
-	OPT_FLAGS	= -O -DNDEBUG
-	PPLUS_OPT_FLAGS	= -O0
-	DBG_FLAGS	= -O0 -g
-	PROF_FLAGS	= -O0 -g
-
-	# Below this line are macro definitions used only for the final linking of the executable
-	# specify gfortran library. With gfortran 4.4, ssee notews in the i386-linux platform
-	# flags file.
-
-	LD		= gcc
-	LDFLAGS		= \
-			  -v \
-			  --verbose \
-			  -fPIC
-
-	SYSLIB		= \
-			  -L/usr/X11R6/lib -lX11 \
-			  /usr/local/gfortran/lib/libgfortran.a \
-			  -lcurl \
-			  -ldl \
-			  -lz \
-			  -lm
-
-# -static-libgfortran can be used with gfortran 4.4 but not 4.1
-# /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgfortran.a
-
-	TMLIB		= ../lib/tmap_lib.a
-
-	GKSLIB		= ../xgks/src/lib/libxgks.a
-
-# For netCDF4 using new hdf5
-
-	CDFLIB		= \
-			  $(NETCDF4_DIR)/lib/libnetcdff.a \
-			  $(NETCDF4_DIR)/lib/libnetcdf.a \
-			  $(HDF5_DIR)/lib/libhdf5_hl.a \
-			  $(HDF5_DIR)/lib/libhdf5.a
-
-	LINUX_OBJS	= \
-			  special/linux_routines.o \
-			  dat/*.o \
-			  ../fmt/src/x*.o \
-			  ../ppl/plot/ppldata.o
-
-	READLINELIB	= -L$(READLINE_DIR)/lib -lreadline 
-#			  $(READLINE_DIR)/lib/libhistory.a
-
-# cancel the default rule for .f -> .o to prevent objects from being built
-# from .f files that are out-of-date with respect to their corresponding .F file
-# %.o : %__.f
-
-# use cpp to preprocess the .F files to .f files and then compile the .f files
-# rename to __.f because removing .f also removes .F
-#%.o : %.F
-#	rm -f $*__.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*__.f
-#	$(F77) $(FFLAGS) -c $*__.f; mv $*__.o $*.o	 
-
-# Directly compile the .F source files to the .o object files
-# since gfortran can handle the C compiler directives in Fortran coe
-%.o : %.F
-	$(FC) $(FFLAGS) -c $*.F -o $*.o
-
-
-#
-# End of platform_specific_includes.mk.i386-apple-darwin
-#
diff --git a/platform_specific.mk.i386-linux b/platform_specific.mk.i386-linux
index dcb2097..0f7a648 100644
--- a/platform_specific.mk.i386-linux
+++ b/platform_specific.mk.i386-linux
@@ -1,106 +1,90 @@
 #
 # platform_specific_includes.mk.i386-linux
 #
-# This file is included in other Makefiles and defines
-# platform specific macros
-
-	GKS_INCLUDES = \
-		-I../../ppl/include/xgks \
-		-I../../xgks/src/lib \
-		-Ipplinc/xgks \
-		-I../../xgks/port 
-
-	INCLUDES = \
-		-I. \
-		-I../../fmt/cmn \
-		-I../common \
-		-I../../ppl/include \
-		-I../../fer/common \
-		$(GKS_INCLUDES) \
-		-I$(READLINE_DIR)/include \
-		-I$(NETCDF4_DIR)/include \
-		-I/usr/local/include
-
-	FINCLUDES = \
-		-I../../ppl/tmap_inc \
-		-I../include \
-		-I../../fmt/cmn \
-		-I../common \
-		-I../../ppl/include \
-		-I../../fer/common
-
-	PLATFORM = $(shell uname -s -r) 32-bit
-
-	CC = gcc
-	FC = gfortran
-	F77 = gfortran
-
-	RANLIB = /usr/bin/ranlib
-
-	CPP = /lib/cpp
-
-	CPP_FLAGS = \
-		$(INCLUDES) \
-		-m32 \
-		-fPIC \
-		-Dunix \
-		-Dgfortran \
-		-DNO_OPEN_SHARED \
-		-DNO_OPEN_RECORDTYPE \
-		-DX_REFRESH \
-		-Dreclen_in_bytes \
-		-DNO_OPEN_READONLY \
-		-DMANDATORY_FORMAT_WIDTHS\
-		-DNO_OPEN_CARRIAGECONTROL \
-		-Dxgks \
-		-DSTAR_1_SUPPORTED \
-		-DFULL_GUI_VERSION \
-		-DX_REFRESH \
-		-DXT_CODE \
-		-DLINUX \
-		-DNO_PASSED_CONCAT \
-		-Dcrptd_cat_argument \
-		-DG77_SIGNAL \
-		-DG77 \
-		-DNEED_IAND \
-		-DNO_PREPEND_STRING \
-		-DNO_DOUBLE_ESCAPE_SLASH \
-		-Ddouble_p 
-
+# This file is included in other Makefiles and defines platform specific macros.  
+# Should not contain any relative directories (other than .) since these Makefiles
+# exist at various levels in the directory tree.
+
+# Extended regular expressions flag for sed (used with cleaning up run_tests results)
+	SED_EXTREGEX_FLAG = -r
+
+# If READLINE_DIR is given, -I$(READLINE_DIR)/include must be the first include flag 
+# (other than .) so the correct readline include files are used.
+ifneq ($(strip $(READLINE_DIR)),)
+	MYINCLUDES	= -I. \
+			  -I$(READLINE_DIR)/include \
+			  -I$(NETCDF4_DIR)/include \
+			  -I$(DIR_PREFIX)/fer/common \
+			  -I$(DIR_PREFIX)/fmt/cmn \
+			  -I$(DIR_PREFIX)/ppl/tmap_inc \
+			  -I$(DIR_PREFIX)/ppl/include \
+			  -I$(DIR_PREFIX)/xgks/src/lib \
+			  -I$(DIR_PREFIX)/xgks/port 
+else
+	MYINCLUDES	= -I. \
+			  -I$(NETCDF4_DIR)/include \
+			  -I$(DIR_PREFIX)/fer/common \
+			  -I$(DIR_PREFIX)/fmt/cmn \
+			  -I$(DIR_PREFIX)/ppl/tmap_inc \
+			  -I$(DIR_PREFIX)/ppl/include \
+			  -I$(DIR_PREFIX)/xgks/src/lib \
+			  -I$(DIR_PREFIX)/xgks/port 
+endif
+
+	MYDEFINES	= -Dcrptd_cat_argument \
+			  -Ddouble_p \
+			  -Dgfortran \
+			  -Dreclen_in_bytes  \
+			  -Dunix \
+			  -Dxgks \
+			  -DG77 \
+			  -DG77_SIGNAL \
+			  -DINTERNAL_READ_FORMAT_BUG \
+			  -DMANDATORY_FORMAT_WIDTHS \
+			  -DNEED_IAND \
+			  -DNO_DOUBLE_ESCAPE_SLASH \
+			  -DNO_OPEN_CARRIAGECONTROL \
+			  -DNO_OPEN_SHARED \
+			  -DNO_OPEN_READONLY \
+			  -DNO_OPEN_RECORDTYPE \
+			  -DNO_PASSED_CONCAT \
+			  -DNO_PREPEND_STRING \
+			  -DSTAR_1_SUPPORTED \
+			  -DX_REFRESH
+
+	PLATFORM 	= $(shell uname -s -r) 32-bit
+
+	CC		= $(shell which gcc)
+	FC		= $(shell which gfortran)
+	F77		= $(shell which gfortran)
+	AR		= $(shell which ar)
+	ARFLAGS		= -cr
+	RANLIB		= $(shell which ranlib)
 
 # Flags for compiling all C code
-	CFLAGS = \
-		$(CPP_FLAGS) \
-		-Dlint \
-		-DVOID_SIGHANDLER \
-		-D_POSIX_VERSION \
-		-DLINUX \
-		-DFULL_GUI_VERSION \
-		-DX_REFRESH \
-		-DXT_CODE 
+# -DusingDODSf2cUnderscore needed if using netcdf library...
+# also consider -ffloat-store.
+	CFLAGS		= -m32 -fPIC $(MYDEFINES) $(MYINCLUDES)
 
 # Flags for compiling the PlotPlus FORTRAN code (ppl subdirectory)
-	PPLUS_FFLAGS = \
-		$(CPP_FLAGS) \
-		-fno-automatic \
-		-DFORTRAN_90 \
-		-fno-second-underscore \
-		-fdollar-ok \
-		-ffixed-line-length-132 \
-		$(FINCLUDES)
+	PPLUS_FFLAGS	= -m32 -fPIC \
+			  -fno-automatic \
+			  -fno-second-underscore \
+			  -fdollar-ok \
+			  -ffixed-line-length-132 \
+			  $(MYDEFINES) $(MYINCLUDES)
 
 # Flags for compiling non-PlotPlus FORTRAN code
-	FFLAGS = \
-		$(CPP_FLAGS) \
-		-fno-automatic \
-		-DFORTRAN_90 \
-		-fno-second-underscore \
-		-fdollar-ok \
-		-ffixed-line-length-132 \
-		-fdefault-real-8 \
-		-fdefault-double-8 \
-		-fimplicit-none \
-		$(FINCLUDES)
+	FFLAGS		= -m32 -fPIC \
+			  -fno-automatic \
+			  -fno-second-underscore \
+			  -fdollar-ok \
+			  -ffixed-line-length-132 \
+			  -ffpe-trap=overflow \
+			  -fimplicit-none \
+			  -fdefault-real-8 \
+			  -fdefault-double-8 \
+			  $(MYDEFINES) $(MYINCLUDES)
 
 	OPT_FLAGS	= -O -DNDEBUG
 	PPLUS_OPT_FLAGS	= -O0
@@ -108,58 +92,38 @@
 	PROF_FLAGS	= -O0 -g -pg
 
 	# Below this line are macro definitions used only for the final linking of the executable
-	#
-
-	LD = gcc
 
-	LDFLAGS = \
-		-v \
-		--verbose \
-		-m32 \
-		-fPIC \
-		-export-dynamic
-
-	SYSLIB = \
-		-lX11 \
-		-lcurl \
-		-ldl \
-		-lz \
-		-Wl,-Bstatic -lgfortran -Wl,-Bdynamic \
-		-lm
-
-# -static-libgfortran can be used with gfortran 4.4 but not 4.1
-# /usr/lib/gcc/i386-redhat-linux/4.1.1/libgfortran.a
-
-	GKSLIB = ../xgks/src/lib/libxgks.a
-
-# For netCDF4 using new hdf5 and new zlib
-
-	CDFLIB = \
-		$(NETCDF4_DIR)/lib/libnetcdff.a \
-		$(NETCDF4_DIR)/lib/libnetcdf.a \
-		$(HDF5_DIR)/lib/libhdf5_hl.a \
-		$(HDF5_DIR)/lib/libhdf5.a
-
-	LINUX_OBJS = \
-		special/linux_routines.o \
-		dat/*.o \
-		../fmt/src/x*.o \
-		../ppl/plot/ppldata.o
-
-# For statically linking in the readline and history libraries
-#	READLINELIB = -L$(READLINE_DIR)/lib -Wl,-Bstatic -lreadline -lhistory -Wl,-Bdynamic
-# For linking against the shared-object libraries (if they exist)
-	READLINELIB = -L$(READLINE_DIR)/lib -lreadline -lhistory
-
-## cancel the default rule for .f -> .o to prevent objects from being built
-## from .f files that are out-of-date with respect to their corresponding .F file
-#%.o : %.f
-#
-## use cpp to preprocess the .F files to .f files and then compile the .f files
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(FFLAGS) -c $*.f	 
+	LD		= gcc
+	LDFLAGS		= -v --verbose -m32 -fPIC -export-dynamic
+
+# If $(READLINE_DIR) is given (and not blank), statically link in the readline 
+# and history libraries given under that directory; otherwise, just use the usual 
+# flags to link in the system readline and history libraries.
+ifneq ($(strip $(READLINE_DIR)),)
+	SYSLIB		= -lX11 \
+			  $(READLINE_DIR)/lib/libreadline.a \
+			  $(READLINE_DIR)/lib/libhistory.a \
+			  -lcurl \
+			  -ldl \
+			  -lz \
+			  -Wl,-Bstatic -lgfortran -Wl,-Bdynamic \
+			  -lm
+else
+	SYSLIB		= -lX11 \
+			  -lreadline \
+			  -lhistory \
+			  -lcurl \
+			  -ldl \
+			  -lz \
+			  -Wl,-Bstatic -lgfortran -Wl,-Bdynamic \
+			  -lm
+endif
+
+# For netCDF4 using HDF5
+	CDFLIB		= $(NETCDF4_DIR)/lib/libnetcdff.a \
+			  $(NETCDF4_DIR)/lib/libnetcdf.a \
+			  $(HDF5_DIR)/lib/libhdf5_hl.a \
+			  $(HDF5_DIR)/lib/libhdf5.a
 
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
@@ -169,4 +133,3 @@
 #
 # End of platform_specific_includes.mk.i386-linux
 #
-
diff --git a/platform_specific.mk.intel-mac b/platform_specific.mk.intel-mac
index b9be468..c298cba 100644
--- a/platform_specific.mk.intel-mac
+++ b/platform_specific.mk.intel-mac
@@ -1,101 +1,130 @@
 #
 # platform_specific_includes.mk.intel-mac
 #
-# This file is included in other Makefiles and defines
-# platform specific macros
+# This file is included in other Makefiles and defines platform specific macros.  
+# Should not contain any relative directories (other than .) since these Makefiles
+# exist at various levels in the directory tree.
 
-	GKS_INCLUDES	= -I../../ppl/include/xgks \
-			  -I../../xgks/src/lib \
-			  -Ipplinc/xgks \
-			  -I../../xgks/port 
+# Extended regular expressions flag for sed (used with cleaning up run_tests results)
+	SED_EXTREGEX_FLAG = -E
 
-	INCLUDES        = -I. \
-			  -I../fmt/cmn/ \
-			  -I$(NETCDF4_DIR)/include \
+# If READLINE_DIR is given, -I$(READLINE_DIR)/include must be the first include flag 
+# (other than .) so the correct readline include files are used.
+ifneq ($(strip $(READLINE_DIR)),)
+	MYINCLUDES	= -I. \
 			  -I$(READLINE_DIR)/include \
-			  -I../common \
-			  -I../../fmt/cmn \
-			  -I../../ppl/include \
-			  -I../../fer/common \
-			  $(GKS_INCLUDES) \
-			  -I/usr/local/include \
-			  -I/usr/X11/include
-
-	FINCLUDES	= -I../../ppl/tmap_inc \
-			  -I../include \
-			  -I../../fmt/cmn \
-			  -I../common \
-			  -I../../ppl/include \
-			  -I../../fer/common
+			  -I$(NETCDF4_DIR)/include \
+			  -I$(DIR_PREFIX)/fer/common \
+			  -I$(DIR_PREFIX)/fmt/cmn \
+			  -I$(DIR_PREFIX)/ppl/tmap_inc \
+			  -I$(DIR_PREFIX)/ppl/include \
+			  -I/opt/X11/include \
+			  -I$(DIR_PREFIX)/xgks/src/lib \
+			  -I$(DIR_PREFIX)/xgks/port 
+else
+	MYINCLUDES	= -I. \
+			  -I$(NETCDF4_DIR)/include \
+			  -I$(DIR_PREFIX)/fer/common \
+			  -I$(DIR_PREFIX)/fmt/cmn \
+			  -I$(DIR_PREFIX)/ppl/tmap_inc \
+			  -I$(DIR_PREFIX)/ppl/include \
+			  -I/opt/X11/include \
+			  -I$(DIR_PREFIX)/xgks/src/lib \
+			  -I$(DIR_PREFIX)/xgks/port 
+endif
+
+	MYDEFINES	= -Dcrptd_cat_argument \
+			  -Ddouble_p \
+			  -Dgfortran \
+			  -Dreclen_in_bytes  \
+			  -Dunix \
+			  -Dxgks \
+			  -DG77 \
+			  -DG77_SIGNAL \
+			  -DINTERNAL_READ_FORMAT_BUG \
+			  -DMANDATORY_FORMAT_WIDTHS \
+			  -DNEED_IAND \
+			  -DNO_DOUBLE_ESCAPE_SLASH \
+			  -DNO_OPEN_CARRIAGECONTROL \
+			  -DNO_OPEN_SHARED \
+			  -DNO_OPEN_READONLY \
+			  -DNO_OPEN_RECORDTYPE \
+			  -DNO_PASSED_CONCAT \
+			  -DNO_PREPEND_STRING \
+			  -DSTAR_1_SUPPORTED \
+			  -DX_REFRESH
 
-	PLATFORM = $(shell uname -s -r) 64-bit
+	PLATFORM 	= $(shell uname -s -r)
 
-	CC		= $(shell which gcc-6)
-	FC		= $(shell which gfortran-6)
-	F77		= $(shell which gfortran-6)
+	CC		= $(shell which gcc-7)
+	FC		= $(shell which gfortran-7)
+	F77		= $(shell which gfortran-7)
 	AR		= $(shell which ar)
 	ARFLAGS		= -cr
 	RANLIB		= $(shell which ranlib)
 
-	CPP_FLAGS       = $(INCLUDES) \
-			  -m64 \
-			  -fPIC -Dunix -Dgfortran   \
-			  -DNO_OPEN_SHARED \
-			  -DNO_OPEN_RECORDTYPE \
-			  -DX_REFRESH -Dreclen_in_bytes  \
-			  -DNO_OPEN_READONLY -DMANDATORY_FORMAT_WIDTHS\
-			  -DNO_OPEN_CARRIAGECONTROL -Dxgks -DSTAR_1_SUPPORTED \
-			  -DFULL_GUI_VERSION -DX_REFRESH \
-			  -DXT_CODE -DLINUX -DNO_PASSED_CONCAT \
-			  -Dcrptd_cat_argument \
-			  -DG77_SIGNAL -DG77 \
-			  -DNEED_IAND -DINTERNAL_READ_FORMAT_BUG \
-			  -DNO_PREPEND_STRING -DNO_DOUBLE_ESCAPE_SLASH \
-			  -Ddouble_p
-
-	CFLAGS		= $(CPP_FLAGS) \
-			  -Dlint -DVOID_SIGHANDLER -D_POSIX_VERSION -DLINUX \
-			  -DFULL_GUI_VERSION -DX_REFRESH -DXT_CODE -Dsun4 
-
-	PPLUS_FFLAGS	= $(CPP_FLAGS) \
-			  -fno-automatic -fno-second-underscore \
-			  -fdollar-ok -ffixed-line-length-132 $(FINCLUDES)
-
-	FFLAGS		= $(CPP_FLAGS) \
-			  -fno-automatic -fno-second-underscore \
-			  -fdollar-ok -ffixed-line-length-132 \
-			  -ffpe-trap=overflow -fimplicit-none \
-			  -fdefault-real-8 -fdefault-double-8 $(FINCLUDES)
+# Flags for compiling all C code
+# -DusingDODSf2cUnderscore needed if using netcdf library...
+# also consider -ffloat-store.
+	CFLAGS		= -fPIC $(MYDEFINES) $(MYINCLUDES)
+
+# Flags for compiling the PlotPlus FORTRAN code (ppl subdirectory)
+	PPLUS_FFLAGS	= -fPIC \
+			  -fno-automatic \
+			  -fno-second-underscore \
+			  -fdollar-ok \
+			  -ffixed-line-length-132 \
+			  $(MYDEFINES) $(MYINCLUDES)
+
+# Flags for compiling non-PlotPlus FORTRAN code
+	FFLAGS		= -fPIC \
+			  -fno-automatic \
+			  -fno-second-underscore \
+			  -fdollar-ok \
+			  -ffixed-line-length-132 \
+			  -ffpe-trap=overflow \
+			  -fimplicit-none \
+			  -fdefault-real-8 \
+			  -fdefault-double-8 \
+			  $(MYDEFINES) $(MYINCLUDES)
 
 	OPT_FLAGS	= -O -DNDEBUG
 	PPLUS_OPT_FLAGS	= -O0
 	DBG_FLAGS	= -O0 -g
-	PROF_FLAGS	= -O0 -g
+	PROF_FLAGS	= -O0 -g -pg
+
+	# Below this line are macro definitions used only for the final linking of the executable
 
-	LD		= $(shell which gfortran-6)
-	LDFLAGS		= -fPIC -static-libgfortran -static-libgcc -dead_strip
+	LD		= $(shell which gcc-7)
+	LDFLAGS		= -v --verbose -fPIC -rdynamic
 
-	SYSLIB		= -L/usr/X11/lib -lX11 \
+# If $(READLINE_DIR) is given (and not blank), statically link in the readline 
+# and history libraries given under that directory; otherwise, just use the usual 
+# flags to link in the system readline and history libraries.
+ifneq ($(strip $(READLINE_DIR)),)
+	SYSLIB		= -L/opt/X11/lib -lX11 \
+			  $(READLINE_DIR)/lib/libreadline.a \
+			  $(READLINE_DIR)/lib/libhistory.a \
+			  -lncurses \
 			  -lcurl \
 			  -ldl \
 			  -lz \
-			  /usr/local/opt/gcc/lib/gcc/6/libquadmath.a \
-			  -lm \
-			  -Wl,-weak_library,/usr/local/opt/gcc/lib/gcc/6/libquadmath.0.dylib
-
-	GKSLIB		= ../xgks/src/lib/libxgks.a
-
-	CDFLIB		= $(NETCDF4_DIR)/lib/libnetcdff.a \
-			  $(NETCDF4_DIR)/lib/libnetcdf.a \
-			  $(HDF5_DIR)/lib/libhdf5_hl.a \
-			  $(HDF5_DIR)/lib/libhdf5.a 
-
-	LINUX_OBJS	= special/linux_routines.o \
-			  dat/*.o \
-			  ../fmt/src/x*.o \
-			  ../ppl/plot/ppldata.o
+			  -lgfortran \
+			  -lm
+else
+	SYSLIB		= -L/opt/X11/lib -lX11 \
+			  -lreadline \
+			  -lhistory \
+			  -lcurl \
+			  -ldl \
+			  -lz \
+			  -lgfortran \
+			  -lm
+endif
 
-	READLINELIB = -L$(READLINE_DIR)/lib -lreadline 
+# For netCDF4 using HDF5
+	CDFLIB		= -L$(NETCDF4_DIR)/lib -lnetcdff -lnetcdf \
+			  -L$(HDF5_DIR)/lib -lhdf5_hl -lhdf5
 
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
@@ -103,5 +132,5 @@
 	$(FC) $(FFLAGS) -c $*.F -o $*.o
 
 #
-# End of platform_specific_includes.mk.x86_64-linux
+# End of platform_specific_includes.mk.intel-mac
 #
diff --git a/platform_specific.mk.x86_64-darwin b/platform_specific.mk.x86_64-darwin
deleted file mode 100644
index de03b89..0000000
--- a/platform_specific.mk.x86_64-darwin
+++ /dev/null
@@ -1,103 +0,0 @@
-#
-# platform_specific_flags.mk.x86_64-darwin
-#
-# This file is included in other Makefiles and defines
-# platform specific macros
-
-TMAP_LOCAL = /usr/local/src/FERRET
-
-INCLUDES        = -I/usr/include \
-		  -I/usr/X11R6/include \
-		  -I/usr/local/include \
-		  -I$(TMAP_LOCAL)/src/xgks/include \
-		  -I. \
-		  -I$(TMAP_LOCAL)/xgks/gif \
-		  -I$(TMAP_LOCAL)/xgks/ps \
-		  -I$(TMAP_LOCAL)/xgks/port \
-                  -I$(TMAP_LOCAL)/xgks/src/lib \
-                  -I$(TMAP_LOCAL)/xgks/src/lib/gksm \
-		  -I$(TMAP_LOCAL)/include \
-                  -Ipplinc/xgks \
-		  -I../common \
-		  -I$(TMAP_LOCAL)/fmt/cmn \
-		  -I$(TMAP_LOCAL)/ppl/include \
-		  -I$(TMAP_LOCAL)/fer/common
-
-FINCLUDES	= -I$(TMAP_LOCAL)/ppl/tmap_inc \
-		  -I../include \
-		  -I$(TMAP_LOCAL)/fmt/cmn \
-		  -I../common \
-		  -I$(TMAP_LOCAL)/ppl/include \
-		  -I$(TMAP_LOCAL)/fer/common
-
-GUI_INCLUDES	= -I/usr/X11R6/include
- 
-# New platform type var - *kob* 10/01
-PLATFORM := $(shell uname -rs)
-
-CC              = gcc
-FC		= gfortran
-F77		= gfortran
-RANLIB          = /usr/bin/ranlib
-
-# Flags for compiling all the C code
-# have to remove -02 flag due to bug in v2.96 of compiler. see
-#   for http://gcc.gnu.org/ml/gcc-bugs/2000-04/msg00716.html for info
-CFLAGS          = -g -arch x86_64 -fPIC -Dlint -Dunix -DNEED_IAND -DFORTRAN_90 -DVOID_SIGHANDLER -D_POSIX_VERSION -DFULL_GUI_VERSION -DX_REFRESH -DXT_CODE $(INCLUDES)
-
-# Flags for compiling the PlotPlus FORTRAN code (ppl subdirectory)
-PPLUS_FFLAGS    = -g -zero -fPIC -noautomatic -c -assume no2underscores -assume nobscc -extend-source 132 -heap-arrays 10 -align dcommons -Dunix -DNEED_IAND -DFORTRAN_90 $(FINCLUDES)
-
-# Flags for compiling non-PlotPlus FORTRAN code
-FFLAGS          = -g -zero -fPIC -noautomatic -c -assume no2underscores -assume nobscc -extend-source 132 -heap-arrays 10 -align dcommons -Dunix -DNEED_IAND -DFORTRAN_90 $(FINCLUDES)
-
-CPP		= /usr/bin/cpp-4.2
-CPP_FLAGS       = $(INCLUDES) -P -Dunix -DFORTRAN_90 \
-		  -DX_REFRESH -DNO_DOUBLE_ESCAPE_SLASH \
-		  -Dxgks -DSTAR_1_SUPPORTED \
-		  -DFULL_GUI_VERSION \
-		  -DXT_CODE
-
-OPT_FLAGS	= -O -DNDEBUG
-PPLUS_OPT_FLAGS	= -O0
-DBG_FLAGS	= -O0 -g
-PROF_FLAGS	= -O0 -g
-
-# Below this line are macro definitions used only for the final linking of the executable
-#
-
-LD		= gcc-4.2
-LDFLAGS		= -v --verbose -fpic -arch x86_64 -L/usr/X11R6/lib 
-LD_DYN_FLAGS	= -v -fpic -arch x86_64 -dynamiclib -L/usr/X11R6/lib -L$(TMAP_LOCAL)/lib -lefi
-#LDFLAGS		= -v --verbose -L/lib -L/usr/X11R6/lib  -static 
-
-
-
-SYSLIB		= -L/usr/X11R6/lib -L/usr/local/lib/ -L$(TMAP_LOCAL)/lib -ldl -lXpm -lXft -lXrender -lfontconfig -llist -lc /usr/local/lib/libXm.a -lXt -lXext -lX11 -lXp -lSM -lICE -lc /opt/intel/Compiler/11.1/058/lib/lib{ifcore,ifport,irc,imf,svml}.a
-
-GKSLIB		= -L$(TMAP_LOCAL)/lib -lxgks
-
-READLINELIB	= /usr/local/lib/libreadline.a -ltermcap
-
-#HDFLIB		= -L/usr/local/lib  -ldf -ljpeg -lz
-HDFLIB		= -L/usr/local/lib  -ldf /usr/local/lib/libjpeg.a -lz
-
-CDFLIB		= -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -lm /usr/local/lib/libsz.a -lnc-dap -ldap -ldapclient -lcurl -lxml2 -lpthread -licucore -lstdc++
-
-DODS_LIBS   	= -L$(TMAP_LOCAL)/src/DODS/lib -L$(TMAP_LOCAL)/src/DODS/packages/lib $(TMAP_LOCAL)/src/DODS/lib/libnc-dods.a  $(TMAP_LOCAL)/src/DODS/lib/libnc-dods.a -lwww -lstdc++ -lrx -lz -lexpect5.21 -ltcl7.6
-
-LINUX_OBJS  = dat/*.o ../fmt/src/x*.o ../ppl/plot/ppldata.o
-
-#.F.o:
-#	rm -f $*__.f
-#	$(CPP) -traditional $(CPP_FLAGS) $(<F) | sed -e        's/de	/de /g' | sed -e  's/de 	/de /g' > $*__.f
-#	$(F77) $(FFLAGS) $*__.f; mv $*__.o $*.o
-
-# Directly compile the .F source files to the .o object files
-# since gfortran can handle the C compiler directives in Fortran code
-%.o : %.F
-	$(FC) $(FFLAGS) -c $*.F -o $*.o
-
-#
-# End of platform_specific_flags.mk.x86_64-darwin
-#
diff --git a/platform_specific.mk.x86_64-linux b/platform_specific.mk.x86_64-linux
index 4db2c51..0fe9b5d 100644
--- a/platform_specific.mk.x86_64-linux
+++ b/platform_specific.mk.x86_64-linux
@@ -1,75 +1,90 @@
 #
 # platform_specific_includes.mk.x86_64-linux
 #
-# This file is included in other Makefiles and defines
-# platform specific macros
+# This file is included in other Makefiles and defines platform specific macros.  
+# Should not contain any relative directories (other than .) since these Makefiles
+# exist at various levels in the directory tree.
 
-	GKS_INCLUDES	= -I../../ppl/include/xgks \
-			  -I../../xgks/src/lib \
-			  -Ipplinc/xgks \
-			  -I../../xgks/port 
+# Extended regular expressions flag for sed (used with cleaning up run_tests results)
+	SED_EXTREGEX_FLAG = -r
 
-	INCLUDES        = -I. \
-			  -I../fmt/cmn/ \
-			  -I$(NETCDF4_DIR)/include \
+# If READLINE_DIR is given, -I$(READLINE_DIR)/include must be the first include flag 
+# (other than .) so the correct readline include files are used.
+ifneq ($(strip $(READLINE_DIR)),)
+	MYINCLUDES	= -I. \
 			  -I$(READLINE_DIR)/include \
-			  -I../common \
-			  -I../../fmt/cmn \
-			  -I../../ppl/include \
-			  -I../../fer/common \
-			  $(GKS_INCLUDES) \
-			  -I/usr/local/include
-
-	FINCLUDES	= -I../../ppl/tmap_inc \
-			  -I../include \
-			  -I../../fmt/cmn \
-			  -I../common \
-			  -I../../ppl/include \
-			  -I../../fer/common
-
-	PLATFORM = $(shell uname -s -r) 64-bit
-
-	CC              = gcc
-	CXX		= c++
-	FC		= gfortran
-	F77		= gfortran
-
-	RANLIB          = /usr/bin/ranlib
-
-	CPP		= /lib/cpp
-
-	CPP_FLAGS       = $(INCLUDES) \
-			  -m64 \
-			  -fPIC -Dunix -Dgfortran   \
+			  -I$(NETCDF4_DIR)/include \
+			  -I$(DIR_PREFIX)/fer/common \
+			  -I$(DIR_PREFIX)/fmt/cmn \
+			  -I$(DIR_PREFIX)/ppl/tmap_inc \
+			  -I$(DIR_PREFIX)/ppl/include \
+			  -I$(DIR_PREFIX)/xgks/src/lib \
+			  -I$(DIR_PREFIX)/xgks/port 
+else
+	MYINCLUDES	= -I. \
+			  -I$(NETCDF4_DIR)/include \
+			  -I$(DIR_PREFIX)/fer/common \
+			  -I$(DIR_PREFIX)/fmt/cmn \
+			  -I$(DIR_PREFIX)/ppl/tmap_inc \
+			  -I$(DIR_PREFIX)/ppl/include \
+			  -I$(DIR_PREFIX)/xgks/src/lib \
+			  -I$(DIR_PREFIX)/xgks/port 
+endif
+
+	MYDEFINES	= -Dcrptd_cat_argument \
+			  -Ddouble_p \
+			  -Dgfortran \
+			  -Dreclen_in_bytes  \
+			  -Dunix \
+			  -Dxgks \
+			  -DG77 \
+			  -DG77_SIGNAL \
+			  -DINTERNAL_READ_FORMAT_BUG \
+			  -DMANDATORY_FORMAT_WIDTHS \
+			  -DNEED_IAND \
+			  -DNO_DOUBLE_ESCAPE_SLASH \
+			  -DNO_OPEN_CARRIAGECONTROL \
 			  -DNO_OPEN_SHARED \
+			  -DNO_OPEN_READONLY \
 			  -DNO_OPEN_RECORDTYPE \
-			  -DX_REFRESH -Dreclen_in_bytes  \
-			  -DNO_OPEN_READONLY -DMANDATORY_FORMAT_WIDTHS\
-			  -DNO_OPEN_CARRIAGECONTROL -Dxgks -DSTAR_1_SUPPORTED \
-			  -DFULL_GUI_VERSION -DX_REFRESH \
-			  -DXT_CODE  -DLINUX -DNO_PASSED_CONCAT \
-			  -Dcrptd_cat_argument \
-			  -DG77_SIGNAL -DG77 \
-			  -DNEED_IAND -DINTERNAL_READ_FORMAT_BUG \
-			  -DNO_PREPEND_STRING -DNO_DOUBLE_ESCAPE_SLASH \
-			  -Ddouble_p 
+			  -DNO_PASSED_CONCAT \
+			  -DNO_PREPEND_STRING \
+			  -DSTAR_1_SUPPORTED \
+			  -DX_REFRESH
+
+	PLATFORM 	= $(shell uname -s -r) 64-bit
+
+	CC		= $(shell which gcc)
+	FC		= $(shell which gfortran)
+	F77		= $(shell which gfortran)
+	AR		= $(shell which ar)
+	ARFLAGS		= -cr
+	RANLIB		= $(shell which ranlib)
 
 # Flags for compiling all C code
 # -DusingDODSf2cUnderscore needed if using netcdf library...
 # also consider -ffloat-store.
-	CFLAGS		= $(CPP_FLAGS) \
-			  -Dlint -DVOID_SIGHANDLER -D_POSIX_VERSION -DLINUX \
-			  -DFULL_GUI_VERSION -DX_REFRESH -DXT_CODE -Dsun4 
+	CFLAGS		= -m64 -fPIC $(MYDEFINES) $(MYINCLUDES)
+
 # Flags for compiling the PlotPlus FORTRAN code (ppl subdirectory)
-	PPLUS_FFLAGS	= $(CPP_FLAGS) \
-			  -fno-automatic -fno-second-underscore \
-			  -fdollar-ok -ffixed-line-length-132 $(FINCLUDES)
+	PPLUS_FFLAGS	= -m64 -fPIC \
+			  -fno-automatic \
+			  -fno-second-underscore \
+			  -fdollar-ok \
+			  -ffixed-line-length-132 \
+			  $(MYDEFINES) $(MYINCLUDES)
+
 # Flags for compiling non-PlotPlus FORTRAN code
-	FFLAGS		= $(CPP_FLAGS) \
-			  -fno-automatic -fno-second-underscore \
-			  -fdollar-ok -ffixed-line-length-132 -ffpe-trap=overflow \
+	FFLAGS		= -m64 -fPIC \
+			  -fno-automatic \
+			  -fno-second-underscore \
+			  -fdollar-ok \
+			  -ffixed-line-length-132 \
+			  -ffpe-trap=overflow \
 			  -fimplicit-none \
-			  -fdefault-real-8 -fdefault-double-8 $(FINCLUDES)
+			  -fdefault-real-8 \
+			  -fdefault-double-8 \
+			  $(MYDEFINES) $(MYINCLUDES)
 
 	OPT_FLAGS	= -O -DNDEBUG
 	PPLUS_OPT_FLAGS	= -O0
@@ -77,50 +92,39 @@
 	PROF_FLAGS	= -O0 -g -pg
 
 	# Below this line are macro definitions used only for the final linking of the executable
-	#
 
 	LD		= gcc
 	LDFLAGS		= -v --verbose -m64 -fPIC -export-dynamic
 
+# If $(READLINE_DIR) is given (and not blank), statically link in the readline 
+# and history libraries given under that directory; otherwise, just use the usual 
+# flags to link in the system readline and history libraries.
+ifneq ($(strip $(READLINE_DIR)),)
 	SYSLIB		= -lX11 \
+			  $(READLINE_DIR)/lib64/libreadline.a \
+			  $(READLINE_DIR)/lib64/libhistory.a \
 			  -lcurl \
 			  -ldl \
 			  -lz \
 			  -Wl,-Bstatic -lgfortran -Wl,-Bdynamic \
 			  -lm
+else
+	SYSLIB		= -lX11 \
+			  -lreadline \
+			  -lhistory \
+			  -lcurl \
+			  -ldl \
+			  -lz \
+			  -Wl,-Bstatic -lgfortran -Wl,-Bdynamic \
+			  -lm
+endif
 
-# -static-libgfortran can be used with gfortran 4.4 but not 4.1
-# /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgfortran.a
-
-	GKSLIB		= ../xgks/src/lib/libxgks.a
-
-# For netCDF4 using new hdf5
-
+# For netCDF4 using HDF5
 	CDFLIB		= $(NETCDF4_DIR)/lib64/libnetcdff.a \
 			  $(NETCDF4_DIR)/lib64/libnetcdf.a \
 			  $(HDF5_DIR)/lib64/libhdf5_hl.a \
 			  $(HDF5_DIR)/lib64/libhdf5.a
 
-	LINUX_OBJS	= special/linux_routines.o \
-			  dat/*.o \
-			  ../fmt/src/x*.o \
-			  ../ppl/plot/ppldata.o
-
-# For statically linking in the readline and history libraries
-#	READLINELIB = -L$(READLINE_DIR)/lib64 -Wl,-Bstatic -lreadline -lhistory -Wl,-Bdynamic
-# For linking against the shared-object libraries (if they exist)
-	READLINELIB = -L$(READLINE_DIR)/lib64 -lreadline -lhistory
-
-## cancel the default rule for .f -> .o to prevent objects from being built
-## from .f files that are out-of-date with respect to their corresponding .F file
-#%.o : %.f
-#
-## use cpp to preprocess the .F files to .f files and then compile the .f files
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(FFLAGS) -c $*.f	 
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/platform_specific.mk.x86_64-linux-gnu b/platform_specific.mk.x86_64-linux-gnu
deleted file mode 100644
index c631732..0000000
--- a/platform_specific.mk.x86_64-linux-gnu
+++ /dev/null
@@ -1,131 +0,0 @@
-#
-# platform_specific_includes.mk.x86_64-linux-gnu
-#
-# This file is included in other Makefiles and defines
-# platform specific macros
-
-	GKS_INCLUDES	= -I../../ppl/include/xgks \
-			  -I../../xgks/src/lib \
-			  -Ipplinc/xgks \
-			  -I../../xgks/port 
-
-	INCLUDES        = -I. \
-			  -I../fmt/cmn/ \
-			  -I$(NETCDF4_DIR)/include \
-			  -I$(READLINE_DIR)/include \
-			  -I../common \
-			  -I../../fmt/cmn \
-			  -I../../ppl/include \
-			  -I../../fer/common \
-			  $(GKS_INCLUDES) \
-			  -I/usr/local/include
-
-	FINCLUDES	= -I../../ppl/tmap_inc \
-			  -I../include \
-			  -I../../fmt/cmn \
-			  -I../common \
-			  -I../../ppl/include \
-			  -I../../fer/common
-
-	PLATFORM = $(shell uname -s -r) 64-bit
-
-	CC              = gcc
-	CXX		= c++
-	FC		= gfortran
-	F77		= gfortran
-
-	RANLIB          = /usr/bin/ranlib
-
-	CPP		= /lib/cpp
-
-	CPP_FLAGS       = $(INCLUDES) \
-			  -m64 \
-			  -fPIC -Dunix -Dgfortran   \
-			  -DNO_OPEN_SHARED \
-			  -DNO_OPEN_RECORDTYPE \
-			  -DX_REFRESH -Dreclen_in_bytes  \
-			  -DNO_OPEN_READONLY -DMANDATORY_FORMAT_WIDTHS\
-			  -DNO_OPEN_CARRIAGECONTROL -Dxgks -DSTAR_1_SUPPORTED \
-			  -DFULL_GUI_VERSION -DX_REFRESH \
-			  -DXT_CODE  -DLINUX -DNO_PASSED_CONCAT \
-			  -Dcrptd_cat_argument \
-			  -DG77_SIGNAL -DG77 \
-			  -DNEED_IAND -DINTERNAL_READ_FORMAT_BUG \
-			  -DNO_PREPEND_STRING -DNO_DOUBLE_ESCAPE_SLASH \
-			  -Ddouble_p 
-
-# Flags for compiling all C code
-# -DusingDODSf2cUnderscore needed if using netcdf library...
-# also consider -ffloat-store.
-	CFLAGS		= $(CPP_FLAGS) \
-			  -Dlint -DVOID_SIGHANDLER -D_POSIX_VERSION -DLINUX \
-			  -DFULL_GUI_VERSION -DX_REFRESH -DXT_CODE -Dsun4 
-# Flags for compiling the PlotPlus FORTRAN code (ppl subdirectory)
-	PPLUS_FFLAGS	= $(CPP_FLAGS) \
-			  -fno-automatic -fno-second-underscore \
-			  -fdollar-ok -ffixed-line-length-132 $(FINCLUDES)
-# Flags for compiling non-PlotPlus FORTRAN code
-	FFLAGS		= $(CPP_FLAGS) \
-			  -fno-automatic -fno-second-underscore \
-			  -fdollar-ok -ffixed-line-length-132 -ffpe-trap=overflow \
-			  -fimplicit-none \
-			  -fdefault-real-8 -fdefault-double-8 $(FINCLUDES)
-
-	OPT_FLAGS	= -O -DNDEBUG
-	PPLUS_OPT_FLAGS	= -O0
-	DBG_FLAGS	= -O0 -g
-	PROF_FLAGS	= -O0 -g -pg
-
-	# Below this line are macro definitions used only for the final linking of the executable
-	#
-
-	LD		= gcc
-	LDFLAGS		= -v --verbose -m64 -fPIC -export-dynamic
-
-	SYSLIB		= -lX11 \
-			  -lcurl \
-			  -ldl \
-			  -lz \
-			  -lgfortran \
-			  -lm
-
-# -static-libgfortran can be used with gfortran 4.4 but not 4.1
-# /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgfortran.a
-
-	GKSLIB		= ../xgks/src/lib/libxgks.a
-
-# For netCDF4 using new hdf5
-
-	CDFLIB		= $(NETCDF4_DIR)/lib/libnetcdff.a \
-			  $(NETCDF4_DIR)/lib/libnetcdf.a \
-			  $(HDF5_DIR)/lib/libhdf5_hl.a \
-			  $(HDF5_DIR)/lib/libhdf5.a
-
-	LINUX_OBJS	= special/linux_routines.o \
-			  dat/*.o \
-			  ../fmt/src/x*.o \
-			  ../ppl/plot/ppldata.o
-
-# For statically linking in the readline and history libraries
-#	READLINELIB = -L$(READLINE_DIR)/lib64 -Wl,-Bstatic -lreadline -lhistory -Wl,-Bdynamic
-# For linking against the shared-object libraries (if they exist)
-	READLINELIB = -L$(READLINE_DIR)/lib/x86_64-linux-gnu -lreadline -lhistory
-
-## cancel the default rule for .f -> .o to prevent objects from being built
-## from .f files that are out-of-date with respect to their corresponding .F file
-#%.o : %.f
-#
-## use cpp to preprocess the .F files to .f files and then compile the .f files
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(FFLAGS) -c $*.f	 
-
-# Directly compile the .F source files to the .o object files
-# since gfortran can handle the C compiler directives in Fortran code
-%.o : %.F
-	$(FC) $(FFLAGS) -c $*.F -o $*.o
-
-#
-# End of platform_specific_includes.mk.x86_64-linux
-#
diff --git a/ppl/Makefile b/ppl/Makefile
index 2a3b42d..338a853 100644
--- a/ppl/Makefile
+++ b/ppl/Makefile
@@ -17,12 +17,6 @@ LIBS	= complot ourlib plot plotlib pplepic \
 	pplusr symlib
 
 # change the standard rules for .F -> .o builds so $(PPLUS_FFLAGS) is used
-
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(PPLUS_FFLAGS) -c $*.f	 
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/ppl/complot/Makefile b/ppl/complot/Makefile
index 476d179..cc2cce7 100644
--- a/ppl/complot/Makefile
+++ b/ppl/complot/Makefile
@@ -15,12 +15,6 @@ include ./LIB_NAME
 OBJS = $(SRCS_C:.c=.o) $(SRCS_F:.F=.o)
 
 # change the standard rules for .F -> .o builds so $(PPLUS_FFLAGS) is used
-
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(PPLUS_FFLAGS) -c $*.f	 
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/ppl/complot/SOURCE_FILES b/ppl/complot/SOURCE_FILES
index 8d1e173..6525f11 100644
--- a/ppl/complot/SOURCE_FILES
+++ b/ppl/complot/SOURCE_FILES
@@ -52,7 +52,9 @@ rangel.F\
 rotate.F\
 scale3.F\
 symbel.F\
+symbel_hershey.F\
 symbol.F\
+symwid.F\
 tabmv.F\
 teklun.F\
 teknme.F\
diff --git a/ppl/complot/hdcopy.F_unused b/ppl/complot/hdcopy.F_unused
deleted file mode 100644
index 36fb8e9..0000000
--- a/ppl/complot/hdcopy.F_unused
+++ /dev/null
@@ -1,76 +0,0 @@
-      SUBROUTINE HDCOPY
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-C**    @(#)hdcopy.f	1.1    3/10/88
-C**
-C**
-C***********************************************************************
-C**
-C**                 PLOT+ Scientific Graphics System
-C**
-C***********************************************************************
-C**
-C**
-C
-C     CALL HDCOPY
-C
-C     THIS SUBROUTINE ACTIVATES THE HARD-COPY ACCESSORY FOR THE
-C     TEKTERMINAL.
-C
-C
-#ifdef unix
-	include 'PLTCOM.DAT'
-#else
-	include 'pplinc:PLTCOM.DAT'
-#endif
-C
-C     ACTIVATE THE HARD-COPY ACCESSORY.
-C
-      CALL CHOUT(ESC,1)
-      CALL CHOUT(23,1)
-C
-C     TRANSMIT SYNC CHARACTERS WHILE THE HARD COPY IS PRODUCED.
-C
-      NDELAY = IFIX(10.0 * FLOAT(BAUDR / 10))
-      DO 10 J=1,NDELAY
-   10 CALL CHOUT(SYN,1)
-C
-C     WRITE OUT THE CHARACTER BUFFER.
-C
-      CALL CHDMP
-      RETURN
-C
-      END
diff --git a/ppl/complot/plot.F_unused b/ppl/complot/plot.F_unused
deleted file mode 100644
index ecf1d45..0000000
--- a/ppl/complot/plot.F_unused
+++ /dev/null
@@ -1,90 +0,0 @@
-      SUBROUTINE PLOT(X,Y,IPEN,IMARK)
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-C**    @(#)plot.f	1.1    3/10/88
-C**
-C**
-C***********************************************************************
-C**
-C**                 PLOT+ Scientific Graphics System
-C**
-C***********************************************************************
-C**
-C**
-C
-C     CALL PLOT(X,Y,IPEN,IMARK)
-C
-C     THIS SUBROUTINE MOVES THE PEN FROM THE CURRENT POSITION TO
-C     A NEW POINT.
-C
-C     THE VARIOUS PARAMETERS IAND THEIR DEFINITIONS ARE LISTED
-C     BELOW:
-C        X,Y    - COORDINATES OF THE NEW POINT IN USER'S UNITS.
-C        IPEN   - PEN POSITION (0 = PEN UP, NON-ZERO = PEN DOWN).
-C        IMARK  - DATA MARK CODE (0-88).
-C
-C
-#ifdef unix
-      include 'PLTCOM.DAT'
-#else
-      include 'pplinc:PLTCOM.DAT'
-#endif
-C
-C     CHECK THE PLOTTING MODE TO INSURE THAT IT IS SET FOR GRAPH-
-C     ICS.
-C
-      IF(PMODE .EQ. ALPHA)PMODE = VECTOR
-C
-C     SCALE THE COORDINATES OF THE NEW POINT.
-C
-      XTEMP = X * XSCALE
-      YTEMP = Y * YSCALE
-C
-C     SET THE PEN POSITION.
-C
-      PENF = .FALSE.
-      IF(IPEN .NE. 0)PENF = .TRUE.
-C
-C     TO THE POINT.
-C
-      CALL XYZPLT
-C
-C     DETERMINE WHETHER A DATA MARK SHOULD BE DRAWN.
-C
-      IF(IPEN .NE. 0)CALL MARK(IMARK)
-      RETURN
-C
-      END
diff --git a/ppl/complot/scale.F_unused b/ppl/complot/scale.F_unused
deleted file mode 100644
index 68b8dbe..0000000
--- a/ppl/complot/scale.F_unused
+++ /dev/null
@@ -1,102 +0,0 @@
-      SUBROUTINE SCALE(XSCL,YSCL,ABIAS,BBIAS,XLO,YLO)
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-C**    @(#)scale.f	1.1    3/10/88
-C**
-C**
-C***********************************************************************
-C**
-C**                 PLOT+ Scientific Graphics System
-C**
-C***********************************************************************
-C**
-C**
-C
-C     CALL SCALE(XSCL,YSCL,ABIAS,BBIAS,XLO,YLO)
-C
-C     THIS SUBROUTINE DEFINES SCALE FACTORS AND DISPLACEMENTS
-C     FOR SUBSEQUENT PLOTTING.  THE SCALE FACTORS DETERMINE THE
-C     RELATIVE SIZE OF THE DISPLAY, AND THE DISPLACEMENTS DETER-
-C     MINE ITS LOCATION WITHIN THE PLOTTING AREA.
-C
-C     THE VARIOUS PARAMETERS AND THEIR DEFINITIONS ARE LISTED
-C     BELOW:
-C        XSCL   - SCALE FACTOR TO CONVERT FROM USER'S UNITS TO
-C                 INCHES (OR MM) ON THE X-AXIS.
-C        YSCL   - SCALE FACTOR TO CONVERT FROM USER'S UNITS TO
-C                 INCHES (OR MM) ON THE Y-AXIS.
-C        ABIAS  - HORIZONTAL DISPLACMENT OF THE DISPLAY IN IN-
-C                 CHES (OR MM).
-C        BBIAS  - VERTICAL DISPLACEMENT OF THE DISPLAY IN INCHES
-C                 (OR MM).
-C        XLO    - MINIMUM X-VALUE TO BE PLOTTED IN USER'S UNITS.
-C        YLO    - MINIMUM Y-VALUE TO BE PLOTTED IN USER'S UNITS.
-C
-C
-#ifdef unix
-	include 'PLTCOM.DAT'
-#else
-	include 'pplinc:PLTCOM.DAT'
-#endif
-	SAVE XLOW,YLOW
-C
-C     CONVERT THE SCALE FACTORS TO INTERNAL INCREMENTS.
-C
-      XSCALE = FACTOR * XSCL
-      YSCALE = FACTOR * YSCL
-C
-C     CALCULATE THE LOCATION OF THE ORIGIN.
-C
-	XLOW = XLO * XSCALE
-	YLOW = YLO * YSCALE
-      AORIGN = FACTOR * ABIAS - XLOW
-      BORIGN = FACTOR * BBIAS - YLOW
-      RETURN
-C
-	ENTRY INQSCL(XSCL,YSCL,ABIAS,BBIAS,XLO,YLO)
-C
-C	INQUIRE SCALE
-C
-	XSCL = XSCALE / FACTOR
-	YSCL = YSCALE / FACTOR
-C
-	XLO = XLOW / XSCALE
-	YLO = YLOW / YSCALE
-C
-	ABIAS = (AORIGN + XLOW) / FACTOR
-	BBIAS = (BORIGN + YLOW) / FACTOR
-	RETURN
-      END
diff --git a/ppl/complot/size.F_unused b/ppl/complot/size.F_unused
deleted file mode 100644
index 3e90ff0..0000000
--- a/ppl/complot/size.F_unused
+++ /dev/null
@@ -1,139 +0,0 @@
-      SUBROUTINE SIZE(WIDTH,HEIGHT)
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-C**    @(#)size.F	1.1    3/10/88
-C**
-C**
-C***********************************************************************
-C**
-C**                 PLOT+ Scientific Graphics System
-C**
-C***********************************************************************
-C**
-C**
-C
-C     PLOTTER DEPENDENT ROUTINE
-C     CONTAINS PHYSICAL CHARACTERISTICS OF ALL LEGAL DEVICES.
-C
-C
-C     CALL SIZE(WIDTH,HEIGHT)
-C
-C     THIS SUBROUTINE DEFINES THE DIMENSIONS OF THE TOTAL PLOT-
-C     TING AREA.  SUBSEQUENT TO A CALL TO SIZE, PLOTTING IS AL-
-C     LOWED ONLY WITHIN THESE LIMITS.
-C
-C     THE VARIOUS PARAMETERS AND THEIR DEFINITIONS ARE LISTED
-C     BELOW:
-C        WIDTH  - TOTAL WIDTH OF THE PLOTTING AREA IN INCHES (OR
-C                 MM).  WIDTH IS RESTRICTED TO A MAXIMUM OF 200
-C                 INCHES ON THE ZETA PLOTTER AND 200 INCHES ON THE
-C                 BENSON PLOTTER.
-C        HEIGHT - TOTAL HEIGHT OF THE PLOTTING AREA IN INCHES
-C                 (OR MM).  HEIGHT IS RESTRICTED TO A MAXIMUM OF
-C                 34 INCHES ON THE ZETA PLOTTER AND 38 INCHES ON
-C                 THE BENSON PLOTTER.
-C
-C     SIZE MAKES THE TEKTERMINAL AND PRINTRONIX PLOTTER APPEAR AS IF
-C     THEY WERE WIDTH INCHES (OR MM) WIDE AND HEIGHT INCHES (OR
-C     MM) HIGH.
-C
-C
-#ifdef unix
-	include 'PLTCOM.DAT'
-	include 'GKSCM1.INC'
-#else
-	include 'pplinc:PLTCOM.DAT'
-	include 'pplinc:GKSCM1.INC'
-#endif
-C
-      IF(WIDTH .EQ. 0.0 .OR. HEIGHT .EQ. 0.0)RETURN
-C
-C     INSURE THAT THE PARAMETERS ARE POSITIVE AND CONVERT THEM
-C     TO INTERNAL INCREMENTS.
-C
-      ANEW = FACTOR * ABS(WIDTH)
-      BNEW = FACTOR * ABS(HEIGHT)
-	IF(ANEW.EQ.ASIZE.AND.BNEW.EQ.BSIZE)RETURN
-	ASIZE=ANEW
-	BSIZE=BNEW
-C
-C     IN ACCORDANCE WITH THE PLOT TYPE, INSURE THAT THE DIMEN-
-C     SIONS ARE NOT TOO LARGE.
-C
-      IF(PTYPE .EQ. 0 .OR. IABS(PTYPE) .GE. 2)THEN
-        IF(ASIZE .GT. 200000.0)ASIZE = 200000.0
-        IF(BSIZE .GT. 34000.0)BSIZE = 34000.0
-      ENDIF
-C
-C     COMPUTE THE TEKTERMINAL CONVERSION FACTORS.
-C
-	IF(TTYPE.GT.0)THEN
-      IF(ASIZE / TWIDTH .GT. BSIZE / THIGHT)THEN
-        PLTOTA = TSCLA / ASIZE
-        PLTOTB = TSCLB / ASIZE * TWIDTH / THIGHT
-      ELSE
-        PLTOTA = TSCLA / BSIZE * THIGHT / TWIDTH
-        PLTOTB = TSCLB / BSIZE
-      ENDIF
-	ELSE
-	PLTOTA=TSCLA/(TWIDTH*FACTOR)
-	PLTOTB=TSCLB/(THIGHT*FACTOR)
-	ENDIF
-C
-C     SET THE MINIMUM AND MAXIMUM ALLOWABLE VALUES OF A AND B.
-C
-      AMIN = 0.0
-      BMIN = 0.0
-      AMAX = ASIZE
-      BMAX = BSIZE
-	IF(PTYPE.GT.2)THEN
-#ifdef core
-	    call crinit
-#else
-	    call gkinit
-#endif
-	ENDIF
-C
-C     CALCULATE THE OFF-SCREEN FLAG.
-C
-      LOSFLG = 0
-      IF(AOLD - 0.001 .GT. AMAX)LOSFLG = 1
-      IF(AOLD + 0.001 .LT. AMIN)LOSFLG = 2
-      IF(BOLD - 0.001 .GT. BMAX)LOSFLG = LOSFLG + 4
-      IF(BOLD + 0.001 .LT. BMIN)LOSFLG = LOSFLG + 8
-      RETURN
-C
-      END
diff --git a/ppl/complot/symbel.F b/ppl/complot/symbel.F
index 7de8f34..ecae03e 100644
--- a/ppl/complot/symbel.F
+++ b/ppl/complot/symbel.F
@@ -1,85 +1,16 @@
- 	SUBROUTINE SYMBEL(X,Y,DEGRES,HEIGHT,NCHAR,STRING)
+        SUBROUTINE SYMBEL(X,Y,DEGRES,HEIGHT,NCHAR,STRING)
 C** 
-C**    @(#)symbel.tplate.F	1.1    3/10/88
+C A simple forward to SYMBEL_HERSHEY.
+C This was done to match PyFerret where the original 
+C subroutine here was renamed SYMBEL_HERSHEY.
 C**
-C**
-C***********************************************************************
-C**
-C**                 PLOT+ Scientific Graphics System
-C**
-C***********************************************************************
-C**
-C**
-C       Mod *JD* 3.19.91 for unix -- use environment variable PLOTFONTS
-C       *jd* 7.92 variable IF renamed to KIF for MAC
-C       *kms* 06-2017 - change from PLOTFONTS to FER_FONTS
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-*       *jd* 11.94 
-*       Modification uses TM_NUMBER to determine if "value" is a number rather
-*       than the ERR= branch of a READ which fails on AIX/xlf
-
-*	Mod *jd* 11.30.95 to fix ragged symbols to to precision loss
-*
-*       Mod *kob* 1.28.97 - Reorganization of the original code to remove
-*			    an illegal (f90) fortran forward reference into
-*			    the middle of a do loop.  This change was 
-*		            necessary to get this routine to compile on linux
-*			    and also to fix a plotting bug with the new 
-*			    solaris version (v4.0) of f77.  This change has 
-*			    occurred in the middle of releasing v4.45 of 
-*		  	    Ferret to the world.  Aix, Sgi, HP, OSF and SunOs
-*			    have already been released, and this change is
-*		            not a part of them.  This change is needed
-*			    to release linux and more importantly solaris.
-C *kob* 04/07/96 passed in character strings had to be declared 
-C                with "*(*)" for the linux port 
-C *ACM* 6/02   When there is a period or decimal point in the text, make
-C              a GKS dot there too, so it'll show up in small labels.
-C *acm* 7/02   Take out the MARKER calls that made dots. This caused trouble 
-C              when making encapsulated postscript from postscript.  
-C *acm* 10/14  Ticket 2203: on the 64-bit machines, the \\ for backspace
-C              should be \ .
 C
-C	CALL SYMBEL(X,Y,DEGRES,HEIGHT,NCHAR,STRING)
+C       CALL SYMBEL(X,Y,DEGRES,HEIGHT,NCHAR,STRING)
 C
-C	THIS SUBROUTINE DRAWS A STRING OF CHARACTERS.
+C       THIS SUBROUTINE DRAWS A STRING OF CHARACTERS.
 C
-C	THE VARIOUS PARAMETERS AND THEIR DEFINITIONS ARE LISTED
-C	BELOW:
+C       THE VARIOUS PARAMETERS AND THEIR DEFINITIONS ARE LISTED
+C       BELOW:
 C        X,Y    - COORDINATES OF THE LOWER LEFT-HAND CORNER OF
 C                 THE FIRST CHARACTER IN USERS UNITS.
 C        DEGRES - ANGLE AT WHICH THE CHARACTERS ARE TO BE DRAWN
@@ -89,525 +20,7 @@ C        NCHAR  - NUMBER OF CHARACTERS TO BE DRAWN.
 C        STRING - ARRAY CONTAINING THE DISPLAY CODES OF THE
 C                 CHARACTERS TO BE DRAWN.
 C
-	DIMENSION SX(12000),SY(12000),ASCII(127,4),BASE(4),RAST(4)
-	INTEGER	  nsxsy
-        PARAMETER ( nsxsy = 12000 )
-	DIMENSION DTYPE(35),DLEN(35),IOFF(4),IFLEN(4),ITYPE(4)
-C
-	LOGICAL SYMROT,READIR,DOPLOT,COLRF
-c	CHARACTER PLTFIL*80
-	CHARACTER ICOM*2,ICHR*1,STRING*(*),DNME(35)*2,DNUM(35)*2
-	CHARACTER DNAME(35)*80,KIF(4)*2,IFN(4)*2
-	CHARACTER*1 KSUB,KSUPER,KBKSP,KCALL,PENS(16)
-
-        REAL XBASE, YBASE
-        INTEGER IPT
-#ifdef unix
-	INTEGER*2 SX,SY
-
-        integer       dirlen
-        character*255 fontdir
-#else
-	byte sx,sy
-#endif
-	INTEGER*2 ICNT,IBASE,IRAST
-*added for linux port
-	INTEGER*4 IBASE4,IRAST4
-	INTEGER*2 ASCII
-	INTEGER*2 DTYPE,DLEN,IOFF,IFLEN,ITYPE
-	INTEGER COLOLD
-	LOGICAL ASCFNT
-	CHARACTER*265 err_msg
-	INTEGER status
-
-C
-C
-	INCLUDE 'PLTCOM.DAT'
-        INCLUDE 'errmsg.parm'
-
-C
-	DATA DNUM,DNME/35*'@@',35*'@@'/
-#ifdef unix
-	DATA KSUB,KSUPER,KBKSP,KCALL/'_','^','\\','@'/
-#else
-	DATA KSUB,KSUPER,KBKSP,KCALL/'_','^','\','@'/
-#endif
-	DATA KIF,IFN/'SR','SG','@@','@@','01','12','@@','@@'/
-	DATA PENS/'1','2','3','4','5','6','7','8','9','A',
-     *	'B','C','D','E','F','G'/
-	DATA READIR/.FALSE./
-
-        LOGICAL TM_NUMBER                ! ** TMAP mod 11/94 **
-
-* Mod to specify external references for SCALE and RANGE * Linux *kob* 1.97
-        external scale, size
-
-* Initialize 
-
-        ICHR = ' '
-
-C
-C	DEFINE THE SCALE FACTOR TO BE THE AMOUNT OF MAGNIFICATION
-C	REQUIRED TO CONVERT THE CHARACTERS IN THE CHARACTER DEFI-
-C	NITION TABLE TO THE SIZE SPECIFIED BY THE USER.
-C
-        CALL INQSCL(XSCL,YSCL,ABIAS,BBIAS,XLO,YLO) ! Bug fix? 11.95
-        CALL SCALE(XSCL,YSCL,ABIAS,BBIAS,0.,0.)
-
-	COLRF=.FALSE.
-C	IF(.NOT.READIR)GOTO 2020
-
-* kob 1/97 - old 2020 code region now contained w/in if-then below.
-	IF(.NOT.READIR) THEN
-#ifdef unix
-C *JD* Mod below fix for unix  -- use environment variable 3.19.91	
-	   call getenv ('FER_FONTS',fontdir)
-       	   dirlen = lnblk (fontdir,255)
-
-C *kob* 1/02 - cygwin 1.3.x requires "\" for unix directory accesses
-#ifdef __CYGWIN__
-	   OPEN(LUSY,FILE=fontdir(:dirlen)//'\fondat.dat',
-     *	        STATUS='OLD')
-#else
-	   OPEN(LUSY,FILE=fontdir(:dirlen)//'/fondat.dat',
-     *	        STATUS='OLD',ERR=5000)
-#endif
-
-#else
-	   open(lusy,file='plotfonts:fondat.dat',readonly,
-     *	       status='old',err=5000)
-#endif
-C
-C	FILE EXISTS
-C
-	   READ(LUSY,983,END=1009)(DNUM(IJ),DNME(IJ),DTYPE(IJ),
-     *	   DLEN(IJ),DNAME(IJ),IJ=1,35)
-#ifdef unix
-C Mod here from A to A9 for read of DNAME *JD* 3.8.91
-C983	   FORMAT(1X,2A2,I2,I5,A)
-983	   FORMAT(1X,2A2,I2,I5,A9)
-#else
-983	   format(1x,2a2,i2,i5,a30)
-#endif
-1009	   NFNT=IJ-1
-    	   CLOSE(LUSY)
-C
-C	READ DEFAULT FONT
-C
-	   IOFF(1)=0
-	   II=1
-	   ID=1
-	   READIR = .TRUE.			
-	   call SETFONT(fontdir,dirlen,dname,ifont,ii,kif,dnme,
-     .               ifn,dnum,itype,dtype,iflen, dlen,ioff,
-     .               icnt,ascii,base,rast,iadd,
-     .		     sx,sy,id)
-	ENDIF
-
-2000	SYMSC = HEIGHT * FACTOR / 21.0
-C
-C	ROTATE THE CHARACTER STRING.
-C
-	IF(DEGRES .NE. 0.0)GO TO 10
-C
-C	RESET THE CHARACTER ROTATION FLAG.
-C
-	SYMROT = .FALSE.
-	GO TO 20
-C
-C	SET THE CHARACTER ROTATION FLAG.
-C
-10	SYMROT = .TRUE.
-C
-C	CONVERT THE ROTATION TO RADIANS.
-C
-	TEMP = 0.01745329251994 * DEGRES
-C
-C	COMPUTE THE SINE AND COSINE.
-C
-	SYMSIN = SIN(TEMP)
-	SYMCOS = COS(TEMP)
-C
-C	SET VECTORS MODE.
-C
-20	PMODE = VECTOR
-C
-C	START AT THE LOWER LEFT-HAND CORNER OF THE FIRST CHARACTER.
-C
-	IF(NCHAR .EQ. 0) GOTO 300 	! Mod 11.30, was RETURN
-	XTEMP = (X - XLO) * XSCALE	! was X * XSCALE
-	YTEMP = (Y - YLO) * YSCALE	! was Y * YSCALE
-	PENF = .FALSE.
-	DOPLOT=NCHAR.GT.0
-	IF(DOPLOT)CALL XYZPLT
-C
-C	INITIALIZE CONTROL VARIABLES.
-C
-	XORG = XTEMP
-	YORG = YTEMP
-	XREF = 0.0
-	YREF = 0.0
-	CHARSC = 1.0
-	WIDTH = 0.0
-	SLANT = 0.0
-	IFONT = 1
-	ASCFNT=ITYPE(1).EQ.-1
-	SYMWID=0.0
-	NCH=IABS(NCHAR)
-C
-C	DRAW THE CHARACTERS IN THE STRING ONE BY ONE.
-C
-	JJ=0
-	DO 170 I=1,NCH
-	JJ=JJ+1
-	IF(JJ.GT.NCH)GOTO 180
-	ICHR = STRING(JJ:JJ)
-C
-C	CHECK FOR A CONTROL CHARACTER.
-C
-	IF(ICHAR(ICHR) .EQ.27)THEN
-	    ASCFNT=.FALSE.
-	    GOTO 170
-	ENDIF
-	IF(ICHAR(ICHR) .EQ. 0)GOTO 180
-#ifdef unix
-	IF(.NOT.ASCFNT.AND.(ICHR.EQ.'@'.OR.
-     *		(ICHR.GE.'\\'.AND.ICHR.LE.'_')))GOTO 80
-#else
-	IF(.NOT.ASCFNT.AND.(ICHR.EQ.'@'.OR.
-     *		(ICHR.GE.'\'.AND.ICHR.LE.'_')))GOTO 80
-#endif
-
-* Some compliers store '\\' as a single character, others see it
-* as '\'.  
-
-	IF (KBKSP.NE.'\\') THEN
-	   IF(.NOT.ASCFNT.AND.(ICHR.EQ.'@'.OR.
-     *		(ICHR.GE.'\'.AND.ICHR.LE.'_')))GOTO 80
-	ENDIF 
-C
-C	CALCULATE POINTER
-C
-	IF(ITYPE(IFONT).LE.0)THEN
-C	    CHARACTER FONT
-	    ICODE = ASCII(ICHAR(ICHR),IFONT)
-	ELSE
-C	    SYMBOL FONT
-	    ICOM = STRING(JJ:JJ+1)
-	    JJ=JJ+1
-	    READ(ICOM,999,IOSTAT=ISTAT)II
-999	    FORMAT(I2)
-	    IF(ISTAT.EQ.0)THEN
-	    	ICODE = ASCII(II,IFONT)
-	    ELSE
-	        ICODE = 1
-	    ENDIF
-	ENDIF
-	IPOINT = ICODE+IOFF(IFONT)
-	IPT = 0
-
-	XMN=SX(IPOINT)
-	XMX=SY(IPOINT)
-	IF(XMN.GT.50.)XMN=XMN-100.
-	IF(XMX.GT.50.)XMX=XMX-100.
-	WIDTH=(XMX-XMN)*CHARSC*RAST(IFONT)
-	SYMWID=SYMWID+WIDTH
-	IF(.NOT.DOPLOT)GOTO 70
-	IPOINT=IPOINT+1
-	IF (IPOINT .GT. NSXSY) GOTO 70
-	PENF = .FALSE.
-C
-C	DRAW THE CHARACTER
-C
- 30	CONTINUE
-	IX=SX(IPOINT)
-	IY=SY(IPOINT)
-	IF(IX.GT.50)IX=IX-100
-	IF(IY.GT.50)IY=IY-100
-	IY=-IY
-	IPOINT=IPOINT+1
-	IF (IPOINT .GT. NSXSY) GOTO 70
-        IPT = IPT + 1
-C
-C	CHECK FOR A CONTROL BYTE.
-C
-	IF(IX .EQ. 50)GO TO 60
-C
-C	CALCULATE THE NEW PEN COORDINATES RELATIVE TO THE LOWER
-C	LEFT-HAND CORNER OF THE FIRST CHARACTER.
-C
-	XY=FLOAT(IY)-BASE(IFONT)
-	XX=FLOAT(IX)-XMN+XY*SLANT
-	XSYM =XREF+XX*CHARSC*RAST(IFONT)
-	YSYM =YREF+XY*CHARSC*RAST(IFONT)
-C
-C	SCALE AND ROTATE THE NEW COORDINATES.
-C
-	IF(SYMROT)GO TO 40
-
-	XTEMP = XSYM * SYMSC + XORG
-	YTEMP = YSYM * SYMSC + YORG
-	GO TO 50
-40	XTEMP = (XSYM * SYMCOS - YSYM * SYMSIN) * SYMSC + XORG
-	YTEMP = (XSYM * SYMSIN + YSYM * SYMCOS) * SYMSC + YORG
-50	CONTINUE
-
-* for decimal points, find the average x and Y location; will
-* plot a point at this location.
-C  xxx  
-C  xxx  Dont do this: it causes trouble with encapsulated postscript.
-C  xxx  and anyway, it was to correct trouble with the postscript translation
-C  xxx  for one printer...
-C  xxx
-C  xxx        IF (ICHR .EQ. '.') THEN
-C  xxx           IF (IPT .EQ. 1) THEN
-C  xxx             XBASE = 0.
-C  xxx             YBASE = 0.
-C  xxx           ENDIF
-C  xxx           XBASE = XBASE + XTEMP
-C  xxx           YBASE = YBASE + YTEMP
-C  xxx        ENDIF
-
-C
-C	MOVE THE PEN TO THE NEW COORDINATES.
-C
-
-        CALL XYZPLT
-
-	PENF = .TRUE.
-	GO TO 30
-C
-C	CHECK FOR THE END OF THE CHARACTER.
-C
-60	IF(IY .EQ. -50)GO TO 70
-	PENF = .FALSE.
-	GO TO 30
-
-70	CONTINUE
-
-C  End of character
-C xxx If it was a decimal point, draw a tiny dot at its center.  
-C  xxx
-C  xxx        IF (ICHR .EQ. '.' .AND. IPT .GT. 1) THEN
-C  xxx           XBASE = XBASE/ FLOAT(IPT-1)
-C  xxx           YBASE = YBASE/ FLOAT(IPT-1)
-C  xxx           XBASE = XBASE/ XSCALE
-C  xxx           YBASE = YBASE/ YSCALE
-C  xxx           call marker (1)              ! could call with 7 for bigger dot.
-C  xxx           CALL PLOT(XBASE, YBASE, 0, 0)
-C  xxx           CALL MARK(99)
-C  xxx           call marker (1)
-C  xxx        ENDIF
-C
-C	ADJUST THE REFERENCE POSITION TO TAKE INTO ACCOUNT THE
-C	CHARACTER THAT WAS JUST DRAWN.
-C
-
-        XREF = XREF + WIDTH
-	IF(CHARSC .EQ. 1.0)GO TO 169
-C	XREF = XREF - 16.*(1.-CHARSC)*RAST(IFONT)
-	YREF = 0.0
-	CHARSC = 1.0
-	GO TO 169
-C
-C	PROCESS CONTROL CHARACTERS.
-C
-80	IF(ICHR .NE. KSUB)GO TO 150
-	CHARSC = 0.75
-C	XREF = XREF + 16.*(1.-CHARSC)*RAST(IFONT)
-	YREF=-11.*CHARSC*RAST(IFONT)
-	GO TO 169
-150	IF(ICHR .NE. KSUPER)GO TO 160
-	CHARSC = 0.75
-C	XREF = XREF + 16.*(1.-CHARSC)*RAST(IFONT)
-	YREF=21.-11.*CHARSC*RAST(IFONT)
-	GO TO 169
-160	IF(ICHR .NE. KBKSP)GO TO 310
-	SYMWID=SYMWID-WIDTH
-	XREF = XREF - WIDTH
-	WIDTH = 0.0
-	GOTO 169
-310	IF(ICHR.NE.KCALL)GOTO 169
-C
-C	UNPACK COMMAND
-C
-	ICOM = STRING(JJ+1:JJ+2)
-	JJ=JJ+2
-C
-C	PROCESS COMMAND
-C
-	CALL UPPER(ICOM,2)
-	IF(ICOM.EQ.'CL')THEN
-C
-C	    CLEAR ALL FONTS FROM THE BUFFERS
-C
-	    DO 1002 II=1,4
-	    IOFF(II)=12000
-	    IFLEN(II)=0
-	    KIF(II)='@@'
-	    IFN(II)='@@'
-	    ITYPE(II)=0
-	    BASE(II)=-9.
-1002	    RAST(II)=1.
-	    IOFF(1)=0
-	    GOTO 169
-        ELSE IF(ICOM(1:1).EQ.'C')THEN
-C
-C           LOOK FOR EXTENDED COLOR COMMAND OF THE FORM
-C           @Cnnn WHERE nnn IS A 3 DIGIT NUMBER
-C
-            IF(.NOT.COLRF)COLOLD=COLOUR
-            COLRF=.TRUE.
-C
-C           SEE IF THE FIRST CHARACTER IS A NUMBER
-C
-            DO 2050 K=1,9
-                IF(ICOM(2:2).EQ.PENS(K))GOTO 2051
-2050        CONTINUE
-C
-C           NO NUMBER FOUND - MUST BE A FONT CHANGE COMMAND
-C
-            IF(ICOM(2:2).NE.'0')GOTO 2010
-2051        JJ=JJ+2
-C
-C           GET THE 3 DIGIT NUMBER
-C
-#ifdef AIX_XLF
-            IF ( .NOT.TM_NUMBER(STRING(JJ-2:JJ)) ) GOTO 169  
-!** TMAP mod 11/94 **
-#endif
-            READ(STRING(JJ-2:JJ),'(I3)',ERR=169)K
-            IF(.NOT.DOPLOT)GOTO 169
-            CALL COLOR(K)
-	ELSE IF(ICOM(1:1).EQ.'P')THEN
-C
-C	    CHANGE PEN/COLOR
-C
-	    IF(.NOT.DOPLOT)GOTO 169
-	    IF(.NOT.COLRF)COLOLD=COLOUR
-	    COLRF=.TRUE.
-	    DO 2030 K=1,16
-	    IF(ICOM(2:2).EQ.PENS(K))GOTO 2031
-2030	    CONTINUE
-	    IF(ICOM(2:2).NE.'0')GOTO 2010
-	    K=1
-2031	    CALL COLOR(K)
-	    GOTO 169
-	ELSE IF(ICOM(1:1).EQ.'Z')THEN
-	    DO 2040 K=1,16
-	    IF(ICOM(2:2).EQ.PENS(K))GOTO 2041
-2040	    CONTINUE
-	    IF(ICOM(2:2).NE.'0')GOTO 2010
-	    K=0
-2041	    SLANT=SIN(K*0.08726646)
-	    GOTO 169
-	ENDIF
-C	SEARCH FOR FONT BY NAME THEN BY NUMBER
-2010	DO 1003 K=1,4
-	IF(ICOM.EQ.KIF(K).OR.ICOM.EQ.IFN(K))GOTO 302
-1003	CONTINUE
-C	NOT FOUND SEARCH MAIN DIRECTORY
-	DO 1004 ID=1,NFNT
-	IF(ICOM.EQ.DNME(ID).OR.ICOM.EQ.DNUM(ID))GOTO 1001
-1004	CONTINUE
-C	FONT NOT FOUND USE LAST FONT
-	GOTO 169
-1001	ILEN=DLEN(ID)
-C
-C	FIND WHERE FONT WILL FIT
-C
-	DO 1005 II=4,1,-1
-	IF(ILEN+IOFF(II).LE.12000) THEN
-* *kob* 1/97 setfont call takes place of branch to old 1010
-	    call SETFONT(fontdir,dirlen,dname,ifont,ii,kif,dnme,
-     .               ifn,dnum,itype,dtype,iflen, dlen,ioff,
-     .               icnt,ascii,base,rast,iadd,
-     .		     sx,sy,id)
-	    goto 169
-	ENDIF
-1005	CONTINUE
-C
-C	ERROR IF NO ROOM ANYWHERE!
-C
-	GOTO 169
-c1006	IF(.NOT.NEWFIL)THEN
-c	    INQUIRE(UNIT=LUHP,NAME=PLTFIL)
-c	    CLOSE(LUHP)
-c	ENDIF
-
-
-
-c	IF(.NOT.NEWFIL)THEN
-c	    IF(PTYPE.EQ.0 .OR. PTYPE.EQ.2 .OR. PTYPE.EQ.4)THEN
-c		OPEN(LUHP,FILE=PLTFIL,FORM='UNFORMATTED',STATUS='OLD',
-c     *		ACCESS='APPEND')
-c	    ELSE
-c		OPEN(LUHP,FILE=PLTFIL,STATUS='OLD',ACCESS='APPEND')
-c	    ENDIF
-c	ENDIF
-C
-C	DONE
-C
-C	IF(READIR)GOTO 169
-C	READIR=.TRUE.
-C	GOTO 2000
-C
-C	READ DIRECTORY
-C
-
-302	IFONT=K
-169	ASCFNT=ITYPE(IFONT).EQ.-1
-170	CONTINUE
-180	IF(.NOT.DOPLOT)THEN
-	    X=SYMWID*HEIGHT/21.
-	    GOTO 300 ! Mod 11.30, was RETURN
-	END IF
-C
-C	SCALE AND ROTATE THE FINAL COORDINATES.
-C
-	IF(SYMROT)GO TO 190
-	XTEMP = XREF * SYMSC + XORG
-	YTEMP = YORG
-	GO TO 200
-190	XTEMP = XREF * SYMCOS * SYMSC + XORG
-	YTEMP = XREF * SYMSIN * SYMSC + YORG
-C
-C	PLOT TO THE END OF THE CHARACTER STRING.
-C
-200	PENF = .FALSE.
-	CALL XYZPLT
-C
-C	RESET COLOR
-C
-	IF(COLRF.AND.(COLOLD.NE.COLOUR))CALL COLOR(COLOLD)
-300     CALL SCALE(XSCL,YSCL,ABIAS,BBIAS,XLO,YLO) ! bug fix(?) 11.95
-
-	RETURN
-C
- 5000   IF (dirlen .GT. 1) THEN
-	   CALL WARN ('Could not open font file. Check the Ferret environment.')
-	   err_msg = fontdir(:dirlen)//'/fondat.dat'
-	ELSE
-	   CALL WARN ('Fonts directory is undefined. Check the Ferret environment.')
-	   err_msg = 'fondat.dat'
-	ENDIF
-
-        CALL errmsg (ferr_file_not_found, status, err_msg, *5002)
-
- 5002	STOP
-
-	END
-	FUNCTION SYMWID(HEIGHT,NCHAR,STRING)
-C *kob* 04/07/96 passed in character strings had to be declared 
-C                with "*(*)" for the linux port 
-	CHARACTER STRING*(*)
-	NC=-IABS(NCHAR)
-C
-C	THIS FUNCTION RETURNS THE WIDTH OF THE STRING WITHOUT DRAWING IT
-C
-	SS=0.
-	CALL SYMBEL(SS,0.,0.,HEIGHT,NC,STRING)
-	SYMWID=SS
-	RETURN
-	END
+        CALL SYMBEL_HERSHEY(X,Y,DEGRES,HEIGHT,NCHAR,STRING)
+        RETURN
+        END
 
diff --git a/ppl/complot/symbel.F b/ppl/complot/symbel_hershey.F
similarity index 96%
copy from ppl/complot/symbel.F
copy to ppl/complot/symbel_hershey.F
index 7de8f34..e01fb25 100644
--- a/ppl/complot/symbel.F
+++ b/ppl/complot/symbel_hershey.F
@@ -1,4 +1,4 @@
- 	SUBROUTINE SYMBEL(X,Y,DEGRES,HEIGHT,NCHAR,STRING)
+ 	SUBROUTINE SYMBEL_HERSHEY(X,Y,DEGRES,HEIGHT,NCHAR,STRING)
 C** 
 C**    @(#)symbel.tplate.F	1.1    3/10/88
 C**
@@ -10,9 +10,6 @@ C**
 C***********************************************************************
 C**
 C**
-C       Mod *JD* 3.19.91 for unix -- use environment variable PLOTFONTS
-C       *jd* 7.92 variable IF renamed to KIF for MAC
-C       *kms* 06-2017 - change from PLOTFONTS to FER_FONTS
 *
 *
 *  This software was developed by the Thermal Modeling and Analysis
@@ -48,6 +45,8 @@ C       *kms* 06-2017 - change from PLOTFONTS to FER_FONTS
 *  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
 *
 *
+C       Mod *JD* 3.19.91 for unix -- use environment variable PLOTFONTS
+C       *jd* 7.92 variable IF renamed to KIF for MACMAC
 *       *jd* 11.94 
 *       Modification uses TM_NUMBER to determine if "value" is a number rather
 *       than the ERR= branch of a READ which fails on AIX/xlf
@@ -73,6 +72,8 @@ C *acm* 7/02   Take out the MARKER calls that made dots. This caused trouble
 C              when making encapsulated postscript from postscript.  
 C *acm* 10/14  Ticket 2203: on the 64-bit machines, the \\ for backspace
 C              should be \ .
+C *kms* 06-2017 - change from PLOTFONTS to FER_FONTS
+C *acm* 07-2017 - ticket 2556 Look for FER_FONTS if not defined also check PLOTFONTS 
 C
 C	CALL SYMBEL(X,Y,DEGRES,HEIGHT,NCHAR,STRING)
 C
@@ -161,8 +162,16 @@ C	IF(.NOT.READIR)GOTO 2020
 	IF(.NOT.READIR) THEN
 #ifdef unix
 C *JD* Mod below fix for unix  -- use environment variable 3.19.91	
+C *ACM* For backwards compatibility (LAS setup etc) also look for PLOTFONTS
+
 	   call getenv ('FER_FONTS',fontdir)
        	   dirlen = lnblk (fontdir,255)
+	   IF (dirlen.LE.1) THEN
+       	      call getenv ('PLOTFONTS',fontdir)
+       	      dirlen = lnblk (fontdir,255)
+	   ENDIF
+
+	   IF (dirlen .LE. 1) GOTO 5000
 
 C *kob* 1/02 - cygwin 1.3.x requires "\" for unix directory accesses
 #ifdef __CYGWIN__
@@ -597,17 +606,3 @@ C
  5002	STOP
 
 	END
-	FUNCTION SYMWID(HEIGHT,NCHAR,STRING)
-C *kob* 04/07/96 passed in character strings had to be declared 
-C                with "*(*)" for the linux port 
-	CHARACTER STRING*(*)
-	NC=-IABS(NCHAR)
-C
-C	THIS FUNCTION RETURNS THE WIDTH OF THE STRING WITHOUT DRAWING IT
-C
-	SS=0.
-	CALL SYMBEL(SS,0.,0.,HEIGHT,NC,STRING)
-	SYMWID=SS
-	RETURN
-	END
-
diff --git a/fmt/src/my_close.c b/ppl/complot/symwid.F
similarity index 83%
rename from fmt/src/my_close.c
rename to ppl/complot/symwid.F
index 7905461..dfd0e3a 100644
--- a/fmt/src/my_close.c
+++ b/ppl/complot/symwid.F
@@ -1,4 +1,5 @@
-/*
+	FUNCTION SYMWID(HEIGHT,NCHAR,STRING)
+
 *
 *  This software was developed by the Thermal Modeling and Analysis
 *  Project(TMAP) of the National Oceanographic and Atmospheric
@@ -30,22 +31,19 @@
 *  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
 *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
 *  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.  
+*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
 *
-*/
-/*
-   06/04 *ywei* -Created to read command file faster
- */
-
-#include <stdio.h>
-
-void my_close_(void ** lun)
-{
-   FILE * fp;
-   fp = *((FILE**)lun);
-   if(fp!=NULL){
-      fclose(fp);
-      *((FILE**)lun) = NULL;
-   }
-}
+* Split off from file symbel.F 5/2015
 
+C *kob* 04/07/96 passed in character strings had to be declared 
+C                with "*(*)" for the linux port 
+	CHARACTER STRING*(*)
+	NC=-IABS(NCHAR)
+C
+C	THIS FUNCTION RETURNS THE WIDTH OF THE STRING WITHOUT DRAWING IT
+C
+	SS=0.
+	IF (NC .NE. 0) CALL SYMBEL(SS,0.,0.,HEIGHT,NC,STRING)
+	SYMWID=SS
+	RETURN
+	END
diff --git a/ppl/include/xgks/gks_implem.h b/ppl/include/xgks/gks_implem.h
deleted file mode 100644
index 643077b..0000000
--- a/ppl/include/xgks/gks_implem.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *		Copyright IBM Corporation 1989
- *
- *                      All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
- *
- * University of Illinois at Urbana-Champaign
- * Department of Computer Science
- * 1304 W. Springfield Ave.
- * Urbana, IL	61801
- *
- * (C) Copyright 1987, 1988 by The University of Illinois Board of Trustees.
- * All rights reserved.
- *
- * Tool: X 11 Graphical Kernel System
- * Author: Gregory Scott Rogers
- * Author: Sung Hsien Ching Kelvin
- * Author: Yu Pan
- * 
- * This file is the header-file for the XGKS implementation.  It includes most
- * necessary X header-files and most XGKS header-files -- it does not include
- * some "specialty" header-files or those specific to the Fortran 
- * implementation).  All XGKS library implementation-files should include this
- * header-file.
- *
- * This header-file should be included before any "specialty" X header-files
- * that depend upon <X11/Xlib.h>.
- *
- * $Id: gks_implem.h 6145 1997-08-12 22:49:01Z sirott $
- * $__Header$
- */
-
-#ifndef XGKS_GKS_IMPLEM_H
-#define XGKS_GKS_IMPLEM_H
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include "xgks.h"
-#include "gks_defines.h"
-#include "primitive.h"
-#include "input.h"
-#include "wdt.h"
-#include "wslist.h"
-#include "gkslist.h"
-#include "gks_errors.h"
-#include "event.h"
-#include "metafile.h"
-
-#endif	/* XGKS_GKS_IMPLEM_H not defined */
diff --git a/ppl/include/xgks/wslist.h b/ppl/include/xgks/wslist.h
deleted file mode 100644
index 691ccb3..0000000
--- a/ppl/include/xgks/wslist.h
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- *		Copyright IBM Corporation 1989
- *
- *                      All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
- *
- * University of Illinois at Urbana-Champaign
- * Department of Computer Science
- * 1304 W. Springfield Ave.
- * Urbana, IL	61801
- *
- * (C) Copyright 1987, 1988 by The University of Illinois Board of Trustees.
- * All rights reserved.
- *
- * Tool: X 11 Graphical Kernel System
- * Author: Gregory Scott Rogers
- * Author: Sung Hsien Ching Kelvin
- * Author: Yu Pan
- *
- * This header-file depends upon header-files "gks_defines.h", "primitive.h",
- * and "wdt.h".
- *
- * $Id: wslist.h 6145 1997-08-12 22:49:01Z sirott $
- */
-
-
-#ifndef  WSLIST_H
-#define  WSLIST_H
-
-
-/*
- * NDC to DC, DC to X, and NDC to X transformations are stored in the
- * workstation structure using the WS_TRANS structure.
- */
-typedef struct {
-    Gfloat          xScale, xTrans;
-    Gfloat          yScale, yTrans;
-}               WS_TRANS;
-
-
-/* Workstation type */
-typedef enum {
-    WST_INVALID,			/* Invalid workstation */
-    X_WIN,				/* X Window System */
-    WISS,				/* Workstation-independent segment-
-					 * storage */
-    MI,					/* Metafile input */
-    MO					/* Metafile output */
-} EWSTYPE;
-
-
-/* Dash-list type */
-typedef struct {
-    int             dn;			/* dash list length */
-    char            dashl[17];		/* dash list */
-} DashList;
-
-
-extern DashList xgksDASHES[10];		/* defined in xpline.c */
-
-
-/*
- * Workstation information for an X window (this structure is unused as yet):
- */
-typedef struct Xwindow {
-    struct ws_struct
-		   *ws;			/* (Enclosing) workstation entry */
-    Display        *dpy;		/* the display ID */
-    Window          win;		/* the window ID */
-    unsigned long   event_mask;		/* the initial window event mask */
-    GC              gc;			/* the window graphics context */
-    GC              plinegc;		/* graphics contexts for specific */
-    GC              pmarkgc;		/* primitives */
-    GC              fillareagc;
-    GC              textgc;
-    Colormap        dclmp;		/* the screen default colour map ID */
-    Colormap        wclmp;		/* the window colourmap ID */
-    Gpoint          wbound;		/* Current x window bound */
-    Gint            wscolour;		/* Number of available colours on the
-					 * ws */
-    Gcobundl       *set_colour_rep;	/* colours set by user */
-    Gint            wsfg, wsbg;		/* foreground and background pixel
-					 * values */
-    WS_TRANS        dctoxtrans;		/* transformation constants from DC
-					 * space to X_WIN space */
-    WS_TRANS        ndctoxtrans;	/* composite of ndctodc and dctox */
-    XRectangle      xclip;		/* the clip area in the X window */
-    XRectangle      last_pline_rectangle;
-    XRectangle      last_pmarker_rectangle;
-    XRectangle      last_farea_rectangle;
-    XRectangle      last_text_rectangle;
-    Gint            last_dash_index;
-    Gint            last_message_width;
-    XcMap           XcMap;		/* GKS <-> X color-mapping */
-    int             soft_clipping_on;   /* soft-clipping is enabled? */
-    int		    backing_store_on;	/* backing-store is enabled? */
-}               Xwindow;
-
-
-/*
- * Type of Metafile:
- * Added PostScript and GIF types *js* 7/16/97
- */
-typedef enum mf_type {
-    MF_GKSM	= 0,
-    MF_CGM,
-    MF_PS,
-    MF_GIF
-}		mf_type;
-
-
-/*
- * Workstation information common to all Metafile implementations:
- */
-#define MF_COMMON \
-    mf_type	type;			/* Type of Metafile */ \
-    Gfile	*fp;			/* File structure */ \
-    Gint	filestat;		/* File status */ \
-    Ggksmit	CurItem;		/* Current item (type, length) */ \
-    Gint	GksmEmpty;		/* Metafile is empty? */
-
-
-/*
- * Common Metafile data-structure:
- */
-typedef struct mf_any {
-    MF_COMMON
-}		mf_any;
-
-/*
- * Workstation information specific to Metafiles:
- *
- * The implementation details are hidden in the individual modules.
- */
-typedef union Metafile {
-    mf_any		*any;
-    struct mf_gksm	*gksm;
-    struct mf_cgmi	*cgmi;
-    struct mf_cgmo	*cgmo;
-}		Metafile;
-
-
-/*
- * Workstation information:
- */
-typedef struct ws_struct {
-    Gint            ws_id;		/* Workstation identifier */
-    Gchar          *conn;		/* Workstation Connection and type */
-    Gchar          *wstype;		/* workstation type */
-    EWSTYPE         ewstype;		/* enum ws type */
-
-    Gint            ws_is_closing;	/* true = closing */
-
-    Metafile        mf;			/* Metafile information: */
-
-    /*
-     * Entries in this group do not exist for workstation of categories INPUT
-     * and MI
-     */
-    Gwsstate        wsstate;		/* Workstation state
-					 * [ACTIVE/INACTIVE] */
-
-    /*
-     * Entries in this group do not exist for workstation of categoeies
-     * INPUT, WISS, MI
-     */
-    Gstore          primi_store;	/* state of storage of non-segment
-					 * primitives */
-    Gpoint          size;		/* Workstation DC space size */
-    Gwsti           wsti;		/* Workstation transformation
-					 * information */
-    Gwsdus          wsdus;		/* Workstation defferal & update
-					 * state */
-    /*
-     * User-defined function called each time after workstation redraw
-     */
-    Gint            (*redrawfuncp) ();
-
-    /*
-     * Entries in this group do not exist for workstation of categoeies
-     * INPUT, WISS, MI, MO
-     */
-    Glnbundl        lnbundl_table[MAX_BUNDL_TBL];	/* Polyline bundle
-							 * table */
-    Gmkbundl        mkbundl_table[MAX_BUNDL_TBL];	/* Polymarker bundle
-							 * table */
-    Gtxbundl        txbundl_table[MAX_BUNDL_TBL];	/* Text bundle table */
-    Gflbundl        flbundl_table[MAX_BUNDL_TBL];	/* Fill area bundle
-							 * table */
-    Gptbundl        ptbundl_table[MAX_BUNDL_TBL];	/* Pattern bundle
-							 * table */
-
-    /*
-     * Segments associated with this workstation -- this structure is very
-     * important when we want to clear a ws
-     */
-    WS_SEG_LIST    *seglist;
-    WS_SEG_LIST    *seg_insertpt;
-    Gint            seg_list_dirty;	/* Flag indicating that ws->seglist
-					 * needs to be re-arrange before next
-					 * gks-redraw */
-
-    /*
-     * A note on implementation, this list will be mantain by routines in
-     * segment.c and should only be changed by routines in it !
-     */
-
-    /*
-     * logical input devices are implemented as a linked list of all the
-     * devices that have been used
-     */
-    INPUT_DEV      *in_dev_list;
-
-    Glimit          clip;		/* Intersection between NDC-viewport
-					 * and WS_window */
-
-    /*
-     * Following output primitive list are for non-segment primitives
-     * associated with this workstation
-     */
-    OUT_PRIMI       primi_list;		/* First primitve is always a
-					 * CLIP_REC */
-    OUT_PRIMI      *primi_insert_pt;
-    /*
-     * Primitive manager needs this for efficient insertion
-     */
-    OUT_PRIMI      *message_pt;		/* Points to mesg. prim. in list;
-					 * NULL if none */
-    OUT_PRIMI      *bef_message;	/* Points to node before mesg in list */
-
-    WS_TRANS        ndctodctrans;	/* transformation constants from NDC
-					 * space to DC space */
-
-    /*
-     * X-specific stuff.  NB: this should be unioned (and, hopefully, will
-     * eventually be) with the Metafile union defined above.
-     */
-    Display        *dpy;		/* the display ID */
-    Window          win;		/* the window ID */
-    unsigned long
-                    event_mask;		/* the initial window event mask */
-    GC              gc;			/* the window graphics context */
-    GC              plinegc;		/* graphics contexts for specific */
-    GC              pmarkgc;		/* primitives */
-    GC              fillareagc;
-    GC              textgc;
-    Colormap        dclmp;		/* the screen default colour map ID */
-    Colormap        wclmp;		/* the window colourmap ID */
-    Gpoint          wbound;		/* Current x window bound */
-    Gint            wscolour;		/* Number of available colours on the
-					 * ws */
-    Gcobundl       *set_colour_rep;	/* colours set by user */
-    Gint            wsfg, wsbg;		/* foreground and background pixel
-					 * values */
-    WS_TRANS        dctoxtrans;		/* transformation constants from DC
-					 * space to X_WIN space */
-    WS_TRANS        ndctoxtrans;	/* composite of ndctodc and dctox */
-    XRectangle      xclip;		/* the clip area in the X window */
-    XRectangle      last_pline_rectangle;
-    XRectangle      last_pmarker_rectangle;
-    XRectangle      last_farea_rectangle;
-    XRectangle      last_text_rectangle;
-    Gint            last_dash_index;
-    Gint            last_message_width;
-    XcMap           XcMap;		/* GKS <-> X color-mapping */
-    int             soft_clipping_on;	/* soft-clipping is enabled? */
-    int		    backing_store_on;	/* backing-store is enabled? */
-}              *WS_STATE_PTR, WS_STATE_ENTRY;
-
-
-#define	NOT_SET	(-9.99)
-
-
-extern Gwscat          XgksWsCategory		PROTO((WS_STATE_PTR ws));
-extern EWSTYPE         XgksWsTypeToEnum		PROTO((Gchar *wstype));
-extern WS_STATE_PTR    XgksValidWsId		PROTO((Gint ws_id));
-
-
-/*
- * VALID_WSID(i) used to check to see if there was a workstation open with
- * the name i.  I renamed this function OPEN_WSID and created a new VALID_WSID
- * that checks if the ws id is valid (non-negative).  This was all done in the
- * name of PTR c1012: many functions returned error 25 (ws not open) in cases
- * where error 20 (ws invalid) would be more appropriate.
- */
-#define VALID_WSID(i)	((i) >= 0)
-#define OPEN_WSID(i)	(XgksValidWsId(i))
-#define WS_CAT(t)	(XgksWsCategory(t))
-
-
-#define NdcToDc(ws, ndc, dc) { \
-    /* WS_STATE_ENTRY *ws; Gpoint *ndc, *dc; */  \
-    (dc)->x = (ndc)->x * (ws)->ndctodctrans.xScale \
-	    + (ws)->ndctodctrans.xTrans; \
-    (dc)->y = (ndc)->y * (ws)->ndctodctrans.yScale \
-	    + (ws)->ndctodctrans.yTrans; \
-}
-
-
-#define DcToNdc(ws, dc, ndc) { \
-    /* WS_STATE_ENTRY *ws; Gpoint *dc, *ndc; */  \
-    (ndc)->x = ((dc)->x - (ws)->ndctodctrans.xTrans) \
-	    / (ws)->ndctodctrans.xScale; \
-    (ndc)->y = ((dc)->y - (ws)->ndctodctrans.yTrans) \
-	    / (ws)->ndctodctrans.yScale; \
-}
-
-
-/*
- * Note the rounding performed in the following by the addition of the 0.5
- * term.  We do this to obtain the X pixel closest to the DC point.  We use
- * a positive 0.5 for rounding because only non-negative X window co-ordinates
- * are useful.
- */
-#define DcToX(ws, dc, xpt) { \
-    /* WS_STATE_ENTRY *ws; Gpoint *dc; XPoint *xpt; */  \
-    (xpt)->x = (short)((dc)->x * (ws)->dctoxtrans.xScale \
-	    + (ws)->dctoxtrans.xTrans + 0.5); \
-    (xpt)->y = (short)(ws->wbound.y - ((dc)->y * (ws)->dctoxtrans.yScale \
-	    + (ws)->dctoxtrans.yTrans) + 0.5); \
-}
-
-
-#define XToDc(ws, xpt, dc) { \
-    /* WS_STATE_ENTRY *ws; Gpoint *dc; XPoint *xpt; */  \
-    (dc)->x = ((xpt)->x - (ws)->dctoxtrans.xTrans) \
-	    / (ws)->dctoxtrans.xScale; \
-    (dc)->y = ((ws->wbound.y - (xpt)->y) - (ws)->dctoxtrans.yTrans) \
-	    / (ws)->dctoxtrans.yScale; \
-}
-
-
-/*
- * Note the rounding performed in the following by the addition of the 0.5
- * term.  We do this to obtain the X pixel closest to the NDC point.  We use
- * a positive 0.5 for rounding because only non-negative X window co-ordinates
- * are useful.  (Aside: Instead of the 0.5 term in the following, Harry Edmon,
- * in his fix, had 0.001).
- */
-#define NdcToX(ws, ndc, xpt) { \
-    /* WS_STATE_ENTRY *ws; Gpoint *ndc; XPoint *xpt; */  \
-    (xpt)->x = (short)((ndc)->x * (ws)->ndctoxtrans.xScale \
-	    + (ws)->ndctoxtrans.xTrans + 0.5); \
-    (xpt)->y = (short)(ws->wbound.y - ((ndc)->y * (ws)->ndctoxtrans.yScale \
-	    + (ws)->ndctoxtrans.yTrans) + 0.5); \
-}
-
-
-#define XToNdc(ws, xpt, ndc) { \
-    /* WS_STATE_ENTRY *ws; Gpoint *ndc; XPoint *xpt; */  \
-    (ndc)->x = ((xpt)->x - (ws)->ndctoxtrans.xTrans) \
-	    / (ws)->ndctoxtrans.xScale; \
-    (ndc)->y = ((ws->wbound.y - (xpt)->y) - (ws)->ndctoxtrans.yTrans) \
-	    / (ws)->ndctoxtrans.yScale; \
-}
-
-
-/*
- * The following lines are for the GKS-color-index-to-X-color-cell mapping
- * abstraction.
- *
- * The "Xc" prefix refers to "X-color".
- */
-
-#ifndef PROTO
-#   define	PROTO(x)	()
-#endif
-
-
-/*
- * Procedural interface to the GKS <-> X color-mapping abstraction:
- */
-extern int	XcNew		PROTO((WS_STATE_PTR XcWs));
-extern int	XcInit		PROTO((WS_STATE_PTR XcWs, XVisualInfo *vinfo));
-extern int	XcSetColour	PROTO((WS_STATE_PTR XcWs, Gint ColourIndex,
-				       Gcobundl *XcRep));
-extern unsigned long	
-	    	XcPixelValue    PROTO((WS_STATE_PTR XcWs, Gint ColourIndex));
-extern Gint	XcColourIndex	PROTO((WS_STATE_PTR XcWs,
-				       unsigned long PixelValue));
-extern int	XcEnd		PROTO((WS_STATE_PTR XcWs));
-
-#endif					/* WSLIST_H not defined */
diff --git a/ppl/ourlib/Makefile b/ppl/ourlib/Makefile
index faee248..30c67ac 100644
--- a/ppl/ourlib/Makefile
+++ b/ppl/ourlib/Makefile
@@ -13,14 +13,8 @@ include ./LIB_NAME
 #
 
 OBJS = $(SRCS_C:.c=.o) $(SRCS_F:.F=.o)
-
+#
 # change the standard rules for .F -> .o builds so $(PPLUS_FFLAGS) is used
-
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(PPLUS_FFLAGS) -c $*.f	 
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/ppl/ourlib/lnonbl5.F_unused b/ppl/ourlib/lnonbl5.F_unused
deleted file mode 100644
index 0232a90..0000000
--- a/ppl/ourlib/lnonbl5.F_unused
+++ /dev/null
@@ -1,78 +0,0 @@
-      FUNCTION LNBLK(STRING, NCHAR)
-*
-*
-*  This software was developed by the Thermal Modeling and Analysis
-*  Project(TMAP) of the National Oceanographic and Atmospheric
-*  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
-*  hereafter referred to as NOAA/PMEL/TMAP.
-*
-*  Access and use of this software shall impose the following
-*  obligations and understandings on the user. The user is granted the
-*  right, without any fee or cost, to use, copy, modify, alter, enhance
-*  and distribute this software, and any derivative works thereof, and
-*  its supporting documentation for any purpose whatsoever, provided
-*  that this entire notice appears in all copies of the software,
-*  derivative works and supporting documentation.  Further, the user
-*  agrees to credit NOAA/PMEL/TMAP in any publications that result from
-*  the use of this software or in any product that includes this
-*  software. The names TMAP, NOAA and/or PMEL, however, may not be used
-*  in any advertising or publicity to endorse or promote any products
-*  or commercial entity unless specific written permission is obtained
-*  from NOAA/PMEL/TMAP. The user also understands that NOAA/PMEL/TMAP
-*  is not obligated to provide the user with any support, consulting,
-*  training or assistance of any kind with regard to the use, operation
-*  and performance of this software nor to provide the user with any
-*  updates, revisions, new versions or "bug fixes".
-*
-*  THIS SOFTWARE IS PROVIDED BY NOAA/PMEL/TMAP "AS IS" AND ANY EXPRESS
-*  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-*  ARE DISCLAIMED. IN NO EVENT SHALL NOAA/PMEL/TMAP BE LIABLE FOR ANY SPECIAL,
-*  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-*  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-*  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
-*
-*
-C**    @(#)lnonbl5.f	1.1    3/10/88
-C**
-C**
-C***********************************************************************
-C**
-C**                 PLOT+ Scientific Graphics System
-C**
-C***********************************************************************
-C**
-C**
-C
-CC  THIS FUNCTION RETURNS THE CHARACTER POSITION
-CC  OF THE LAST NON-BLANK CHARACTER IN THE STRING.
-CC  CHARACTERS ARE NUMBERED STARTING WITH 1 AT THE
-CC  LEFT OF THE FIRST WORD AND ARE PACKED TEN WORD
-CC  WITH BLANK FILL. THE LAST WORD IS SCANNED FROM
-CC  THE FAR RIGHT REGARDLESS OF WHETHER NCHAR INDICATES
-CC  ONLY A PARTIALLY FULL WORD.
-C
-C *kob* 04/07/96 passed in character strings had to be declared 
-C                with "*(*)" for the linux port 
-	CHARACTER STRING*(*)
-	DO 10 I=NCHAR,1,-1
-	IF(STRING(I:I).NE.' ')GOTO 11
-10	CONTINUE
-	LNBLK=0
-	RETURN
-C
-C	RSX-11M
-C
-C11	LNBLK=I-1
-C
-C	END RSX-11M
-C
-C	VAX/VMS
-C
-11	LNBLK=I
-C
-C	END VAX/VMS
-C
-      RETURN
-      END
diff --git a/ppl/plot/Makefile b/ppl/plot/Makefile
index 476d179..cc2cce7 100644
--- a/ppl/plot/Makefile
+++ b/ppl/plot/Makefile
@@ -15,12 +15,6 @@ include ./LIB_NAME
 OBJS = $(SRCS_C:.c=.o) $(SRCS_F:.F=.o)
 
 # change the standard rules for .F -> .o builds so $(PPLUS_FFLAGS) is used
-
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(PPLUS_FFLAGS) -c $*.f	 
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/ppl/plot/daxis2.F b/ppl/plot/daxis2.F
index dda2173..c31c64c 100644
--- a/ppl/plot/daxis2.F
+++ b/ppl/plot/daxis2.F
@@ -77,6 +77,8 @@ C**
 
 	CHARACTER OUT*255
         INTEGER TM_LENSTR, numlines, i, j
+        CHARACTER labeltmpstr*2048
+        INTEGER labeltmpstrlen
 
 c        CHARACTER fontprefix*3, penprefix*3, newfont*3, newpen*3
 c        INTEGER lnbeg(500), lnend(500), 
@@ -110,9 +112,29 @@ c        line_spacing = 1.4
      .           npnew, nfnew, newfont, newpen, ncr)
 
 	   NCR = lnend(j) - lnbeg(j) + 1
-	   XMN=SYMWID(HLB,NCR+npen+nfont,
+C          Save to a temporary string to fix valgrid-reported issue with
+C          using uninitialized characters
+           IF ( (npen .GT. 0) .AND. (nfont .GT. 0) ) THEN
+              labeltmpstr = 
      .                 penprefix(1:npen)//fontprefix(1:nfont)//
-     .                 LABS(I)(lnbeg(j):lnend(j)))
+     .                 LABS(I)(lnbeg(j):lnend(j))
+              labeltmpstrlen = npen + nfont + NCR
+           ELSE IF ( npen .GT. 0 ) THEN
+              labeltmpstr = 
+     .                 penprefix(1:npen)//
+     .                 LABS(I)(lnbeg(j):lnend(j))
+              labeltmpstrlen = npen + NCR
+           ELSE IF ( nfont .GT. 0 ) THEN
+              labeltmpstr = 
+     .                 fontprefix(1:nfont)//
+     .                 LABS(I)(lnbeg(j):lnend(j))
+              labeltmpstrlen = nfont + NCR
+           ELSE
+              labeltmpstr = 
+     .                 LABS(I)(lnbeg(j):lnend(j))
+              labeltmpstrlen = NCR
+           ENDIF
+	   XMN=SYMWID(HLB, labeltmpstrlen, labeltmpstr)
 
 	   IF(USRLBS(I))THEN
 	       XFUSER=1.
@@ -186,9 +208,29 @@ c        line_spacing = 1.4
 	   YL=YL/YFUSER+YLOUSR+SHFT*SN/YF -
      .         line_spacing*(j-1)*hlb*CS/yf
 
-           CALL SYMBEL(XL,YL,RLABS(i),HLB,NCR+npen+nfont,
+C          Save to a temporary string to fix valgrid-reported issue with
+C          using uninitialized characters
+           IF ( (npen .GT. 0) .AND. (nfont .GT. 0) ) THEN
+              labeltmpstr = 
      .                 penprefix(1:npen)//fontprefix(1:nfont)//
-     .                 LABS(I)(lnbeg(j):lnend(j)))
+     .                 LABS(I)(lnbeg(j):lnend(j))
+              labeltmpstrlen = npen + nfont + NCR
+           ELSE IF ( npen .GT. 0 ) THEN
+              labeltmpstr = 
+     .                 penprefix(1:npen)//
+     .                 LABS(I)(lnbeg(j):lnend(j))
+              labeltmpstrlen = npen + NCR
+           ELSE IF ( nfont .GT. 0 ) THEN
+              labeltmpstr = 
+     .                 fontprefix(1:nfont)//
+     .                 LABS(I)(lnbeg(j):lnend(j))
+              labeltmpstrlen = nfont + NCR
+           ELSE
+              labeltmpstr = 
+     .                 LABS(I)(lnbeg(j):lnend(j))
+              labeltmpstrlen = NCR
+           ENDIF
+           CALL SYMBEL(XL,YL,RLABS(i),HLB,labeltmpstrlen,labeltmpstr)
 
 C  Set up to use any font settings from this line on subsequent lines.
 
diff --git a/ppl/plot/dsflab.F b/ppl/plot/dsflab.F
index c3d7abb..17f6930 100644
--- a/ppl/plot/dsflab.F
+++ b/ppl/plot/dsflab.F
@@ -113,12 +113,7 @@ C
 C	LJUST left justifies a string and returns its length
 C
 	INTEGER INLEN,OUTLEN
-
-#ifdef FORTRAN_90
-	character str*(*)
-#else
-	CHARACTER STR*2048
-#endif
+	CHARACTER STR*(*)
 
 	IF(STR.EQ.' ')THEN
 	    OUTLEN=1
diff --git a/ppl/plotlib/Makefile b/ppl/plotlib/Makefile
index 476d179..cc2cce7 100644
--- a/ppl/plotlib/Makefile
+++ b/ppl/plotlib/Makefile
@@ -15,12 +15,6 @@ include ./LIB_NAME
 OBJS = $(SRCS_C:.c=.o) $(SRCS_F:.F=.o)
 
 # change the standard rules for .F -> .o builds so $(PPLUS_FFLAGS) is used
-
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(PPLUS_FFLAGS) -c $*.f	 
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/ppl/pplepic/Makefile b/ppl/pplepic/Makefile
index 476d179..cc2cce7 100644
--- a/ppl/pplepic/Makefile
+++ b/ppl/pplepic/Makefile
@@ -15,12 +15,6 @@ include ./LIB_NAME
 OBJS = $(SRCS_C:.c=.o) $(SRCS_F:.F=.o)
 
 # change the standard rules for .F -> .o builds so $(PPLUS_FFLAGS) is used
-
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(PPLUS_FFLAGS) -c $*.f	 
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/ppl/pplusr/Makefile b/ppl/pplusr/Makefile
index 476d179..cc2cce7 100644
--- a/ppl/pplusr/Makefile
+++ b/ppl/pplusr/Makefile
@@ -15,12 +15,6 @@ include ./LIB_NAME
 OBJS = $(SRCS_C:.c=.o) $(SRCS_F:.F=.o)
 
 # change the standard rules for .F -> .o builds so $(PPLUS_FFLAGS) is used
-
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(PPLUS_FFLAGS) -c $*.f	 
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/ppl/symlib/Makefile b/ppl/symlib/Makefile
index 476d179..cc2cce7 100644
--- a/ppl/symlib/Makefile
+++ b/ppl/symlib/Makefile
@@ -15,12 +15,6 @@ include ./LIB_NAME
 OBJS = $(SRCS_C:.c=.o) $(SRCS_F:.F=.o)
 
 # change the standard rules for .F -> .o builds so $(PPLUS_FFLAGS) is used
-
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(PPLUS_FFLAGS) -c $*.f	 
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/ppl/symlib/setsym.F b/ppl/symlib/setsym.F
index 0845e1f..3ef4cb4 100644
--- a/ppl/symlib/setsym.F
+++ b/ppl/symlib/setsym.F
@@ -77,6 +77,8 @@ C                with "*(*)" for the linux port
 C* v552 *acm* 3/03 Longer strings: changes for multi-line labels
 * V686 *acm* 11/13 Allow symbol names to be up to 120 characters long
 * v695 9/15 *acm* write values to PPL* symbols using 6 digits not 4
+* v721 8/17 *kms* always do TM_NUMBER check (not just #ifdef AIX_XLF) 
+*                 for newer gfortran (Mac)
 
 
 	CHARACTER LINE*(*),VALUE*2048,SYM*120,OPR*1,ARG(4)*120
@@ -244,17 +246,13 @@ C
 	    I=INDEX(VALUE,' ')
 	    K=I-1
 	    if(k.eq.1)then
-#ifdef AIX_XLF
 	       IF ( .NOT.TM_NUMBER(value(:k)) ) GOTO 120! ** TMAP mod 10/94 **
-#endif
 		read(value(:k),'(i1)',err=120)jk
 		x1=jk
 	    else
 	    WRITE(FRMT,999)K
 999	    FORMAT('(F',I3.3,'.0)')
-#ifdef AIX_XLF
 	    IF ( .NOT.TM_NUMBER(value(:i-1)) ) GOTO 120	! ** TMAP mod 10/94 **
-#endif
 	    READ(VALUE(:I-1),FRMT,ERR=120)X1
 	    endif
 200	    I=I+1
@@ -268,9 +266,7 @@ C
 	    IST=INDEX(VALUE(I:),' ')+I-2
 	    K=IST-I+1
 	    WRITE(FRMT,999)K
-#ifdef AIX_XLF
 	    IF ( .NOT.TM_NUMBER(value(i:ist)) ) GOTO 120	! ** TMAP mod 10/94 **
-#endif
 	    READ(VALUE(I:IST),FRMT,ERR=120)X2
 	    IF(OPR.EQ.'+')THEN
 		X=X1+X2
@@ -341,21 +337,17 @@ C                with "*(*)" for the linux port
 C
 C	DEFAULT VALUE IF NO NUMBER IS 1.0
 C
-100	    X=1.0
+   	    X=1.0
 	    RETURN
 	ENDIF
 	if(n.eq.1)then
-#ifdef AIX_XLF
-            IF ( .NOT.TM_NUMBER(str) ) GOTO 100  ! ** TMAP mod 11/94 **
-#endif
+            IF ( .NOT.TM_NUMBER(str) ) GOTO 1000  ! ** TMAP mod 11/94 **
 	    read(str,'(i1)',err=1000)jk
 	    x=jk
 	else
 	WRITE(FRMT,999)N
 999	FORMAT('(F',I2.2,'.0)')
-#ifdef AIX_XLF
-            IF ( .NOT.TM_NUMBER(str) ) GOTO 100  ! ** TMAP mod 11/94 **
-#endif
+            IF ( .NOT.TM_NUMBER(str) ) GOTO 1000  ! ** TMAP mod 11/94 **
 	READ(STR,FRMT,ERR=1000)X
 	endif
 
diff --git a/ppl/tmapadds/pplmem.h b/ppl/tmap_inc/pplmem.h
similarity index 52%
rename from ppl/tmapadds/pplmem.h
rename to ppl/tmap_inc/pplmem.h
index bdb08d1..50096de 100644
--- a/ppl/tmapadds/pplmem.h
+++ b/ppl/tmap_inc/pplmem.h
@@ -1,8 +1,11 @@
+#ifndef _PPLMEM_H_
+#define _PPLMEM_H_
+
 /* pplmem.h 
    Declarations for routines that allow dynamic PPLUS memory buffer 
    9/18/01 *acm*
 
-/*
+*
 *  This software was developed by the Thermal Modeling and Analysis
 *  Project(TMAP) of the National Oceanographic and Atmospheric
 *  Administration's (NOAA) Pacific Marine Environmental Lab(PMEL),
@@ -36,8 +39,9 @@
 *  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. 
 *
 * V68  *acm* 1/12  changes for double-precision ferret, single-precision pplus
+*/
 
-/* Easier way of handling FORTRAN calls with underscore/no underscore */
+/* Better if these were defined in only one include file, but .... */
 #ifndef FORTRAN
 #ifdef NO_ENTRY_NAME_UNDERSCORES
 #define FORTRAN(a) a
@@ -46,56 +50,41 @@
 #endif
 #endif
 
-
-void FORTRAN(pplcmd_c)(int *, int *, int *);
-void FORTRAN(pplcmd_f)(int *, int *, int *, float * );
-
+#ifndef DFTYPE
 #ifdef double_p
-void FORTRAN(pplldx_envelope)(int *, double *, double *, int *, 
-                       char *, char *, double *, int *);
-
-void FORTRAN(pplldx)( int *, double *, double *, int *, 
-                       char *, char *, double *, float * );
-
-
-void FORTRAN(pplldc_envelope)(int *, double *, int *, int *, int *, int *,
-                       int *, int *, double *, double *, int *, int *,
-                       double *, double *, double *, double *, int *);
-
-void FORTRAN(pplldc)( int *, double *, int *, int *, int *, int *, 
-                       int *, int *, double *, double *, int *, int *, 
-                       double *, double *, double *, double *, float *);
-
-void FORTRAN(pplldv_envelope)(int *, double *, int *, int *, int *, 
-                       int *, int *, int *);
-
-void FORTRAN(pplldv)( int *, double *, int *, int *, int *, int *, 
-                       int *, int *, float *);
+#define DFTYPE double
 #else
-void FORTRAN(pplldx_envelope)(int *, float *, float *, int *, 
-                       char *, char *, float *, int *);
-
-void FORTRAN(pplldx)( int *, float *, float *, int *, 
-                       char *, char *, float *, float * );
-
-
-void FORTRAN(pplldc_envelope)(int *, float *, int *, int *, int *, int *,
-                       int *, int *, float *, float *, int *, int *,
-                       float *, float *, float *, float *, int *);
-
-void FORTRAN(pplldc)( int *, float *, int *, int *, int *, int *, 
-                       int *, int *, float *, float *, int *, int *, 
-                       float *, float *, float *, float *, float *);
-
-void FORTRAN(pplldv_envelope)(int *, float *, int *, int *, int *, 
-                       int *, int *, int *);
-
-void FORTRAN(pplldv)( int *, float *, int *, int *, int *, int *, 
-                       int *, int *, float *);
+#define DFTYPE float
+#endif
 #endif
 
-void FORTRAN(save_ppl_memory_size)(int *);
-void FORTRAN(get_ppl_memory_size)(int *);
-
-void reallo_ppl_memory( int * );
+/* pointer to memory to be used by PPL - allocated by ferret */
+extern float *ppl_memory;
+
+/* Prototypes for C functions in ppl/tmapadds */
+void reallo_ppl_memory(int *this_size);
+
+void FORTRAN(get_ppl_memory_size)(int *plot_mem_used);
+int  FORTRAN(its_gksm)(int *wkid);
+void FORTRAN(pplcmd_c)(int *isi, int *icmdim, int *icmsze);
+void FORTRAN(pplcmd_f)(int *isi, int *icmdim, int *icmsze, float *plot_memory);
+void FORTRAN(pplld_pts)(int *npts, float *plot_memory);
+void FORTRAN(pplld_pts_envelope)(int *npts, int *plot_mem_used);
+void FORTRAN(pplldc)(int *k, DFTYPE *z, int *mx, int *my,int *imn, int *imx,
+                     int *jmn, int *jmx, DFTYPE *pi, DFTYPE *pj,int *nx1, int *ny1,
+                     DFTYPE *xmin1, DFTYPE *ymin1, DFTYPE *dx1, DFTYPE *dy1, float *plot_mem_used);
+void FORTRAN(pplldc_envelope)(int *k, DFTYPE *z, int *mx, int *my,int *imn, int *imx,
+                              int *jmn, int *jmx, DFTYPE *pi, DFTYPE *pj,int *nx1, int *ny1,
+                              DFTYPE *xmin1, DFTYPE *ymin1, DFTYPE *dx1, DFTYPE *dy1, int *plot_mem_used);
+void FORTRAN(pplldv)(int *K, DFTYPE *Z, int *MX, int *MY, int *IMN,int *IMX, int *JMN, int *JMX, float *plot_memory);
+void FORTRAN(pplldv_envelope)(int *K, DFTYPE *Z, int *MX, int *MY, int *IMN,int *IMX, int *JMN, int *JMX);
+void FORTRAN(pplldx)(int *icode, DFTYPE *xt, DFTYPE *yt, int *npts, char *tstrt, char *tref, DFTYPE *xdt, float *plot_memory);
+void FORTRAN(pplldx_envelope)(int *icode, DFTYPE *xt, DFTYPE *yt, int *npts, char *tstrt, char *tref, DFTYPE *xdt, int *plot_mem_used);
+void FORTRAN(reallo_envelope)(int *plot_mem_used);
+void FORTRAN(resize_xgks_window)(int *ws_id, float *x, float *y, int *ix, int *iy);
+void FORTRAN(save_ppl_memory_size)(int *plot_mem_used);
+void FORTRAN(set_background)(int *ws_id, int *ndx);
+void FORTRAN(wait_on_resize)(int *ws_id);
+void FORTRAN(xgks_x_events)(void);
 
+#endif
diff --git a/ppl/tmapadds/Makefile b/ppl/tmapadds/Makefile
index 4f7ab3c..9eead51 100644
--- a/ppl/tmapadds/Makefile
+++ b/ppl/tmapadds/Makefile
@@ -14,12 +14,6 @@ include ./SOURCE_FILES
 OBJS = $(SRCS_C:.c=.o) $(SRCS_F:.F=.o)
 
 # change the standard rules for .F -> .o builds so $(PPLUS_FFLAGS) is used
-
-#%.o : %.F
-#	rm -f $*.f
-#	$(CPP) -P -traditional $(CPP_FLAGS) $(<F) | sed -e 's/de    /de /g' | sed -e 's/de         /de /g' > $*.f
-#	$(F77) $(PPLUS_FFLAGS) -c $*.f	 
-
 # Directly compile the .F source files to the .o object files
 # since gfortran can handle the C compiler directives in Fortran code
 %.o : %.F
diff --git a/ppl/tmapadds/gxstrm.c b/ppl/tmapadds/gxstrm.c
deleted file mode 100644
index 2c78641..0000000
--- a/ppl/tmapadds/gxstrm.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* Included in the Ferret source repository only for reference */
-/* Code is available at
-   http://grads.sourcearchive.com/documentation/2.0.a7.1-3/main.html */
-
-
-#include <stdio.h>
-#include <malloc.h>
-#include <math.h>
-#include "gx.h"
-
-void gxstrm (float *u, float *v, float *c, int is, int js,
-   float uund, float vund, float cund, int flag, float *shdlvs,
-   int *shdcls, int shdcnt, int den) {
-float *up, *vp; 
-float x,y,xx,yy,uv1,uv2,uv,vv1,vv2,vv,auv,avv,xsav,ysav,xold,yold;
-int i,j,ii,jj,ipen,ii1,ij1,i2,j2,ipt,acnt,icol,scol,kk,dis;
-int *it,siz,iacc,iisav,iscl,imn,imx,jmn,jmx,iz,jz,iss,jss,bflg;
-float fact,rscl,xxsv,yysv,*cp,cv1,cv2,cv;
-
-  scol = -9;
-  icol = 1;
-
-  /* Figure out the interval for the flag grid */
-
-  i = is;
-  if (js>i) i = js;
-  iscl = 200/i;
-  iscl = iscl + den - 5;
-  if (iscl<1) iscl=1;
-  if (iscl>10) iscl=10;
-  fact = 0.5/((float)iscl);
-  rscl = (float)iscl;
- 
-  /* Allocate memory for the flag grid */
-
-  iss = is*iscl; jss = js*iscl;
-  siz = iss*jss;
-  it = (int *)malloc(sizeof(int) * siz);
-  if (it==NULL) {
-    printf ("Cannot allocate memory for streamline function\n");
-    return;
-  }
-  for (i=0; i<siz; i++) *(it+i) = 0;
-
-  /* Loop through flag grid to look for start of streamlines.  
-     To start requires no streams drawn within surrounding 
-     flag boxes.  */
-
-  i2 = 0;
-  j2 = 0;
-  for (i=0; i<siz; i++) {
-    dis = 2;
-    if (den<5) dis = 3;
-    if (den>5) dis = 1;
-    imn = i2-dis; imx = i2+dis+1; 
-    jmn = j2-dis; jmx = j2+dis+1;
-    if (imn<0) imn = 0;
-    if (imx>iss) imx = iss;
-    if (jmn<0) jmn = 0;
-    if (jmx>jss) jmx = jss;
-    iacc = 0;
-    for (jz=jmn; jz<jmx; jz++) {
-      ipt = jz*iss+imn;
-      for (iz=imn; iz<imx; iz++) {
-        iacc = iacc + *(it+ipt);
-        ipt++;
-      }
-    }
-    if (iacc==0){
-      x = ((float)i2)/rscl;
-      y = ((float)j2)/rscl;
-      xsav = x;
-      ysav = y;
-      gxconv (x+1.0,y+1.0,&xx,&yy,3);
-      gxplot (xx,yy,3);
-      xxsv = xx; yysv = yy;
-      iisav = -999;
-      iacc = 0;
-      acnt = 0;
-      bflg = 0;
-      while (x>=0.0 && x<(float)(is-1) && y>=0.0 && y<(float)(js-1)) {
-        ii = (int)x;
-        jj = (int)y;
-        xx = x - (float)ii;
-        yy = y - (float)jj;
-        up = u + jj*is+ii;      
-        vp = v + jj*is+ii;
-        if (*up==uund || *(up+1)==uund ||
-            *(up+is)==uund || *(up+is+1)==uund) break;
-        if (*vp==vund || *(vp+1)==vund ||
-            *(vp+is)==vund || *(vp+is+1)==vund) break;
-        if (flag) {
-          cp = c + jj*is+ii;
-          if (*cp==cund || *(cp+1)==cund ||
-              *(cp+is)==cund || *(cp+is+1)==cund) icol = 15;
-          else {
-            cv1 = *cp + (*(cp+1)-*cp)*xx;
-            cv2 = *(cp+is) + (*(cp+is+1)-*(cp+is))*xx;
-            cv = cv1 + (cv2-cv1)*yy;
-            icol = gxshdc(shdlvs,shdcls,shdcnt,cv);
-          }
-          if (icol!=scol && icol>-1) gxcolr(icol);
-          scol = icol;
-        }
-        uv1 = *up + (*(up+1)-*up)*xx;
-        uv2 = *(up+is) + (*(up+is+1)-*(up+is))*xx;
-        uv = uv1 + (uv2-uv1)*yy;
-        vv1 = *vp + (*(vp+1)-*vp)*xx;
-        vv2 = *(vp+is) + (*(vp+is+1)-*(vp+is))*xx;
-        vv = vv1 + (vv2-vv1)*yy;
-        auv = fabs(uv); avv=fabs(vv);
-        if (auv<0.1 && avv<0.1) break;
-        if (auv>avv) {
-          vv = vv*fact/auv;
-          uv = uv*fact/auv;
-        } else {
-          uv = uv*fact/avv;
-          vv = vv*fact/avv;
-        }
-        x = x + uv;
-        y = y + vv;
-        ii1 = (int)(x*rscl);
-        ij1 = (int)(y*rscl);
-        ii1 = ij1*iss + ii1;
-        if (ii1<0 || ii1>=siz) break;
-        if (*(it+ii1)==1) break;
-        if (ii1!=iisav && iisav>-1) *(it+iisav) = 1;
-        if (ii1==iisav) iacc++;
-        else iacc = 0;
-        if (iacc>10) break;
-        iisav = ii1;
-        gxconv (x+1.0,y+1.0,&xx,&yy,3);
-        if (icol>-1) {
-          if (bflg) {gxplot(xold,yold,3); bflg=0;}
-          gxplot (xx,yy,2);
-        } else bflg = 1;
-        xold = xx;
-        yold = yy;
-        acnt++;
-        if (acnt>20) {
-          if (icol>-1) strmar (xxsv,yysv,xx,yy);
-          acnt = 0;
-        }
-        xxsv = xx; yysv = yy;
-      }
-      bflg = 0;
-      x = xsav; y = ysav;
-      gxconv (x+1.0,y+1.0,&xx,&yy,3);
-      gxplot (xx,yy,3);
-      xxsv = xx;
-      yysv = yy;
-      iisav = -999;
-      iacc = 0;
-      acnt = 19;
-      while (x>=0.0 && x<(float)(is-1) && y>=0.0 && y<(float)(js-1)) {
-        ii = (int)x;
-        jj = (int)y;
-        xx = x - (float)ii;
-        yy = y - (float)jj;
-        up = u + jj*is+ii;      
-        vp = v + jj*is+ii;
-        if (*up==uund || *(up+1)==uund ||
-            *(up+is)==uund || *(up+is+1)==uund) break;
-        if (*vp==vund || *(vp+1)==vund ||
-            *(vp+is)==vund || *(vp+is+1)==vund) break;
-        if (flag) {
-          cp = c + jj*is+ii;
-          if (*cp==cund || *(cp+1)==cund ||
-              *(cp+is)==cund || *(cp+is+1)==cund) icol = 15;
-          else {
-            cv1 = *cp + (*(cp+1)-*cp)*xx;
-            cv2 = *(cp+is) + (*(cp+is+1)-*(cp+is))*xx;
-            cv = cv1 + (cv2-cv1)*yy;
-            icol = gxshdc(shdlvs,shdcls,shdcnt,cv);
-          }
-          if (icol!=scol && icol>-1) gxcolr(icol);
-          scol = icol;
-        }
-        uv1 = *up + (*(up+1)-*up)*xx;
-        uv2 = *(up+is) + (*(up+is+1)-*(up+is))*xx;
-        uv = uv1 + (uv2-uv1)*yy;
-        vv1 = *vp + (*(vp+1)-*vp)*xx;
-        vv2 = *(vp+is) + (*(vp+is+1)-*(vp+is))*xx;
-        vv = vv1 + (vv2-vv1)*yy;
-        auv = fabs(uv); avv=fabs(vv);
-        if (auv<0.1 && avv<0.1) break;
-        if (auv>avv) {
-          vv = vv*fact/auv;
-          uv = uv*fact/auv;
-        } else {
-          uv = uv*fact/avv;
-          vv = vv*fact/avv;
-        }
-        x = x - uv;
-        y = y - vv;
-        ii1 = (int)(x*rscl);
-        ij1 = (int)(y*rscl);
-        ii1 = ij1*iss + ii1;
-        if (ii1<0 || ii1>=siz) break;
-        if (*(it+ii1)==1) break;
-        if (ii1!=iisav && iisav>-1) *(it+iisav) = 1;
-        if (ii1==iisav) iacc++;
-        else iacc = 0;
-        if (iacc>10) break;
-        iisav = ii1;
-        gxconv (x+1.0,y+1.0,&xx,&yy,3);
-        if (icol>-1) {
-          if (bflg) {gxplot(xold,yold,3); bflg=0;}
-          gxplot (xx,yy,2);
-        } else bflg = 1;
-        xold = xx;
-        yold = yy;
-        acnt++;
-        if (acnt>20) {
-          if (icol>-1) strmar(xx,yy,xxsv,yysv);
-          acnt = 0;
-        }
-        xxsv = xx; yysv = yy;
-      }
-    }
-    i2++;
-    if (i2==iss) { i2 = 0; j2++; }
-  }
-  free (it);
-}
-
-static float a150 = 150.0*3.1416/180.0;
-
-void strmar (float xx1, float yy1, float xx2, float yy2) {
-float dir;
-  dir = atan2(yy2-yy1,xx2-xx1);
-  gxplot (xx2,yy2,3);
-  gxplot (xx2+0.05*cos(dir+a150),yy2+0.05*sin(dir+a150),2);
-  gxplot (xx2,yy2,3);
-  gxplot (xx2+0.05*cos(dir-a150),yy2+0.05*sin(dir-a150),2);
-  gxplot (xx2,yy2,3);
-}
-
-/* Given a shade value, return the relevent color */
-
-int gxshdc (float *shdlvs, int *shdcls, int shdcnt, float val) {
-int i;
-
-  if (shdcnt==0) return(1);
-  if (shdcnt==1) return(shdcls[0]);
-  if (val<shdlvs[1]) return(shdcls[0]);
-  for (i=1; i<shdcnt-1; i++) {
-    if (val>=shdlvs[i] && val<shdlvs[i+1])
-                 return(shdcls[i]); 
-  }
-  return(shdcls[shdcnt-1]);
-}
diff --git a/ppl/tmapadds/its_gksm.c b/ppl/tmapadds/its_gksm.c
index de4edbc..b1b9ca1 100644
--- a/ppl/tmapadds/its_gksm.c
+++ b/ppl/tmapadds/its_gksm.c
@@ -57,17 +57,13 @@
 /* *kob* 10/03 v553 - gcc v3.x needs wchar.h included */
 
 #include <wchar.h>
-
+#include "pplmem.h"
 #include "udposix.h"
 #include "gks_implem.h"
 
 
 /* its_gksm */
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-int its_gksm(int *wkid)
-#else
-int its_gksm_(int *wkid )
-#endif
+int FORTRAN(its_gksm)(int *wkid)
 {
   WS_STATE_PTR    ws;
   ws = OPEN_WSID((Gint) *wkid);
diff --git a/ppl/tmapadds/pplcmd_c.c b/ppl/tmapadds/pplcmd_c.c
index acfa28b..d61a485 100644
--- a/ppl/tmapadds/pplcmd_c.c
+++ b/ppl/tmapadds/pplcmd_c.c
@@ -59,21 +59,7 @@
    Get ppl_memory and pass it to pplcmd_f, which has all the original code.
  */
 
-void FORTRAN (pplcmd_c)(int*isi, int *icmdim, int *icmsze)
-
-/*******************/
-
+void FORTRAN(pplcmd_c)(int *isi, int *icmdim, int *icmsze)
 {
-/* The global pointer to PLOT+ memory is declared as extern here
-   (Defined in fermain_c.c)
-*/
-extern float *ppl_memory;
-
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-  pplcmd_f(isi, icmdim, icmsze, ppl_memory);
-#else
-  pplcmd_f_(isi, icmdim, icmsze, ppl_memory);
-#endif
-
-  return;
+  FORTRAN(pplcmd_f)(isi, icmdim, icmsze, ppl_memory);
 }
diff --git a/ppl/tmapadds/pplld_pts_envelope.c b/ppl/tmapadds/pplld_pts_envelope.c
index 7f72f7b..753347c 100644
--- a/ppl/tmapadds/pplld_pts_envelope.c
+++ b/ppl/tmapadds/pplld_pts_envelope.c
@@ -52,18 +52,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "pplmem.h"
-/*******************/
 
-/* The global pointer to PLOT+ memory is declared as extern here
-   (Defined in fermain_c.c)
-*/
-  extern float *ppl_memory; 
-  
 /* pplld_pts_envelope: this routine, called from FORTRAN, will check the
    memory available for plotting, allocate more if needed, and call pplld_pts.
  */
 
-void FORTRAN(pplld_pts_envelope)(int *npts,int *plot_mem_used) 
+void FORTRAN(pplld_pts_envelope)(int *npts, int *plot_mem_used)
 {  
 /* local variable declaration */
   int pmemsize;
@@ -75,9 +69,8 @@ void FORTRAN(pplld_pts_envelope)(int *npts,int *plot_mem_used)
 
   FORTRAN(get_ppl_memory_size)(&pmemsize);
 
-  if (*plot_mem_used > pmemsize) reallo_ppl_memory(plot_mem_used); 
-
-  FORTRAN(pplld_pts) (npts, ppl_memory);
+  if (*plot_mem_used > pmemsize)
+      reallo_ppl_memory(plot_mem_used); 
 
-return;
+  FORTRAN(pplld_pts)(npts, ppl_memory);
 }
diff --git a/ppl/tmapadds/pplldc_envelope.c b/ppl/tmapadds/pplldc_envelope.c
index 28dd288..97d6242 100644
--- a/ppl/tmapadds/pplldc_envelope.c
+++ b/ppl/tmapadds/pplldc_envelope.c
@@ -56,23 +56,9 @@
 #include <stdlib.h>
 #include "pplmem.h"
 
-/* The global pointer to PLOT+ memory is declared as extern here
-   (Defined in fermain_c.c)
-*/
-extern float *ppl_memory;
-
-#ifdef double_p
-void FORTRAN(pplldc_envelope)(int *k, double *z, int *mx, int *my,int *imn, int *imx,
-             int *jmn, int *jmx, double *pi, double *pj,int *nx1, int *ny1,
-			 double *xmin1, double *ymin1, double *dx1, double *dy1, 
-			 int *plot_mem_used)
-#else
-void FORTRAN(pplldc_envelope)(int *k, float *z, int *mx, int *my,int *imn, int *imx,
-             int *jmn, int *jmx, float *pi, float *pj,int *nx1, int *ny1,
-			 float *xmin1, float *ymin1, float *dx1, float *dy1, 
-			 int *plot_mem_used)
-#endif
-
+void FORTRAN(pplldc_envelope)(int *k, DFTYPE *z, int *mx, int *my,int *imn, int *imx,
+             int *jmn, int *jmx, DFTYPE *pi, DFTYPE *pj,int *nx1, int *ny1,
+             DFTYPE *xmin1, DFTYPE *ymin1, DFTYPE *dx1, DFTYPE *dy1, int *plot_mem_used)
 {  
 /* local variable declarations */
   int pmemsize;
@@ -85,9 +71,9 @@ void FORTRAN(pplldc_envelope)(int *k, float *z, int *mx, int *my,int *imn, int *
 
   FORTRAN(get_ppl_memory_size)(&pmemsize);
 
-  if (*plot_mem_used > pmemsize) reallo_ppl_memory(plot_mem_used); 
+  if (*plot_mem_used > pmemsize)
+      reallo_ppl_memory(plot_mem_used); 
 
-  FORTRAN(pplldc) (k, z, mx, my, imn, imx, jmn, jmx, pi, pj, nx1, ny1, 
-                   xmin1, ymin1, dx1, dy1, ppl_memory);
-return;
+  FORTRAN(pplldc)(k, z, mx, my, imn, imx, jmn, jmx, pi, pj, nx1, ny1, 
+                  xmin1, ymin1, dx1, dy1, ppl_memory);
 }
diff --git a/ppl/tmapadds/pplldv_envelope.c b/ppl/tmapadds/pplldv_envelope.c
index 336f2f1..e748b48 100644
--- a/ppl/tmapadds/pplldv_envelope.c
+++ b/ppl/tmapadds/pplldv_envelope.c
@@ -53,28 +53,10 @@
 #include <stdlib.h>
 #include "pplmem.h"
 
-
 /* pplldv_envelope: this routine, called from FORTRAN, calls pplldv with ppl_memory
  */
 
-#ifdef double_p
-void FORTRAN(pplldv_envelope)(int *K, double *Z, int *MX, int *MY, int *IMN,int *IMX,
-                              int *JMN,int *JMX)
-#else
-void FORTRAN(pplldv_envelope)(int *K, float *Z, int *MX, int *MY, int *IMN,int *IMX,
-                              int *JMN,int *JMX)
-
-#endif
-/*******************/
-
+void FORTRAN(pplldv_envelope)(int *K, DFTYPE *Z, int *MX, int *MY, int *IMN,int *IMX, int *JMN, int *JMX)
 {
-
-/* The global pointer to PLOT+ memory is declared as extern here
-   (Defined in fermain_c.c)
-*/
-  extern float *ppl_memory;
-
-  FORTRAN(pplldv) (K,Z,MX,MY,IMN,IMX,JMN,JMX,ppl_memory);
-
-  return;
+  FORTRAN(pplldv)(K,Z,MX,MY,IMN,IMX,JMN,JMX,ppl_memory);
 }
diff --git a/ppl/tmapadds/pplldx_envelope.c b/ppl/tmapadds/pplldx_envelope.c
index 5824ed1..1d190aa 100644
--- a/ppl/tmapadds/pplldx_envelope.c
+++ b/ppl/tmapadds/pplldx_envelope.c
@@ -53,26 +53,12 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "pplmem.h"
-/*******************/
 
-/* The global pointer to PLOT+ memory is declared as extern here
-   (Defined in fermain_c.c)
-*/
-  extern float *ppl_memory; 
-  
 /* pplldx_envelope: this routine, called from FORTRAN, will check the
    memory available for plotting, allocate more if needed, and call pplldx.
  */
 
-#ifdef double_p
-void FORTRAN(pplldx_envelope)(int *icode, double *xt, double *yt, int *npts,
-                              char *tstrt, char *tref, double *xdt, 
-							  int *plot_mem_used) 
-#else
-void FORTRAN(pplldx_envelope)(int *icode, float *xt, float *yt, int *npts,
-                              char *tstrt, char *tref, float *xdt, 
-							  int *plot_mem_used) 
-#endif
+void FORTRAN(pplldx_envelope)(int *icode, DFTYPE *xt, DFTYPE *yt, int *npts, char *tstrt, char *tref, DFTYPE *xdt, int *plot_mem_used) 
 {  
 /* local variable declaration */
   int pmemsize;
@@ -84,9 +70,8 @@ void FORTRAN(pplldx_envelope)(int *icode, float *xt, float *yt, int *npts,
 
   FORTRAN(get_ppl_memory_size)(&pmemsize);
 
-  if (*plot_mem_used > pmemsize) reallo_ppl_memory(plot_mem_used); 
+  if (*plot_mem_used > pmemsize)
+      reallo_ppl_memory(plot_mem_used); 
 
   FORTRAN(pplldx) (icode, xt, yt, npts, tstrt, tref, xdt, ppl_memory);
-
-return;
 }
diff --git a/ppl/tmapadds/reallo_envelope.c b/ppl/tmapadds/reallo_envelope.c
index f7f29e1..1de9742 100644
--- a/ppl/tmapadds/reallo_envelope.c
+++ b/ppl/tmapadds/reallo_envelope.c
@@ -50,13 +50,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "pplmem.h"
-/*******************/
 
-/* The global pointer to PLOT+ memory is declared as extern here
-   (Defined in fermain_c.c)
-*/
-  extern float *ppl_memory; 
-  
 /* reallo_envelope: this routine, called from FORTRAN, will check the
    memory available for plotting and allocate more if needed.
  */
@@ -72,7 +66,6 @@ void FORTRAN(reallo_envelope)(int *plot_mem_used)
 */
 
   FORTRAN(get_ppl_memory_size)(&pmemsize);
-  if (*plot_mem_used > pmemsize) reallo_ppl_memory(plot_mem_used); 
-
-return;
+  if (*plot_mem_used > pmemsize)
+      reallo_ppl_memory(plot_mem_used); 
 }
diff --git a/ppl/tmapadds/reallo_ppl_memory.c b/ppl/tmapadds/reallo_ppl_memory.c
index 219ef3f..1eceaf2 100644
--- a/ppl/tmapadds/reallo_ppl_memory.c
+++ b/ppl/tmapadds/reallo_ppl_memory.c
@@ -34,7 +34,7 @@
 
 NOTE: Needs error checking to see that the realloc actually worked.
 
-/* reallo_ppl_memory.c
+ * reallo_ppl_memory.c
 
    Enlarge the memory allocated to the PLOT+ buffer.
    Ferret v5.52 *acm* 6/5/04 fix typo in print statement 
@@ -47,12 +47,7 @@ NOTE: Needs error checking to see that the realloc actually worked.
 #include <stdio.h>
 #include <stdlib.h>
 #include "pplmem.h"
-
-/* The global pointer to PLOT+ memory is declared as extern here
-   (Defined in fermain_c.c)
-*/
-  extern float *ppl_memory; 
-  
+#include "FerMem.h"  /* for FerMem_ functions */
 
 void reallo_ppl_memory(int *this_size)
 {
@@ -66,18 +61,18 @@ void reallo_ppl_memory(int *this_size)
 
 /* free the currently allocated memory */
   if (current_size != 0)
-      free ( (void *) ppl_memory );
+      FerMem_Free(ppl_memory, __FILE__, __LINE__);
 /* allocate new ammount of memory */
-  ppl_memory = (float *) malloc(sizeof(float) * *this_size );
+  ppl_memory = (float *) FerMem_Malloc(sizeof(float) * *this_size, __FILE__, __LINE__);
 
 /* Check that the memory was allocated OK*/
 
-  if ( ppl_memory == (float *)0 ) {
-    printf("Unable to allocate the requested %d words of PLOT memory.\n",*this_size);
-    exit(0);
-   }
+  if ( ppl_memory == NULL ) {
+      printf("Unable to allocate the requested %d words of PLOT memory.\n",*this_size);
+      exit(0);
+  }
 /* save the size of what was allocated */
-  FORTRAN(save_ppl_memory_size) (this_size);
+  FORTRAN(save_ppl_memory_size)(this_size);
 
   return;
 }
diff --git a/ppl/tmapadds/resize_xgks_window.c b/ppl/tmapadds/resize_xgks_window.c
index 1a22091..be573cc 100644
--- a/ppl/tmapadds/resize_xgks_window.c
+++ b/ppl/tmapadds/resize_xgks_window.c
@@ -60,41 +60,22 @@
 /* *kob* 10/03 v553 - gcc v3.x needs wchar.h included */
 
 #include <wchar.h>
-#include "udposix.h"
-#include "gks_implem.h"
-#include "cgm/cgm.h"
-#include "cgm/cgm_implem.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <time.h> 
+#include "udposix.h"
+#include "gks_implem.h"
+#include "cgm/cgm.h"
+#include "cgm/cgm_implem.h"
+#include "pplmem.h"
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-resize_xgks_window (ws_id, x, y, ix, iy)
-#else
-resize_xgks_window_ (ws_id, x, y, ix, iy)
-#endif
-
-Gint *ws_id;
-float *x;
-float *y;
-int   *ix,*iy;
-
+void FORTRAN(resize_xgks_window)(int *ws_id, float *x, float *y, int *ix, int *iy)
 {
   WS_STATE_ENTRY *ws;
-
-  Display       **dpy;
-  Window         *win;
-  GC             *gc;
-
-  XEvent          evnt;
-  Gint            val;
   Gpoint          size;
-
   float           xf,yf,aspect;
-
-  int             xw_event,scr; 
-  time_t          t0,t_now,*tp;
+  int             scr; 
 
 /*****************************************************************************/
 
@@ -127,17 +108,6 @@ int   *ix,*iy;
   if (ws){
     if (ws->ewstype == X_WIN && ws->dpy){
       XResizeWindow (ws->dpy,ws->win,*ix,*iy);
-      tp = &t_now;
-      t0 = time(0);
-  
-/*
- *    do { 
- *    xw_event = XCheckWindowEvent (ws->dpy,ws->win,StructureNotifyMask,&evnt);
- *     time (tp);
- *   } while (xw_event && (t_now - t0 < 3));
- *
- */
-
     } else if (ws->ewstype == MO){
       int type = ws->mf.cgmo->type;
       if (type == MF_GIF){
diff --git a/ppl/tmapadds/set_background.c b/ppl/tmapadds/set_background.c
index e94db2d..fbd8589 100644
--- a/ppl/tmapadds/set_background.c
+++ b/ppl/tmapadds/set_background.c
@@ -51,30 +51,17 @@
 /* *kob* 10/03 v553 - gcc v3.x needs wchar.h included */
 
 #include <wchar.h>
-#include "udposix.h"
-#include "gks_implem.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include "udposix.h"
+#include "gks_implem.h"
+#include "pplmem.h"
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-set_background (ws_id, ndx)
-#else
-set_background_ (ws_id, ndx)
-#endif
-Gint *ws_id; 
-int *ndx;
-
+void FORTRAN(set_background)(int *ws_id, int *ndx)
 {
   WS_STATE_ENTRY *ws;
-
-  Display **dpy;
-  Window   *win;
-  GC        *gc;
-
-  Gint            val;
   int             scr;
-  int             stat;
 
 /****************************************************************************/
 
@@ -89,7 +76,3 @@ int *ndx;
   }
 }
 
-
-
-
-
diff --git a/ppl/tmapadds/wait_on_resize.c b/ppl/tmapadds/wait_on_resize.c
index 8bedf96..b029bb8 100644
--- a/ppl/tmapadds/wait_on_resize.c
+++ b/ppl/tmapadds/wait_on_resize.c
@@ -48,38 +48,24 @@
 /* *kob* 10/03 v553 - gcc v3.x needs wchar.h included */
 
 #include <wchar.h>
-#include "udposix.h"
-#include "gks_implem.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <time.h> 
+#include "udposix.h"
+#include "gks_implem.h"
+#include "pplmem.h"
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-wait_on_resize (ws_id)
-#else
-wait_on_resize_ (ws_id)
-#endif
-
-Gint *ws_id;
-
+void FORTRAN(wait_on_resize)(int *ws_id)
 {
   WS_STATE_ENTRY *ws;
-
-  Display       **dpy;
-  Window         *win;
-  GC             *gc;
-
   XEvent          evnt;
-
-  int             xw_event,scr; 
+  int             xw_event; 
   time_t          t0,t_now,*tp;
 
 /*****************************************************************************/
 
   ws  = OPEN_WSID (*ws_id);
-  scr = DefaultScreen (ws->dpy);
-
   tp = &t_now;
   t0 = time(0);
   do { 
diff --git a/ppl/tmapadds/xgks_x_events.c b/ppl/tmapadds/xgks_x_events.c
index b9d259b..4d7661c 100644
--- a/ppl/tmapadds/xgks_x_events.c
+++ b/ppl/tmapadds/xgks_x_events.c
@@ -34,19 +34,22 @@
 *
 */
 
-
-
 /* Routine to get waiting X events processed in xgks.  Called by
  * process_x_events, written when Solaris install failed to resize
  *
  * J Davison 3.8.94
  */
 
-#ifdef NO_ENTRY_NAME_UNDERSCORES
-xgks_x_events ()
-#else
-xgks_x_events_ ()
-#endif
+#include <wchar.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h> 
+#include "udposix.h"
+#include "gks_implem.h"
+#include "pplmem.h"
+
+void FORTRAN(xgks_x_events)(void)
 {
-  xProcessEvents ();
+    xProcessEvents();
 }
diff --git a/site_specific.mk b/site_specific.mk
deleted file mode 100644
index 7bb1f73..0000000
--- a/site_specific.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-## Site-dependent definitions included in Makefiles
-
-## !!! Also check external_functions/ef_utility/site_specific.mk !!!
-
-## Machine for which to build Ferret
-## Use $(HOSTTYPE) to build natively for the machine you are using
-# BUILDTYPE	= $(HOSTTYPE)
-BUILDTYPE	= x86_64-linux
-# BUILDTYPE	= i386-linux
-# BUILDTYPE	= i386-apple-darwin
-# BUILDTYPE	= intel-mac
-
-## Installation directory for built Ferret.  Using the "install"
-## Makefile target circumvents the need to create the fer_*.tar.gz
-## files just for creating a Ferret installation.
-INSTALL_FER_DIR = $(HOME)/ferret_distributions/rhel6_64
-# INSTALL_FER_DIR = $(FER_DIR)
-
-## Installation directory for HDF5 static libraries
-## (contains include and lib or lib64 subdirectories)
-# HDF5_DIR	= /usr
-# HDF5_DIR	= /usr/local
-# HDF5_DIR	= /usr/local/hdf5-1.8.18
-HDF5_DIR	= /usr/local/hdf5-1.8.18-64
-# HDF5_DIR	= /usr/local/hdf5-1.8.18-32
-
-## Installation directory for NetCDF static libraries
-## (contains include and lib or lib64 subdirectories)
-# NETCDF4_DIR	= /usr
-# NETCDF4_DIR	= /usr/local
-# NETCDF4_DIR	= /usr/local/netcdf-4.4.1.1
-NETCDF4_DIR	= /usr/local/netcdf-4.4.1.1-64
-# NETCDF4_DIR	= /usr/local/netcdf-4.4.1.1-32
-
-## Installation directory for readline static libraries
-## (contains include and lib or lib64 subdirectories)
-# READLINE_DIR	= /
-READLINE_DIR	= /usr
-# READLINE_DIR	= /usr/local
-
-## Java home directory - this may be predefined
-## from your shell environment.  If JAVA_HOME is defined,
-## $(JAVA_HOME)/bin/javac and $(JAVA_HOME)/bin/jar is
-## called to build threddsBrowser.jar; otherwise, 
-## threddsBrowser.jar is not built and the Ferret command
-## SET DATA /BROWSE (or the alias OPEN) will not work.
-# JAVA_HOME	= /usr/java/latest
-# JAVA_HOME	= /usr/lib/jvm/java-oracle
-# JAVA_HOME	= /usr/lib/jvm/java-sun
-JAVA_HOME	= /usr/lib/jvm/java
-# JAVA_HOME	= /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
-
-##
diff --git a/site_specific.mk.in b/site_specific.mk.in
new file mode 100644
index 0000000..7c0af97
--- /dev/null
+++ b/site_specific.mk.in
@@ -0,0 +1,84 @@
+## Site-dependent definitions included in Makefiles
+
+## !!! Also check external_functions/ef_utility/site_specific.mk !!!
+
+##
+## Full path name of the directory containing this file (the ferret root directory).
+## Do not use $(shell pwd) since this is included in Makefiles in other directories.
+##
+# DIR_PREFIX = $(HOME)/build/trunk/FERRET
+DIR_PREFIX = $(HOME)/git/Ferret
+# DIR_PREFIX = $(HOME)/svn/ferret
+
+##
+## Machine for which to build Ferret
+## Use $(HOSTTYPE) to build natively for the machine you are using
+##
+# BUILDTYPE	= $(HOSTTYPE)
+BUILDTYPE	= x86_64-linux
+# BUILDTYPE	= i386-linux
+# BUILDTYPE	= intel-mac
+
+##
+## Installation directory for built Ferret.  Using the "install"
+## Makefile target circumvents the need to create the fer_*.tar.gz
+## files just for creating a Ferret installation.
+##
+# INSTALL_FER_DIR = $(HOME)/ferret_distributions/rhel6_64
+# INSTALL_FER_DIR = $(HOME)/Ferret32
+INSTALL_FER_DIR = $(HOME)/Ferret64
+# INSTALL_FER_DIR = $(FER_DIR)
+
+##
+## Installation directory for HDF5 static libraries
+## (contains include and lib or lib64 subdirectories)
+##
+# HDF5_DIR	= /usr
+# HDF5_DIR	= /usr/local
+# HDF5_DIR	= /usr/local/hdf5-1.8.18
+HDF5_DIR	= /usr/local/hdf5-1.8.18-64
+# HDF5_DIR	= /usr/local/hdf5-1.8.18-32
+
+##
+## Installation directory for NetCDF static libraries
+## (contains include and lib or lib64 subdirectories)
+##
+# NETCDF4_DIR	= /usr
+# NETCDF4_DIR	= /usr/local
+# NETCDF4_DIR	= /usr/local/netcdf-4.4.1.1
+NETCDF4_DIR	= /usr/local/netcdf-4.4.1.1-64
+# NETCDF4_DIR	= /usr/local/netcdf-4.4.1.1-32
+
+##
+## If the readline provided by the system is not actually GNU readline 
+## (e.g.; on Mac, where it is actually editline), it may not have the
+## ability to specify a function to repeatedly call while waiting for 
+## user input (the rl_event_hook).  Ferret uses this ability to keep 
+## plot windows refreshed and responsive, so in this case, an actual 
+## GNU readline (and history) static library must be built and installed. 
+## The installation directory (contains the subdirectories "include" 
+## and "lib") should then be specified here and these libraries will 
+## be statically linked in.
+##
+## If the readline provided by the system does provide this required 
+## functionality (i.e; is GNU readline, which is the case for most 
+## Linux systems), do not define this value (or leave it blank).
+## In this case the system readline and history libraries will be 
+## used (dynamically linked in).
+##
+# READLINE_DIR = /usr/local/Cellar/readline/7.0.3_1
+
+##
+## Java home directory - this may be already defined from your shell 
+## environment.  If JAVA_HOME is defined, $(JAVA_HOME)/bin/javac and 
+## $(JAVA_HOME)/bin/jar is called to build threddsBrowser.jar; 
+## otherwise, threddsBrowser.jar is not built and the Ferret command
+## SET DATA /BROWSE (or the alias OPEN) will not work.
+##
+# JAVA_HOME	= /usr/java/latest
+# JAVA_HOME	= /usr/lib/jvm/java-oracle
+# JAVA_HOME	= /usr/lib/jvm/java-sun
+JAVA_HOME	= /usr/lib/jvm/java
+# JAVA_HOME	= /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
+
+##
diff --git a/xgks/CUSTOMIZE.i386-apple-darwin b/xgks/CUSTOMIZE.i386-apple-darwin
deleted file mode 100644
index 1d8f33c..0000000
--- a/xgks/CUSTOMIZE.i386-apple-darwin
+++ /dev/null
@@ -1,39 +0,0 @@
-# This file is for customizing the configuation process performed by
-# `./configuration'.  This file consists of sh(1) variable-definition lines.
-# The value given to those variable by this file will override their default
-# values.
-#
-# You can also customize the configuration process via the environment
-# variables seen by ./configure.  For example:
-#
-#     In csh(1):
-#	  % setenv CC acc
-#	  & setenv CFLAGS -g
-#	  % ./configure
-#
-#     In sh(1):
-#	  $ CC=acc CFLAGS=-g ./configure
-#
-# Variables in this file override the environmental ones.
-#
-#############################################################################
-#
-# Type of C compiler (default is `cc'):
-CC='gcc'
-#
-# C compiler flags (default is `-O'):
-CFLAGS='-O2'
-#
-# C preprocessor flags (default is `-DNDEBUG'):
-CPPFLAGS='-DNDEBUG'
-#
-# Installation prefix (default is `../..'):
-prefix=..
-
-FC='gfortran'
-FFLAGS='-O2 -fno-second-underscore -fno-backslash -fdollar-ok -ffixed-line-length-132 -ffast-math'
-
-OS=macosx
-
-LD_X11='-L/usr/X11R6/lib -lX11'
-
diff --git a/xgks/CUSTOMIZE.intel-mac b/xgks/CUSTOMIZE.intel-mac
index d0f8398..08c0321 100644
--- a/xgks/CUSTOMIZE.intel-mac
+++ b/xgks/CUSTOMIZE.intel-mac
@@ -19,7 +19,7 @@
 #############################################################################
 #
 # Type of C compiler (default is `cc'):
-CC='gcc-6'
+CC='gcc-7'
 #
 # C compiler flags (default is `-O'):
 CFLAGS='-O -I/usr/X11/include'
@@ -32,7 +32,7 @@ CPPFLAGS='-DNDEBUG'
 # Installation prefix (default is `../..'):
 prefix=..
 
-FC='gfortran-6'
+FC='gfortran-7'
 FFLAGS='-O2 -fno-second-underscore -fno-backslash -fdollar-ok -ffixed-line-length-132 -ffast-math'
 # FFLAGS='-O0 -g -fno-second-underscore -fno-backslash -fdollar-ok -ffixed-line-length-132 -ffast-math'
 
diff --git a/xgks/Makefile.in b/xgks/Makefile.in
index 8a7590b..97f596c 100644
--- a/xgks/Makefile.in
+++ b/xgks/Makefile.in
@@ -1,6 +1,6 @@
 # Root Makefile for the XGKS package.
 #
-# $Id: Makefile.in 12472 2011-07-23 01:19:45Z ksmith $
+# $Id$
 
 PACKAGE		= xgks
 
diff --git a/xgks/configure.in b/xgks/configure.in
index 2101d00..f330853 100644
--- a/xgks/configure.in
+++ b/xgks/configure.in
@@ -1,4 +1,4 @@
-dnl $Id: configure.in 6358 1998-09-01 17:32:40Z tmap $
+dnl $Id$
 dnl
 dnl Process this file with GNU autoconf(1) to produce a configure script.
 dnl
diff --git a/xgks/doc/Makefile.in b/xgks/doc/Makefile.in
index d49ec4a..cced22f 100644
--- a/xgks/doc/Makefile.in
+++ b/xgks/doc/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 #
 # Makefile for the "doc" subdirectory of the XGKS package.
 
diff --git a/xgks/doc/binding/Makefile.in b/xgks/doc/binding/Makefile.in
index 131d56b..800e5ab 100644
--- a/xgks/doc/binding/Makefile.in
+++ b/xgks/doc/binding/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 #
 # Makefile for the "doc/binding" subdirectory of the XGKS package.
 
diff --git a/xgks/doc/binding/mkcbinding b/xgks/doc/binding/mkcbinding
index ac6186a..1d7cdda 100755
--- a/xgks/doc/binding/mkcbinding
+++ b/xgks/doc/binding/mkcbinding
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: mkcbinding 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 # $__Header$
 
 function_list=$1
diff --git a/xgks/doc/userdoc/Makefile.in b/xgks/doc/userdoc/Makefile.in
index e1fa11d..59fdcca 100644
--- a/xgks/doc/userdoc/Makefile.in
+++ b/xgks/doc/userdoc/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 #
 # Makefile for the "doc/userdoc" subdirectory of the XGKS package.
 
diff --git a/xgks/doc/xgks.3src1 b/xgks/doc/xgks.3src1
index b9ebec4..cd33ba8 100644
--- a/xgks/doc/xgks.3src1
+++ b/xgks/doc/xgks.3src1
@@ -1,4 +1,4 @@
-''' $Id: xgks.3src1 6358 1998-09-01 17:32:40Z tmap $
+''' $Id$
 .TH XGKS 3 "23 July 1991" "XGKS Version 2"
 .SH NAME
 XGKS - A GKS library for the X Window System
diff --git a/xgks/fontdb/Makefile.in b/xgks/fontdb/Makefile.in
index 5d7ddca..53fb97b 100644
--- a/xgks/fontdb/Makefile.in
+++ b/xgks/fontdb/Makefile.in
@@ -1,6 +1,6 @@
 # Makefile for the XGKS fonts.
 #
-# $Id: Makefile.in 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 
 DEFINES		= 
 INCLUDES	= -I../src/lib -I../port
diff --git a/xgks/fontdb/mkfont.c b/xgks/fontdb/mkfont.c
index d2e28e8..b9c4eb1 100644
--- a/xgks/fontdb/mkfont.c
+++ b/xgks/fontdb/mkfont.c
@@ -49,7 +49,7 @@
     static void lint_malloc(n) size_t n; { n++; }
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
-    static char     rcsid[] = "$Id: mkfont.c 19905 2015-07-01 00:25:30Z ksmith $";
+    static char     rcsid[] = "$Id$";
     static char     afsid[] = "$__Header$";
 #endif
 
@@ -372,7 +372,7 @@ ReadVFont(argc, argv)
 	    break;
 	case 'C':
 	    sp++;
-	    sp[strlen(sp) - 1] = NULL;		/* past the space & null */
+	    sp[strlen(sp) - 1] = '\0';		/* past the space & null */
 	    /* (void)fprintf(stdout,"Character name = %s\n",sp); */
 	    BeginChar(sp);
 	    break;
diff --git a/xgks/include/gif/gif.h b/xgks/include/gif/gif.h
index 43ebed9..a9d1fce 100644
--- a/xgks/include/gif/gif.h
+++ b/xgks/include/gif/gif.h
@@ -21,78 +21,78 @@
  *
  * PostScript driver for XGKS metafiles
  * Created by Joe Sirott, Pacific Marine Environmental Lab
- * $Id: gif.h 6154 1997-08-22 01:18:23Z sirott $
+ * $Id$
  */
 
 
 #ifndef XGKS_GIF_H
 #define XGKS_GIF_H
 
-extern int GIFrecSize	PROTO((
+extern int GIFrecSize(
     Gint            type
-));
-extern int GIFnextItem	PROTO((
+);
+extern int GIFnextItem(
     Metafile	*mf		/* Metafile structure */
-));
-extern int GIFwriteItem	PROTO((
+);
+extern int GIFwriteItem(
     Metafile      **mf,		/* Metafile structures */
     int             num,	/* Number of Metafiles */
     Gint	    type,	/* item type */
     Gint	    length,	/* item length */
     Gchar          *data	/* item data-record */
-));
-extern int GIFreadItem	PROTO((
+);
+extern int GIFreadItem(
     Metafile	*mf,		/* Metafile structure  */
     char        *record	/* input data-record */
-));
-extern int GIFmiOpen	PROTO((
+);
+extern int GIFmiOpen(
     Metafile	*mf		/* Metafile structure */
-));
-extern int GIFmoOpen	PROTO((
+);
+extern int GIFmoOpen(
     WS_STATE_PTR ws
-));
-extern int GIFmoClose	PROTO((
+);
+extern int GIFmoClose(
     Metafile	*mf
-));
-extern int GIFclear	PROTO((
+);
+extern int GIFclear(
     Metafile	*mf,
     int		num,
     Gclrflag	flag
-));
-extern int GIFredrawAllSeg	PROTO((
+);
+extern int GIFredrawAllSeg(
     Metafile	**mf,
     int		num
-));
-extern int GIFupdate	PROTO((
+);
+extern int GIFupdate(
     Metafile	**mf,
     int		num,
     Gregen	regenflag
-));
-extern int GIFdefer	PROTO((
+);
+extern int GIFdefer(
     Metafile	**mf,
     int		num,
     Gdefmode	defer_mode,
     Girgmode	regen_mode
-));
-extern int GIFmessage	PROTO((
+);
+extern int GIFmessage(
     Metafile	**mf,
     int		num,
     Gchar	*string
-));
-extern int GIFoutputGraphic	PROTO((
+);
+extern int GIFoutputGraphic(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	num_pt,
     Gpoint	*pos
-));
-extern int GIFtext	PROTO((
+);
+extern int GIFtext(
     Metafile	*mf,
     int		num,
     Gpoint	*at,
     Gchar	*string
-));
-extern int GIFcellArray	PROTO((
+);
+extern int GIFcellArray(
     Metafile	*mf,
     int		num,
     Gpoint	*ll,
@@ -101,62 +101,62 @@ extern int GIFcellArray	PROTO((
     Gint	row,
     Gint	*colour,
     Gipoint	*dim
-));
-extern int GIFsetGraphSize	PROTO((
+);
+extern int GIFsetGraphSize(
     Metafile	*mf,
     int		num,
     Gint	code,
     double	size
-));
-extern int GIFcloseSeg	PROTO((
+);
+extern int GIFcloseSeg(
     Metafile	*mf,
     int		num
-));
-extern int GIFsetGraphAttr	PROTO((
+);
+extern int GIFsetGraphAttr(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	attr
-));
-extern int GIFsetTextFP	PROTO((
+);
+extern int GIFsetTextFP(
     Metafile	*mf,
     int		num,
     Gtxfp	*txfp
-));
-extern int GIFsetCharUp	PROTO((
+);
+extern int GIFsetCharUp(
     Metafile	*mf,
     int		num,
     Gpoint	*up,
     Gpoint	*base
-));
-extern int GIFsetTextPath	PROTO((
+);
+extern int GIFsetTextPath(
     Metafile	*mf,
     int		num,
     Gtxpath	path
-));
-extern int GIFsetTextAlign	PROTO((
+);
+extern int GIFsetTextAlign(
     Metafile	*mf,
     int		num,
     Gtxalign	*align
-));
-extern int GIFsetFillStyle	PROTO((
+);
+extern int GIFsetFillStyle(
     Metafile	*mf,
     int		num,
     Gflinter	style
-));
-extern int GIFsetPatSize	PROTO((
+);
+extern int GIFsetPatSize(
     Metafile	*mf,
     int		num
-));
-extern int GIFsetPatRefpt	PROTO((
+);
+extern int GIFsetPatRefpt(
     Metafile	*mf,
     int		num
-));
-extern int GIFsetAsf	PROTO((
+);
+extern int GIFsetAsf(
     Metafile	*mf,
     int		num
-));
-extern int GIFsetLineMarkRep	PROTO((
+);
+extern int GIFsetLineMarkRep(
     Metafile	*mf,
     int		num,
     Gint	code,
@@ -164,84 +164,84 @@ extern int GIFsetLineMarkRep	PROTO((
     Gint	type,
     double	size,
     Gint	colour
-));
-extern int GIFsetTextRep	PROTO((
+);
+extern int GIFsetTextRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gtxbundl	*rep
-));
-extern int GIFsetFillRep	PROTO((
+);
+extern int GIFsetFillRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gflbundl	*rep
-));
-extern int GIFsetPatRep	PROTO((
+);
+extern int GIFsetPatRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gptbundl	*rep
-));
-extern int GIFsetColRep	PROTO((
+);
+extern int GIFsetColRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gcobundl	*rep
-));
-extern int GIFsetClip	PROTO((
+);
+extern int GIFsetClip(
     Metafile	*mf,
     int		num,
     Glimit	*rect
-));
-extern int GIFsetLimit	PROTO((
+);
+extern int GIFsetLimit(
     Metafile	*mf,
     int		num,
     Gint	code,
     Glimit	*rect
-));
-extern int GIFrenameSeg	PROTO((
+);
+extern int GIFrenameSeg(
     Metafile	*mf,
     int		num,
     Gint	old,
     Gint	new
-));
-extern int GIFsetSegTran	PROTO((
+);
+extern int GIFsetSegTran(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gfloat	matrix[2][3]
-));
-extern int GIFsetSegAttr	PROTO((
+);
+extern int GIFsetSegAttr(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gint	code,
     Gint	attr
-));
-extern int GIFsetSegVis	PROTO((
+);
+extern int GIFsetSegVis(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegvis	vis
-));
-extern int GIFsetSegHilight	PROTO((
+);
+extern int GIFsetSegHilight(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gseghi	hilight
-));
-extern int GIFsetSegPri	PROTO((
+);
+extern int GIFsetSegPri(
     Metafile	*mf,
     int		num,
     Gint	name,
     double	pri
-));
-extern int GIFsetSegDetect	PROTO((
+);
+extern int GIFsetSegDetect(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegdet	det
-));
+);
 
 #endif	/* XGKS_PS_H not defined */
diff --git a/xgks/include/ps/ps.h b/xgks/include/ps/ps.h
index 39a7bc4..1a6bceb 100644
--- a/xgks/include/ps/ps.h
+++ b/xgks/include/ps/ps.h
@@ -20,7 +20,7 @@
  * SOFTWARE.
  * PostScript driver for XGKS metafiles
  * Created by Joe Sirott, Pacific Marine Environmental Lab
- * $Id: ps.h 6154 1997-08-22 01:18:23Z sirott $
+ * $Id$
  */
 
 
@@ -28,71 +28,71 @@
 #define XGKS_PS_H
 
 
-extern int PSrecSize	PROTO((
+extern int PSrecSize(
     Gint            type
-));
-extern int PSnextItem	PROTO((
+);
+extern int PSnextItem(
     Metafile	*mf		/* Metafile structure */
-));
-extern int PSwriteItem	PROTO((
+);
+extern int PSwriteItem(
     Metafile      **mf,		/* Metafile structures */
     int             num,	/* Number of Metafiles */
     Gint	    type,	/* item type */
     Gint	    length,	/* item length */
     Gchar          *data	/* item data-record */
-));
-extern int PSreadItem	PROTO((
+);
+extern int PSreadItem(
     Metafile	*mf,		/* Metafile structure  */
     char        *record	/* input data-record */
-));
-extern int PSmiOpen	PROTO((
+);
+extern int PSmiOpen(
     Metafile	*mf		/* Metafile structure */
-));
-extern int PSmoOpen	PROTO((
+);
+extern int PSmoOpen(
     WS_STATE_PTR ws
-));
-extern int PSmoClose	PROTO((
+);
+extern int PSmoClose(
     Metafile	*mf
-));
-extern int PSclear	PROTO((
+);
+extern int PSclear(
     Metafile	*mf,
     int		num,
     Gclrflag	flag
-));
-extern int PSredrawAllSeg	PROTO((
+);
+extern int PSredrawAllSeg(
     Metafile	**mf,
     int		num
-));
-extern int PSupdate	PROTO((
+);
+extern int PSupdate(
     Metafile	**mf,
     int		num,
     Gregen	regenflag
-));
-extern int PSdefer	PROTO((
+);
+extern int PSdefer(
     Metafile	**mf,
     int		num,
     Gdefmode	defer_mode,
     Girgmode	regen_mode
-));
-extern int PSmessage	PROTO((
+);
+extern int PSmessage(
     Metafile	**mf,
     int		num,
     Gchar	*string
-));
-extern int PSoutputGraphic	PROTO((
+);
+extern int PSoutputGraphic(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	num_pt,
     Gpoint	*pos
-));
-extern int PStext	PROTO((
+);
+extern int PStext(
     Metafile	*mf,
     int		num,
     Gpoint	*at,
     Gchar	*string
-));
-extern int PScellArray	PROTO((
+);
+extern int PScellArray(
     Metafile	*mf,
     int		num,
     Gpoint	*ll,
@@ -101,62 +101,62 @@ extern int PScellArray	PROTO((
     Gint	row,
     Gint	*colour,
     Gipoint	*dim
-));
-extern int PSsetGraphSize	PROTO((
+);
+extern int PSsetGraphSize(
     Metafile	*mf,
     int		num,
     Gint	code,
     double	size
-));
-extern int PScloseSeg	PROTO((
+);
+extern int PScloseSeg(
     Metafile	*mf,
     int		num
-));
-extern int PSsetGraphAttr	PROTO((
+);
+extern int PSsetGraphAttr(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	attr
-));
-extern int PSsetTextFP	PROTO((
+);
+extern int PSsetTextFP(
     Metafile	*mf,
     int		num,
     Gtxfp	*txfp
-));
-extern int PSsetCharUp	PROTO((
+);
+extern int PSsetCharUp(
     Metafile	*mf,
     int		num,
     Gpoint	*up,
     Gpoint	*base
-));
-extern int PSsetTextPath	PROTO((
+);
+extern int PSsetTextPath(
     Metafile	*mf,
     int		num,
     Gtxpath	path
-));
-extern int PSsetTextAlign	PROTO((
+);
+extern int PSsetTextAlign(
     Metafile	*mf,
     int		num,
     Gtxalign	*align
-));
-extern int PSsetFillStyle	PROTO((
+);
+extern int PSsetFillStyle(
     Metafile	*mf,
     int		num,
     Gflinter	style
-));
-extern int PSsetPatSize	PROTO((
+);
+extern int PSsetPatSize(
     Metafile	*mf,
     int		num
-));
-extern int PSsetPatRefpt	PROTO((
+);
+extern int PSsetPatRefpt(
     Metafile	*mf,
     int		num
-));
-extern int PSsetAsf	PROTO((
+);
+extern int PSsetAsf(
     Metafile	*mf,
     int		num
-));
-extern int PSsetLineMarkRep	PROTO((
+);
+extern int PSsetLineMarkRep(
     Metafile	*mf,
     int		num,
     Gint	code,
@@ -164,84 +164,84 @@ extern int PSsetLineMarkRep	PROTO((
     Gint	type,
     double	size,
     Gint	colour
-));
-extern int PSsetTextRep	PROTO((
+);
+extern int PSsetTextRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gtxbundl	*rep
-));
-extern int PSsetFillRep	PROTO((
+);
+extern int PSsetFillRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gflbundl	*rep
-));
-extern int PSsetPatRep	PROTO((
+);
+extern int PSsetPatRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gptbundl	*rep
-));
-extern int PSsetColRep	PROTO((
+);
+extern int PSsetColRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gcobundl	*rep
-));
-extern int PSsetClip	PROTO((
+);
+extern int PSsetClip(
     Metafile	*mf,
     int		num,
     Glimit	*rect
-));
-extern int PSsetLimit	PROTO((
+);
+extern int PSsetLimit(
     Metafile	*mf,
     int		num,
     Gint	code,
     Glimit	*rect
-));
-extern int PSrenameSeg	PROTO((
+);
+extern int PSrenameSeg(
     Metafile	*mf,
     int		num,
     Gint	old,
     Gint	new
-));
-extern int PSsetSegTran	PROTO((
+);
+extern int PSsetSegTran(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gfloat	matrix[2][3]
-));
-extern int PSsetSegAttr	PROTO((
+);
+extern int PSsetSegAttr(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gint	code,
     Gint	attr
-));
-extern int PSsetSegVis	PROTO((
+);
+extern int PSsetSegVis(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegvis	vis
-));
-extern int PSsetSegHilight	PROTO((
+);
+extern int PSsetSegHilight(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gseghi	hilight
-));
-extern int PSsetSegPri	PROTO((
+);
+extern int PSsetSegPri(
     Metafile	*mf,
     int		num,
     Gint	name,
     double	pri
-));
-extern int PSsetSegDetect	PROTO((
+);
+extern int PSsetSegDetect(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegdet	det
-));
+);
 
 #endif	/* XGKS_PS_H not defined */
diff --git a/xgks/port/Makefile.in b/xgks/port/Makefile.in
index b8ab19b..9eb70e9 100644
--- a/xgks/port/Makefile.in
+++ b/xgks/port/Makefile.in
@@ -1,6 +1,6 @@
 # This is the makefile for the Unidata portability package.
 #
-# $Id: Makefile.in 13368 2012-02-22 23:30:03Z ksmith $
+# $Id$
 
 PACKAGE		= udport
 LIBRARY		= udport
diff --git a/xgks/port/atexit.c b/xgks/port/atexit.c
index fa95a0d..dda8129 100644
--- a/xgks/port/atexit.c
+++ b/xgks/port/atexit.c
@@ -1,5 +1,5 @@
 /*
- * $Id: atexit.c 19905 2015-07-01 00:25:30Z ksmith $
+ * $Id$
  */
 
 /*LINTLIBRARY*/
diff --git a/xgks/port/configure.in b/xgks/port/configure.in
index 4a552a7..5233fac 100644
--- a/xgks/port/configure.in
+++ b/xgks/port/configure.in
@@ -1,4 +1,4 @@
-dnl $Id: configure.in 6358 1998-09-01 17:32:40Z tmap $
+dnl $Id$
 dnl
 dnl Process this file with GNU autoconf(1) to produce a configure script.
 dnl
diff --git a/xgks/port/fortc.fc b/xgks/port/fortc.fc
index aaa8f7c..9c2fa8b 100644
--- a/xgks/port/fortc.fc
+++ b/xgks/port/fortc.fc
@@ -1,5 +1,5 @@
 /*
- * $Id: fortc.fc 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  *
  * This file implements some support routines for FORTRAN-callable C
  * functions.
diff --git a/xgks/port/fortc.h b/xgks/port/fortc.h
index 4a28847..caafd74 100644
--- a/xgks/port/fortc.h
+++ b/xgks/port/fortc.h
@@ -1,5 +1,5 @@
 /*
- * $Id: fortc.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #ifndef UD_FORTC_H_INCLUDED
diff --git a/xgks/port/fortc/Makefile.in b/xgks/port/fortc/Makefile.in
index 0262708..c227cc0 100644
--- a/xgks/port/fortc/Makefile.in
+++ b/xgks/port/fortc/Makefile.in
@@ -1,6 +1,6 @@
 # This is the makefile for the Unidata FORTRAN-callable-C generator.
 #
-# $Id: Makefile.in 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 
 exec_prefix	= $(prefix)/bin
 BINFILES	= fortc
diff --git a/xgks/port/fortc/configure.in b/xgks/port/fortc/configure.in
index 9eac2b2..102d963 100644
--- a/xgks/port/fortc/configure.in
+++ b/xgks/port/fortc/configure.in
@@ -1,4 +1,4 @@
-dnl $Id: configure.in 6358 1998-09-01 17:32:40Z tmap $
+dnl $Id$
 dnl
 dnl Process this file with GNU autoconf(1) to produce a configure script.
 dnl
diff --git a/xgks/port/fortc/fortc.1 b/xgks/port/fortc/fortc.1
index 055ff38..2c25e6c 100644
--- a/xgks/port/fortc/fortc.1
+++ b/xgks/port/fortc/fortc.1
@@ -1,5 +1,5 @@
-\" $Id: fortc.1 6358 1998-09-01 17:32:40Z tmap $
-.TH fortc 1 "$Date: 1998-09-01 10:32:40 -0700 (Tue, 01 Sep 1998) $" "Printed: \n(yr-\n(mo-\n(dy" "UNIDATA UTILITIES"
+\" $Id$
+.TH fortc 1 "$Date$" "Printed: \n(yr-\n(mo-\n(dy" "UNIDATA UTILITIES"
 .SH NAME
 fortc \- Unidata utility to generate fortran-compatible C code
 .SH SYNOPSIS
diff --git a/xgks/port/fortc/fortc.src b/xgks/port/fortc/fortc.src
index 2b30221..65353e7 100755
--- a/xgks/port/fortc/fortc.src
+++ b/xgks/port/fortc/fortc.src
@@ -2,7 +2,7 @@
 # fortc - make C source file FORTRAN compatible
 # usage: fortc [-L LibDir] [-O OpSys] file
 #
-# $Id: fortc.src 6522 1999-03-10 01:34:55Z sirott $
+# $Id$
 
 
 #set -x
diff --git a/xgks/port/master.mk.in b/xgks/port/master.mk.in
index b98deeb..6bae61f 100644
--- a/xgks/port/master.mk.in
+++ b/xgks/port/master.mk.in
@@ -1,6 +1,6 @@
 # This is the master makefile.  It contains general rules.
 #
-# $Id: master.mk.in 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 
 
 .SUFFIXES:
diff --git a/xgks/port/sigaddset.c b/xgks/port/sigaddset.c
index 4f49b05..01ce32d 100644
--- a/xgks/port/sigaddset.c
+++ b/xgks/port/sigaddset.c
@@ -1,5 +1,5 @@
 /*
- * $Id: sigaddset.c 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #include "udposix.h"
diff --git a/xgks/port/sigdelset.c b/xgks/port/sigdelset.c
index ec0a4e9..8d90686 100644
--- a/xgks/port/sigdelset.c
+++ b/xgks/port/sigdelset.c
@@ -1,5 +1,5 @@
 /*
- * $Id: sigdelset.c 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #include "udposix.h"
diff --git a/xgks/port/sigemptyset.c b/xgks/port/sigemptyset.c
index aa9a82d..d5f7ec0 100644
--- a/xgks/port/sigemptyset.c
+++ b/xgks/port/sigemptyset.c
@@ -1,5 +1,5 @@
 /*
- * $Id: sigemptyset.c 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #include "udposix.h"
diff --git a/xgks/port/signal.h.in b/xgks/port/signal.h.in
index c129d7c..7366f61 100644
--- a/xgks/port/signal.h.in
+++ b/xgks/port/signal.h.in
@@ -1,5 +1,5 @@
 /*
- * $Id: signal.h.in 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #ifndef UD_signal_h
diff --git a/xgks/port/sigprocmask.c b/xgks/port/sigprocmask.c
index e8185a5..ab65380 100644
--- a/xgks/port/sigprocmask.c
+++ b/xgks/port/sigprocmask.c
@@ -1,5 +1,5 @@
 /*
- * $Id: sigprocmask.c 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  *
  * POSIX signal interface layered atop the native signal interface.
  */
diff --git a/xgks/port/sigsuspend.c b/xgks/port/sigsuspend.c
index 52f898a..fb7276a 100644
--- a/xgks/port/sigsuspend.c
+++ b/xgks/port/sigsuspend.c
@@ -1,5 +1,5 @@
 /*
- * $Id: sigsuspend.c 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #include "udposix.h"
diff --git a/xgks/port/stdarg.h.in b/xgks/port/stdarg.h.in
index 86de0e3..6d0fadd 100644
--- a/xgks/port/stdarg.h.in
+++ b/xgks/port/stdarg.h.in
@@ -1,5 +1,5 @@
 /*
- * $Id: stdarg.h.in 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #ifndef UD_stdarg_h
diff --git a/xgks/port/stddef.h.in b/xgks/port/stddef.h.in
index 6466bb6..edb045e 100644
--- a/xgks/port/stddef.h.in
+++ b/xgks/port/stddef.h.in
@@ -1,5 +1,5 @@
 /*
- * $Id: stddef.h.in 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #ifndef UD_stddef_h
diff --git a/xgks/port/stdlib.h.in b/xgks/port/stdlib.h.in
index ff9bf93..4fc5e2b 100644
--- a/xgks/port/stdlib.h.in
+++ b/xgks/port/stdlib.h.in
@@ -1,5 +1,5 @@
 /*
- * $Id: stdlib.h.in 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #ifndef UD_stdlib_h
diff --git a/xgks/port/strerror.c b/xgks/port/strerror.c
index e27b9fc..627899c 100644
--- a/xgks/port/strerror.c
+++ b/xgks/port/strerror.c
@@ -1,5 +1,5 @@
 /*
- * $Id: strerror.c 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 /*LINTLIBRARY*/
diff --git a/xgks/port/string.h.in b/xgks/port/string.h.in
index b1e9a0a..13f3730 100644
--- a/xgks/port/string.h.in
+++ b/xgks/port/string.h.in
@@ -1,5 +1,5 @@
 /*
- * $Id: string.h.in 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #ifndef UD_string_h
diff --git a/xgks/port/strstr.c b/xgks/port/strstr.c
index 3163fc3..8c594da 100644
--- a/xgks/port/strstr.c
+++ b/xgks/port/strstr.c
@@ -1,5 +1,5 @@
 /*
- * $Id: strstr.c 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 /*LINTLIBRARY*/
diff --git a/xgks/port/udalloc.h b/xgks/port/udalloc.h
index 59afd86..6025a29 100644
--- a/xgks/port/udalloc.h
+++ b/xgks/port/udalloc.h
@@ -1,5 +1,5 @@
 /*
- * $Id: udalloc.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 #ifndef UD_ALLOC_H_INCLUDED
diff --git a/xgks/port/udposix.h.in b/xgks/port/udposix.h.in
index 21f0f21..2554002 100644
--- a/xgks/port/udposix.h.in
+++ b/xgks/port/udposix.h.in
@@ -1,5 +1,5 @@
 /*
- * $Id: udposix.h.in 6522 1999-03-10 01:34:55Z sirott $
+ * $Id$
  *
  * Base udposix(3) configuration header file.
  */
diff --git a/xgks/progs/Makefile.in b/xgks/progs/Makefile.in
index 14ae387..1182544 100644
--- a/xgks/progs/Makefile.in
+++ b/xgks/progs/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in 12677 2011-09-07 22:08:54Z ksmith $
+# $Id$
 #
 # Makefile for the "demonstration programs" subdirectory of the XGKS package.
 # add tmapadds object files for linking *kob* 9/98
diff --git a/xgks/progs/demo.h b/xgks/progs/demo.h
index 27392de..d08e6d9 100644
--- a/xgks/progs/demo.h
+++ b/xgks/progs/demo.h
@@ -32,7 +32,7 @@
  * Author: Sung Hsien Ching Kelvin
  * Author: Yu Pan
  *
- * $Id: demo.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $Header$
  */
 
diff --git a/xgks/progs/font.c b/xgks/progs/font.c
index c3cfe6c..eabd9a2 100644
--- a/xgks/progs/font.c
+++ b/xgks/progs/font.c
@@ -34,7 +34,7 @@
  */
 
 #ifndef lint
-    static char rcsid[] = "$Id: font.c 6358 1998-09-01 17:32:40Z tmap $";
+    static char rcsid[] = "$Id$";
     static char afsid[] = "$__Header$";
 #endif
 
diff --git a/xgks/progs/gksdemo.f b/xgks/progs/gksdemo.f
index 77b1501..d7c41e9 100644
--- a/xgks/progs/gksdemo.f
+++ b/xgks/progs/gksdemo.f
@@ -20,7 +20,7 @@ C* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 C* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 C* SOFTWARE.
 C*
-C* $Id: gksdemo.f 6522 1999-03-10 01:34:55Z sirott $
+C* $Id$
 C*
 C*****
 C*****   Product:     graPHIGS GKS-CO Demonstration Program
diff --git a/xgks/progs/hanoi.c b/xgks/progs/hanoi.c
index 2ef1e27..74e071a 100644
--- a/xgks/progs/hanoi.c
+++ b/xgks/progs/hanoi.c
@@ -35,7 +35,7 @@
 
 #ifndef lint
 #   ifndef __SABER__
-	static char	rcsid[]	= "$Id: hanoi.c 6358 1998-09-01 17:32:40Z tmap $";
+	static char	rcsid[]	= "$Id$";
 	static char	afsid[]	= "$__Header$";
 #   endif
 #endif
diff --git a/xgks/progs/mi.c b/xgks/progs/mi.c
index c2ce37e..8366806 100644
--- a/xgks/progs/mi.c
+++ b/xgks/progs/mi.c
@@ -34,7 +34,7 @@
  */
 
 #ifndef lint
-    static char	rcsid[]	= "$Id: mi.c 6358 1998-09-01 17:32:40Z tmap $";
+    static char	rcsid[]	= "$Id$";
     static char	afsid[]	= "$__Header$";
 #endif
 
diff --git a/xgks/progs/pline.c b/xgks/progs/pline.c
index bc2ed36..23a5853 100644
--- a/xgks/progs/pline.c
+++ b/xgks/progs/pline.c
@@ -34,7 +34,7 @@
  */
 
 #ifndef lint
-    static char	rcsid[]	= "$Id: pline.c 19905 2015-07-01 00:25:30Z ksmith $";
+    static char	rcsid[]	= "$Id$";
     static char	afsid[]	= "$__Header$";
 #endif
 
diff --git a/xgks/progs/pmark.c b/xgks/progs/pmark.c
index 3044438..b5ab926 100644
--- a/xgks/progs/pmark.c
+++ b/xgks/progs/pmark.c
@@ -33,7 +33,7 @@
  * Author: Yu Pan
  */
 #ifndef lint
-    static char	rcsid[]	= "$Id: pmark.c 19905 2015-07-01 00:25:30Z ksmith $";
+    static char	rcsid[]	= "$Id$";
     static char	afsid[]	= "$__Header$";
 #endif
 
diff --git a/xgks/src/Makefile.in b/xgks/src/Makefile.in
index 417a91d..ec34bd8 100644
--- a/xgks/src/Makefile.in
+++ b/xgks/src/Makefile.in
@@ -1,6 +1,6 @@
 # Makefile for the XGKS library
 #
-# $Id: Makefile.in 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 
 SUBDIRS		= fortran lib
 SUBDIR_TARGETS	= fortran/all fortran/clean fortran/distclean \
diff --git a/xgks/src/fortran/Makefile.in b/xgks/src/fortran/Makefile.in
index 8942c55..1f77dd3 100644
--- a/xgks/src/fortran/Makefile.in
+++ b/xgks/src/fortran/Makefile.in
@@ -1,6 +1,6 @@
 # Makefile for the FORTRAN API to the XGKS library
 #
-# $Id: Makefile.in 12677 2011-09-07 22:08:54Z ksmith $
+# $Id$
 
 LIBNAME		= xgks
 REMOTE_LIBRARY	= ../lib/lib$(LIBNAME).a
diff --git a/xgks/src/fortran/control.fc b/xgks/src/fortran/control.fc
index 19a78f7..61e1539 100644
--- a/xgks/src/fortran/control.fc
+++ b/xgks/src/fortran/control.fc
@@ -64,7 +64,7 @@
 #   define	realloc(p,n)	(lint_realloc(p,n), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: control.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 /* 
diff --git a/xgks/src/fortran/error.fc b/xgks/src/fortran/error.fc
index fe99cd9..4515501 100644
--- a/xgks/src/fortran/error.fc
+++ b/xgks/src/fortran/error.fc
@@ -43,7 +43,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: error.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 extern int	error_lun;
diff --git a/xgks/src/fortran/escapes.fc b/xgks/src/fortran/escapes.fc
index 0daa3ef..d4f385d 100644
--- a/xgks/src/fortran/escapes.fc
+++ b/xgks/src/fortran/escapes.fc
@@ -53,7 +53,7 @@
 #   define	realloc(p,n)	(lint_realloc(p,n), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: escapes.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 /*
diff --git a/xgks/src/fortran/finqpixel.fc b/xgks/src/fortran/finqpixel.fc
index 4461cf2..c0f04a7 100644
--- a/xgks/src/fortran/finqpixel.fc
+++ b/xgks/src/fortran/finqpixel.fc
@@ -59,7 +59,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: finqpixel.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/fortmac.h b/xgks/src/fortran/fortmac.h
index 5e7fd61..de8b3c4 100644
--- a/xgks/src/fortran/fortmac.h
+++ b/xgks/src/fortran/fortmac.h
@@ -26,7 +26,7 @@
  * TCS Development
  * Cambridge MA
  *
- * $Id: fortmac.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/fortran/fortxgks.h b/xgks/src/fortran/fortxgks.h
index 932a9f9..69f4bc3 100644
--- a/xgks/src/fortran/fortxgks.h
+++ b/xgks/src/fortran/fortxgks.h
@@ -27,7 +27,7 @@
  *
  * May 30 1988
  *
- * $Id: fortxgks.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/fortran/fxgksvers.c b/xgks/src/fortran/fxgksvers.c
index cb465ef..64d49b5 100644
--- a/xgks/src/fortran/fxgksvers.c
+++ b/xgks/src/fortran/fxgksvers.c
@@ -1,3 +1,3 @@
 char *fxgksvers () {
-  return "$Id: fxgksvers.c 6358 1998-09-01 17:32:40Z tmap $";
+  return "$Id$";
 }
diff --git a/xgks/src/fortran/gerhnd.fc b/xgks/src/fortran/gerhnd.fc
index f5188a0..d36f0dd 100644
--- a/xgks/src/fortran/gerhnd.fc
+++ b/xgks/src/fortran/gerhnd.fc
@@ -32,7 +32,7 @@
  */
 
 #ifndef lint
-    static char	rcsid[]	= "$Id: gerhnd.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char	rcsid[]	= "$Id$";
     static char	afsid[] = "$__Header$";
 #endif
 
diff --git a/xgks/src/fortran/getlunname.fc b/xgks/src/fortran/getlunname.fc
index c66de2b..83e8a5c 100644
--- a/xgks/src/fortran/getlunname.fc
+++ b/xgks/src/fortran/getlunname.fc
@@ -6,7 +6,7 @@
 #include "fortxgks.h"
 
 #ifndef lint
-    static char	rcsid[]	= "$Id: getlunname.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char	rcsid[]	= "$Id$";
     static char afsid[]	= "$__Header$";
 #endif
 
diff --git a/xgks/src/fortran/inputevent.fc b/xgks/src/fortran/inputevent.fc
index da28b7d..ce8f882 100644
--- a/xgks/src/fortran/inputevent.fc
+++ b/xgks/src/fortran/inputevent.fc
@@ -38,7 +38,7 @@
  *
  * August 31 1988
  *
- * $Id: inputevent.fc 23929 2017-06-26 20:24:42Z ksmith $
+ * $Id$
  * $__Header$
  */
 
@@ -60,7 +60,7 @@
 #   define	realloc(p,n)	(lint_realloc(p,n), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inputevent.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 extern char    *forttext;
diff --git a/xgks/src/fortran/inputinit.fc b/xgks/src/fortran/inputinit.fc
index a03e0ab..e41af85 100644
--- a/xgks/src/fortran/inputinit.fc
+++ b/xgks/src/fortran/inputinit.fc
@@ -40,7 +40,7 @@
  *
  * August 31 1988
  *
- * $Id: inputinit.fc 23929 2017-06-26 20:24:42Z ksmith $
+ * $Id$
  * $__Header$
  */
 
@@ -60,7 +60,7 @@
 #   define	realloc(p,n)	(lint_realloc(p,n), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inputinit.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 extern int     *fortint;
diff --git a/xgks/src/fortran/inputmode.fc b/xgks/src/fortran/inputmode.fc
index 04f7444..665f778 100644
--- a/xgks/src/fortran/inputmode.fc
+++ b/xgks/src/fortran/inputmode.fc
@@ -37,7 +37,7 @@
  *
  * August 31 1988
  *
- * $Id: inputmode.fc 23929 2017-06-26 20:24:42Z ksmith $
+ * $Id$
  * $__Header$
  */
 
@@ -50,7 +50,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inputmode.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/inputreq.fc b/xgks/src/fortran/inputreq.fc
index c56f85e..45f9f60 100644
--- a/xgks/src/fortran/inputreq.fc
+++ b/xgks/src/fortran/inputreq.fc
@@ -38,7 +38,7 @@
  *
  * August 31 1988
  *
- * $Id: inputreq.fc 23929 2017-06-26 20:24:42Z ksmith $
+ * $Id$
  * $__Header$
  */
 
@@ -57,7 +57,7 @@
 #   define	realloc(p,n)	(lint_realloc(p,n), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inputreq.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 extern char    *forttext;
diff --git a/xgks/src/fortran/inputsamp.fc b/xgks/src/fortran/inputsamp.fc
index 7eecbdd..862507c 100644
--- a/xgks/src/fortran/inputsamp.fc
+++ b/xgks/src/fortran/inputsamp.fc
@@ -37,7 +37,7 @@
  *
  * August 31 1988
  *
- * $Id: inputsamp.fc 23929 2017-06-26 20:24:42Z ksmith $
+ * $Id$
  * $__Header$
  */
 
@@ -56,7 +56,7 @@
 #   define	realloc(p,n)	(lint_realloc(p,n), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inputsamp.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 extern char    *forttext;
diff --git a/xgks/src/fortran/inqerrlist.fc b/xgks/src/fortran/inqerrlist.fc
index 4339692..91b830c 100644
--- a/xgks/src/fortran/inqerrlist.fc
+++ b/xgks/src/fortran/inqerrlist.fc
@@ -44,7 +44,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqerrlist.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/inqgksdesc.fc b/xgks/src/fortran/inqgksdesc.fc
index 503da29..9857049 100644
--- a/xgks/src/fortran/inqgksdesc.fc
+++ b/xgks/src/fortran/inqgksdesc.fc
@@ -45,7 +45,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqgksdesc.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/inqgkslist.fc b/xgks/src/fortran/inqgkslist.fc
index 4d1b872..affca1f 100644
--- a/xgks/src/fortran/inqgkslist.fc
+++ b/xgks/src/fortran/inqgkslist.fc
@@ -78,7 +78,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqgkslist.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/inqlun.f b/xgks/src/fortran/inqlun.f
index d1242ad..52d364f 100644
--- a/xgks/src/fortran/inqlun.f
+++ b/xgks/src/fortran/inqlun.f
@@ -12,7 +12,7 @@ C Todd Gill
 C TCS Development
 C Cambridge MA
 C
-C $Id: inqlun.f 6358 1998-09-01 17:32:40Z tmap $
+C $Id$
 C $__Header$
 C
 C Return the name associated with a Fortran Logical Unit Number.
diff --git a/xgks/src/fortran/inqseglist.fc b/xgks/src/fortran/inqseglist.fc
index fd5d9fe..efd914f 100644
--- a/xgks/src/fortran/inqseglist.fc
+++ b/xgks/src/fortran/inqseglist.fc
@@ -44,7 +44,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqseglist.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/inqstate.fc b/xgks/src/fortran/inqstate.fc
index f0ea89a..ce4c49c 100644
--- a/xgks/src/fortran/inqstate.fc
+++ b/xgks/src/fortran/inqstate.fc
@@ -43,7 +43,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqstate.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/inqwsdesc.fc b/xgks/src/fortran/inqwsdesc.fc
index 815c372..b6102db 100644
--- a/xgks/src/fortran/inqwsdesc.fc
+++ b/xgks/src/fortran/inqwsdesc.fc
@@ -65,7 +65,7 @@
 #   define	malloc(n)	(lint_malloc(n), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqwsdesc.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 #define	FREE(p)		{ if ((p) != NULL) free((voidp) p); }
diff --git a/xgks/src/fortran/inqwslist.fc b/xgks/src/fortran/inqwslist.fc
index 421b7a3..5413d3f 100644
--- a/xgks/src/fortran/inqwslist.fc
+++ b/xgks/src/fortran/inqwslist.fc
@@ -61,7 +61,7 @@
 #   define	realloc(p,n)	(lint_realloc(p,n), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqwslist.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 #define GKS_FREE(p)	{ if ((p) != NULL) free((voidp) p); }
diff --git a/xgks/src/fortran/meta.fc b/xgks/src/fortran/meta.fc
index 78ebcf9..836c82c 100644
--- a/xgks/src/fortran/meta.fc
+++ b/xgks/src/fortran/meta.fc
@@ -45,7 +45,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: meta.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/output.fc b/xgks/src/fortran/output.fc
index b8d1580..033e1fc 100644
--- a/xgks/src/fortran/output.fc
+++ b/xgks/src/fortran/output.fc
@@ -56,7 +56,7 @@
 #   define	realloc(p,n)	(lint_realloc(p,n), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: output.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 extern int     *fortint;
diff --git a/xgks/src/fortran/pdrutils.h b/xgks/src/fortran/pdrutils.h
index eeb3ec0..10b885f 100644
--- a/xgks/src/fortran/pdrutils.h
+++ b/xgks/src/fortran/pdrutils.h
@@ -28,7 +28,7 @@
  *
  * September 12, 1988
  *
- * $Id: pdrutils.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/fortran/ps2aixdefs.h b/xgks/src/fortran/ps2aixdefs.h
index 880d864..651c485 100644
--- a/xgks/src/fortran/ps2aixdefs.h
+++ b/xgks/src/fortran/ps2aixdefs.h
@@ -27,7 +27,7 @@
  *
  * June 19 1989
  *
- * $Id: ps2aixdefs.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/fortran/rep.fc b/xgks/src/fortran/rep.fc
index 5d76c35..f7adcce 100644
--- a/xgks/src/fortran/rep.fc
+++ b/xgks/src/fortran/rep.fc
@@ -52,7 +52,7 @@
 #   define	realloc(p,n)	(lint_realloc(p,n), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: rep.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 extern char    *forttext;
diff --git a/xgks/src/fortran/segattr.fc b/xgks/src/fortran/segattr.fc
index f825ee8..3a9c997 100644
--- a/xgks/src/fortran/segattr.fc
+++ b/xgks/src/fortran/segattr.fc
@@ -47,7 +47,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: segattr.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/segment.fc b/xgks/src/fortran/segment.fc
index 52165fd..2e6f98b 100644
--- a/xgks/src/fortran/segment.fc
+++ b/xgks/src/fortran/segment.fc
@@ -50,7 +50,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: segment.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/transform.fc b/xgks/src/fortran/transform.fc
index 1677477..34293fc 100644
--- a/xgks/src/fortran/transform.fc
+++ b/xgks/src/fortran/transform.fc
@@ -48,7 +48,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: transform.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/fortran/utils.fc b/xgks/src/fortran/utils.fc
index 9459b60..8f8fad9 100644
--- a/xgks/src/fortran/utils.fc
+++ b/xgks/src/fortran/utils.fc
@@ -45,7 +45,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: utils.fc 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 #define DATARECWIDTH 80 
diff --git a/xgks/src/fortran/wsioutattr.fc b/xgks/src/fortran/wsioutattr.fc
index ddddcb2..4b325fe 100644
--- a/xgks/src/fortran/wsioutattr.fc
+++ b/xgks/src/fortran/wsioutattr.fc
@@ -47,7 +47,7 @@
 
 #ifndef lint
 static char     afsid[] = "$__Header$";
-static char     rcsid[] = "$Id: wsioutattr.fc 23929 2017-06-26 20:24:42Z ksmith $";
+static char     rcsid[] = "$Id$";
 
 #endif
 
diff --git a/xgks/src/lib/Makefile.in b/xgks/src/lib/Makefile.in
index a4b67d8..c7a4abc 100644
--- a/xgks/src/lib/Makefile.in
+++ b/xgks/src/lib/Makefile.in
@@ -1,6 +1,6 @@
 # Makefile for the C, XGKS library
 #
-# $Id: Makefile.in 6522 1999-03-10 01:34:55Z sirott $
+# $Id$
 
 LIBRARY		= xgks
 
diff --git a/xgks/src/lib/act_ws.c b/xgks/src/lib/act_ws.c
index ae04677..fe28a5f 100644
--- a/xgks/src/lib/act_ws.c
+++ b/xgks/src/lib/act_ws.c
@@ -43,7 +43,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: act_ws.c 8483 2004-01-21 23:06:13Z kobrien $";
+    static char rcsid[]	= "$Id$";
 #endif
                      
 #include <wchar.h>
diff --git a/xgks/src/lib/aspect_flags.c b/xgks/src/lib/aspect_flags.c
index e3b332b..7b24694 100644
--- a/xgks/src/lib/aspect_flags.c
+++ b/xgks/src/lib/aspect_flags.c
@@ -41,7 +41,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: aspect_flags.c 8483 2004-01-21 23:06:13Z kobrien $";
+    static char rcsid[] = "$Id$";
 #endif
 
 #include <wchar.h>
diff --git a/xgks/src/lib/cellarray.c b/xgks/src/lib/cellarray.c
index 56af9cd..27974b5 100644
--- a/xgks/src/lib/cellarray.c
+++ b/xgks/src/lib/cellarray.c
@@ -46,7 +46,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char	afsid[]	= "$__Header$";
-    static char	rcsid[]	= "$Id: cellarray.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char	rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/cgm/Makefile.in b/xgks/src/lib/cgm/Makefile.in
index 19ddbb4..9dfaf45 100644
--- a/xgks/src/lib/cgm/Makefile.in
+++ b/xgks/src/lib/cgm/Makefile.in
@@ -1,6 +1,6 @@
 # Makefile for the Computer Graphics Metafile (CGM) backend to XGKS
 #
-# $Id: Makefile.in 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 
 LIBNAME		= xgks
 REMOTE_LIBRARY	= ../lib$(LIBNAME).a
diff --git a/xgks/src/lib/cgm/cgm.h b/xgks/src/lib/cgm/cgm.h
index 57d943e..a9e76d4 100644
--- a/xgks/src/lib/cgm/cgm.h
+++ b/xgks/src/lib/cgm/cgm.h
@@ -35,7 +35,7 @@
  *
  * This header-file depends upon header-file "xgks.h".
  * 
- * $Id: cgm.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  */
 
 /*
@@ -49,75 +49,75 @@
 /*
  * CGM API:
  */
-extern int CGMrecSize	PROTO((
+extern int CGMrecSize(
     Gint            type
-));
-extern int CGMnextItem	PROTO((
+);
+extern int CGMnextItem(
     Metafile	*mf		/* Metafile structure */
-));
-extern int CGMwriteItem	PROTO((
+);
+extern int CGMwriteItem(
     Metafile	*mf,		/* Metafile structures */
     int		num,		/* Number of Metafiles */
     Gint	type,		/* item type */
     Gint	length,		/* item length */
     Gchar	*data		/* item data-record */
-));
-extern int CGMreadItem	PROTO((
+);
+extern int CGMreadItem(
     Metafile	*mf,		/* Metafile structure  */
     char        *record	/* input data-record */
-));
-extern int CGMmiOpen	PROTO((
+);
+extern int CGMmiOpen(
     Metafile	*mf,		/* Metafile structure */
     char	*conn		/* Metafile identifier (filename) */
-));
-extern int CGMmiClose	PROTO((
+);
+extern int CGMmiClose(
     Metafile	*mf		/* Metafile structure */
-));
-extern int CGMmoOpen	PROTO((
+);
+extern int CGMmoOpen(
     WS_STATE_PTR	ws
-));
-extern int CGMmoClose	PROTO((
+);
+extern int CGMmoClose(
     Metafile	*mf
-));
-extern int CGMclear	PROTO((
+);
+extern int CGMclear(
     Metafile	*mf,
     int		num,
     Gclrflag	flag
-));
-extern int CGMredrawAllSeg	PROTO((
+);
+extern int CGMredrawAllSeg(
     Metafile	*mf,
     int		num
-));
-extern int CGMupdate	PROTO((
+);
+extern int CGMupdate(
     Metafile	*mf,
     int		num,
     Gregen	regenflag
-));
-extern int CGMdefer	PROTO((
+);
+extern int CGMdefer(
     Metafile	*mf,
     int		num,
     Gdefmode	defer_mode,
     Girgmode	regen_mode
-));
-extern int CGMmessage	PROTO((
+);
+extern int CGMmessage(
     Metafile	*mf,
     int		num,
     Gchar	*string
-));
-extern int CGMoutputGraphic	PROTO((
+);
+extern int CGMoutputGraphic(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	num_pt,
     Gpoint	*pos
-));
-extern int CGMtext	PROTO((
+);
+extern int CGMtext(
     Metafile	*mf,
     int		num,
     Gpoint	*at,
     Gchar	*string
-));
-extern int CGMcellArray	PROTO((
+);
+extern int CGMcellArray(
     Metafile	*mf,
     int		num,
     Gpoint	*ll,
@@ -126,62 +126,62 @@ extern int CGMcellArray	PROTO((
     Gint	row,
     Gint	*colour,
     Gipoint	*dim
-));
-extern int CGMsetGraphSize	PROTO((
+);
+extern int CGMsetGraphSize(
     Metafile	*mf,
     int		num,
     Gint	code,
     double	size
-));
-extern int CGMcloseSeg	PROTO((
+);
+extern int CGMcloseSeg(
     Metafile	*mf,
     int		num
-));
-extern int CGMsetGraphAttr	PROTO((
+);
+extern int CGMsetGraphAttr(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	attr
-));
-extern int CGMsetTextFP	PROTO((
+);
+extern int CGMsetTextFP(
     Metafile	*mf,
     int		num,
     Gtxfp	*txfp
-));
-extern int CGMsetCharUp	PROTO((
+);
+extern int CGMsetCharUp(
     Metafile	*mf,
     int		num,
     Gpoint	*up,
     Gpoint	*base
-));
-extern int CGMsetTextPath	PROTO((
+);
+extern int CGMsetTextPath(
     Metafile	*mf,
     int		num,
     Gtxpath	path
-));
-extern int CGMsetTextAlign	PROTO((
+);
+extern int CGMsetTextAlign(
     Metafile	*mf,
     int		num,
     Gtxalign	*align
-));
-extern int CGMsetFillStyle	PROTO((
+);
+extern int CGMsetFillStyle(
     Metafile	*mf,
     int		num,
     Gflinter	style
-));
-extern int CGMsetPatSize	PROTO((
+);
+extern int CGMsetPatSize(
     Metafile	*mf,
     int		num
-));
-extern int CGMsetPatRefpt	PROTO((
+);
+extern int CGMsetPatRefpt(
     Metafile	*mf,
     int		num
-));
-extern int CGMsetAsf	PROTO((
+);
+extern int CGMsetAsf(
     Metafile	*mf,
     int		num
-));
-extern int CGMsetLineMarkRep	PROTO((
+);
+extern int CGMsetLineMarkRep(
     Metafile	*mf,
     int		num,
     Gint	code,
@@ -189,84 +189,84 @@ extern int CGMsetLineMarkRep	PROTO((
     Gint	type,
     double	size,
     Gint	colour
-));
-extern int CGMsetTextRep	PROTO((
+);
+extern int CGMsetTextRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gtxbundl	*rep
-));
-extern int CGMsetFillRep	PROTO((
+);
+extern int CGMsetFillRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gflbundl	*rep
-));
-extern int CGMsetPatRep	PROTO((
+);
+extern int CGMsetPatRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gptbundl	*rep
-));
-extern int CGMsetColRep	PROTO((
+);
+extern int CGMsetColRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gcobundl	*rep
-));
-extern int CGMsetClip	PROTO((
+);
+extern int CGMsetClip(
     Metafile	*mf,
     int		num,
     Glimit	*rect
-));
-extern int CGMsetLimit	PROTO((
+);
+extern int CGMsetLimit(
     Metafile	*mf,
     int		num,
     Gint	code,
     Glimit	*rect
-));
-extern int CGMrenameSeg	PROTO((
+);
+extern int CGMrenameSeg(
     Metafile	*mf,
     int		num,
     Gint	old,
     Gint	new
-));
-extern int CGMsetSegTran	PROTO((
+);
+extern int CGMsetSegTran(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gfloat	matrix[2][3]
-));
-extern int CGMsetSegAttr	PROTO((
+);
+extern int CGMsetSegAttr(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gint	code,
     Gint	attr
-));
-extern int CGMsetSegVis	PROTO((
+);
+extern int CGMsetSegVis(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegvis	vis
-));
-extern int CGMsetSegHilight	PROTO((
+);
+extern int CGMsetSegHilight(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gseghi	hilight
-));
-extern int CGMsetSegPri	PROTO((
+);
+extern int CGMsetSegPri(
     Metafile	*mf,
     int		num,
     Gint	name,
     double	pri
-));
-extern int CGMsetSegDetect	PROTO((
+);
+extern int CGMsetSegDetect(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegdet	det
-));
+);
 
 #endif	/* XGKS_CGM_H not defined above */
diff --git a/xgks/src/lib/cgm/cgm_implem.h b/xgks/src/lib/cgm/cgm_implem.h
index f9524d4..3b5329e 100644
--- a/xgks/src/lib/cgm/cgm_implem.h
+++ b/xgks/src/lib/cgm/cgm_implem.h
@@ -3,7 +3,7 @@
  * for the Computer Graphics Metatafile (CGM) implementaion of an XGKS
  * Metafile.
  *
- * $Id: cgm_implem.h 8483 2004-01-21 23:06:13Z kobrien $
+ * $Id$
  */
 
 #ifndef CGM_IMPLEM_H_SEEN
diff --git a/xgks/src/lib/cgm/cgmi.c b/xgks/src/lib/cgm/cgmi.c
index 1bfeb24..e6ed1f8 100644
--- a/xgks/src/lib/cgm/cgmi.c
+++ b/xgks/src/lib/cgm/cgmi.c
@@ -31,7 +31,7 @@
 #include "cgm_implem.h"		/* for implementation details */
 
 #ifndef lint
-    static char rcsid[]	= "$Id: cgmi.c 8483 2004-01-21 23:06:13Z kobrien $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 /*
diff --git a/xgks/src/lib/cgm/cgmo.c b/xgks/src/lib/cgm/cgmo.c
index 00e794e..9087597 100644
--- a/xgks/src/lib/cgm/cgmo.c
+++ b/xgks/src/lib/cgm/cgmo.c
@@ -29,7 +29,7 @@
 #include "cgm_implem.h"		/* for implementation details */
 
 #ifndef lint
-    static char rcsid[]	= "$Id: cgmo.c 19905 2015-07-01 00:25:30Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 /*
@@ -661,7 +661,7 @@ AuthorDate()
 	    cp	+= nchr; \
 	)
 
-    ADD_STRING("UCAR/Unidata XGKS/CGM $Revision: 19905 $: ");
+    ADD_STRING("UCAR/Unidata XGKS/CGM $Revision$: ");
 
     if (username == NULL) {
 	ADD_STRING("<unknown>");
@@ -1229,7 +1229,6 @@ CGMredrawAllSeg(mf, num)
     int		num;
 {
     int		ii;
-    extern void	XgksDrawSegToWs PROTO((WS_STATE_PTR));
 
     for (ii = 0; ii < num; ++ii) {
 	mf_cgmo	*cgmo	= mf[ii].cgmo;
diff --git a/xgks/src/lib/choice.c b/xgks/src/lib/choice.c
index 2ae04b7..1c44fe3 100644
--- a/xgks/src/lib/choice.c
+++ b/xgks/src/lib/choice.c
@@ -55,7 +55,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char	afsid[]	= "$__Header$";
-    static char	rcsid[]	= "$Id: choice.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char	rcsid[]	= "$Id$";
 #endif
 
 #define DEF_CHO_FONT    "fixed"
diff --git a/xgks/src/lib/colours.c b/xgks/src/lib/colours.c
index 0fbe0f8..da2901b 100644
--- a/xgks/src/lib/colours.c
+++ b/xgks/src/lib/colours.c
@@ -51,7 +51,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char	afsid[] = "$__Header$";
-    static char	rcsid[] = "$Id: colours.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char	rcsid[] = "$Id$";
 #endif
 
 static int	loadcache();
diff --git a/xgks/src/lib/colours.c.linux b/xgks/src/lib/colours.c.linux
index f818993..fc2e28b 100644
--- a/xgks/src/lib/colours.c.linux
+++ b/xgks/src/lib/colours.c.linux
@@ -50,7 +50,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char	afsid[] = "$__Header$";
-    static char	rcsid[] = "$Id: colours.c.linux 6358 1998-09-01 17:32:40Z tmap $";
+    static char	rcsid[] = "$Id$";
 #endif
 
 static int	loadcache();
diff --git a/xgks/src/lib/deferral_ws.c b/xgks/src/lib/deferral_ws.c
index 35c14c1..4dd6357 100644
--- a/xgks/src/lib/deferral_ws.c
+++ b/xgks/src/lib/deferral_ws.c
@@ -39,7 +39,7 @@
 
 #ifndef lint
     static char afsid[]="$__Header$";
-    static char rcsid[]="$Id: deferral_ws.c 8483 2004-01-21 23:06:13Z kobrien $";
+    static char rcsid[]="$Id$";
 #endif
 #include <wchar.h>
 #include <wchar.h>
diff --git a/xgks/src/lib/escape.c b/xgks/src/lib/escape.c
index 5baae2c..c5221ac 100644
--- a/xgks/src/lib/escape.c
+++ b/xgks/src/lib/escape.c
@@ -52,7 +52,7 @@
 #   define malloc(n)		(lint_malloc(n), 0)
 #else
     static char	afsid[] = "$__Header$";
-    static char	rcsid[] = "$Id: escape.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char	rcsid[] = "$Id$";
 #endif
 
 extern char	*progname;
diff --git a/xgks/src/lib/event.c b/xgks/src/lib/event.c
index 0d0b1b6..863adac 100644
--- a/xgks/src/lib/event.c
+++ b/xgks/src/lib/event.c
@@ -56,7 +56,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char	afsid[] = "$__Header$";
-    static char	rcsid[] = "$Id: event.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char	rcsid[] = "$Id$";
 #endif
 
 static Bool	Waiting;	/* True if await event is waiting */
diff --git a/xgks/src/lib/event.h b/xgks/src/lib/event.h
index 913a7a9..f63197e 100644
--- a/xgks/src/lib/event.h
+++ b/xgks/src/lib/event.h
@@ -35,7 +35,7 @@
  * 
  *  Define file for : Xevent 
  * 
- * $Id: event.h 6358 1998-09-01 17:32:40Z tmap $:
+ * $Id$:
  * $__Header$
  */
 
diff --git a/xgks/src/lib/fillarea.c b/xgks/src/lib/fillarea.c
index 3e56ded..b56cc94 100644
--- a/xgks/src/lib/fillarea.c
+++ b/xgks/src/lib/fillarea.c
@@ -53,7 +53,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: fillarea.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 #include <wchar.h>
diff --git a/xgks/src/lib/fillarea.h b/xgks/src/lib/fillarea.h
index e9d1188..d15c506 100644
--- a/xgks/src/lib/fillarea.h
+++ b/xgks/src/lib/fillarea.h
@@ -25,7 +25,7 @@
  * 
  * Define file for :  fillarea predefined bundles
  * 
- * $Id: fillarea.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/font.h b/xgks/src/lib/font.h
index 6b3cb03..a9ecfa2 100644
--- a/xgks/src/lib/font.h
+++ b/xgks/src/lib/font.h
@@ -35,7 +35,7 @@
  * 
  * font.h - vector fonts for UIGKS servers.
  *
- * $Id: font.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/gif.c b/xgks/src/lib/gif.c
index 9077158..88b2bca 100644
--- a/xgks/src/lib/gif.c
+++ b/xgks/src/lib/gif.c
@@ -41,7 +41,7 @@
 /*
  * GIF driver for XGKS metafiles
  * Created by Joe Sirott, Pacific Marine Environmental Lab
- * $Id: gif.c 19905 2015-07-01 00:25:30Z ksmith $
+ * $Id$
  *
  * *js* 8.97 umalloc(0) returns 0 on DEC alpha; eliminated assert(meta->style) in
  *  set_lineStyle to avoid this problem, since length can be 0 
@@ -116,7 +116,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: gif.c 19905 2015-07-01 00:25:30Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 static const int DefaultSize = 600;
diff --git a/xgks/src/lib/gif.c.orig b/xgks/src/lib/gif.c.orig
index 474408f..bd47713 100644
--- a/xgks/src/lib/gif.c.orig
+++ b/xgks/src/lib/gif.c.orig
@@ -39,7 +39,7 @@
 /*
  * GIF driver for XGKS metafiles
  * Created by Joe Sirott, Pacific Marine Environmental Lab
- * $Id: gif.c.orig 10455 2008-11-20 22:17:57Z ansley $
+ * $Id$
  *
  * *js* 8.97 umalloc(0) returns 0 on DEC alpha; eliminated assert(meta->style) in
  *  set_lineStyle to avoid this problem, since length can be 0 
@@ -110,7 +110,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: gif.c.orig 10455 2008-11-20 22:17:57Z ansley $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 static const int DefaultSize = 600;
diff --git a/xgks/src/lib/gif.c.test b/xgks/src/lib/gif.c.test
index c801c4d..94df4c8 100644
--- a/xgks/src/lib/gif.c.test
+++ b/xgks/src/lib/gif.c.test
@@ -39,7 +39,7 @@
 /*
  * GIF driver for XGKS metafiles
  * Created by Joe Sirott, Pacific Marine Environmental Lab
- * $Id: gif.c.test 10455 2008-11-20 22:17:57Z ansley $
+ * $Id$
  *
  * *js* 8.97 umalloc(0) returns 0 on DEC alpha; eliminated assert(meta->style) in
  *  set_lineStyle to avoid this problem, since length can be 0 
@@ -110,7 +110,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: gif.c.test 10455 2008-11-20 22:17:57Z ansley $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 static const int DefaultSize = 600;
diff --git a/xgks/src/lib/gif/gif.h b/xgks/src/lib/gif/gif.h
index 6ec5bcc..ce7ee79 100644
--- a/xgks/src/lib/gif/gif.h
+++ b/xgks/src/lib/gif/gif.h
@@ -21,79 +21,79 @@
  *
  * PostScript driver for XGKS metafiles
  * Created by Joe Sirott, Pacific Marine Environmental Lab
- * $Id: gif.h 14748 2012-08-20 22:07:51Z ansley $
+ * $Id$
  */
 
 
 #ifndef XGKS_GIF_H
 #define XGKS_GIF_H
 
-extern int GIFrecSize	PROTO((
+extern int GIFrecSize(
     Gint            type
-));
-extern int GIFnextItem	PROTO((
+);
+extern int GIFnextItem(
     Metafile	*mf		/* Metafile structure */
-));
-extern int GIFwriteItem	PROTO((
+);
+extern int GIFwriteItem(
     Metafile      **mf,		/* Metafile structures */
     int             num,	/* Number of Metafiles */
     Gint	    type,	/* item type */
     Gint	    length,	/* item length */
     Gchar          *data	/* item data-record */
-));
-extern int GIFreadItem	PROTO((
+);
+extern int GIFreadItem(
     Metafile	*mf,		/* Metafile structure  */
     char        *record	/* input data-record */
-));
-extern int GIFmiOpen	PROTO((
+);
+extern int GIFmiOpen(
     Metafile	*mf		/* Metafile structure */
-));
-extern int GIFmoOpen	PROTO((
+);
+extern int GIFmoOpen(
     WS_STATE_PTR ws
-));
-extern int GIFmoClose	PROTO((
+);
+extern int GIFmoClose(
     Metafile	*mf,
     int         batmode
-));
-extern int GIFclear	PROTO((
+);
+extern int GIFclear(
     Metafile	*mf,
     int		num,
     Gclrflag	flag
-));
-extern int GIFredrawAllSeg	PROTO((
+);
+extern int GIFredrawAllSeg(
     Metafile	**mf,
     int		num
-));
-extern int GIFupdate	PROTO((
+);
+extern int GIFupdate(
     Metafile	**mf,
     int		num,
     Gregen	regenflag
-));
-extern int GIFdefer	PROTO((
+);
+extern int GIFdefer(
     Metafile	**mf,
     int		num,
     Gdefmode	defer_mode,
     Girgmode	regen_mode
-));
-extern int GIFmessage	PROTO((
+);
+extern int GIFmessage(
     Metafile	**mf,
     int		num,
     Gchar	*string
-));
-extern int GIFoutputGraphic	PROTO((
+);
+extern int GIFoutputGraphic(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	num_pt,
     Gpoint	*pos
-));
-extern int GIFtext	PROTO((
+);
+extern int GIFtext(
     Metafile	*mf,
     int		num,
     Gpoint	*at,
     Gchar	*string
-));
-extern int GIFcellArray	PROTO((
+);
+extern int GIFcellArray(
     Metafile	*mf,
     int		num,
     Gpoint	*ll,
@@ -102,62 +102,62 @@ extern int GIFcellArray	PROTO((
     Gint	row,
     Gint	*colour,
     Gipoint	*dim
-));
-extern int GIFsetGraphSize	PROTO((
+);
+extern int GIFsetGraphSize(
     Metafile	*mf,
     int		num,
     Gint	code,
     double	size
-));
-extern int GIFcloseSeg	PROTO((
+);
+extern int GIFcloseSeg(
     Metafile	*mf,
     int		num
-));
-extern int GIFsetGraphAttr	PROTO((
+);
+extern int GIFsetGraphAttr(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	attr
-));
-extern int GIFsetTextFP	PROTO((
+);
+extern int GIFsetTextFP(
     Metafile	*mf,
     int		num,
     Gtxfp	*txfp
-));
-extern int GIFsetCharUp	PROTO((
+);
+extern int GIFsetCharUp(
     Metafile	*mf,
     int		num,
     Gpoint	*up,
     Gpoint	*base
-));
-extern int GIFsetTextPath	PROTO((
+);
+extern int GIFsetTextPath(
     Metafile	*mf,
     int		num,
     Gtxpath	path
-));
-extern int GIFsetTextAlign	PROTO((
+);
+extern int GIFsetTextAlign(
     Metafile	*mf,
     int		num,
     Gtxalign	*align
-));
-extern int GIFsetFillStyle	PROTO((
+);
+extern int GIFsetFillStyle(
     Metafile	*mf,
     int		num,
     Gflinter	style
-));
-extern int GIFsetPatSize	PROTO((
+);
+extern int GIFsetPatSize(
     Metafile	*mf,
     int		num
-));
-extern int GIFsetPatRefpt	PROTO((
+);
+extern int GIFsetPatRefpt(
     Metafile	*mf,
     int		num
-));
-extern int GIFsetAsf	PROTO((
+);
+extern int GIFsetAsf(
     Metafile	*mf,
     int		num
-));
-extern int GIFsetLineMarkRep	PROTO((
+);
+extern int GIFsetLineMarkRep(
     Metafile	*mf,
     int		num,
     Gint	code,
@@ -165,84 +165,84 @@ extern int GIFsetLineMarkRep	PROTO((
     Gint	type,
     double	size,
     Gint	colour
-));
-extern int GIFsetTextRep	PROTO((
+);
+extern int GIFsetTextRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gtxbundl	*rep
-));
-extern int GIFsetFillRep	PROTO((
+);
+extern int GIFsetFillRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gflbundl	*rep
-));
-extern int GIFsetPatRep	PROTO((
+);
+extern int GIFsetPatRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gptbundl	*rep
-));
-extern int GIFsetColRep	PROTO((
+);
+extern int GIFsetColRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gcobundl	*rep
-));
-extern int GIFsetClip	PROTO((
+);
+extern int GIFsetClip(
     Metafile	*mf,
     int		num,
     Glimit	*rect
-));
-extern int GIFsetLimit	PROTO((
+);
+extern int GIFsetLimit(
     Metafile	*mf,
     int		num,
     Gint	code,
     Glimit	*rect
-));
-extern int GIFrenameSeg	PROTO((
+);
+extern int GIFrenameSeg(
     Metafile	*mf,
     int		num,
     Gint	old,
     Gint	new
-));
-extern int GIFsetSegTran	PROTO((
+);
+extern int GIFsetSegTran(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gfloat	matrix[2][3]
-));
-extern int GIFsetSegAttr	PROTO((
+);
+extern int GIFsetSegAttr(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gint	code,
     Gint	attr
-));
-extern int GIFsetSegVis	PROTO((
+);
+extern int GIFsetSegVis(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegvis	vis
-));
-extern int GIFsetSegHilight	PROTO((
+);
+extern int GIFsetSegHilight(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gseghi	hilight
-));
-extern int GIFsetSegPri	PROTO((
+);
+extern int GIFsetSegPri(
     Metafile	*mf,
     int		num,
     Gint	name,
     double	pri
-));
-extern int GIFsetSegDetect	PROTO((
+);
+extern int GIFsetSegDetect(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegdet	det
-));
+);
 
 #endif	/* XGKS_PS_H not defined */
diff --git a/xgks/src/lib/gks_defines.h b/xgks/src/lib/gks_defines.h
index 8289bf9..f46cdcc 100644
--- a/xgks/src/lib/gks_defines.h
+++ b/xgks/src/lib/gks_defines.h
@@ -37,7 +37,7 @@
  *
  * This header-file depends upon header-file "xgks.h".
  *
- * $Id: gks_defines.h 23929 2017-06-26 20:24:42Z ksmith $
+ * $Id$
  * $__Header$
  */
 
@@ -80,9 +80,9 @@
 
 /* make sure voidp is defined by including udposix.h here */
 #include "udposix.h"
-extern void	ufree		PROTO((voidp ptr));
-extern voidp	umalloc		PROTO((size_t size));
-extern voidp	urealloc	PROTO((voidp ptr, size_t size));
+extern void	ufree		(voidp ptr);
+extern voidp	umalloc		(size_t size);
+extern voidp	urealloc	(voidp ptr, size_t size);
 
 /*
  *	Manage memory safely (i.e. ignore signals while doing it).
diff --git a/xgks/src/lib/gks_error.c b/xgks/src/lib/gks_error.c
index 9598eb7..334153b 100644
--- a/xgks/src/lib/gks_error.c
+++ b/xgks/src/lib/gks_error.c
@@ -42,7 +42,7 @@
 
 #ifndef lint
     static char	afsid[]	= "$__Header$";
-    static char	rcsid[]	= "$Id: gks_error.c 8483 2004-01-21 23:06:13Z kobrien $";
+    static char	rcsid[]	= "$Id$";
 #endif
 
 #define GKS_ERROR_C
diff --git a/xgks/src/lib/gks_errors.h b/xgks/src/lib/gks_errors.h
index 0ed53a0..6756153 100644
--- a/xgks/src/lib/gks_errors.h
+++ b/xgks/src/lib/gks_errors.h
@@ -35,7 +35,7 @@
  * 
  * States
  * 
- * $Id: gks_errors.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/gks_implem.h b/xgks/src/lib/gks_implem.h
index 1d62c50..f2b3e3a 100644
--- a/xgks/src/lib/gks_implem.h
+++ b/xgks/src/lib/gks_implem.h
@@ -42,7 +42,7 @@
  * This header-file should be included before any "specialty" X header-files
  * that depend upon <X11/Xlib.h>.
  *
- * $Id: gks_implem.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/gkslist.h b/xgks/src/lib/gkslist.h
index d9ce762..a0d5fbb 100644
--- a/xgks/src/lib/gkslist.h
+++ b/xgks/src/lib/gkslist.h
@@ -35,7 +35,7 @@
  *
  * This header-file depends upon header-file "wslist.h".
  * 
- * $Id: gkslist.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/gksm/Makefile.in b/xgks/src/lib/gksm/Makefile.in
index 1703ef1..93b39f5 100644
--- a/xgks/src/lib/gksm/Makefile.in
+++ b/xgks/src/lib/gksm/Makefile.in
@@ -1,6 +1,6 @@
 # Makefile for the GKS Metafile (GKSM) backend to XGKS
 #
-# $Id: Makefile.in 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 
 LIBNAME		= xgks
 REMOTE_LIBRARY	= ../lib$(LIBNAME).a
diff --git a/xgks/src/lib/gksm/gksm.c b/xgks/src/lib/gksm/gksm.c
index 8582e44..7d4c018 100644
--- a/xgks/src/lib/gksm/gksm.c
+++ b/xgks/src/lib/gksm/gksm.c
@@ -52,7 +52,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: gksm.c 6432 1998-12-22 22:41:49Z kobrien $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 static Gint	gksm_version = 1;
diff --git a/xgks/src/lib/gksm/gksm.h b/xgks/src/lib/gksm/gksm.h
index 68f8a6a..495bcbb 100644
--- a/xgks/src/lib/gksm/gksm.h
+++ b/xgks/src/lib/gksm/gksm.h
@@ -35,7 +35,7 @@
  *
  * This header-file depends upon header-file "xgks.h".
  * 
- * $Id: gksm.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
@@ -47,72 +47,72 @@
 #define XGKS_GKSM_H
 
 
-extern int GMnextItem	PROTO((
+extern int GMnextItem(
     Metafile	*mf		/* Metafile structure */
-));
-extern int GMwriteItem	PROTO((
+);
+extern int GMwriteItem(
     Metafile	*mf,		/* Metafile structures */
     int		num,	/* Number of Metafiles */
     Gint	type,	/* item type */
     Gint	length,	/* item length */
     Gchar	*data	/* item data-record */
-));
-extern int GMreadItem	PROTO((
+);
+extern int GMreadItem(
     Metafile	*mf,		/* Metafile structure  */
     char        *record	/* input data-record */
-));
-extern int GMmiOpen	PROTO((
+);
+extern int GMmiOpen(
     Metafile	*mf,		/* Metafile structure */
     char	*conn		/* Metafile identifier (filename) */
-));
-extern int GMmiClose	PROTO((
+);
+extern int GMmiClose(
     Metafile	*mf
-));
-extern int GMmoOpen	PROTO((
+);
+extern int GMmoOpen(
     WS_STATE_PTR	ws
-));
-extern int GMmoClose	PROTO((
+);
+extern int GMmoClose(
     Metafile	*mf
-));
-extern int GMclear	PROTO((
+);
+extern int GMclear(
     Metafile	*mf,
     int		num,
     Gclrflag	flag
-));
-extern int GMredrawAllSeg	PROTO((
+);
+extern int GMredrawAllSeg(
     Metafile	*mf,
     int		num
-));
-extern int GMupdate	PROTO((
+);
+extern int GMupdate(
     Metafile	*mf,
     int		num,
     Gregen	regenflag
-));
-extern int GMdefer	PROTO((
+);
+extern int GMdefer(
     Metafile	*mf,
     int		num,
     Gdefmode	defer_mode,
     Girgmode	regen_mode
-));
-extern int GMmessage	PROTO((
+);
+extern int GMmessage(
     Metafile	*mf,
     int		num,
     Gchar	*string
-));
-extern int GMoutputGraphic	PROTO((
+);
+extern int GMoutputGraphic(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	num_pt,
     Gpoint	*pos
-));
-extern int GMtext	PROTO((
+);
+extern int GMtext(
     Metafile	*mf,
     int		num,
     Gpoint	*at,
     Gchar	*string
-));
-extern int GMcellArray	PROTO((
+);
+extern int GMcellArray(
     Metafile	*mf,
     int		num,
     Gpoint	*ll,
@@ -121,62 +121,62 @@ extern int GMcellArray	PROTO((
     Gint	row,
     Gint	*colour,
     Gipoint	*dim
-));
-extern int GMsetGraphSize	PROTO((
+);
+extern int GMsetGraphSize(
     Metafile	*mf,
     int		num,
     Gint	code,
     double	size
-));
-extern int GMcloseSeg	PROTO((
+);
+extern int GMcloseSeg(
     Metafile	*mf,
     int		num
-));
-extern int GMsetGraphAttr	PROTO((
+);
+extern int GMsetGraphAttr(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	attr
-));
-extern int GMsetTextFP	PROTO((
+);
+extern int GMsetTextFP(
     Metafile	*mf,
     int		num,
     Gtxfp	*txfp
-));
-extern int GMsetCharUp	PROTO((
+);
+extern int GMsetCharUp(
     Metafile	*mf,
     int		num,
     Gpoint	*up,
     Gpoint	*base
-));
-extern int GMsetTextPath	PROTO((
+);
+extern int GMsetTextPath(
     Metafile	*mf,
     int		num,
     Gtxpath	path
-));
-extern int GMsetTextAlign	PROTO((
+);
+extern int GMsetTextAlign(
     Metafile	*mf,
     int		num,
     Gtxalign	*align
-));
-extern int GMsetFillStyle	PROTO((
+);
+extern int GMsetFillStyle(
     Metafile	*mf,
     int		num,
     Gflinter	style
-));
-extern int GMsetPatSize	PROTO((
+);
+extern int GMsetPatSize(
     Metafile	*mf,
     int		num
-));
-extern int GMsetPatRefpt	PROTO((
+);
+extern int GMsetPatRefpt(
     Metafile	*mf,
     int		num
-));
-extern int GMsetAsf	PROTO((
+);
+extern int GMsetAsf(
     Metafile	*mf,
     int		num
-));
-extern int GMsetLineMarkRep	PROTO((
+);
+extern int GMsetLineMarkRep(
     Metafile	*mf,
     int		num,
     Gint	code,
@@ -184,84 +184,84 @@ extern int GMsetLineMarkRep	PROTO((
     Gint	type,
     double	size,
     Gint	colour
-));
-extern int GMsetTextRep	PROTO((
+);
+extern int GMsetTextRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gtxbundl	*rep
-));
-extern int GMsetFillRep	PROTO((
+);
+extern int GMsetFillRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gflbundl	*rep
-));
-extern int GMsetPatRep	PROTO((
+);
+extern int GMsetPatRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gptbundl	*rep
-));
-extern int GMsetColRep	PROTO((
+);
+extern int GMsetColRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gcobundl	*rep
-));
-extern int GMsetClip	PROTO((
+);
+extern int GMsetClip(
     Metafile	*mf,
     int		num,
     Glimit	*rect
-));
-extern int GMsetLimit	PROTO((
+);
+extern int GMsetLimit(
     Metafile	*mf,
     int		num,
     Gint	code,
     Glimit	*rect
-));
-extern int GMrenameSeg	PROTO((
+);
+extern int GMrenameSeg(
     Metafile	*mf,
     int		num,
     Gint	old,
     Gint	new
-));
-extern int GMsetSegTran	PROTO((
+);
+extern int GMsetSegTran(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gfloat	matrix[2][3]
-));
-extern int GMsetSegAttr	PROTO((
+);
+extern int GMsetSegAttr(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gint	code,
     Gint	attr
-));
-extern int GMsetSegVis	PROTO((
+);
+extern int GMsetSegVis(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegvis	vis
-));
-extern int GMsetSegHilight	PROTO((
+);
+extern int GMsetSegHilight(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gseghi	hilight
-));
-extern int GMsetSegPri	PROTO((
+);
+extern int GMsetSegPri(
     Metafile	*mf,
     int		num,
     Gint	name,
     double	pri
-));
-extern int GMsetSegDetect	PROTO((
+);
+extern int GMsetSegDetect(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegdet	det
-));
+);
 
 #endif	/* XGKS_GKSM_H not defined */
diff --git a/xgks/src/lib/gksm/gksm_implem.h b/xgks/src/lib/gksm/gksm_implem.h
index 7e56a2d..ae4b467 100644
--- a/xgks/src/lib/gksm/gksm_implem.h
+++ b/xgks/src/lib/gksm/gksm_implem.h
@@ -1,5 +1,5 @@
 /*
- * $Id: gksm_implem.h 18840 2014-12-03 00:18:05Z ansley $
+ * $Id$
  *
  * This file contains implementation-specific definitions and declarations
  * for the GKS Metafile (GKSM) implementaion of an XGKS Metafile.
diff --git a/xgks/src/lib/input.c b/xgks/src/lib/input.c
index b453181..7bce32d 100644
--- a/xgks/src/lib/input.c
+++ b/xgks/src/lib/input.c
@@ -41,7 +41,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: input.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 #include <wchar.h>
diff --git a/xgks/src/lib/input.h b/xgks/src/lib/input.h
index c5dbef5..a26cb1f 100644
--- a/xgks/src/lib/input.h
+++ b/xgks/src/lib/input.h
@@ -37,7 +37,7 @@
  *
  * This header-file depends upon header-file "xgks.h".
  * 
- * $Id: input.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/inqWDT.c b/xgks/src/lib/inqWDT.c
index 91a14c5..9664838 100644
--- a/xgks/src/lib/inqWDT.c
+++ b/xgks/src/lib/inqWDT.c
@@ -47,7 +47,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]="$__Header$";
-    static char rcsid[]="$Id: inqWDT.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]="$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/inqfillareas.c b/xgks/src/lib/inqfillareas.c
index be956a1..7bf1b91 100644
--- a/xgks/src/lib/inqfillareas.c
+++ b/xgks/src/lib/inqfillareas.c
@@ -47,7 +47,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqfillareas.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 extern Gptbundl xgks_xpttn[];
diff --git a/xgks/src/lib/inqpixel.c b/xgks/src/lib/inqpixel.c
index 1054b90..025cf71 100644
--- a/xgks/src/lib/inqpixel.c
+++ b/xgks/src/lib/inqpixel.c
@@ -38,7 +38,7 @@
 
 #ifndef lint
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqpixel.c 8483 2004-01-21 23:06:13Z kobrien $";
+    static char rcsid[] = "$Id$";
 #endif
 
 #include <wchar.h>
diff --git a/xgks/src/lib/inqpmarker.c b/xgks/src/lib/inqpmarker.c
index 4ee9f92..8da204d 100644
--- a/xgks/src/lib/inqpmarker.c
+++ b/xgks/src/lib/inqpmarker.c
@@ -47,7 +47,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqpmarker.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/inqpolylines.c b/xgks/src/lib/inqpolylines.c
index a08e928..c80c158 100644
--- a/xgks/src/lib/inqpolylines.c
+++ b/xgks/src/lib/inqpolylines.c
@@ -47,7 +47,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqpolylines.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/inqtext.c b/xgks/src/lib/inqtext.c
index c65b68e..191ad2c 100644
--- a/xgks/src/lib/inqtext.c
+++ b/xgks/src/lib/inqtext.c
@@ -47,7 +47,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqtext.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/inqtransform.c b/xgks/src/lib/inqtransform.c
index 3101d23..2ecc708 100644
--- a/xgks/src/lib/inqtransform.c
+++ b/xgks/src/lib/inqtransform.c
@@ -46,7 +46,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[] = "$__Header$";
-    static char rcsid[] = "$Id: inqtransform.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[] = "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/inquiries.c b/xgks/src/lib/inquiries.c
index 7ffd6ad..06a7f73 100644
--- a/xgks/src/lib/inquiries.c
+++ b/xgks/src/lib/inquiries.c
@@ -56,7 +56,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: inquiries.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/locator.c b/xgks/src/lib/locator.c
index d892557..dc7cd70 100644
--- a/xgks/src/lib/locator.c
+++ b/xgks/src/lib/locator.c
@@ -49,7 +49,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: locator.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/message.c b/xgks/src/lib/message.c
index a0fa44b..18755bb 100644
--- a/xgks/src/lib/message.c
+++ b/xgks/src/lib/message.c
@@ -50,7 +50,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: message.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 /*
diff --git a/xgks/src/lib/metafile.c b/xgks/src/lib/metafile.c
index fad9ead..aa3855c 100644
--- a/xgks/src/lib/metafile.c
+++ b/xgks/src/lib/metafile.c
@@ -62,7 +62,7 @@
 #include "gif/gif.h"
 
 #ifndef lint
-    static char rcsid[]	= "$Id: metafile.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
     static char afsid[]	= "$__Header$";
 #endif
 
diff --git a/xgks/src/lib/metafile.h b/xgks/src/lib/metafile.h
index 2f043d6..3f78028 100644
--- a/xgks/src/lib/metafile.h
+++ b/xgks/src/lib/metafile.h
@@ -297,76 +297,76 @@ typedef struct {
 /*
  * Metafile API:
  */
-extern int XgksMiOpenWs		PROTO((WS_STATE_PTR ws));
-extern int XgksMoOpenWs		PROTO((WS_STATE_PTR ws));
-extern int XgksMiCloseWs	PROTO((WS_STATE_PTR ws));
-extern int XgksMoCloseWs	PROTO((WS_STATE_PTR ws, Gint batmode));
-extern int XgksMoClearWs	PROTO((WS_STATE_PTR ws, Gclrflag flag));
-extern int XgksMoReDrawAllSeg	PROTO((WS_STATE_PTR ws));
-extern int XgksMoUpdateWs	PROTO((WS_STATE_PTR ws, Gregen regenflag));
-extern int XgksMoDeferWs	PROTO((WS_STATE_PTR ws, Gdefmode defer_mode, 
-				       Girgmode regen_mode));
-extern int XgksMoMessage	PROTO((WS_STATE_PTR ws, Gchar *string));
-extern int XgksMoGraphicOutputToWs	PROTO((WS_STATE_PTR ws, Gint code, 
-					       Gint num_pt, Gpoint *pos));
-extern int XgksMoGraphicOutput	PROTO((Gint code, Gint num_pt, Gpoint *pos));
-extern int XgksMoTextToWs	PROTO((WS_STATE_PTR ws, Gpoint *at, 
-				       Gchar *string));
-extern int XgksMoText		PROTO((Gpoint *at, Gchar *string));
-extern int XgksMoCellArrayToWs	PROTO((WS_STATE_PTR ws, Gpoint *ll, Gpoint *ur,
+extern int XgksMiOpenWs		(WS_STATE_PTR ws);
+extern int XgksMoOpenWs		(WS_STATE_PTR ws);
+extern int XgksMiCloseWs	(WS_STATE_PTR ws);
+extern int XgksMoCloseWs	(WS_STATE_PTR ws, Gint batmode);
+extern int XgksMoClearWs	(WS_STATE_PTR ws, Gclrflag flag);
+extern int XgksMoReDrawAllSeg	(WS_STATE_PTR ws);
+extern int XgksMoUpdateWs	(WS_STATE_PTR ws, Gregen regenflag);
+extern int XgksMoDeferWs	(WS_STATE_PTR ws, Gdefmode defer_mode, 
+				       Girgmode regen_mode);
+extern int XgksMoMessage	(WS_STATE_PTR ws, Gchar *string);
+extern int XgksMoGraphicOutputToWs	(WS_STATE_PTR ws, Gint code, 
+					       Gint num_pt, Gpoint *pos);
+extern int XgksMoGraphicOutput	(Gint code, Gint num_pt, Gpoint *pos);
+extern int XgksMoTextToWs	(WS_STATE_PTR ws, Gpoint *at, 
+				       Gchar *string);
+extern int XgksMoText		(Gpoint *at, Gchar *string);
+extern int XgksMoCellArrayToWs	(WS_STATE_PTR ws, Gpoint *ll, Gpoint *ur,
 				       Gpoint *lr, 
-				       Gint row, Gint *colour, Gipoint *dim));
-extern int XgksMoCellArray	PROTO((Gpoint *ll, Gpoint *ur, Gpoint *lr,
-				       Gint row, Gint *colour, Gipoint *dim));
-extern int XgksMoSetGraphicSizeOnWs	PROTO((WS_STATE_PTR ws, Gint code, 
-					       double size));
-extern int XgksMoSetGraphicSize	PROTO((Gint code, double size));
-extern int XgksMoCloseSegOnWs	PROTO((WS_STATE_PTR ws));
-extern int XgksMoCloseSeg	PROTO((void));
-extern int XgksMoSetGraphicAttrOnWs	PROTO((WS_STATE_PTR ws, Gint code, 
-					      Gint attr));
-extern int XgksMoSetGraphicAttr	PROTO((Gint code, Gint attr));
-extern int XgksMoSetTextFPOnWs	PROTO((WS_STATE_PTR ws, Gtxfp *txfp));
-extern int XgksMoSetTextFP	PROTO((Gtxfp *txfp));
-extern int XgksMoSetCharUpOnWs	PROTO((WS_STATE_PTR ws, Gpoint *up,
-				       Gpoint *base));
-extern int XgksMoSetCharUp	PROTO((void));
-extern int XgksMoSetTextPathOnWs	PROTO((WS_STATE_PTR ws, Gtxpath path));
-extern int XgksMoSetTextPath	PROTO((Gtxpath path));
-extern int XgksMoSetTextAlignOnWs	PROTO((WS_STATE_PTR ws, 
-					      Gtxalign *align));
-extern int XgksMoSetTextAlign	PROTO((Gtxalign *align));
-extern int XgksMoSetFillIntStyleOnWs	PROTO((WS_STATE_PTR ws, 
-					      Gflinter style));
-extern int XgksMoSetFillIntStyle	PROTO((Gflinter style));
-extern int XgksMoSetPatSizeOnWs	PROTO((WS_STATE_PTR ws));
-extern int XgksMoSetPatSize	PROTO((void));
-extern int XgksMoSetPatRefOnWs	PROTO((WS_STATE_PTR ws));
-extern int XgksMoSetPatRef	PROTO((void));
-extern int XgksMoSetAsfOnWs	PROTO((WS_STATE_PTR ws));
-extern int XgksMoSetAsf		PROTO((void));
-extern int XgksMoSetLineMarkRep	PROTO((WS_STATE_PTR ws, Gint code, Gint idx, 
-				       Gint type, double size, Gint colour));
-extern int XgksMoSetTextRep	PROTO((WS_STATE_PTR ws, Gint idx, Gtxbundl *rep));
-extern int XgksMoSetFillRep	PROTO((WS_STATE_PTR ws, Gint idx, Gflbundl *rep));
-extern int XgksMoSetPatRep	PROTO((WS_STATE_PTR ws, Gint idx, Gptbundl *rep));
-extern int XgksMoSetColourRep	PROTO((WS_STATE_PTR ws, Gint idx, Gcobundl *rep));
-extern int XgksMoSetClipOnWs	PROTO((WS_STATE_PTR ws, Glimit *rect));
-extern int XgksMoSetClip	PROTO((Glimit *rect));
-extern int XgksMoSetLimit	PROTO((WS_STATE_PTR ws, Gint code, 
-				       Glimit *rect));
-extern int XgksMoRenameSeg	PROTO((Gint old, Gint new));
-extern int XgksMoSetSegTransOnWs	PROTO((WS_STATE_PTR ws, Gint name, 
-					       Gfloat matrix[2][3]));
-extern int XgksMoSetSegTrans	PROTO((Gint name, Gfloat matrix[2][3]));
-extern int XgksMoSetSegAttrOnWs	PROTO((WS_STATE_PTR ws, Gint name, Gint code,
-				       Gint attr));
-extern int XgksMoSetSegVis	PROTO((Gint name, Gsegvis vis));
-extern int XgksMoSetSegHiLight	PROTO((Gint name, Gseghi hilight));
-extern int XgksMoSetSegPriOnWs	PROTO((WS_STATE_PTR ws, Gint name, double pri));
-extern int XgksMoSetSegPri	PROTO((Gint name, double pri));
-extern int XgksMoSetSegDet	PROTO((Gint name, Gsegdet det));
-extern int XgksMoActivateWs	PROTO((WS_STATE_PTR ws));
-extern int XgksInitGksM		PROTO((void));
+				       Gint row, Gint *colour, Gipoint *dim);
+extern int XgksMoCellArray	(Gpoint *ll, Gpoint *ur, Gpoint *lr,
+				       Gint row, Gint *colour, Gipoint *dim);
+extern int XgksMoSetGraphicSizeOnWs	(WS_STATE_PTR ws, Gint code, 
+					       double size);
+extern int XgksMoSetGraphicSize	(Gint code, double size);
+extern int XgksMoCloseSegOnWs	(WS_STATE_PTR ws);
+extern int XgksMoCloseSeg	(void);
+extern int XgksMoSetGraphicAttrOnWs	(WS_STATE_PTR ws, Gint code, 
+					      Gint attr);
+extern int XgksMoSetGraphicAttr	(Gint code, Gint attr);
+extern int XgksMoSetTextFPOnWs	(WS_STATE_PTR ws, Gtxfp *txfp);
+extern int XgksMoSetTextFP	(Gtxfp *txfp);
+extern int XgksMoSetCharUpOnWs	(WS_STATE_PTR ws, Gpoint *up,
+				       Gpoint *base);
+extern int XgksMoSetCharUp	(void);
+extern int XgksMoSetTextPathOnWs	(WS_STATE_PTR ws, Gtxpath path);
+extern int XgksMoSetTextPath	(Gtxpath path);
+extern int XgksMoSetTextAlignOnWs	(WS_STATE_PTR ws, 
+					      Gtxalign *align);
+extern int XgksMoSetTextAlign	(Gtxalign *align);
+extern int XgksMoSetFillIntStyleOnWs	(WS_STATE_PTR ws, 
+					      Gflinter style);
+extern int XgksMoSetFillIntStyle	(Gflinter style);
+extern int XgksMoSetPatSizeOnWs	(WS_STATE_PTR ws);
+extern int XgksMoSetPatSize	(void);
+extern int XgksMoSetPatRefOnWs	(WS_STATE_PTR ws);
+extern int XgksMoSetPatRef	(void);
+extern int XgksMoSetAsfOnWs	(WS_STATE_PTR ws);
+extern int XgksMoSetAsf		(void);
+extern int XgksMoSetLineMarkRep	(WS_STATE_PTR ws, Gint code, Gint idx, 
+				       Gint type, double size, Gint colour);
+extern int XgksMoSetTextRep	(WS_STATE_PTR ws, Gint idx, Gtxbundl *rep);
+extern int XgksMoSetFillRep	(WS_STATE_PTR ws, Gint idx, Gflbundl *rep);
+extern int XgksMoSetPatRep	(WS_STATE_PTR ws, Gint idx, Gptbundl *rep);
+extern int XgksMoSetColourRep	(WS_STATE_PTR ws, Gint idx, Gcobundl *rep);
+extern int XgksMoSetClipOnWs	(WS_STATE_PTR ws, Glimit *rect);
+extern int XgksMoSetClip	(Glimit *rect);
+extern int XgksMoSetLimit	(WS_STATE_PTR ws, Gint code, 
+				       Glimit *rect);
+extern int XgksMoRenameSeg	(Gint old, Gint new);
+extern int XgksMoSetSegTransOnWs	(WS_STATE_PTR ws, Gint name, 
+					       Gfloat matrix[2][3]);
+extern int XgksMoSetSegTrans	(Gint name, Gfloat matrix[2][3]);
+extern int XgksMoSetSegAttrOnWs	(WS_STATE_PTR ws, Gint name, Gint code,
+				       Gint attr);
+extern int XgksMoSetSegVis	(Gint name, Gsegvis vis);
+extern int XgksMoSetSegHiLight	(Gint name, Gseghi hilight);
+extern int XgksMoSetSegPriOnWs	(WS_STATE_PTR ws, Gint name, double pri);
+extern int XgksMoSetSegPri	(Gint name, double pri);
+extern int XgksMoSetSegDet	(Gint name, Gsegdet det);
+extern int XgksMoActivateWs	(WS_STATE_PTR ws);
+extern int XgksInitGksM		(void);
 
 #endif	/* XGKS_METAFILE_H not defined above */
diff --git a/xgks/src/lib/mkerrmsg.c b/xgks/src/lib/mkerrmsg.c
index ec1f069..6f9a801 100644
--- a/xgks/src/lib/mkerrmsg.c
+++ b/xgks/src/lib/mkerrmsg.c
@@ -46,7 +46,7 @@
 #include "udposix.h"
 
 #ifndef lint
-    static char	*rcsid	="$Id: mkerrmsg.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char	*rcsid	="$Id$";
     static char	*afsid	="$__Header$";
 #endif
 
diff --git a/xgks/src/lib/open_gks.c b/xgks/src/lib/open_gks.c
index 5f9f11b..fef9745 100644
--- a/xgks/src/lib/open_gks.c
+++ b/xgks/src/lib/open_gks.c
@@ -54,7 +54,7 @@ extern FILE	*errfp;
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: open_gks.c 8483 2004-01-21 23:06:13Z kobrien $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 /* gks state list */
diff --git a/xgks/src/lib/open_ws.c b/xgks/src/lib/open_ws.c
index 5b902c2..98378fc 100644
--- a/xgks/src/lib/open_ws.c
+++ b/xgks/src/lib/open_ws.c
@@ -50,7 +50,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: open_ws.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 extern void		XgksDelAllMoSeg();
diff --git a/xgks/src/lib/pick.c b/xgks/src/lib/pick.c
index 46b92fd..9d58110 100644
--- a/xgks/src/lib/pick.c
+++ b/xgks/src/lib/pick.c
@@ -55,7 +55,7 @@
 #define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char     afsid[] = "$__Header$";
-    static char     rcsid[] = "$Id: pick.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char     rcsid[] = "$Id$";
 #endif
 
 /*
diff --git a/xgks/src/lib/polylines.c b/xgks/src/lib/polylines.c
index 0219e76..f2c1b0f 100644
--- a/xgks/src/lib/polylines.c
+++ b/xgks/src/lib/polylines.c
@@ -59,7 +59,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: polylines.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/polylines.h b/xgks/src/lib/polylines.h
index 81760dd..48b510b 100644
--- a/xgks/src/lib/polylines.h
+++ b/xgks/src/lib/polylines.h
@@ -25,7 +25,7 @@
  * 
  * Define file for :  polyline predefined bundles
  * 
- * $Id: polylines.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/polymarkers.c b/xgks/src/lib/polymarkers.c
index 9c85ef7..65b0758 100644
--- a/xgks/src/lib/polymarkers.c
+++ b/xgks/src/lib/polymarkers.c
@@ -59,7 +59,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: polymarkers.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/polymarkers.h b/xgks/src/lib/polymarkers.h
index bb90c6c..d0b1962 100644
--- a/xgks/src/lib/polymarkers.h
+++ b/xgks/src/lib/polymarkers.h
@@ -25,7 +25,7 @@
  * 
  * Define file for :  polymarker predefined bundles
  * 
- * $Id: polymarkers.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/primitive.h b/xgks/src/lib/primitive.h
index 0e3dff7..6628f2a 100644
--- a/xgks/src/lib/primitive.h
+++ b/xgks/src/lib/primitive.h
@@ -37,7 +37,7 @@
  *
  * This header-file depends upon header-files "xgks.h" and "gks_defines.h".
  *
- * $Id: primitive.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/prmgr.c b/xgks/src/lib/prmgr.c
index 72d01f7..83803b8 100644
--- a/xgks/src/lib/prmgr.c
+++ b/xgks/src/lib/prmgr.c
@@ -67,7 +67,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: prmgr.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 static void	XgksFreePrimiStruct();
diff --git a/xgks/src/lib/ps.c b/xgks/src/lib/ps.c
index 9a30084..5529eb7 100644
--- a/xgks/src/lib/ps.c
+++ b/xgks/src/lib/ps.c
@@ -103,7 +103,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: ps.c 8483 2004-01-21 23:06:13Z kobrien $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 static char MARKERSIZE[] = "markersize";
diff --git a/xgks/src/lib/ps/ps.h b/xgks/src/lib/ps/ps.h
index e070c82..1a6bceb 100644
--- a/xgks/src/lib/ps/ps.h
+++ b/xgks/src/lib/ps/ps.h
@@ -20,7 +20,7 @@
  * SOFTWARE.
  * PostScript driver for XGKS metafiles
  * Created by Joe Sirott, Pacific Marine Environmental Lab
- * $Id: ps.h 9621 2006-09-22 16:34:28Z ansley $
+ * $Id$
  */
 
 
@@ -28,71 +28,71 @@
 #define XGKS_PS_H
 
 
-extern int PSrecSize	PROTO((
+extern int PSrecSize(
     Gint            type
-));
-extern int PSnextItem	PROTO((
+);
+extern int PSnextItem(
     Metafile	*mf		/* Metafile structure */
-));
-extern int PSwriteItem	PROTO((
+);
+extern int PSwriteItem(
     Metafile      **mf,		/* Metafile structures */
     int             num,	/* Number of Metafiles */
     Gint	    type,	/* item type */
     Gint	    length,	/* item length */
     Gchar          *data	/* item data-record */
-));
-extern int PSreadItem	PROTO((
+);
+extern int PSreadItem(
     Metafile	*mf,		/* Metafile structure  */
     char        *record	/* input data-record */
-));
-extern int PSmiOpen	PROTO((
+);
+extern int PSmiOpen(
     Metafile	*mf		/* Metafile structure */
-));
-extern int PSmoOpen	PROTO((
+);
+extern int PSmoOpen(
     WS_STATE_PTR ws
-));
-extern int PSmoClose	PROTO((
+);
+extern int PSmoClose(
     Metafile	*mf
-));
-extern int PSclear	PROTO((
+);
+extern int PSclear(
     Metafile	*mf,
     int		num,
     Gclrflag	flag
-));
-extern int PSredrawAllSeg	PROTO((
+);
+extern int PSredrawAllSeg(
     Metafile	**mf,
     int		num
-));
-extern int PSupdate	PROTO((
+);
+extern int PSupdate(
     Metafile	**mf,
     int		num,
     Gregen	regenflag
-));
-extern int PSdefer	PROTO((
+);
+extern int PSdefer(
     Metafile	**mf,
     int		num,
     Gdefmode	defer_mode,
     Girgmode	regen_mode
-));
-extern int PSmessage	PROTO((
+);
+extern int PSmessage(
     Metafile	**mf,
     int		num,
     Gchar	*string
-));
-extern int PSoutputGraphic	PROTO((
+);
+extern int PSoutputGraphic(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	num_pt,
     Gpoint	*pos
-));
-extern int PStext	PROTO((
+);
+extern int PStext(
     Metafile	*mf,
     int		num,
     Gpoint	*at,
     Gchar	*string
-));
-extern int PScellArray	PROTO((
+);
+extern int PScellArray(
     Metafile	*mf,
     int		num,
     Gpoint	*ll,
@@ -101,62 +101,62 @@ extern int PScellArray	PROTO((
     Gint	row,
     Gint	*colour,
     Gipoint	*dim
-));
-extern int PSsetGraphSize	PROTO((
+);
+extern int PSsetGraphSize(
     Metafile	*mf,
     int		num,
     Gint	code,
     double	size
-));
-extern int PScloseSeg	PROTO((
+);
+extern int PScloseSeg(
     Metafile	*mf,
     int		num
-));
-extern int PSsetGraphAttr	PROTO((
+);
+extern int PSsetGraphAttr(
     Metafile	*mf,
     int		num,
     Gint	code,
     Gint	attr
-));
-extern int PSsetTextFP	PROTO((
+);
+extern int PSsetTextFP(
     Metafile	*mf,
     int		num,
     Gtxfp	*txfp
-));
-extern int PSsetCharUp	PROTO((
+);
+extern int PSsetCharUp(
     Metafile	*mf,
     int		num,
     Gpoint	*up,
     Gpoint	*base
-));
-extern int PSsetTextPath	PROTO((
+);
+extern int PSsetTextPath(
     Metafile	*mf,
     int		num,
     Gtxpath	path
-));
-extern int PSsetTextAlign	PROTO((
+);
+extern int PSsetTextAlign(
     Metafile	*mf,
     int		num,
     Gtxalign	*align
-));
-extern int PSsetFillStyle	PROTO((
+);
+extern int PSsetFillStyle(
     Metafile	*mf,
     int		num,
     Gflinter	style
-));
-extern int PSsetPatSize	PROTO((
+);
+extern int PSsetPatSize(
     Metafile	*mf,
     int		num
-));
-extern int PSsetPatRefpt	PROTO((
+);
+extern int PSsetPatRefpt(
     Metafile	*mf,
     int		num
-));
-extern int PSsetAsf	PROTO((
+);
+extern int PSsetAsf(
     Metafile	*mf,
     int		num
-));
-extern int PSsetLineMarkRep	PROTO((
+);
+extern int PSsetLineMarkRep(
     Metafile	*mf,
     int		num,
     Gint	code,
@@ -164,84 +164,84 @@ extern int PSsetLineMarkRep	PROTO((
     Gint	type,
     double	size,
     Gint	colour
-));
-extern int PSsetTextRep	PROTO((
+);
+extern int PSsetTextRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gtxbundl	*rep
-));
-extern int PSsetFillRep	PROTO((
+);
+extern int PSsetFillRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gflbundl	*rep
-));
-extern int PSsetPatRep	PROTO((
+);
+extern int PSsetPatRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gptbundl	*rep
-));
-extern int PSsetColRep	PROTO((
+);
+extern int PSsetColRep(
     Metafile	*mf,
     int		num,
     Gint	idx,
     Gcobundl	*rep
-));
-extern int PSsetClip	PROTO((
+);
+extern int PSsetClip(
     Metafile	*mf,
     int		num,
     Glimit	*rect
-));
-extern int PSsetLimit	PROTO((
+);
+extern int PSsetLimit(
     Metafile	*mf,
     int		num,
     Gint	code,
     Glimit	*rect
-));
-extern int PSrenameSeg	PROTO((
+);
+extern int PSrenameSeg(
     Metafile	*mf,
     int		num,
     Gint	old,
     Gint	new
-));
-extern int PSsetSegTran	PROTO((
+);
+extern int PSsetSegTran(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gfloat	matrix[2][3]
-));
-extern int PSsetSegAttr	PROTO((
+);
+extern int PSsetSegAttr(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gint	code,
     Gint	attr
-));
-extern int PSsetSegVis	PROTO((
+);
+extern int PSsetSegVis(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegvis	vis
-));
-extern int PSsetSegHilight	PROTO((
+);
+extern int PSsetSegHilight(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gseghi	hilight
-));
-extern int PSsetSegPri	PROTO((
+);
+extern int PSsetSegPri(
     Metafile	*mf,
     int		num,
     Gint	name,
     double	pri
-));
-extern int PSsetSegDetect	PROTO((
+);
+extern int PSsetSegDetect(
     Metafile	*mf,
     int		num,
     Gint	name,
     Gsegdet	det
-));
+);
 
 #endif	/* XGKS_PS_H not defined */
diff --git a/xgks/src/lib/segments.c b/xgks/src/lib/segments.c
index 6d09aad..595e860 100644
--- a/xgks/src/lib/segments.c
+++ b/xgks/src/lib/segments.c
@@ -119,7 +119,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: segments.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 #define MAXNUM 1.0e+20
diff --git a/xgks/src/lib/string.c b/xgks/src/lib/string.c
index 28ec632..adf94d1 100644
--- a/xgks/src/lib/string.c
+++ b/xgks/src/lib/string.c
@@ -53,7 +53,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: string.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 #define DEF_STR_BUFSIZ	1024
diff --git a/xgks/src/lib/stroke.c b/xgks/src/lib/stroke.c
index d5f0981..55bd5fc 100644
--- a/xgks/src/lib/stroke.c
+++ b/xgks/src/lib/stroke.c
@@ -50,7 +50,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: stroke.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/text.c b/xgks/src/lib/text.c
index 5aecbaf..f68d52c 100644
--- a/xgks/src/lib/text.c
+++ b/xgks/src/lib/text.c
@@ -66,7 +66,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: text.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 #define PI	3.1415926535897932384626433
diff --git a/xgks/src/lib/text.h b/xgks/src/lib/text.h
index dcbb803..3467f6d 100644
--- a/xgks/src/lib/text.h
+++ b/xgks/src/lib/text.h
@@ -25,7 +25,7 @@
  * 
  * Define file for :  predefined text bundles
  * 
- * $Id: text.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/transforms.c b/xgks/src/lib/transforms.c
index 9b68cfb..fca19fc 100644
--- a/xgks/src/lib/transforms.c
+++ b/xgks/src/lib/transforms.c
@@ -59,7 +59,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: transforms.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/update.c b/xgks/src/lib/update.c
index ccd0cd0..0c3bb16 100644
--- a/xgks/src/lib/update.c
+++ b/xgks/src/lib/update.c
@@ -43,7 +43,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: update.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/valuator.c b/xgks/src/lib/valuator.c
index fe1ee40..d8963ff 100644
--- a/xgks/src/lib/valuator.c
+++ b/xgks/src/lib/valuator.c
@@ -58,7 +58,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: valuator.c 23929 2017-06-26 20:24:42Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 /* As under current implementation pets 1 and 2 are supported */
diff --git a/xgks/src/lib/wdt.h b/xgks/src/lib/wdt.h
index f9ff2cf..59da677 100644
--- a/xgks/src/lib/wdt.h
+++ b/xgks/src/lib/wdt.h
@@ -37,7 +37,7 @@
  *
  * This header-file depends upon header-files "xgks.h" and "gks_defines.h".
  * 
- * $Id: wdt.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
diff --git a/xgks/src/lib/wslist.h b/xgks/src/lib/wslist.h
index 5553ee8..992e3bb 100644
--- a/xgks/src/lib/wslist.h
+++ b/xgks/src/lib/wslist.h
@@ -36,7 +36,7 @@
  * This header-file depends upon header-files "gks_defines.h", "primitive.h",
  * and "wdt.h".
  *
- * $Id: wslist.h 6396 1998-12-09 21:05:00Z kobrien $
+ * $Id$
  */
 
 
@@ -287,9 +287,9 @@ typedef struct ws_struct {
 #define	NOT_SET	(-9.99)
 
 
-extern Gwscat          XgksWsCategory		PROTO((WS_STATE_PTR ws));
-extern EWSTYPE         XgksWsTypeToEnum		PROTO((Gchar *wstype));
-extern WS_STATE_PTR    XgksValidWsId		PROTO((Gint ws_id));
+extern Gwscat          XgksWsCategory(WS_STATE_PTR ws);
+extern EWSTYPE         XgksWsTypeToEnum(Gchar *wstype);
+extern WS_STATE_PTR    XgksValidWsId(Gint ws_id);
 
 
 /*
@@ -378,22 +378,26 @@ extern WS_STATE_PTR    XgksValidWsId		PROTO((Gint ws_id));
  * The "Xc" prefix refers to "X-color".
  */
 
-#ifndef PROTO
-#   define	PROTO(x)	()
-#endif
-
 
 /*
  * Procedural interface to the GKS <-> X color-mapping abstraction:
  */
-extern int	XcNew		PROTO((WS_STATE_PTR XcWs));
-extern int	XcInit		PROTO((WS_STATE_PTR XcWs, XVisualInfo *vinfo));
-extern int	XcSetColour	PROTO((WS_STATE_PTR XcWs, Gint ColourIndex,
-				       Gcobundl *XcRep));
+extern int	XcNew(WS_STATE_PTR XcWs);
+extern int	XcInit(WS_STATE_PTR XcWs, XVisualInfo *vinfo);
+extern int	XcSetColour(WS_STATE_PTR XcWs, Gint ColourIndex,
+				       Gcobundl *XcRep);
 extern unsigned long	
-	    	XcPixelValue    PROTO((WS_STATE_PTR XcWs, Gint ColourIndex));
-extern Gint	XcColourIndex	PROTO((WS_STATE_PTR XcWs,
-				       unsigned long PixelValue));
-extern int	XcEnd		PROTO((WS_STATE_PTR XcWs));
+	    	XcPixelValue(WS_STATE_PTR XcWs, Gint ColourIndex);
+extern Gint	XcColourIndex(WS_STATE_PTR XcWs,
+				       unsigned long PixelValue);
+extern int	XcEnd(WS_STATE_PTR XcWs);
+
+/* Added prototypes */
+int  GIFFlush(Metafile *mf, char *filename);
+int  GIFFlusht0(Metafile *mf, char *filename);
+int  GIFFlusht1(Metafile *mf, char *filename);
+void GIFresize(WS_STATE_PTR ws, Gpoint size);
+void PSresize(WS_STATE_PTR ws, Gpoint size);
+void XgksDrawSegToWs(WS_STATE_PTR);
 
 #endif					/* WSLIST_H not defined */
diff --git a/xgks/src/lib/x/Makefile.in b/xgks/src/lib/x/Makefile.in
index 8f8a99a..86bc3ab 100644
--- a/xgks/src/lib/x/Makefile.in
+++ b/xgks/src/lib/x/Makefile.in
@@ -1,6 +1,6 @@
 # Makefile for the X backend to XGKS
 #
-# $Id: Makefile.in 6358 1998-09-01 17:32:40Z tmap $
+# $Id$
 
 LIBNAME		= xgks
 REMOTE_LIBRARY	= ../lib$(LIBNAME).a
diff --git a/xgks/src/lib/x/xSet.c b/xgks/src/lib/x/xSet.c
index 4d5a339..4119fc9 100644
--- a/xgks/src/lib/x/xSet.c
+++ b/xgks/src/lib/x/xSet.c
@@ -41,7 +41,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xSet.c 6358 1998-09-01 17:32:40Z tmap $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/x/xcellarray.c b/xgks/src/lib/x/xcellarray.c
index d6eeef8..05b9b8b 100644
--- a/xgks/src/lib/x/xcellarray.c
+++ b/xgks/src/lib/x/xcellarray.c
@@ -50,7 +50,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xcellarray.c 6358 1998-09-01 17:32:40Z tmap $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/x/xcolours.c b/xgks/src/lib/x/xcolours.c
index d9237ea..ac0ac28 100644
--- a/xgks/src/lib/x/xcolours.c
+++ b/xgks/src/lib/x/xcolours.c
@@ -72,7 +72,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xcolours.c 19905 2015-07-01 00:25:30Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 #ifdef DEBUG
diff --git a/xgks/src/lib/x/xevent.c b/xgks/src/lib/x/xevent.c
index 79df81f..a10efae 100644
--- a/xgks/src/lib/x/xevent.c
+++ b/xgks/src/lib/x/xevent.c
@@ -47,7 +47,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xevent.c 21965 2016-06-20 18:10:36Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 #ifdef EVENTDEBUG
diff --git a/xgks/src/lib/x/xfillarea.c b/xgks/src/lib/x/xfillarea.c
index cdc0758..20423ea 100644
--- a/xgks/src/lib/x/xfillarea.c
+++ b/xgks/src/lib/x/xfillarea.c
@@ -48,7 +48,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xfillarea.c 6358 1998-09-01 17:32:40Z tmap $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/x/xinqpixel.c b/xgks/src/lib/x/xinqpixel.c
index 1b15a48..d513fae 100644
--- a/xgks/src/lib/x/xinqpixel.c
+++ b/xgks/src/lib/x/xinqpixel.c
@@ -45,7 +45,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xinqpixel.c 6358 1998-09-01 17:32:40Z tmap $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/x/xopws.c b/xgks/src/lib/x/xopws.c
index e2e200a..00e07d3 100644
--- a/xgks/src/lib/x/xopws.c
+++ b/xgks/src/lib/x/xopws.c
@@ -75,7 +75,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xopws.c 20213 2015-08-17 22:09:56Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 static int      InitDefaults();
diff --git a/xgks/src/lib/x/xpline.c b/xgks/src/lib/x/xpline.c
index 8f4d875..f9ef211 100644
--- a/xgks/src/lib/x/xpline.c
+++ b/xgks/src/lib/x/xpline.c
@@ -48,7 +48,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xpline.c 6358 1998-09-01 17:32:40Z tmap $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 extern DashList xgksDASHES[];
diff --git a/xgks/src/lib/x/xpmarker.c b/xgks/src/lib/x/xpmarker.c
index 6b6f5fd..3db1d88 100644
--- a/xgks/src/lib/x/xpmarker.c
+++ b/xgks/src/lib/x/xpmarker.c
@@ -48,7 +48,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xpmarker.c 6358 1998-09-01 17:32:40Z tmap $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/x/xport.c b/xgks/src/lib/x/xport.c
index 4c588e5..f26ae7e 100644
--- a/xgks/src/lib/x/xport.c
+++ b/xgks/src/lib/x/xport.c
@@ -4,7 +4,7 @@
  */
 
 #ifndef lint
-    static char	rcsid[]	= "$Id: xport.c 8483 2004-01-21 23:06:13Z kobrien $";
+    static char	rcsid[]	= "$Id$";
 #endif
 
 #include <wchar.h>
diff --git a/xgks/src/lib/x/xtext.c b/xgks/src/lib/x/xtext.c
index 940f0a3..08ccada 100644
--- a/xgks/src/lib/x/xtext.c
+++ b/xgks/src/lib/x/xtext.c
@@ -56,7 +56,7 @@
 #   define	malloc(n)	(lint_malloc((n)), 0)
 #else
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xtext.c 19905 2015-07-01 00:25:30Z ksmith $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 #define PI	3.1415926535897932384626433
diff --git a/xgks/src/lib/x/xupdate.c b/xgks/src/lib/x/xupdate.c
index ace8cb5..7f311c1 100644
--- a/xgks/src/lib/x/xupdate.c
+++ b/xgks/src/lib/x/xupdate.c
@@ -54,7 +54,7 @@
 
 #ifndef lint
     static char afsid[]	= "$__Header$";
-    static char rcsid[]	= "$Id: xupdate.c 6358 1998-09-01 17:32:40Z tmap $";
+    static char rcsid[]	= "$Id$";
 #endif
 
 
diff --git a/xgks/src/lib/xgks.h b/xgks/src/lib/xgks.h
index 0b888b8..34f1d7e 100644
--- a/xgks/src/lib/xgks.h
+++ b/xgks/src/lib/xgks.h
@@ -37,7 +37,7 @@
  *
  * This header-file includes header-file <stdio.h>.
  * 
- * $Id: xgks.h 6358 1998-09-01 17:32:40Z tmap $
+ * $Id$
  * $__Header$
  */
 
@@ -1528,16 +1528,12 @@ typedef enum Gfuncerrmap {
 #define gxconfig(ws)	gescsetbackingstore(ws, 1)
 #define gxname(name)	gescsetprogname(name)
 
+extern void gescsetbackingstore(Gint ws, Gint i);
+extern void gescsetprogname(Gchar *name);
 
-/*
- * Declarations of non-int functions:
- */
-
-#ifndef PROTO
-#   define PROTO(x)	()
-#endif
-
-extern void gescsetbackingstore PROTO((Gint ws, Gint i));
-extern void gescsetprogname     PROTO((Gchar *name));
+/* Added prototypes */
+void WindowMapping(int map_it);
+int  gescsetdcsize(Gint ws_id, Gpoint size);
+void xProcessEvents(void);
 
 #endif

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



More information about the debian-science-commits mailing list