Differences From Artifact [f835ebd14a]:

To Artifact [0f74549f73]:


12
13
14
15
16
17
18






19
20
21
22
23
24
25

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






## Revision 1.24  2000/11/30 15:12:55  peterg
## Zapped the declaration of subsystem connections - now in individual
## .def files
##
## Revision 1.23  2000/11/30 15:07:28  peterg
## Sorted out mtt_getsize
##







>
>
>
>
>
>







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

###############################################################
## Version control history
###############################################################
## $Id$
##
## $Log$
## Revision 1.25  2000/12/01 14:51:26  peterg
## Major changes towards partioning
##
## - generates sub ese, def and struc
## - generates indices for conversion of subsystem in/out/state - but not used yet
##
## Revision 1.24  2000/11/30 15:12:55  peterg
## Zapped the declaration of subsystem connections - now in individual
## .def files
##
## Revision 1.23  2000/11/30 15:07:28  peterg
## Sorted out mtt_getsize
##
213
214
215
216
217
218
219







































220
221
222
223
224
225
226
  structure(7) = $Nuc; # Connecting inputs

  makedef(structure,deffilenum);  #Create definitions
EOF

echo "END;" >> $1_def.r
}







































  # Find subsystems
  subsystems=`mtt_get_subsystems $1`

  # Top level  
  makedef $1;
  echo "END;" >> $1_ese.r








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
  structure(7) = $Nuc; # Connecting inputs

  makedef(structure,deffilenum);  #Create definitions
EOF

echo "END;" >> $1_def.r
}


function get_indices {
  sys=$1
  which=$2
  awk '{if ($1==which) print $2}' which=$which < ${sys}_struc.txt
}

function convert_indices {
  sys=$1
  Which="input output state"
  for which in $Which; do
  
    indices=`get_indices ${sys} $which`
  
    case $which in
      input)
  	name=u
  	;;
      output)
  	name=y
  	;;
      state)
  	name=x
  	;;
      *)
  	
    esac
  
    new=0
    for old in $indices; do
      new=`expr $new + 1`
      pattern="MTT${name}(${old},1)"
      replacement="MTT${name}(${new},1)"
      mv ${sys}_ese.r mtt_junk
      sed "s/$pattern/$replacement/" <mtt_junk >${sys}_ese.r
    done
  done
}
  # Find subsystems
  subsystems=`mtt_get_subsystems $1`

  # Top level  
  makedef $1;
  echo "END;" >> $1_ese.r

245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
  ## Subsystems (Only works when no repetitions at this level)
  esefile=${subsystem}_ese.r
  echo Creating $esefile
  cat ${subsystem}_1_ese.r ${subsystem}_1_*_ese.r > $esefile 2> /dev/null
  echo "END;" >> $esefile

  ## Def file for subsystem
  #makedef ${subsystem}
  
  echo Creating ${subsystem}_def.r
  cp mtt_all_def.r ${subsystem}_def.r

  echo Creating ${subsystem}_struc.txt
  grep $subsystem < $1_struc.txt > ${subsystem}_struc.txt
  echo "Creating indices (needs more work to convert subsystem indices)"
  whichs="input output state"
  for which in $whichs; do
    indices=`mtt_get_subindex $subsystem $which`
    echo "  $which $indices"
  done
  done

fi


# Create the _alised file
touch mtt_aliased.txt







|

<
<
<


|
<
<
|
|
|







290
291
292
293
294
295
296
297
298



299
300
301


302
303
304
305
306
307
308
309
310
311
  ## Subsystems (Only works when no repetitions at this level)
  esefile=${subsystem}_ese.r
  echo Creating $esefile
  cat ${subsystem}_1_ese.r ${subsystem}_1_*_ese.r > $esefile 2> /dev/null
  echo "END;" >> $esefile

  ## Def file for subsystem
  makedef ${subsystem}
  



  echo Creating ${subsystem}_struc.txt
  grep $subsystem < $1_struc.txt > ${subsystem}_struc.txt



  echo Converting subsystem indices
  convert_indices ${subsystem}

  done

fi


# Create the _alised file
touch mtt_aliased.txt

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