Differences From Artifact [3b8f7df6f9]:

To Artifact [a08246f929]:


1
2
3

4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
















35
36
37
#! /bin/sh

set -e


filename="$1"

# get expression to optimise

lhs=`cat ${filename} | gawk '{ print $1 }'`
rhs=`cat ${filename} | gawk '{ print $2 }'`

# set work file names

tmp="$0.tmp"
log="$0.log"



cat <<EOF | reduce > $log
off echo$
load scope$
on double$
on noconvert$
on rounded$
off int$
off nat$

out "${tmp}"$
optimize mtt_tmp0 :=: ${rhs} iname mtt_tmp$
write "${lhs} := mtt_tmp0"$
shut "${tmp}"$

;end;
EOF

















mv ${tmp} ${filename}

exit 0



>



<
<
<
<
<





>
|
|









|
|




|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



1
2
3
4
5
6
7





8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/sh

set -e
set -x

filename="$1"






# set work file names

tmp="$0.tmp"
log="$0.log"

optimise_with_reduce ()
{
    cat <<EOF | reduce > $log
off echo$
load scope$
on double$
on noconvert$
on rounded$
off int$
off nat$

out "${tmp}"$
optimize mtt_tmp0 :=: `cat ${filename} | gawk '{ print $2 }'` iname mtt_tmp$
write "`cat ${filename} | gawk '{ print $1 }'` := mtt_tmp0"$
shut "${tmp}"$

;end;
EOF
}

optimise_with_maxima ()
{
    cat ${filename}					|\
	tr "\t\n" "  "					|\
	sed -e 's/\ //g'				|\
	sed -e 's/\(MTTYz([0-9.]*,[0-9.]*)\)/\1 /'     	|\
	sed -e 's/[A-Za-z0-9_.:()]*(D2)\(.*\)/\1/'	|\
	sed -e 's/\([A-Za-z0-9_.:()]*\)(C3)/\1/g'	|\
	optimise_max2r.awk				|\
	tr "A-Z" "a-z"					> ${tmp}
}


optimise_with_maxima
#cat $filename
mv ${tmp} ${filename}

exit 0

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]