#!/usr/bin/env bash
umask 022

pwd=$( exec pwd )
gen=$( dirname "$0" )
gen=$( cd "${gen}" && exec pwd )
for d in "${gen}" ../../../src/lib/h ../../src/lib/h ../src/lib/h src/lib/h ; do
	if [[ -d "${d}" ]] ; then
		dir=$( cd "${d}" && exec pwd )
		if [[ "${dir}" = "${pwd}" ]] ; then
			echo "Do not run '$0' in '${pwd}'" 1>&2
			exit 1
		fi
	fi
done

rm -f HDR
rm -f map_lib.h

cat <<EOF >map_lib.h
//-----------------------------------------------------------------------------
// Copyright © 2003 - Philip Howard - All rights reserved
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that 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 this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//-----------------------------------------------------------------------------
// package	libh/map
// homepage	http://libh.slashusr.org/
//-----------------------------------------------------------------------------
// author	Philip Howard
// email	libh at ipal dot org
// homepage	http://phil.ipal.org/
//-----------------------------------------------------------------------------
// This file is best viewed using a fixed spaced font such as Courier
// and in a display at least 120 columns wide.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// file		map_lib.h
//
// purpose	Define resources for the data MAPping library package that
//		are needed only by the library source code itself.
//-----------------------------------------------------------------------------
#ifndef __MAP_LIB_H__
#define __MAP_LIB_H__

//-----------------------------------------------------------------------------
// headers
//-----------------------------------------------------------------------------
#include "libh_common.h"

#include <libh/map.h>

//-----------------------------------------------------------------------------
// end of header
//-----------------------------------------------------------------------------
#endif /* __MAP_LIB_H__ */
EOF

ls -ld --full-time map_lib.h

ln -fns libh/map.h HDR
ls -ld --full-time HDR

${gen}/map_array.sh
${gen}/map_scalar.sh

