#! /bin/csh -f

# This C shell script will generate C code for all Karma data types based on a
# template file.

#   Copyright (C) 1992,1993  Richard Gooch
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#   Richard Gooch may be reached by email at  karma-request@atnf.csiro.au
#   The postal address is:
#     Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.


# Written by		Richard Gooch	4-JUN-1992

# Last updated by	Richard Gooch	16-OCT-1992


# Usage:	generic_to_c template_file.gen

if ("$#argv" != "1") then
    echo "Usage:	generic_to_c template_file.gen"
    exit 1
endif

set _infile = $argv[1]
set _outfile = $_infile:r.c

rm -f $_outfile
touch $_outfile

foreach _datatype (`cat $KARMABASE/etc/datatypes`)
    sed -e "s/C_DATA_TYPE/$_datatype/g" $_infile >> $_outfile
end

exit 0
