Index: mttroot/mtt/bin/trans/mtt_m2p ================================================================== --- mttroot/mtt/bin/trans/mtt_m2p +++ mttroot/mtt/bin/trans/mtt_m2p @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.11 1998/07/29 14:18:34 peterg +## Reorganised rep dependednt output +## ## Revision 1.10 1998/07/27 20:26:15 peterg ## Added new VARs mttWSTEPS, MTTWMIN,mttWMAX ## ## Revision 1.9 1998/07/27 17:20:42 peterg ## Allow , between () @@ -87,25 +90,32 @@ echo "PROCEDURE $Sys_rep(VAR mtty : OutputVector;" echo " mttx : StateVector;" echo " mttu : InputVector;" echo " mttt : REAL);" ;; + smx) + echo "PROCEDURE $Sys_rep(VAR mtta : StateMatrix;" + echo " mttx : StateVector;" + echo " mttu : InputVector);" + ;; ode2odes) echo "PROGRAM $Sys_rep;" echo "TYPE" echo " StateVector =ARRAY[1..$Nx] OF REAL;" echo " InputVector =ARRAY[1..$Nu] OF REAL;" echo " OutputVector =ARRAY[1..$Ny] OF REAL;" - echo " IntegrationMethod = (Euler,ImplicitL,Implicit);" + echo " StateMatrix =ARRAY[1..$Nx,1..$Nx] OF REAL;" + echo " IntegrationMethod = 1..3;" echo "VAR" echo " MTTt,mttLAST,mttDT,mttDDT : REAL;" echo " MTTWMIN,mttWMAX : REAL;" echo " mttx,mttdx : StateVector;" echo " mttu : InputVector;" echo " mtty : OutputVector;" + echo " mttA : StateMatrix;" echo " MTTi,MTTj,MTTit,MTTiLast,mttSTEPFACTOR,mttWSTEPS : INTEGER;" - echo " mttMETHOD : STRING;" + echo " mttMETHOD : IntegrationMethod;" ;; switch) echo "PROCEDURE $Sys_rep(VAR mttxs : StateVector;" echo " mttx : StateVector);" echo "VAR" @@ -138,14 +148,30 @@ if (NF>1) printf("{* %s *}", $2) printf("\n") }' |\ sed "s/$space\[\($non_space\)\]$spaces=$spaces\($fun_name\)(\([a-zA-Z0-9,]*\))/\2(\1,\3)/" |\ sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)(\([a-zA-Z0-9,]*\))/\2(\1,\3)/" |\ +sed "s/$space\[\($non_space\)\]$spaces=$spaces\(zeros\)(\([a-zA-Z0-9,]*\))/\2(\1,\3)/" |\ sed "s/$space\[\($non_space\)\]$spaces=$spaces\($fun_name\)/\2(\1)/" |\ sed "s/$space\($non_space\)$spaces=$spaces\($fun_name\)(\([a-zA-Z0-9,]*\))/\2(\1,\3)/" |\ sed "s/$space\($non_space\)$spaces=$spaces\($fun_name\)/\2(\1)/" |\ awk ' +function printvar(Name,N) { + if (N<1) return; + width = 10; + kk = 0; + printf("VAR\n"); + for (k=1;k<=N;k++) { + printf("mtt%s%i", Name, k); + if (k==N) + printf(" : REAL;\n") + else + printf(", "); + kk++; + if (kk==width){printf("\n"); kk=0} + } +} BEGIN{ comment_regexp = "{" doing_header = 0 doing_globals = 0 Nt = 9 @@ -169,23 +195,26 @@ if (doing_header==1){ if (rep=="ode2odes"){ printf("VAR "); for (k=1;k> $Filename # p2c doesn't like mixed case filenames!