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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
+
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
-
-
-
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
|
grep -v '\[[0-9]*\]' $1_unique_raw_list | \
awk --field-separator ':' '
BEGIN {
OldComponent="None";
}
{
Component = $1;
Name = $2;
##Aliases
##Aliases
if (Component == "SS") {
port_alias[++j] = $2;
port_alias[++j] = Name;
}
else {
alias[++i] = $2;
alias[++i] = Name;
if (length(sensitivity)>0) {
s_arg = sprintf("%ss",$2);
s_arg = sprintf("%ss",Name);
alias[++i] = s_arg;
s_arg = sprintf(";%s",s_arg);
Component = substr(Component,2);
lin = "slin"
}
else {
lin = "lin"
}
}
## Table of components
cr["SS"] = "SS"; arg["SS"] = "external,external";
cr["Se"] = "SS"; arg["Se"] = sprintf("external%s", s_arg);
cr["Sf"] = "SS"; arg["Sf"] = sprintf("external%s", s_arg);
cr["De"] = "SS"; arg["De"] = "external";
cr["Df"] = "SS"; arg["Df"] = "external";
cr["R"] = lin; arg["R"] = sprintf("flow,%s%s", $2, s_arg);
cr["C"] = lin; arg["C"] = sprintf("effort,%s%s", $2, s_arg);
cr["I"] = lin; arg["I"] = sprintf("flow,%s%s", $2, s_arg);
cr["R"] = lin; arg["R"] = sprintf("flow,%s%s", Name, s_arg);
cr["C"] = lin; arg["C"] = sprintf("effort,%s%s", Name, s_arg);
cr["I"] = lin; arg["I"] = sprintf("flow,%s%s", Name, s_arg);
cr["CS"] = "lin"; arg["CS"] = sprintf("effort,%s;%s_x0%s", $2, $2, s_arg);
cr["IS"] = "lin"; arg["IS"] = sprintf("flow,%s;%s_x0%s", $2, $2, s_arg);
cr["INTFS"] = "lin"; arg["INTFS"] = sprintf("%s_x0%s", $2, s_arg);
cr["CS"] = "lin"; arg["CS"] = sprintf("effort,%s;%s_x0%s", Name, Name, s_arg);
cr["IS"] = "lin"; arg["IS"] = sprintf("flow,%s;%s_x0%s", Name, Name, s_arg);
cr["INTFS"] = "lin"; arg["INTFS"] = sprintf("%s_x0%s", Name, s_arg);
cr["TF"] = "lin"; arg["TF"] = sprintf("flow,%s%s", $2, s_arg);
cr["GY"] = "lin"; arg["GY"] = sprintf("flow,%s%s", $2, s_arg);
cr["TF"] = "lin"; arg["TF"] = sprintf("flow,%s%s", Name, s_arg);
cr["GY"] = "lin"; arg["GY"] = sprintf("flow,%s%s", Name, s_arg);
cr["AE"] = "lin"; arg["AE"] = sprintf("%s%s", $2, s_arg);
cr["AF"] = "lin"; arg["AF"] = sprintf("%s%s", $2, s_arg);
cr["AE"] = "lin"; arg["AE"] = sprintf("%s%s", Name, s_arg);
cr["AF"] = "lin"; arg["AF"] = sprintf("%s%s", Name, s_arg);
cr["CDx"] = "lin"; arg["CDx"] = sprintf("%s%s", $2, s_arg);
cr["CDx"] = "lin"; arg["CDx"] = sprintf("%s%s", Name, s_arg);
cr["RS"] = lin; arg["RS"] = sprintf("flow,%s%s", $2, s_arg);
cr["RS"] = lin; arg["RS"] = sprintf("flow,%s%s", Name, s_arg);
## Heading
if (Component !~ OldComponent) print "\n% Component type", Component
## Component
printf("\t%s\t", Component);
printf("\t%s\t", Name);
if (Component in cr)
printf("%s\t\t", cr[Component])
else
printf("none\t\t");
if (Component in arg)
printf("%s\t\t\n", arg[Component])
else {
print "lbl2args_txt2out", Component | "/bin/sh"; close("/bin/sh")
}
##print "\t" $2 "\t" cr[Component] "\t\t" arg[Component];
OldComponent=Component;
}
END{
print "\n% Port aliases" >> "mtt_junk_alias.txt";
for (k=1;k<=j;k++){
if (port_alias[k] ~ "\\["){ # Only do ports
port_name = substr(port_alias[k],2,length(port_alias[k])-2);
if (length(sensitivity)==0)
print "%ALIAS\t" port_name "\t" port_name >> "mtt_junk_alias.txt";
else
print "%ALIAS\t" port_name "\t" port_name "_1," port_name "_2" >> "mtt_junk_alias.txt";
}
}
print "\n% Argument aliases" >> "mtt_junk_alias.txt";
for (k=1;k<=i;k++){
print "%ALIAS\t\$" k "\t" alias[k] >> "mtt_junk_alias.txt";
# print "\n% Argument aliases" >> "mtt_junk_alias.txt";
# for (k=1;k<=i;k++){
# print "%ALIAS\t\$" k "\t" alias[k] >> "mtt_junk_alias.txt";
}
}' sensitivity=$sensitivity > mtt_junk_body.txt
# }
}' sensitivity=$sensitivity > $1_lbl.txt
cat mtt_junk_top.txt mtt_junk_alias.txt mtt_junk_blurb.txt mtt_junk_body.txt > $1_lbl.txt
## Create argument aliases
cat > mtt_junk_arg_alias.txt<<EOF
# Argument aliases
EOF
abg2sympar_m2txt $1 "" use_label_file |\
awk '{printf("#ALIAS $%i %s\n", ++i, $1)}' >> mtt_junk_arg_alias.txt
mv $1_lbl.txt mtt_junk_body.txt
cat mtt_junk_top.txt mtt_junk_alias.txt mtt_junk_arg_alias.txt mtt_junk_blurb.txt mtt_junk_body.txt > $1_lbl.txt
|