Overview
Comment:header only version does not need to compute sizes from _def.r
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 30623ff1ddc721f585acb8e4e2ab737079625eae94fd55ae7c25fd7c49f67814
User & Date: gawthrop@users.sourceforge.net on 2001-07-23 23:43:15
Other Links: branch diff | manifest | tags
Context
2001-07-24
00:55:17
Resolved clashes -- marked with ## >>> check-in: 586aea5bdc user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2001-07-23
23:43:15
header only version does not need to compute sizes from _def.r check-in: 30623ff1dd user: gawthrop@users.sourceforge.net tags: origin/master, trunk
23:31:17
Added -cr option to load CRs first - avoids alg. loops with R
implementation of mutiports.
check-in: 4767414321 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt_header from [d88a1bf0c6] to [a0d03d6db5].

8
9
10
11
12
13
14



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

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



## Revision 1.36  2001/07/12 04:00:51  gawthrop
## Now zeros y correctly - ie Ny NOT Nx elements
##
## Revision 1.35  2001/06/13 10:39:51  gawthrop
## Zeros output matices in csex and cseo just in case some elements are
## actually zero and not set in code. Works for m and oct.
##







>
>
>







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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.37  2001/07/13 04:54:04  geraint
## Branch merge: numerical-algebraic-solution back to main.
##
## Revision 1.36  2001/07/12 04:00:51  gawthrop
## Now zeros y correctly - ie Ny NOT Nx elements
##
## Revision 1.35  2001/06/13 10:39:51  gawthrop
## Zeros output matices in csex and cseo just in case some elements are
## actually zero and not set in code. Works for m and oct.
##
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
other=$4 # Anything else eg stdin

if [ -z "$system" ]; then
  echo 'Usage: mtt_header sys rep lang [stdin]'
  exit
fi

# Find system constants
Nx=`mtt_getsize $system x` # States
Nxx=`mtt_getsize $system xx` # States x States
Nu=`mtt_getsize $system u` # Inputs 
Ny=`mtt_getsize $system y` # Outputs 
Nyz=`mtt_getsize $system yz` # Zero outputs
##Npar=`wc -l $system\_sympar.txt | awk '{print $1}'`

# get octave version
octave_development=`octave --version | awk '{print $4}' | awk -F\. '{print $2}'`
case `$MATRIX --version | awk -F\. '{print $2}'` in
    0) # stable
	vector_value=vector_value
	;;







<
<
<
<
<
<
<







166
167
168
169
170
171
172







173
174
175
176
177
178
179
other=$4 # Anything else eg stdin

if [ -z "$system" ]; then
  echo 'Usage: mtt_header sys rep lang [stdin]'
  exit
fi









# get octave version
octave_development=`octave --version | awk '{print $4}' | awk -F\. '{print $2}'`
case `$MATRIX --version | awk -F\. '{print $2}'` in
    0) # stable
	vector_value=vector_value
	;;
337
338
339
340
341
342
343
344








345
346
347
348
349
350
351
	;;
    tf)
	states=no;
	inputs=no;
	parameters=yes;
        output='mttnum,mttden'
        args=mttpar;
	;;    *)








	echo Representation $rep not supported - sorry; exit 1
esac

## Sort out parentheses
if [ -n "$args" ]; then
    Args='('$args')'
fi







|
>
>
>
>
>
>
>
>







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
	;;
    tf)
	states=no;
	inputs=no;
	parameters=yes;
        output='mttnum,mttden'
        args=mttpar;
	;;    
    type)
	states=no;
	inputs=no;
	parameters=no;
	header_only=yes;
	;;

     *)
	echo Representation $rep not supported - sorry; exit 1
esac

## Sort out parentheses
if [ -n "$args" ]; then
    Args='('$args')'
fi
365
366
367
368
369
370
371
















372
373
374
375
376
377
378
	declaration="$Output$1_$rep$Args;"
        if [ "$other" != "stdin" ]; then
	  noglobals=true; # Fudge to make mtt_m2p work
        fi     
        start='## BEGIN Code'
        finish='## END Code'
        var_declaration=
















        declarestates=no
        declareinputs=no
	declareswitches=no
	;;
    txt)
	modeline='## -*-octave-*- Put Emacs into octave-mode ##';
	Lc='##';







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
	declaration="$Output$1_$rep$Args;"
        if [ "$other" != "stdin" ]; then
	  noglobals=true; # Fudge to make mtt_m2p work
        fi     
        start='## BEGIN Code'
        finish='## END Code'
        var_declaration=
        declarestates=no
        declareinputs=no
	declareswitches=no
	;;
    sh)
	modeline='## -*-shell-script-*- Put Emacs into shell-script-mode ##';
	Lc='##';
	Rc='';
	Lb='(';
	Rb=')';
	function=""
	declaration=""
        start=''
        parameters=no
	states=no
	inputs=no
        declarestates=no
        declareinputs=no
	declareswitches=no
	;;
    txt)
	modeline='## -*-octave-*- Put Emacs into octave-mode ##';
	Lc='##';
402
403
404
405
406
407
408










409
410
411
412
413
414
415
    *)
	echo Language $language not supported - sorry; exit 1
esac

if [ "$rep" = "simpar" ]; then
   output=${output}${map}    # Output is simpar_map in this case
fi











zero_matrices()
{
## Set matrices to zero
echo
 ## echo '## Set matrices to zero'
for name in $zeromatrices; do







>
>
>
>
>
>
>
>
>
>







422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
    *)
	echo Language $language not supported - sorry; exit 1
esac

if [ "$rep" = "simpar" ]; then
   output=${output}${map}    # Output is simpar_map in this case
fi

get_sizes()
    {
    Nx=`mtt_getsize $system x` # States
    Nxx=`mtt_getsize $system xx` # States x States
    Nu=`mtt_getsize $system u` # Inputs 
    Ny=`mtt_getsize $system y` # Outputs 
    Nyz=`mtt_getsize $system yz` # Zero outputs
    ##Npar=`wc -l $system\_sympar.txt | awk '{print $1}'`
    }

zero_matrices()
{
## Set matrices to zero
echo
 ## echo '## Set matrices to zero'
for name in $zeromatrices; do
820
821
822
823
824
825
826






827
828
829
830
831
832
833
$modeline
$function $declaration
$Lc $declaration
$Lc System $system, representation $rep, language $language; $Rc
$Lc File $1_$rep.$language; $Rc
$Lc Generated by MTT on `date`; $Rc
EOF







if [ ${language} = "oct" ];then
    write_standalone_header
    write_DLD_header
    map_DLD_inputs ${args}
    undeclared=`get_extra_fields ${args:-"nil"} ${output:-"nil"}`
    declare_DLD_outputs ${undeclared}







>
>
>
>
>
>







850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
$modeline
$function $declaration
$Lc $declaration
$Lc System $system, representation $rep, language $language; $Rc
$Lc File $1_$rep.$language; $Rc
$Lc Generated by MTT on `date`; $Rc
EOF

if [ -n "${header_only}" ]; then
    exit
else
    get_sizes;
fi

if [ ${language} = "oct" ];then
    write_standalone_header
    write_DLD_header
    map_DLD_inputs ${args}
    undeclared=`get_extra_fields ${args:-"nil"} ${output:-"nil"}`
    declare_DLD_outputs ${undeclared}


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