#!/bin/sh

#
# Grapnel API with PVM target for Grapnel environment (inst-for-pg)
#
# Copyright (c) Drotos Daniel, University of Miskolc. 1994,98
#
#  This file is part of Grapnel API with PVM target for GRAPNEL
#  environment.
#
#  The GRAPNEL system is part of SEPP project. This project is
#  supported by the EC within COPERNICUS Research Project
#  No. 5383. The grp2c (Grapnel Compiler) translates GRP files,
#  generated by the Graphical Program Editor (GRED), into C
#  source. Latest version of the grapnel compiler is available on site
#  mazsola:
#
#  http://mazsola.iit.uni-miskolc.hu/~dani/grp2c
#
# This script is used to instrument PG-PVM version of the
# Grapnel Library
#
# Use: pginst source
#
# Where `source' is the name of the source file being modified
# without the .c extension!


if [ ! -f "${1}.c" ]; then
  exit 1
fi

TMP=/tmp/${1}.tmp

sed -e "/Instrumentation/{a\\
#include \"pg_proto.h\"
a\\

a\\
#define PgInstrumented 1
}
" ${1}.c >$TMP

mv $TMP ${1}_p.c

# End of inst-for-pg
