#! /bin/bash

sed 's/add/sub/g' add.pas | sed 's/OPR/-/g' > sub.inc
sed 's/add/mul/g' add.pas | sed 's/OPR/\*/g' > mul.inc
sed 's/add/dvd/g' add.pas | sed 's|OPR|/|g' > dvd.inc
sed 's/OPR/+/g'   add.pas > add.inc

src="mtx09.pas add.inc sub.inc mul.inc dvd.inc"

# Clean list of funct. &proc. headers and leading comments {**
# remove single _ on one line to produce empty lines in comments
# in the interface sections used by pasdoc. The leading comment
# of each function/procedure to appear in the interface MUST NOT
# contain blank lines to be processed by awk simple begin,end pattern
# OR NOT ? TODO CHECK this out properly !
cat $src |\
awk  '/^{\*\*/,/^function /||/^procedure/' |\
sed 's/{\*\*/\n{/' |\
sed 's/^_$//' > mtx09.inc
ln -sf opr.pas opr.inc
ln -sf private.pas private.inc
