Differences From Artifact [cca83822e8]:

To Artifact [0298389683]:


11
12
13
14
15
16
17



18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop, 1996.

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



## Revision 1.8  2001/10/15 14:25:44  gawthrop
## Now handles white space at the end of component names
## Converts ports lables [1:5] into [1,2,3,4,5]
##
## Revision 1.7  2001/07/24 22:42:59  geraint
## Fixes problem when lbl.txt does not end with newline.
##







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.9  2002/01/11 03:44:19  geraint
## Breaks compounds objects into individual components. Eliminates "incorrect object code error" in cbg.ps when component is not causally complete.
##
## Revision 1.8  2001/10/15 14:25:44  gawthrop
## Now handles white space at the end of component names
## Converts ports lables [1:5] into [1,2,3,4,5]
##
## Revision 1.7  2001/07/24 22:42:59  geraint
## Fixes problem when lbl.txt does not end with newline.
##
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

# Deletes trailing white space in component names
# and break compound objects
sed 's/[	 ]*\\001/\\001/' < $1_abg.fig |\
grep -v "^6 [0-9 ]*" | grep -v "^-6$" >$1_abg.mtt1

# Replace [1:5] with [1,2,3,4,5]
awk '{
   if (match($14, /\[1:[0-9]*\]/)){
    range = substr($14,2,length($14)-6);
    split(range,a,":");
    str = "1";
    for (i=2;i<=a[2];i++) str = sprintf("%s,%i", str, i);
    sub(/1:[0-9]*/, str, $14);
   }
    print $0
}' < $1_abg.mtt1 > $1_abg.mtt2


# The following horrible sed thing is to replace tab by ----
# this is because I can't get sed to recognise tabs even if FS=" ".
echo "" > $1_abg.mtt3
sed 's/	/---- /'<$1_abg.mtt2 >> $1_abg.mtt3

# This is the main transformation using awk
cat $1_lbl.txt $1_abg.mtt3 |  awk -f $MTTPATH/trans/awk/rbg_fig2m.awk $1

rm -f $1_abg.mtt

#Create the stripped abg file
cat $1_head.fig $1_bnd.fig $1_cmp.fig> $1_sabg.fig














|

















|












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

# Deletes trailing white space in component names
# and break compound objects
sed 's/[	 ]*\\001/\\001/' < $1_abg.fig |\
grep -v "^6 [0-9 ]*" | grep -v "^-6$" >$1_abg.mtt1

# Replace [1:5] with [1,2,3,4,5]
gawk '{
   if (match($14, /\[1:[0-9]*\]/)){
    range = substr($14,2,length($14)-6);
    split(range,a,":");
    str = "1";
    for (i=2;i<=a[2];i++) str = sprintf("%s,%i", str, i);
    sub(/1:[0-9]*/, str, $14);
   }
    print $0
}' < $1_abg.mtt1 > $1_abg.mtt2


# The following horrible sed thing is to replace tab by ----
# this is because I can't get sed to recognise tabs even if FS=" ".
echo "" > $1_abg.mtt3
sed 's/	/---- /'<$1_abg.mtt2 >> $1_abg.mtt3

# This is the main transformation using awk
cat $1_lbl.txt $1_abg.mtt3 |  gawk -f $MTTPATH/trans/awk/rbg_fig2m.awk $1

rm -f $1_abg.mtt

#Create the stripped abg file
cat $1_head.fig $1_bnd.fig $1_cmp.fig> $1_sabg.fig








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