summaryrefslogtreecommitdiff
path: root/tools/PracroAdd
diff options
context:
space:
mode:
authordeva <deva>2007-07-13 10:37:41 +0000
committerdeva <deva>2007-07-13 10:37:41 +0000
commit3ec2c4175b940ad4d06dd9818dbee8928c22a20c (patch)
treeef48143366668f84bcf2e2f550d3eada7cd311a4 /tools/PracroAdd
parent3b0d2f3ce16c80cd453f6153ad4063a55153b29b (diff)
Added new_file script
Diffstat (limited to 'tools/PracroAdd')
-rw-r--r--tools/PracroAdd67
1 files changed, 67 insertions, 0 deletions
diff --git a/tools/PracroAdd b/tools/PracroAdd
new file mode 100644
index 0000000..acbe519
--- /dev/null
+++ b/tools/PracroAdd
@@ -0,0 +1,67 @@
+# -*- mode: shell-script; sh-shell: bash; sh-indentation: 2 -*-
+
+function allfile() {
+ echo "/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */" > $1;
+ echo "/***************************************************************************" >> $1;
+ echo " * $1" >> $1;
+ echo " *" >> $1 ;
+ echo " * `date`" >> $1;
+ echo -n " * Copyright " >> $1
+ echo -n `date +%Y | xargs` >> $1
+ echo " Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup" >> $1;
+ echo " * deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk" >> $1;
+ echo " ****************************************************************************/" >> $1;
+ echo "" >> $1;
+ echo "/*" >> $1;
+ echo " * This file is part of Pracro." >> $1;
+ echo " *" >> $1;
+ echo " * Pracro is free software; you can redistribute it and/or modify" >> $1;
+ echo " * it under the terms of the GNU General Public License as published by" >> $1;
+ echo " * the Free Software Foundation; either version 2 of the License, or" >> $1;
+ echo " * (at your option) any later version." >> $1;
+ echo " *" >> $1;
+ echo " * Pracro is distributed in the hope that it will be useful," >> $1;
+ echo " * but WITHOUT ANY WARRANTY; without even the implied warranty of" >> $1;
+ echo " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" >> $1;
+ echo " * GNU General Public License for more details." >> $1;
+ echo " *" >> $1;
+ echo " * You should have received a copy of the GNU General Public License" >> $1;
+ echo " * along with Pracro; if not, write to the Free Software" >> $1;
+ echo " * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA." >> $1;
+ echo " */" >> $1;
+}
+
+function ccfile() {
+ local hf=`echo -n $1 | cut -d'.' -f1`.h;
+ hfile $hf;
+
+ allfile $1;
+ echo -n '#include "' >> $1;
+ echo -n $hf >> $1;
+ echo '"' >> $1;
+ echo '' >> $1;
+}
+
+function hfile() {
+ allfile $1;
+ local hn=`echo $1 | tr 'a-z.' 'A-Z_'`
+ echo -n "#ifndef __PRACRO_" >> $1;
+ echo -n "$hn" >> $1;
+ echo "__" >> $1;
+ echo -n "#define __PRACRO_" >> $1;
+ echo -n "$hn" >> $1;
+ echo "__" >> $1;
+ echo -n "#endif/*__PRACRO_" >> $1;
+ echo -n "$hn" >> $1;
+ echo "__*/" >> $1;
+}
+
+if [ "$#" = "1" ]; then
+if [ "CC" = `echo $1 | cut -d'.' -f2 | tr 'a-z' 'A-Z'` ]; then
+ ccfile $1;
+fi;
+if [ "H" = `echo $1 | cut -d'.' -f2 | tr 'a-z' 'A-Z'` ]; then
+ hfile $1;
+fi;
+else echo "Usage: $0 filename";
+fi;