From: g0dil Date: Tue, 15 Jan 2008 10:13:01 +0000 (+0000) Subject: Added _template folder and 'add.sh' helper script X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=4b297da63f48cdcb5b6b7b7b92fa43ab1ce2f24d;p=senf.git Added _template folder and 'add.sh' helper script git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@599 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/_templates/Example.cc b/_templates/Example.cc new file mode 100644 index 0000000..fdd2150 --- /dev/null +++ b/_templates/Example.cc @@ -0,0 +1,50 @@ +// $Id$ +// +// Copyright (C) 2008 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// @AUTHOR@ +// +// 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 @NAME@ non-inline non-template implementation */ + +//#include "@NAME@.hh" +//#include "@NAME@.ih" + +// Custom includes + +//#include "@NAME@.mpp" +#define prefix_ +///////////////////////////////cc.p//////////////////////////////////////// + + + +///////////////////////////////cc.e//////////////////////////////////////// +#undef prefix_ +//#include "@NAME@.mpp" + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: diff --git a/_templates/Example.cci b/_templates/Example.cci new file mode 100644 index 0000000..0ebb613 --- /dev/null +++ b/_templates/Example.cci @@ -0,0 +1,47 @@ +// $Id$ +// +// Copyright (C) 2008 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// @AUTHOR@ +// +// 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 @NAME@ inline non-template implementation */ + +//#include "@NAME@.ih" + +// Custom includes + +#define prefix_ inline +///////////////////////////////cci.p/////////////////////////////////////// + + + +///////////////////////////////cci.e/////////////////////////////////////// +#undef prefix_ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: diff --git a/_templates/Example.ct b/_templates/Example.ct new file mode 100644 index 0000000..62a08d2 --- /dev/null +++ b/_templates/Example.ct @@ -0,0 +1,47 @@ +// $Id$ +// +// Copyright (C) 2008 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// @AUTHOR@ +// +// 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 @NAME@ non-inline template implementation */ + +//#include "@NAME@.ih" + +// Custom includes + +#define prefix_ +///////////////////////////////ct.p//////////////////////////////////////// + + + +///////////////////////////////ct.e//////////////////////////////////////// +#undef prefix_ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: diff --git a/_templates/Example.cti b/_templates/Example.cti new file mode 100644 index 0000000..6322864 --- /dev/null +++ b/_templates/Example.cti @@ -0,0 +1,47 @@ +// $Id$ +// +// Copyright (C) 2008 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// @AUTHOR@ +// +// 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 @NAME@ inline template implementation */ + +//#include "@NAME@.ih" + +// Custom includes + +#define prefix_ inline +///////////////////////////////cti.p/////////////////////////////////////// + + + +///////////////////////////////cti.e/////////////////////////////////////// +#undef prefix_ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: diff --git a/_templates/Example.dox b/_templates/Example.dox new file mode 100644 index 0000000..f168059 --- /dev/null +++ b/_templates/Example.dox @@ -0,0 +1,39 @@ +// $Id$ +// +// Copyright (C) 2008 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// @AUTHOR@ +// +// 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. + +/** \mainpage + + + */ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// mode: flyspell +// mode: auto-fill +// End: diff --git a/_templates/Example.hh b/_templates/Example.hh new file mode 100644 index 0000000..f97c2a9 --- /dev/null +++ b/_templates/Example.hh @@ -0,0 +1,51 @@ +// $Id$ +// +// Copyright (C) 2008 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// @AUTHOR@ +// +// 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 @NAME@ public header */ + +#ifndef HH_@NAME@_ +#define HH_@NAME@_ 1 + +// Custom includes + +//#include "@NAME@.mpp" +///////////////////////////////hh.p//////////////////////////////////////// + + + +///////////////////////////////hh.e//////////////////////////////////////// +//#include "@NAME@.cci" +//#include "@NAME@.ct" +//#include "@NAME@.cti" +#endif + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: diff --git a/_templates/Example.ih b/_templates/Example.ih new file mode 100644 index 0000000..4782a9e --- /dev/null +++ b/_templates/Example.ih @@ -0,0 +1,47 @@ +// $Id$ +// +// Copyright (C) 2008 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// @AUTHOR@ +// +// 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 @NAME@ internal header */ + +#ifndef IH_@NAME@_ +#define IH_@NAME@_ 1 + +// Custom includes + +///////////////////////////////ih.p//////////////////////////////////////// + + + +///////////////////////////////ih.e//////////////////////////////////////// +#endif + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: diff --git a/_templates/Example.mpp b/_templates/Example.mpp new file mode 100644 index 0000000..e4f7010 --- /dev/null +++ b/_templates/Example.mpp @@ -0,0 +1,63 @@ +// $Id$ +// +// Copyright (C) 2008 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// @AUTHOR@ +// +// 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 @NAME@ Boost.Preprocesser external iteration include */ + +#if !BOOST_PP_IS_ITERATING && !defined(MPP_@NAME@_) +#define MPP_@NAME@_ 1 + +// Custom includes + + +// ///////////////////////////mpp.p//////////////////////////////////////// +#elif BOOST_PP_IS_ITERATING // //////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////// +// Local Macros + + +// //////////////////////////////////////////////////////////////////////// +#if BOOST_PP_ITERATION_FLAGS()==1 // ////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////// + + + +// //////////////////////////////////////////////////////////////////////// +#endif // ///////////////////////////////////////////////////////////////// +// //////////////////////////////////////////////////////////////////////// +// Undefine local Macros + + +// //////////////////////////////////////////////////////////////////////// +#endif // ///////////////////////////////////////////////////////////////// +// ///////////////////////////mpp.e//////////////////////////////////////// + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: diff --git a/_templates/add.sh b/_templates/add.sh new file mode 100755 index 0000000..f349159 --- /dev/null +++ b/_templates/add.sh @@ -0,0 +1,49 @@ +#!/bin/sh -e + +if [ -z "$1" ]; then + cat <. [] + +Will add the file with that name to the current directory by copying +the appropriate template and replacing the @NAME@ placeholders +appropriately. + + needs to be one of + + hh header + ih internal header + cc non-inline non-template code + cci inline non-template code + ct non-inline template code + cti inline template code + mpp special Boost.Preprocessor sourcefile (external iteration) + dox additional doxygen documentation file + +If is given, it is also set correctly replaced. If +is unset but the environment variable SENF_AUTHOR is set, it's value +is used. Otherwise, the @AUTHOR@ placeholder will need to be replaced +manually. +EOF + exit 1 +fi + +base="`dirname "$0"`"; base="`cd "$base"; pwd`" + +type="${1##*.}" +name="`basename "$1" ".$type"`" + +if [ ! -r "$base/Example.$type" ] ; then + echo "Don't know about file type '$type'" + exit 1 +fi + +[ -z "$2" ] || SENF_AUTHOR="$2" + +if [ -r "$1" ] ; then + echo "Target file '$1' exists." + exit 1 +fi + +sed -e "s/@NAME@/$name/g" -e "s/@AUTHOR@/${SENF_AUTHOR:-@AUTHOR@}/g" \ + < "$base/Example.$type" \ + > "$1"