Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 8baddcf689c7e63407c4e87d7d1e41e43add940481aa1b46e321f5b477329327
User & Date: gawthrop@users.sourceforge.net on 2000-10-12 12:32:23
Other Links: branch diff | manifest | tags
Context
2000-10-12
13:45:13
Put in the no-file version check-in: dfc38970f6 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:32:23
Initial revision check-in: 8baddcf689 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
09:17:24
Makde global - ie allow for right-hand side terms check-in: 34967f2efe user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/mtt_update version [5698aa8ff7].











































































































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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#!/bin/sh

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

# Bourne shell script: mtt_update
# Generates r code to write matrices
# Copyright (C) 2000 by Peter J. Gawthrop

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


sys=$1 # System name
rep=$2 # System representation

textfile=$1_$2.txt
infofile=$1_sympar.txt
default='0.0'

# Inform User
echo Checking $textfile

# 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


answered=''
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    

  while [ -z "$answered" ]; do
    echo "Update $textfile (y/n)?"
    read answer
    case $answer in
	y)
	    answered=yes
 	    for old in $in_text; do
	      sed "s/\($old[ \t]*=\)/## Removed by MTT on `date`: \1/" <$textfile > mtt_tmp
              mv mtt_tmp $textfile
	    done
	    ;;
	n)
	    answered=yes
	    ;;
	*)
    esac
  done      
fi

answered=''
if [ -f "mtt_in_info" ]; then
  in_info=`cat mtt_in_info`
  echo "The following variables exist, but are not defined in $textfile:"
  echo $in_info

  while [ -z "$answered" ]; do
    echo "Update $textfile (y/n)?"
    read answer
    case $answer in
	y)
	    answered=yes
 	    for new in $in_info; do
		echo "$new = $default; # Added by MTT on `date`" >> $textfile
	    done
	    ;;
	n)
	    answered=yes
	    ;;
	*)
    esac
  done      
fi



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