Artifact 1a32a9e3a244ded4b61df3bd7bd917bf65aac806d6630d725026cffb20ffb752:
- Executable file mttroot/mtt/bin/trans/mtt_p2m — part of check-in [d383e3be7f] at 2000-08-29 09:57:45 on branch origin/master — Another go at removing ends nicely (user: gawthrop@users.sourceforge.net, size: 534) [annotate] [blame] [check-ins using]
#! /bin/sh
## Chages the Pascal output from gentran to octave form
# Copyright (C) 2000 by Peter J. Gawthrop
sed 's/begin$//' |\
sed 's/end$//' |\
sed 's/end;$/;/' |\
sed 's/\[\([0-9,]*\)\]/(\1)/g' |\
sed 's/:=/ = /' |\
sed 's/\*\*/\^/g' |\
sed 's/mtt\([a-z]*\)\([0-9]\)\([0-9]*\)/mtt\1(\2\3)/g' |\
awk '{
sub(/^[\ ]*/, "", $0)
sub(/\$$/, ";", $0)
if (match($NF,"[;\#\.\%]$")==0){
Previous[++i] = $0
}
else {
for (j=1;j<=i;j++) printf("%s", Previous[j]);
printf("%s\n", $0)
i=0;
}
}' |\
sed 's/#/%/g'