Differences From Artifact [93dc7c2cf2]:

To Artifact [906b34eb53]:


12
13
14
15
16
17
18



19
20
21
22
23
24
25

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



## Revision 1.28  2001/02/05 17:19:52  gawthrop
## Now gives unique names to the states of multiports. Second name
## onwards labeled with port number
##
## Revision 1.27  2000/12/05 12:09:56  peterg
## Changed function name to name()
##







>
>
>







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

###############################################################
## Version control history
###############################################################
## $Id$
##
## $Log$
## Revision 1.29  2001/03/29 19:24:14  gawthrop
## Can now use c representations of crs when using -c option
##
## Revision 1.28  2001/02/05 17:19:52  gawthrop
## Now gives unique names to the states of multiports. Second name
## onwards labeled with port number
##
## Revision 1.27  2000/12/05 12:09:56  peterg
## Changed function name to name()
##
326
327
328
329
330
331
332

333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352





353
354
355
356
357
358
359
360
361
362
mv mtt_aliased.txt $1_aliased.txt

# Sort the struc file
mv $structurefile junk
sort -k 1,1 -k 2,2n junk >$structurefile

# Relabel states with multiple ports

mv $structurefile junk
awk '
BEGIN{
   state_index=1;  
   oldname="";
}
{
   name=$4;
   newname=name;
   if ($1=="state") {
     if (name==oldname)
       newname = sprintf("%s_%i",name, ++state_index);
     else
       state_index=1;
   }
   $4 = newname
   for (i=1;i<NF;i++) printf("%s\t",$i);
   printf("%s\n", $NF)
   oldname = name;
'} < junk > $structurefile






# Now invoke the standard error handling.
mtt_error mtt_error.txt














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

|
|
|
|
|
>
>
>
>
>










329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
mv mtt_aliased.txt $1_aliased.txt

# Sort the struc file
mv $structurefile junk
sort -k 1,1 -k 2,2n junk >$structurefile

# Relabel states with multiple ports
relabel_multiple_definitions(){
  mv $structurefile junk
  awk '
  BEGIN{
     var_type_index=1;  
     oldname="";
  }
  {
     name=$4;
     newname=name;
     if ($1==var_type) {
       if (name==oldname)
         newname = sprintf("%s_%i",name, ++var_type_index);
       else
         var_type_index=1; 
   }
     $4 = newname
     for (i=1;i<NF;i++) printf("%s\t",$i);
     printf("%s\n", $NF)
     oldname = name;
  '} < junk var_type=$1> $structurefile
}

relabel_multiple_definitions input;
relabel_multiple_definitions output;
relabel_multiple_definitions state;

# Now invoke the standard error handling.
mtt_error mtt_error.txt








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