Differences From Artifact [48cec506ae]:

To Artifact [069e67f88c]:


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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23


24















































25































26
27
28
29
30
31
32







+
+
+





-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







# Copyright (c) P.J.Gawthrop, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1999/03/09 00:03:19  peterg
## Revisions for xmtt
##
## Revision 1.1  1998/10/20 08:13:14  peterg
## Initial revision
##
###############################################################

#MTT blurb
title=`mtt --version`

#Collect all systems (inc dir name)
dirname=`basename $PWD`
systems=`echo *_abg.fig | sed 's/\([a-zA-Z0-9]*\)_abg.fig/\1/g'`
dirname_in_systems=`echo $systems | grep -c $dirname`
if [ "$dirname_in_systems" = "0" ]; then
    systems="$systems $dirname"
fi

# Default system
system=$dirname

cat<<EOF
# Default system
set system "$system"

# Arguments to mtt
set args "-q"

# The top level menu
button .mtt -text "$title ($dirname)" -command "exec mtt warranty &"
menubutton .util  -text "Utilities" -menu .util.util
menubutton .opt  -text "Options" -menu .opt.opt
menubutton .sys -text "Systems" -menu .sys.sys
menubutton .rep -text "Representations (major)" -menu .rep.rep
menubutton .repall -text "Representations (all)" -menu .repall.repall
menubutton .exam -text "Examples" -menu .exam.exam
button .mtt_quit -text "Quit" -command exit
pack .mtt .rep  .repall .sys .exam .util .opt  .mtt_quit
 
menu .util.util
# .mtt.opt.util add command -label "copy example" -command 
# .mtt.opt.util add command -label "copy" 
.util.util add command -label "clean" -command "exec mtt -q Clean &"
.util.util add command -label "recursive clean" -command "exec mtt -q rclean &"

menu .opt.opt


# System choice
menu .sys.sys
EOF

for sys in $systems; do
    echo .sys.sys add radio -label "$sys"  -command {set system "$sys"} 
done

# Create the options menu
# Create reps menu
mtt |  awk '{
  if (Options) {
    option=substr($1,2);
    label="";
    for (i=2;i<=NF;i++)
      label = sprintf("%s %s",label,$i);
    printf(".opt.opt add check -label \"%s (-%s)\" -variable %s -command {set args \"$args -%s\"}\n", label, option, option, option); 
  }
  if ($1=="Options:") Options = 1;
}'

# Examples menu
cat <<EOF
menu .exam.exam
EOF

awk '{
    gsub(/"/,"",$0); # zap quotes
    printf("\n# Example  %s\n", $1)
    sub(/:/,"",$1); # zap :
    printf(" set mtt {xmtt -example %s} \n", $1); 
    $1 = $1 ":";
    printf(" set label \"%s\" \n", $0); 
    printf(".exam.exam add command -label $label -command \"exec echo $mtt &; exec $mtt & \"\n", $1);
}' < $MTTPATH/EXAMPLES

# Create other menus from the reps.txt file
cat<<EOF
menu .rep.rep
menu .repall.repall
EOF
awk '{
# Important representation?
 if (index($1,"*")) {
    rep=substr($1,1,length($1)-1);
    printf("\n# Menus for representation %s\n", $1)
    printf(".rep.rep add  cascade -label \"%s\" -menu .rep.rep.%s\n", rep, $1);
    printf("menu .rep.rep.%s\n", $1);
119
120
121
122
123
124
125
126

127
128
129
130
131
132
133
134
135
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
59







-
+









    printf("menu .repall.repall.%s\n", rep);
    for (i=2;i<=NF;i++) {
      printf(" set mtt {mtt $args $system %s %s} \n", rep, $i); 
      printf(".repall.repall.%s add  command -label  \"%s\" ", rep, $i);
      printf(" -command  \"exec echo $mtt &; exec $mtt &\" \n"); 
   }
 }
}' <$MTTPATH/REPS 
}'










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