Overview
Comment:Revisions for xmtt
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 2226a03e09f4139d49430fcd6170e26dd454e36d90aee94f5c62db7ed6c8f019
User & Date: gawthrop@users.sourceforge.net on 1999-03-09 00:03:19
Other Links: branch diff | manifest | tags
Context
1999-03-09
00:03:55
Major revisions for release 3.5 check-in: aef3d41bf9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
00:03:19
Revisions for xmtt check-in: 2226a03e09 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1999-03-08
21:24:43
Handles * representations:
rep* is special
rep shows all possible languages
check-in: 9cb40d6495 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt2reps_txt from [29a1758c0f] to [8b5d8284b3].

1
2
3
4
5
6
7
8
9
10
11






12
13
14
15
16
17
18
#! /bin/sh

# mtt2reps_txt: Gives a tabular listing of representations and languages
# P J Gawthrop July 1998, October 1998
# Copyright (c) P.J.Gawthrop, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$






## Revision 1.2  1999/03/08 06:34:07  peterg
## Removed mtt help - replaced by grep #SUMMARY - quicker
##
## Revision 1.1  1998/10/20 08:15:08  peterg
## Initial revision
##
###############################################################











>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/sh

# mtt2reps_txt: Gives a tabular listing of representations and languages
# P J Gawthrop July 1998, October 1998
# Copyright (c) P.J.Gawthrop, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1999/03/08 21:24:43  peterg
## Handles * representations:
##
## 	rep* is special
##         rep shows all possible languages
##
## Revision 1.2  1999/03/08 06:34:07  peterg
## Removed mtt help - replaced by grep #SUMMARY - quicker
##
## Revision 1.1  1998/10/20 08:15:08  peterg
## Initial revision
##
###############################################################
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
          if (index(rep,"*")==length(rep)){
            if ($2==rep) print $NF
          }
          else
            if (($2==rep)||($2==sprintf("%s*",rep))) print $NF
        }' rep=$rep |\
      sort -u | sed 's/[()]//g'`
    echo $rep $language |\
       awk '{
         printf( "%s", $1)
         for (i=2;i<=NF;i++) printf("\t%s", $i); 
         printf("\n")
       }'
done








|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
          if (index(rep,"*")==length(rep)){
            if ($2==rep) print $NF
          }
          else
            if (($2==rep)||($2==sprintf("%s*",rep))) print $NF
        }' rep=$rep |\
      sort -u | sed 's/[()]//g'`
    echo $rep $language  |\
       awk '{
         printf( "%s", $1)
         for (i=2;i<=NF;i++) printf("\t%s", $i); 
         printf("\n")
       }'
done

Modified mttroot/mtt/bin/trans/reps_txt2tk from [cedff4e4d3] to [48cec506ae].

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
# Copyright (c) P.J.Gawthrop, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



###############################################################


name=`mtt --version`












cat<<EOF






# The top level menu
menubutton .mtt -text "$name" -menu .mtt.sys







pack .mtt







menu .mtt.sys
.mtt.sys add cascade -label "NewSystem" -menu .mtt.sys.rep
.mtt.sys add cascade -label "sys1" -menu .mtt.sys.rep



.mtt.sys add cascade -label "sys2" -menu .mtt.sys.rep



.mtt.sys add separator











.mtt.sys add command -label "Exit" -command "exit"



EOF











# Create other menus from the reps.txt file
cat<<EOF
menu .mtt.sys.rep

EOF
awk '{



 printf("\n# Menus for representation %s\n", $1)
 printf(".mtt.sys.rep add  cascade -label \"%s\" -menu .mtt.sys.rep.%s\n", $1, $1);
 printf("menu .mtt.sys.rep.%s\n", $1);
 for (i=2;i<=NF;i++) {

    printf(".mtt.sys.rep.%s add  command -label  \"%s\" ", $1, $i);
    printf(" -command  \"exec mtt sys %s %s \" \n",  $1, $i); 
 }













}' 















>
>
>


>
|

>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>
>

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


>
>
>
>
>
>
>
>
>
>


|
>


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


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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Copyright (c) P.J.Gawthrop, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## 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
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);
    for (i=2;i<=NF;i++) {
      printf(" set mtt {mtt $args $system %s %s} \n", rep, $i); 
      printf(".rep.rep.%s add  command -label  \"%s\" ", $1, $i);
      printf(" -command  \"exec echo $mtt &; exec $mtt &\" \n"); 
   }
 }
 else {
    rep = $1;
    printf("\n# Menus for representation %s\n", rep)
    printf(".repall.repall add  cascade  -label \"%s\" -menu .repall.repall.%s\n", rep, rep);
    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 ]