3
old_file="basis_list.cc"
4
new_file="basis_list.cc.new"
6
cat > ${new_file} << EOF1
7
// file automatically generated by: $0
9
/// This file is part of Rheolef.
11
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
13
/// Rheolef is free software; you can redistribute it and/or modify
14
/// it under the terms of the GNU General Public License as published by
15
/// the Free Software Foundation; either version 2 of the License, or
16
/// (at your option) any later version.
18
/// Rheolef is distributed in the hope that it will be useful,
19
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
/// GNU General Public License for more details.
23
/// You should have received a copy of the GNU General Public License
24
/// along with Rheolef; if not, write to the Free Software
25
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
/// =========================================================================
28
#include "rheolef/basis.h"
31
for basis in ${basis_list}; do
32
echo "#include \"${basis}.h\"" >> ${new_file}
35
cat >> ${new_file} << EOF2
40
basis_rep::make_ptr (string name)
42
// TODO: use gperf instead of a long if-else test suite
43
if (name == "") return 0;
46
for basis in ${basis_list}; do
47
echo " if (name == \"${basis}\") return new_macro(basis_${basis});" >> ${new_file}
50
cat >> ${new_file} << EOF3
51
error_macro ("undefined basis \`" << name << "'");
54
} // namespace rheolef
57
if test ! -f ${old_file}; then
58
mv ${new_file} ${old_file}
59
echo "! file ${old_file} created." 1>&2
60
elif diff ${old_file} ${new_file} >/dev/null; then
61
echo "! file ${old_file} unchanged." 1>&2
64
mv ${new_file} ${old_file}
65
echo "! file ${old_file} modified." 1>&2