Overview
Comment:Included logic rep.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: c29b7adc22bc589e66d6d073c0830764475fcce4c45079e51647a93f82379ad5
User & Date: gawthrop@users.sourceforge.net on 2000-10-17 08:36:56
Other Links: branch diff | manifest | tags
Context
2000-10-17
08:37:23
Included logic rep check-in: 1af7bb600f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:36:56
Included logic rep. check-in: c29b7adc22 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2000-10-16
09:41:29
Fixed bug with printing a blank line. check-in: 11cbaba428 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt_update from [6d04774928] to [3c49e7525e].

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.12  2000/10/14 16:11:00  peterg
## Made all variables, states etc lower case
##
## Revision 1.11  2000/10/13 11:07:00  peterg
## Added initialisation for state and input
##
## Revision 1.10  2000/10/13 10:56:07  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.13  2000/10/15 09:27:13  peterg
## Better way of generating $infofile
##
## Revision 1.12  2000/10/14 16:11:00  peterg
## Made all variables, states etc lower case
##
## Revision 1.11  2000/10/13 11:07:00  peterg
## Added initialisation for state and input
##
## Revision 1.10  2000/10/13 10:56:07  peterg
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
##
###############################################################


sys=$1 # System name
rep=$2 # System representation
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
            awk '{if ($1==rep) printf("%s\n", $4)}' rep=$2 \
            <$1_struc.txt >$infofile
	    cat $infofile $1_sympar.$ext> $moreinfofile  










	    default='0.0'
	;;
    *)
	    echo Representation $rep not implemented
	    exit
esac


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

  case $rep in
    numpar)
           sympar2numpar_txt2txt $1
	;;
    state)
	   struc2state_txt2txt $1
	;;
    input)
	   struc2input_txt2txt $1
	;;
    *)
	
esac
  exit    
fi

# Remove tmp files
rm -f mtt_in_text mtt_in_info

# Strip files







>











|
|
|




|
|
|
|


|
>
>
>
>
>
>
>
>
>
>







>




>
|
<
|
|
|
|
<
<
<
<
<
|
<







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





117

118
119
120
121
122
123
124
##
###############################################################


sys=$1 # System name
rep=$2 # System representation
update=$3 # Update or not
date=`date`

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

rm -f mtt_empty
touch mtt_empty

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

# Create a string containing the variables
if [ -f "$textfile" ]; then
  # Inform User
  echo Checking $textfile
else
  echo Creating $textfile
  mtt_header $sys $rep $lang > $textfile 

  info=`cut -f1 $infofile | sort`
  for new in $info; do
    echo $new $default  |\
    awk '{printf("%s\t= %s; # Default\n",$1,$2)}' >> $textfile





  done

  exit    
fi

# Remove tmp files
rm -f mtt_in_text mtt_in_info

# Strip files
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198

199
200


201
202
203
204
205
206
207
208
209
210
211
  }'  default=$default mtt_text mtt_info mtt_moreinfo


if [ -z "$update" ]; then
  if [ -f "mtt_in_text" ]; then
    echo "The following variables are defined in $textfile, but do not exist:"
    sort mtt_in_text | awk '{printf("\t%s\n",$1)}'
    echo Use mtt $sys $rep $ext to update
  fi
  if [ -f "mtt_in_info" ]; then
    echo "The following variables exist, but are not defined in $textfile:"
    sort mtt_in_info | awk '{printf("\t%s\n",$1)}'
    echo Use mtt $sys $rep $ext to update
  fi
  exit    
fi
answered=''
if [ -f "mtt_in_text" ]; then
  in_text=`sort mtt_in_text`
  echo "The following variables are defined in $textfile, but do not exist:"
  sort mtt_in_text | awk '{printf("\t%s\n",$1)}'


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

answered=''
if [ -f "mtt_in_info" ]; then
  in_info=`sort mtt_in_info`
  echo "The following variables exist, but are not defined in $textfile:"
  sort mtt_in_info | awk '{printf("\t%s\n",$1)}'

  while [ -z "$answered" ]; do
    echo "Update $textfile (y/n)?"
    read answer < /dev/tty
    case $answer in
	y)
	    answered=yes

 	    for new in $in_info; do
                echo Adding $new


		echo "$new = $default; # Added by MTT on `date`" >> $textfile
                changed=yes
	    done
	    ;;
	n)
	    answered=yes
	    ;;
	*)
    esac
  done      
fi







|




|


















|















<









>


>
>
|










151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
  }'  default=$default mtt_text mtt_info mtt_moreinfo


if [ -z "$update" ]; then
  if [ -f "mtt_in_text" ]; then
    echo "The following variables are defined in $textfile, but do not exist:"
    sort mtt_in_text | awk '{printf("\t%s\n",$1)}'
    echo Use mtt $sys $rep $lang to update
  fi
  if [ -f "mtt_in_info" ]; then
    echo "The following variables exist, but are not defined in $textfile:"
    sort mtt_in_info | awk '{printf("\t%s\n",$1)}'
    echo Use mtt $sys $rep $lang to update
  fi
  exit    
fi
answered=''
if [ -f "mtt_in_text" ]; then
  in_text=`sort mtt_in_text`
  echo "The following variables are defined in $textfile, but do not exist:"
  sort mtt_in_text | awk '{printf("\t%s\n",$1)}'


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

answered=''
if [ -f "mtt_in_info" ]; then

  echo "The following variables exist, but are not defined in $textfile:"
  sort mtt_in_info | awk '{printf("\t%s\n",$1)}'

  while [ -z "$answered" ]; do
    echo "Update $textfile (y/n)?"
    read answer < /dev/tty
    case $answer in
	y)
	    answered=yes
            in_info=`sort mtt_in_info`
 	    for new in $in_info; do
                echo Adding $new
                echo $new $default  |\
                awk '{printf("%s\t= %s; # Added by MTT on %s\n",$1,$2,strftime())}'\
                >> $textfile
                changed=yes
	    done
	    ;;
	n)
	    answered=yes
	    ;;
	*)
    esac
  done      
fi


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