Overview
Comment:Added state and input - it checks against sympar as well so that
defined variables may be used here.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 0a89ae10457062a0a4f6a18f8ff2788b5872d7378ea7ffaf63e1047e3473973d
User & Date: gawthrop@users.sourceforge.net on 2000-10-13 08:07:24
Other Links: branch diff | manifest | tags
Context
2000-10-13
08:56:51
Output variables as column, not row. check-in: 38ceaf1e4b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:07:24
Added state and input - it checks against sympar as well so that
defined variables may be used here.
check-in: 0a89ae1045 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2000-10-12
19:27:47
Now writes the aliased args check-in: 8736c8191c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt_update from [9f0ffb24f1] to [7cb28c6a97].

9
10
11
12
13
14
15



16
17
18
19
20
21
22
# Copyright (C) 2000 by Peter J. Gawthrop

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



## Revision 1.4  2000/10/12 17:57:34  peterg
## Fixed header typos
##
## Revision 1.3  2000/10/12 15:11:30  peterg
## Added the update switch
##
## Revision 1.2  2000/10/12 13:45:13  peterg







>
>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  2000/10/12 19:24:55  peterg
## Corrected output message
##
## Revision 1.4  2000/10/12 17:57:34  peterg
## Fixed header typos
##
## Revision 1.3  2000/10/12 15:11:30  peterg
## Added the update switch
##
## Revision 1.2  2000/10/12 13:45:13  peterg
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
83
84
85
update=$3 # Update or not

if [ -z "$2" ]; then
  echo Usage mtt_update system representation [update]    
  exit
fi






ext=txt
textfile=$1_$2.$ext
infofile=$1_sympar.$ext

default='1.0'

















if [ -f "$textfile" ]; then
  # Inform User
  echo Checking $textfile
else
  sympar2numpar_txt2txt $1
  exit    
fi

# Remove tmp files
rm -f mtt_in_text mtt_in_info

# Strip files
strip_comments <$textfile >mtt_text
strip_comments <$infofile >mtt_info


# Use awk to check file
awk '{
  if (FILENAME=="mtt_text") {
    gsub("[\t ]" ,""); # Remove whitespace
    split($0,a,"=");
    text[a[1]] = a[2];
  }
  if (FILENAME=="mtt_info") info[$1] = default;





  }
END{
  # for (iname in info) print iname
  for (tname in text) {
    if (!(tname in info)) print tname >> "mtt_in_text"
  }
  for (iname in info) {
    if (!(iname in text)) print iname >> "mtt_in_info"
  }
  }'  default=$default mtt_text mtt_info


if [ -z "$update" ]; then
  if [ -f "mtt_in_text" ]; then
    in_text=`cat mtt_in_text`
    echo "The following variables are defined in $textfile, but do not exist:"
    echo $in_text







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















>








|
>
>
>
>
>




|




|







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
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
113
114
115
116
update=$3 # Update or not

if [ -z "$2" ]; then
  echo Usage mtt_update system representation [update]    
  exit
fi

rm -f mtt_empty
touch mtt_empty

case $rep in
    numpar)
	    ext=txt
	    textfile=$1_$2.$ext
	    infofile=$1_sympar.$ext
	    moreinfofile=$infofile
	    default='1.0'
	;;
    state|input)
	    ext=txt
	    textfile=$1_$2.$ext
	    infofile=mtt_list.$ext
	    moreinfofile=mtt_list_numpar.$ext
	    grep "$rep" <$1_struc.txt |\
	    awk '{printf("%s_%s_%s\n", $4, $5, $3)}' \
             > $infofile 
	    cat $infofile $1_sympar.$ext> $moreinfofile  
	    default='1.0'
	;;
    *)
	    echo Representation $rep not implemented
	    exit
esac

if [ -f "$textfile" ]; then
  # Inform User
  echo Checking $textfile
else
  sympar2numpar_txt2txt $1
  exit    
fi

# Remove tmp files
rm -f mtt_in_text mtt_in_info

# Strip files
strip_comments <$textfile >mtt_text
strip_comments <$infofile >mtt_info
strip_comments <$moreinfofile >mtt_moreinfo

# Use awk to check file
awk '{
  if (FILENAME=="mtt_text") {
    gsub("[\t ]" ,""); # Remove whitespace
    split($0,a,"=");
    text[a[1]] = a[2];
  }
  if (FILENAME=="mtt_info"){
     info[$1] = default;
  }
  if (FILENAME=="mtt_moreinfo"){
     moreinfo[$1] = default;
  }
  }
END{
  # for (iname in info) print iname
  for (tname in text) {
    if (!(tname in moreinfo)) print tname >> "mtt_in_text"
  }
  for (iname in info) {
    if (!(iname in text)) print iname >> "mtt_in_info"
  }
  }'  default=$default mtt_text mtt_info mtt_moreinfo


if [ -z "$update" ]; then
  if [ -f "mtt_in_text" ]; then
    in_text=`cat mtt_in_text`
    echo "The following variables are defined in $textfile, but do not exist:"
    echo $in_text


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