1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#!/bin/bash
FN="$1"
FN_LOW=`echo "${FN}" | awk '{print tolower($1);}'`
if [ "${FN}" != "${FN_LOW}" ] ; then echo "Expecting single lower case word" ; exit ; fi
if [ "${F:0:8}" = "function" ] ; then echo "Not expecting argument to be prefixed 'function' (it will be added)" ; exit ; fi
F="functions_${FN}"
Y=`date +%Y`
WHO=${DEBEMAIL%<*>}
if [ -e ${F}.h ] ; then echo "${F}.h already exists" ; exit ; fi
if [ -e ${F}.cpp ] ; then echo "${F}.cpp already exists" ; exit ; fi
cat > ${F}.h <<EOF
// Source file for evolvotron
// Copyright (C) ${Y} ${WHO}
/*
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.
*/
/*! \file
\brief Interfaces and implementation for specific Function classes.
*/
#ifndef _functions_${FN}_h_
#define _functions_${FN}_h_
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
#endif
EOF
cat > ${F}.cpp <<EOF
// Source file for evolvotron
// Copyright (C) ${Y} ${WHO}
/*
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.
*/
/*! \file
\brief Implementation of specific Function classes.
Except there's nothing here because it's all in the header.
*/
#include "libfunction_precompiled.h"
#include "function_boilerplate_instantiate.h"
#include "${F}.h"
EOF
echo "Don't forget: "
echo " cvs add ${F}.h ${F}.cpp"
echo "and add to sources and headers in libfunction.pro"
echo "and"
echo " ./update_register_all_functions"
echo "when done"
|