11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.11 2000/10/17 09:55:21 peterg
# %% Added logic rep
# %%
# %% Revision 1.10 2000/10/15 09:51:50 peterg
# %% Set array code in input rep
# %%
# %% Revision 1.9 2000/10/13 11:07:33 peterg
|
>
>
>
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.12 2000/11/08 11:20:49 peterg
# %% removed the empty matrix stuff
# %%
# %% Revision 1.11 2000/10/17 09:55:21 peterg
# %% Added logic rep
# %%
# %% Revision 1.10 2000/10/15 09:51:50 peterg
# %% Set array code in input rep
# %%
# %% Revision 1.9 2000/10/13 11:07:33 peterg
|
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
system=$1
representation=$2
outfile=$1_$2.m
# Inform user
echo Creating $outfile
#Create the rep file complete with headers.
case $representation in
input)
name=mttu
|
>
>
|
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
system=$1
representation=$2
outfile=$1_$2.m
tolower () { tr [A-Z] [a-z] ;}
# Inform user
echo Creating $outfile
#Create the rep file complete with headers.
case $representation in
input)
name=mttu
|
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
if (NF>1) print statement " # " $2
}' | sed\
-e 's/\[\([0-9]*\)\]/(\1)/g' \
-e 's/\([^a-zA-Z_]\)t\([^a-zA-Z_]\)/\1mttt\2/g' \
-e 's/x(/mttx(/g' \
-e 's/u(/mttu(/g' \
-e 's/mttmtt/mtt/g' \
>> $outfile
if [ -n "$arraycode" ]; then
new_style=`strip_comments < $1_$2.txt| grep "$name(">/dev/null; echo $?`
if [ "$new_style" = "1" ]; then
echo >> $outfile
echo " ## Set up the $name vector" >> $outfile
## echo " $name = []; # Default to empty matrix (Remove in mtt_m2p)" >> $outfile
mtt_name2array $1 $arraycode set >> $outfile
else
echo "Old-style file detected: not creating array translations"
fi
fi
## Special for logic rep
if [ "$representation" = "logic" ]; then
echo >> $outfile
echo "## Open switches" >> $outfile
switch_txt2m $system >> $outfile
fi
# End of the function
echo '## END Code' >> $outfile
echo 'endfunction' >> $outfile
|
|
|
>
|
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
if (NF>1) print statement " # " $2
}' | sed\
-e 's/\[\([0-9]*\)\]/(\1)/g' \
-e 's/\([^a-zA-Z_]\)t\([^a-zA-Z_]\)/\1mttt\2/g' \
-e 's/x(/mttx(/g' \
-e 's/u(/mttu(/g' \
-e 's/mttmtt/mtt/g' \
| tolower >> $outfile
if [ -n "$arraycode" ]; then
new_style=`strip_comments < $1_$2.txt| grep "$name(">/dev/null; echo $?`
if [ "$new_style" = "1" ]; then
echo >> $outfile
echo " ## Set up the $name vector" >> $outfile
## echo " $name = []; # Default to empty matrix (Remove in mtt_m2p)" >> $outfile
mtt_name2array $1 $arraycode set >> $outfile
else
echo "Old-style file detected: not creating array translations"
fi
fi
## Special for logic rep
if [ "$representation" = "logic" ]; then
echo >> $outfile
echo "## Open switches" >> $outfile
switch_txt2m $system | tolower >> $outfile
fi
# End of the function
echo '## END Code' >> $outfile
echo 'endfunction' >> $outfile
|