#!/bin/bash hn=amg_const.h fn=amg_base_prec_type.F90 echo "/* This file was generated by a script using the $fn file as a basis. */" > $hn echo '#ifndef AMG_CONST_H_' >> $hn echo '#define AMG_CONST_H_' >> $hn echo '#ifdef __cplusplus' >> $hn echo 'extern "C" { ' >> $hn echo '#endif' >> $hn cat $fn | sed 's/=/= (/g;s/$/ )/g' | grep '\(^ *!\)\|parameter' | grep '_\>' | sed 's/^\s*//g;s/^.*:://g;s/\s*=\s*/ /g' | sed 's/,/\n/g;s/^ //g' | tr '[:lower:]' '[:upper:]' | grep ^AMG | sed 's/^/#define /g' >> $hn echo '#ifdef __cplusplus' >> $hn echo '}' >> $hn echo '#endif' >> $hn echo '#endif' >> $hn exit