summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-06-24 08:13:32 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-06-24 08:13:32 +0200
commit0c835dce3bf01dc31b33311378043b3799150a64 (patch)
tree65197c9aa5eec4cedf9bbf9156b9165532d257df /tools
Import from shared project.
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am6
-rwxr-xr-xtools/add_file89
2 files changed, 95 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
new file mode 100644
index 0000000..3799dc1
--- /dev/null
+++ b/tools/Makefile.am
@@ -0,0 +1,6 @@
+EXTRA_DIST = \
+ add_file \
+ test \
+ testlist \
+ test.h \
+ Makefile.am.test
diff --git a/tools/add_file b/tools/add_file
new file mode 100755
index 0000000..89d4e1a
--- /dev/null
+++ b/tools/add_file
@@ -0,0 +1,89 @@
+#!/bin/bash
+PROJECT="LibAudioIn"
+
+function allfile() {
+ echo "/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */" > $1;
+ echo "/* vim: set et sw=2 ts=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" >> $1;
+ echo " * deva@aasimon.org" >> $1;
+ echo " ****************************************************************************/" >> $1;
+ echo "" >> $1;
+ echo "/*" >> $1;
+ echo " * This file is part of $PROJECT." >> $1;
+ echo " *" >> $1;
+ echo " * $PROJECT 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 " * $PROJECT 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 $PROJECT; 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;
+
+ local hn=`echo $1 | cut -d'.' -f1 | tr 'a-z.' 'A-Z_'`
+ echo "#ifdef TEST_${hn}" >> $1;
+ echo "//Additional dependency files" >> $1;
+ echo "//deps:" >> $1;
+ echo "//Required cflags (autoconf vars may be used)" >> $1;
+ echo "//cflags:" >> $1;
+ echo "//Required link options (autoconf vars may be used)" >> $1;
+ echo "//libs:" >> $1;
+ echo "#include \"test.h\"" >> $1;
+ echo "" >> $1;
+ echo "TEST_BEGIN;" >> $1;
+ echo "" >> $1;
+ echo "// TODO: Put some testcode here (see test.h for usable macros)." >> $1;
+ echo "" >> $1;
+ echo "TEST_END;" >> $1;
+ echo "" >> $1;
+ echo "#endif/*TEST_${hn}*/" >> $1;
+}
+
+function hfile() {
+ allfile $1;
+ local hn=`echo $1 | tr 'a-z.' 'A-Z_'`
+ local pr=`echo $PROJECT | tr 'a-z.' 'A-Z_'`
+ echo "#ifndef __${pr}_${hn}__" >> $1;
+ echo "#define __${pr}_${hn}__" >> $1;
+ echo "#endif/*__${pr}_${hn}__*/" >> $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";
+ echo
+ echo "Examples:";
+ echo "$0 myclass.cc Which will produce both myclass.cc and myclass.h";
+ echo "$0 myinterface.h Which will only produce myinterface.h";
+ echo
+ echo "NOTE: The files will be created in the current directory!";
+fi;