#!/bin/bash
#
# --- GSMP-COPYRIGHT-NOTE-BEGIN ---
# 
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the GSMP-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
# 
# GSMP: dam/script/NewFile.sh
# General Sound Manipulation Program is Copyright (C) 2000 - 2004
#   Valentin Ziegler and René Rebe
# 
# 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; version 2. A copy of the GNU General
# Public License can be found in the file LICENSE.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANT-
# ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
# 
# --- GSMP-COPYRIGHT-NOTE-END ---

header=$1.hh
template=$1.tcc
src=$1.cc

headerfile=include/$header
templatefile=include/template/$template
srcfile=src/$src

incLock="DAM__"`echo $1 | tr [:lower:] [:upper:]`"_HH__"
templGuard="DAM__"`echo $1 | tr [:lower:] [:upper:]`"_TMPL__"

test -f $headerfile  && echo "$headerfile exists." && exit
test -f $templatefile  && echo "$templatefile exists." && exit
test -f $srcfile  && echo "$srcfile exists." && exit


cat > $headerfile <<EOF

#ifndef $incLock
#define $incLock

namespace DAM
{


} // end namespace DAM


/* include template implementation */
#define $templGuard
#include "template/$template"
#undef $templGuard

#endif // $incLock
EOF

cat > $templatefile <<EOF

// -*- c++ -*-

#ifndef $templGuard
#error "This file is included by $header."
#error "Include that file instead." 
#endif


namespace DAM
{


} // end namespace DAM
EOF

cat > $srcfile <<EOF

#include "$header"

using namespace DAM;

EOF
