#!/bin/sh 
#
# Part of rksuite_90 v1.2 (December 1995)
#         software for initial value problems in ODEs
#
# Authors: R.W. Brankin (NAG Ltd., Oxford, England)
#          I. Gladwell  (Math Dept., SMU, Dallas, TX, USA)
#          see main doc for contact details
#
# Script to automate generation of scalar dependent variable
# version of rksuite_90 from a 1d array dependent variable version
#
# USAGE do_1_to_0 <infile >outfile
#
# NOTE if "infile" is not the distributed copy of "rksuite_90.bas"
#      the results are not predictable
#
# NOTE this script is not meant to be neat/fast/efficient/...
#      however, it does work!
#
sed -e "s/\(_[rc]\)1/\10/" \
    -e "s/_1d/_0d/" \
    -e "/.*[^\!]$/s/(:,/(/g" \
    -e "/\!spec-/s/:,//g" \
    -e "/.*dep\!$/s/, dimension(:)//g" \
    -e "/.*dep\!$/s/(:,:)/(:)/g" \
    -e "/.*dep\!$/s/, dimension(size([a-z],1))//g" \
    -e "/.*alloc\!$/s/(size([^)]*))//g" \
    -e "/.*alloc\!$/s/size([^)]*),//g" \
    -e "/\!spec-ar\!/s-m[ai][xn]val--g" \
    -e "/\!spec-ar\!/s-sum--g" \
    -e "/\!spec-ar1\!/s-\(comm%y[p]*\)-(/\1/)-g"
