blob: 1a17d4656b629766f51b5dd31015a0654b0c47de (
plain)
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
|
#!/bin/bash
PROJECT="LibAudioIO"
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" >> $1;
echo " * modify it under the terms of the GNU Lesser General Public" >> $1;
echo " * License as published by the Free Software Foundation; either" >> $1;
echo " * version 2.1 of the License, or (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 GNU" >> $1;
echo " * Lesser General Public License for more details." >> $1;
echo " * " >> $1;
echo " * You should have received a copy of the GNU Lesser General Public" >> $1;
echo " * License along with $PROJECT; if not, write to the Free Software" >> $1;
echo " * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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_'`
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;
|