Differences From Artifact [fe70dda0ea]:

To Artifact [3056188b71]:


11
12
13
14
15
16
17




18
19
20
21
22
23
24
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28







+
+
+
+







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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  2002/04/28 18:55:03  geraint
## Fixed [ 549658 ] awk should be gawk.
## Replaced calls to awk with call to gawk.
##
## Revision 1.5  2000/11/27 10:13:25  peterg
## Now passes though options as second argument
##
## Revision 1.4  1998/04/14 18:17:15  peterg
## More messages about Makefile
##
## Revision 1.3  1998/04/14 18:01:04  peterg
51
52
53
54
55
56
57
58

59
60


61
62






































































63
64
65
66
67
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
136
137
138
139
140
141
142








+


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





if [ "$mtt_count" = "0" ]; then
  echo 'Hmm .. seems to be an old format. creating new file'
  echo "Old version saved as $1_rep.txt.SAVE"
  mv $1_rep.txt $1_rep.txt.SAVE
  strip_comments < $1_rep.txt.SAVE |\
  gawk '{print "mtt", sys, $1, $2}' sys="$1" >$1_rep.txt
fi


# Execute the commands - quietly and untidily!
# But use switches
# | sed "s/mtt /mtt -q -u $mtt_switches /" #| tee -a JUNK  | sh

strip_comments< $1_rep.txt | sed "s/mtt /mtt -q -u $mtt_switches /" | tee -a JUNK  | sh

strip_comments< $1_rep.txt | awk '
{
  ## Add in the external switches
  sub("mtt", sprintf("mtt %s", mtt_switches));
      
  ## Count the switches (noting that -i -dr -dw and -de have an argument)
  ## and make up a string (switches) containing them
  Switches=0; switches = "";
  for (i=2;i<=NF;i++) {
    if (match($i,"-")==1) {
      Switches++;
      switches=sprintf("%s%s", switches, $i);
    }
    if (match($i,"-i")==1) {
      Switches++;
      j=i+1;
      switches=sprintf("%s%s", switches, $j);
    }
    if (match($i,"-dr")==1){
      Switches++;
      j=i+1;
      switches=sprintf("%s%s", switches, $j);
    }
    if (match($i,"-dw")==1){
      Switches++;
      j=i+1;
      switches=sprintf("%s%s", switches, $j);
    }
    if (match($i,"-de")==1){
      Switches++;
      j=i+1;
      switches=sprintf("%s%s", switches, $j);
    }
  }
  System = $(Switches+2)
  Representation = $(Switches+3);
  Multiple = "odes odeso sms smso daes daeso";
  Language = $(Switches+4);

  args = $(Switches+5);
  if ( (length(args)>0)&&(match(Language,"ps")>0)) {
    __Args = sprintf("-%s", gensub(/_/, "-", "g", args) );
  }
  else
  {
  __Args = "";
  }

  ## mtt command
  printf("%s\n", $0);

  ## Add in the main mtt switches
  __Args = sprintf("%s%s", switches, __Args);
 
  ## Zap -q -u
  gsub("-[qu]","", __Args);

  ## Zap blanks
  gsub(" ","", __Args);

  ## copy result to long name file
  SysRepLang = sprintf("%s_%s.%s", System, Representation, Language);
  if (length(__Args)==0)
    __Args = "-noargs";
  SysRepArgLang = sprintf("%s_%s%s.%s", System, Representation, __Args, Language);
  printf("echo Creating %s\n", SysRepArgLang);
  printf("cp %s %s\n", SysRepLang, SysRepArgLang);

}' mtt_switches="${mtt_switches}"  | sh

echo "Done creating representations for $1_rep.tex"





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