Overview
Comment:Convert _cmp.txt to _sub.sh.
Slightly edited copy of (obsolete) abg2sub_m2sh.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: ac5f400cd0a46ed902e217fc52df8636f53a746d9fa8bc48e59f57130a03136b
User & Date: geraint@users.sourceforge.net on 2002-12-03 23:26:08
Other Links: branch diff | manifest | tags
Context
2002-12-03
23:28:44
Added dependencies for bond graphs built with dia. check-in: 5080aeba87 user: geraint@users.sourceforge.net tags: origin/master, trunk
23:26:08
Convert _cmp.txt to _sub.sh.
Slightly edited copy of (obsolete) abg2sub_m2sh.
check-in: ac5f400cd0 user: geraint@users.sourceforge.net tags: origin/master, trunk
22:22:12
Write to file instead of stdout. check-in: ff73654302 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/cmp2sub_txt2sh version [ca5b3c97a3].



















































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cmp2sub_txt2sh

# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  2002/04/28 18:41:26  geraint
## Fixed [ 549658 ] awk should be gawk.
## Replaced calls to awk with call to gawk.
##
## Revision 1.3  2000/10/03 11:34:53  peterg
## Correct $MTT_LIB
##
## Revision 1.2  2000/03/17 09:53:10  peterg
## Removed irritating echo Using "$1_sub.sh"
##
## Revision 1.1  2000/03/15 21:23:20  peterg
## Initial revision
##
###############################################################


if [ -f "$1_sub.sh" ]; then
    #echo Using "$1_sub.sh"
    exit
else
    #Inform user
    echo Creating $1_sub.sh    
fi


echo '# Commands to generate subsystem representations'>  $1_sub.sh
echo "# File $1_sub.sh"			>> $1_sub.sh
echo "# Generated by MTT on `date`."	>> $1_sub.sh
echo					>> $1_sub.sh

# Get a list of all components for the _abg file
gawk -F\: '{print $1}' $1_cmp.txt |\
sort -u > mtt_tmp1

# Remove all components starting with 0 or 1
grep -v '^[01]' < mtt_tmp1 > mtt_tmp4

# Get a list of all standard simple components
echo ls $MTT_LIB/comp/simple
ls $MTT_LIB/comp/simple |\
  gawk '/_cause.m/{split($1,a,"_");print(a[1])}'  >mtt_tmp2

# Get a list of all standard compound components
#ls $MTTPATH/comp/compound |\
#  gawk '/_abg.m/{split($1,a,"_");print(a[1])}'  >> mtt_tmp2

# Sorted combined list
cat mtt_tmp2 | \
  sed  's/^zero$/0/' |\
  sed  's/^one$/1/' |\
  sort -u >mtt_tmp3

# Print the non-standard components
comm mtt_tmp4 mtt_tmp3 |\
  gawk 'BEGIN{FS="\t"}{if (length($1)>0) print "$1" $1 "$2"}' \
  >>$1_sub.sh

# Clean up mtt_tmp files
#rm -f mtt_tmp?









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