Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!inria!mirsa!uranie.inria.fr!maman From: maman@uranie.inria.fr (Nathan Maman) Newsgroups: comp.lang.fortran Subject: Re: FORTRAN Prettyprinter? Keywords: FORTRAN, printing, formatting Message-ID: <8800@mirsa.inria.fr> Date: 15 Oct 90 14:30:42 GMT References: Sender: news@mirsa.inria.fr Reply-To: maman@cosinus.inria.fr Organization: INRIA Sophia Antipolis Lines: 803 In article , keane@cars.rutgers.edu (John Keane) writes: > > Does anyone know of a formatter for FORTRAN source, public domain or > otherwise, that will prettify the source: i.e. supply indentation for > loops, move format statements to the bottom, etc.? > > E-mail response to keane@paul.rutgers.edu preferred. > > Thanks! > > -John I hope this would help. Some bug(s) might remain, but for my codes, it worked fine. Perhaps should we use something like the yacc-analyser of f2c and customize it for that particular use ? #!/bin/sh # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by on Mon Oct 15 14:51:13 MET 1990 # Contents: Fpr.l Fpr echo x - Fpr.l sed 's/^@//' > "Fpr.l" <<'@//E*O*F Fpr.l//' @.EV @.TH Fpr l "88 Nov 24" "Nathan" "Sinus\'s Section" @.SH NAME Fpr \- Fortran program beautifier @.SH SYNTAX @.B Fpr [ option ] ... [ file ]... @.SH OPTIONS @.TP 8 @.BI -com removes comment lines. @.TP @.BI +cont prints control lines for operation count. @.TP @.BI +count tries to count the operations made. @.TP @.BI +cpp calls the C preprocessor '/lib/cpp' before any treatment. @.TP @.BI +dc \ 'c' puts @.I 'c' as first comment character. (default: 'C') @.TP @.BI +entete puts starting lines to each file. @.TP @.BI -ll \ lnlen splits lines longer than @.I lnlen (default: 70). @.TP @.BI +pr calls 'pr' instead of 'cat' as postprocessor (default page size: 80x66). @.TP @.BI -tab \ tablen takes @.I tablen as indentation size (default: 3). @.TP @.BI - \ filename allows @.I filename to start with '-'. @.TP @.BI - * adds -* to the postprocessor options. @.SH DESCRIPTION @.I Fpr formats a Fortran file according to arbitrary rules : @.TP 8 1) doesn't modify comments nor strings. @.TP 2) puts everything in capital letters. ( except comments and strings ) @.TP 3) removes ending blanks, tabs, double precision calls ... @.SH EXAMPLE @.I Fpr essai.f only formats essai.f sending the result to the standard output. The result is supposed to be also Fortran. @.br @.I Fpr \ +count essai.f formats and counts operations. @.SH SEE ALSO struct(1), ratfor(1) @//E*O*F Fpr.l// chmod u=rw,g=r,o=r Fpr.l echo x - Fpr sed 's/^@//' > "Fpr" <<'@//E*O*F Fpr//' #!/bin/ksh # ====================================================================== # # FICHIER /u/cosinus/0/sun3/sinus/utils/KSH/Fpr # # CREATION Mon Apr 18 11:53:54 1988 Nathan Maman # # MODIFIE Fri Oct 13 11:16:33 1989 Nathan Maman # # ====================================================================== # comm="b ecrit" controle="#" cpp="cat" debcom="C" entete="#" nbcar=70 nbtab=3 oper='-+*/' pr='cat' propt= skip=" b affin " files="" b0=`basename $0` if [ $# -eq 0 ] then man $b0 || \ echo -n "\ USAGE: $b0 options files DESCRIPTION: formatte un fichier Fortran. files : noms de fichiers Si un nom de fichier commence par '-' alors mettre '- filename' nom de l'option ---------:------------------------------------------------- -com : supprime les lignes de commentaires +cont : ecrit des lignes pour controler le comptage des operations +count : compte les operations +cpp : appelle le preprocesseur C avant tout traitement +dc 'c' : caractere 'c' au debut des commentaires (defaut: '$debcom') +entete : met une entete a chaque fichier -ll 'x' : 'x' est le nombre maximum de caracteres par ligne (defaut: $nbcar) +pr : appel 'pr' au lieu de '$pr' et suppose une page de 80x66 -tab 'x' : mettra des tabulations de longueur x (defaut: $nbtab) -???? : ajoute -???? aux options d'impression deja presente (defaut: '$propt') Exemple: $b0 file1.f # formatte simplement $b0 - -file2.f -bn +entete # en numerotant les lignes et avec entete " exit 1 fi while [ $# -ne 0 ] do case "$1" in -com) comm="d" ;; +cont) controle="" ;; +count) skip=" " ;; +cpp) cpp="/lib/cpp" ;; +dc) debcom=`expr $2 : '\(.\).*'` shift ;; +entete)entete="" ;; -ll) nbcar="$2" shift ;; -oper) oper='' ;; +pr) pr='pr' propt='-f -w80 -l66 -h "File:$i"';; -tab) nbtab=$2; shift;; -) shift files="$files $1" ;; -*) propt="$propt $1" ;; *) files="$files $1" ;; esac shift done set "$files" str="$debcom $b0" for i in $* do if [ -f "$i.f" ] then file=$i.f elif [ -f "$i.h" ] then file=$i.h else file=$i fi $cpp $file | sed -ne " # Suppression des lignes precedemment crees par la procedure /^[cC][oO][mM][pP][tT][oO][pP][eE][rR]/ d /^[cC]% [-+*/ ]*>>[0-9 ]*$/ d # Suppression blancs de queue s/ *$// # On remplace les en debut de ligne ou apres un label par 8 blancs s/^ / / s/^\( *[0-9]*\) /\1 / # C est la 1ere ligne 1 { x d } # C est une carte suite /^ [^ ]/{ H x s/\n [^ ]//g x $ !d } x # C est un commentaire /^[^ 0-9]/ { s/ /\/g s/ /\ /g p d } # On remplace tous les par 8 blancs s/ / /g # On detecte les chaines /'/{ s/^/\\ / s/$/\\ / } : redo s/^\([^']*\)'/\1\\ '/ : nextch s/\(\n'[^']*'\)\([^'\n]*\)'/\1\\ \2\\ '/ t nextch s/\(\n'[^']*'\)\([^']*\)$/\1\\ \2/ s/'\n *\n'/\\/g /^\n[0-9 ]*[Ww][Rr][Ii][Tt][Ee][^\n]*\n'[^\n]*'\n )/{ : rnn s/^\(\n[0-9 ]*[Ww][Rr][Ii][Tt][Ee][^\n]*\n'[^\n\]*\)/\1'\/ t rnn s/\/\/g s/^\(\n[0-9 ]*[Ww][Rr][Ii][Tt][Ee][^\n]*\n\)'\([^\n]*\)'/\1\\2\/ b redo } s/\(\n .*[0-9][0-9]*\) *[.] *\([ED0-9][ED0-9]*\)/\1.\2/g s/\n/& \&/g s/\n\n \&/ /g p $ { x /^ [^ ]/ !p } " | sed -ne " # Si ce n est ni un commentaire ni une chaine -> MAJUSCULES /^[^ 0-9]/ !{ /^ \&'/ !y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/ } /^ \&'/{ s/ /\/g s/^\\\\\\&/ \&/ s/=/\/g s/,/\/g s/(/\/g s/)/\/g s/+/\/g s/-/\/g s/[*]/\/g s/[/]/\ /g s/ /\ /g } # C est la 1ere ligne 1{ x d } # C est une carte suite /^ [^ ]/{ H x s/\n [^ ]//g x $ !d } x # C est un commentaire /^[^ 0-9]/ { p d } s/$/ / s/\([^A-Za-z0-9_][0-9]*[.][0-9]*[ED]\)\([0-9]\)/\1+\2/g s/\([^A-Za-z0-9_]\)\([.][0-9][0-9]*\)/\10\2/g s/\([^A-Za-z0-9_][0-9]*[.][0-9]*[ED][-+]\)0*\([0-9]\)/\1\2/g s/\([^A-Za-z0-9_][0-9]*[.][0-9]*\)[ED][-+]0*\([^0-9]\)/\1\2/g s/\([^A-Za-z0-9_][0-9]*[.][0-9]*\)[ED]+\([0-9][0-9]*[^0-9]\)/\1E\\2/g s/\([^A-Za-z0-9_][0-9]*[.][0-9]*\)[ED]-\([0-9][0-9]*[^0-9]\)/\1E\\2/g s/\([^A-Za-z0-9_]\)0*\([0-9]*[0-9][.][0-9]*[1-9]\)0*\([^0-9]\)/\1\2\3/g s/\([^A-Za-z0-9_]\)0*\([0-9]*[0-9][.]\)0*\([^0-9]\)/\1\2\3/g s/ $// s/ *\([*/]\) */\1/g s/ *\([/][/]\) */\1 /g s/ *, */, /g s/( */( /g s/ *(/ (/g s/ *)/ )/g s/) */) /g s/\([A-Za-z0-9_]\) *(/\1(/g s/ *\([-+]\) */ \1 /g s/ *\(=\) */\1 /g : loop s/\(GO *TO *\)(\([^$oper=()]*\))/\1\\2\/ s/\(CALL *[A-Z][A-Z0-9_]* *\)(\([^$oper=()]*\))/\1\\2\/ : blinp s/\(([^$oper=() ]*\) *\([^$oper=()]*)\)/\1\2/ t blinp s/(\([^()]*\))/\\1\/ t loop s/\/(/g s/\/)/g /^[ 0-9]*IF/{ s/[.](/. (/g s/)[.]/) ./g } /^ *PARAMETER/{ s/ *= */=/g s/PARAMETER *( */PARAMETER( / s/ *) *$/ )/ } /^[ 0-9][ 0-9]*PRINT/ s/PRINT */PRINT/ /^[ 0-9][ 0-9]*WRITE/{ s/( */(/ s/, */,\/ s/ *) */) / } /^[ 0-9][ 0-9]*READ/{ s/( */(/ s/, */,\/ s/ *) */) / } /^ *COMMON/ s.COMMON */ *\([^/]*\) */ *.COMMON/\1/ .g /^ .*DATA/ { s.DATA *\([^/]*\) */ *.DATA\\1/.g s./ *./ .g s./ ,./,.g s. */ *\([^,/]*\) */./\1/.g } /^[ 0-9].*CALL/{ s/ \(CALL\) *\([^(]*\) *( */ \1 \2( / s/ *, */, /g s/ *) *$/ )/g s/\( CALL\) */\1\/ } /^ *SUBROUTINE/{ s/\(SUBROUTINE\) *\([^(]*\) *( */\1 \2( / s/ *, */, /g s/ *) *$/ )/g s/\(SUBROUTINE\) *\([^(]\)/\1\\2/ } /^ .*FUNCTION/{ s/\(FUNCTION\) *\([^(]*\) *( */\1 \2( / s/ *, */, /g s/ *) *$/ )/g } /^[ 0-9].*GO *TO *[(][^)]*/ s/ *) *$/ )/g /^[ 0-9].*DO/ s/ *\([-+*/=]\) */\1/g /^[ 0-9]*FORMAT/{ s/FORMAT( */FORMAT( / s/ *) *$/ )/ } s/\/=/g s/\/,/g s/\/+/g s/\/-/g s/\/*/g s/\ /\//g s/\/'/g s/\/(/g s/\/)/g s/' *'/''/g p $ { x /^ [^ ]/ !p } " | sed -ne ' # Traitement des lignes concernant le preprocesseur /^#[^ ]/{ s/^/## / b ecrit } # Traitement des commentaires et des lignes vides /^[ 0-9]/ !{ /^$/ !{ s/^.// s/^/<> '"$debcom"'/ } '"$comm"' } # Ici, plus de commentaires et plus de cartes-suites # Suppression blancs de tete s/^ *// s/ */ /g # Standardisation /SQRT/{ s/\([^A-Z0-9_]\)[CD]\(SQRT\)(/\1\2(/g s/\([^A-Z0-9_]\)CD\(SQRT\)(/\1\2(/g } /LOG/{ s/\([^A-Z0-9_]\)[ACD]\(LOG\)(/\1\2(/g s/\([^A-Z0-9_]\)CD\(LOG\)(/\1\2(/g s/\([^A-Z0-9_]\)[ACD]\(LOG10\)(/\1\2(/g s/\([^A-Z0-9_]\)CD\(LOG10\)(/\1\2(/g } /EXP/{ s/\([^A-Z0-9_]\)[CD]\(EXP\)(/\1\2(/g s/\([^A-Z0-9_]\)CD\(EXP\)(/\1\2(/g } /SIN/{ s/\([^A-Z0-9_]\)[CD]\(SIN\)(/\1\2(/g s/\([^A-Z0-9_]\)CD\(SIN\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(SIND\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(ASIN\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(ASIND\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(SINH\)(/\1\2(/g } /COS/{ s/\([^A-Z0-9_]\)[CD]\(COS\)(/\1\2(/g s/\([^A-Z0-9_]\)CD\(COS\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(ACOS\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(ACOSD\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(COSD\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(COSH\)(/\1\2(/g } /TAN/{ s/\([^A-Z0-9_]\)D\(TAN\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(TAND\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(TANH\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(ATAN\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(ATAND\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(ATAN2\)(/\1\2(/g s/\([^A-Z0-9_]\)D\(ATAN2D\)(/\1\2(/g } /ABS/{ s/\([^A-Z0-9_]\)I\(ABS\)(/\1\2(/g s/\([^A-Z0-9_]\)[IJK]I\(ABS\)(/\1\2(/g s/\([^A-Z0-9_]\)[CD]\(ABS\)(/\1\2(/g s/\([^A-Z0-9_]\)CD\(ABS\)(/\1\2(/g } /INT/{ s/\([^A-Z0-9_]\)[IJK]I\(INT\)(/\1\2(/g s/\([^A-Z0-9_]\)[IJK]ID\(INT\)(/\1\2(/g s/\([^A-Z0-9_]\)ID\(INT\)(/\1\2(/g s/\([^A-Z0-9_]\)[AD]\(INT\)(/\1\2(/g s/\([^A-Z0-9_]\)\(INT\)[1248](/\1\2(/g s/\([^A-Z0-9_]\)[IJK]I\(NINT\)(/\1\2(/g s/\([^A-Z0-9_]\)[IJK]ID\(NINT\)(/\1\2(/g s/\([^A-Z0-9_]\)ID\(NINT\)(/\1\2(/g s/\([^A-Z0-9_]\)[AD]\(NINT\)(/\1\2(/g } /MAX/{ s/\([^A-Z0-9_]\)[ADIJK]\(MAX\)[01](/\1\2(/g s/\([^A-Z0-9_]\)A[IJK]\(MAX\)[01](/\1\2(/g s/\([^A-Z0-9_]\)[ADIJK]\(MAX\)(/\1\2(/g s/\([^A-Z0-9_]\)A[IJK]\(MAX\)(/\1\2(/g s/\([^A-Z0-9_]\)\(MAX\)[01](/\1\2(/g } /MIN/{ s/\([^A-Z0-9_]\)[ADIJK]\(MIN\)[01](/\1\2(/g s/\([^A-Z0-9_]\)A[IJK]\(MIN\)[01](/\1\2(/g s/\([^A-Z0-9_]\)[ADIJK]\(MIN\)(/\1\2(/g s/\([^A-Z0-9_]\)A[IJK]\(MIN\)(/\1\2(/g s/\([^A-Z0-9_]\)\(MIN\)[01](/\1\2(/g } # Detection des labels s/^\([0-9][0-9]*\) */C| \1 / # Examen de la ligne executable precedente # avant l ecriture de la ligne executable courante x # Suppression des cartes-suites s/\n\&//g # Suppression des chaines de caracteres : string '"s/^\([^']*\)'[^']*'/\1/"' t string # Suppression de l eventuel indice de tableau dans la partie gauche # de l affectation : afftab s/^\([^=]*\)([^)]*)/\1/ t afftab # Les affectations /^[^ ]* *=/{ # Suppression de tous les blancs '"$skip"' s/ //g # Suppression des calculs entiers /^[I-N]/ b affin # Suppression de la partie gauche s/^[^=]*= *// # Suppression des simples changements de signe s/^[-+]// # Re-ecriture des nombres avec exposant s/[0-9]*[.][0-9]*[ED][-+][0-9]*/1/g s/[0-9][0-9]*[ED][-+][0-9]*/1/g # Decompte de certaines operations speciales s/^/ / s/\([^A-Z0-9_]\)SQRT(/\1 * (/g s/\([^A-Z0-9_]\)SIGN(/\1 * (/g s/\([^A-Z0-9_]\)LOG(/\1 * * * (/g s/\([^A-Z0-9_]\)MAX(/\1 * (/g s/\([^A-Z0-9_]\)MIN(/\1 * (/g s/\*\*/ * * * /g # Suppression de certaines operations s/\([^A-Z0-9_]\)ABS(/\1(/g s/^ *// # Suppression des indices de tableaux s/[A-Z][A-Z_0-9 ]*/A/g : supind s/\(A((*\)[^()][^()]*/\1/ s/()// t supind # Suppression de tout ce qui n est pas une operation s/[^-+*/]/ /g # Suppression des blancs en trop s/ */ /g # Suppression des initialisations /^ $/ b affin # Mise d un signe reconnaissable s/^/C% / # Ecriture p : affin } # Recopie du hold space dans le pattern space g s/^IF */IF/g # Les IF s /^IF *(/{ : supbool s/^\([^()]*([^() ]*\) */\1/ s/^\([^()]*([^() ]*\) *\([^() ]*)\)/\1\2/ t supbool s/^IF *(/IF (/ s/ *THEN */ THEN/ s/THEN\(.\)/\1/ s/ *GOTO */ GOTO / s/ *CALL\/ CALL\/ b ecrit } s/^ENDIF/END IF/ /^END IF$/ b ecrit # Les DO s /^DO/{ s/^\(DO\) *\([0-9][0-9]*\) */\1 \2 / s/ *\([^= ]*\) *= */ \1 = / : virtab s/\(([^)]*\) *, */\1|/ t virtab s/ *, */ , /g /^[^,]*,[^,]*$/{ s/$/ , 1/ } s/|/,/g s/ */ /g b ecrit } # /^C| [0-9]* *FORMAT/ b ecrit # /^C| [0-9]/{ # /CONTINUE/ !{ # i\ #*** Error\ #p #i\ #*** Label on executable statement\ #*** Must be on CONTINUE # q # } # } : ecrit p ' | awk 'BEGIN{ FS=" " sum=0; sumt=0; npile=0; nbtab='"$nbtab"' debcom="'"$debcom"'"; nbcar='"$nbcar"' '"$entete"' print "'"$str"' >>> file '"${file#$HOME/}"' <<<" } # Conventions : ## preprocesseur # <> commentaire # C% decompte d operations # & carte suite ( perime ) # C| ligne etiquettee $1 == "##" { printf "%s", $2 for(i=3;i<=NF;++i){ printf " %s", $i } printf "\n" continue } $1 == "<>" { printf "%s", $2 for(i=3;i<=NF;++i){ printf " %s", $i } printf "\n" continue } $1 == "C%" { sum += NF-1 sumt += NF-1 '"$controle"'print $0," >> ",NF-1,sum,"<><><><><> Controle <><><><><>" continue } $1 != debcom && $1 != "C%" { if( $3 == "CONTINUE" || \ ( $1 == "IF" && $NF == "THEN" ) || \ $1 == "GOTO" || \ $1 == "GO" || \ $1 == "ELSE" || \ $1 == "ENDIF" || \ $1 == "END" || \ $1 == "DO" || \ $1 == "RETURN" || \ $1 == "STOP" ){ if(sum!=0){ print debcom "% -=-=-=-=-= Bilan Partiel Debut -=-=-=-=-=" printf "%s%% %d\n",debcom,sum if(npile>0){ for(i=npile;i>0;i--){ printf "%s%% %s\n",debcom,facto[i] } } printf "%s%% -=-=-=-=-= Bilan Partiel Fin -=-=-=-=-=\n", debcom sum=0 } } nbsuite=48 ii=1 ll=0 if( $1=="&" ){ if(++nbsuite>=59) nbsuite-=10 printf " SS%c ", nbsuite ll=9 ii=2 } if($1 $2 =="ENDIF" || $1 == "ELSE") --npile contaft=0 align="" nbsp=(int((npile+1)/2) + int(npile/2)*2)*nbtab if( nbsp>nbcar/2. ) nbsp=nbcar/2. while( nbsp>7 ){ nbsp -= 8; align= align " " } while( nbsp>0 ){ --nbsp ; align=align " " } if($1=="C|"){ # il y a un label if( $3!="CONTINUE" && $3!="FORMAT(" ){ # ni FORMAT, ni CONTINUE # donc sur une ligne executable if( $2!=label[npile] ){ # cette ligne ne correspond pas a un DO # donc CONTINUE avant, indente comme precedemment printf "%5d ",$2 ll=ll+6 ii=3 while( ll<6 ){ ll += 1; printf " " } printf "%sCONTINUE\n", align ll=0 } else { # cette ligne correspond a un DO # donc CONTINUE apres contaft=1 ii=3 } } else { # il y a un label avec FORMAT ou CONTINUE # donc sur une ligne non executable printf "%5d ",$2 ll=ll+6 ii=3 } } if($1=="C|" && $3=="CONTINUE"){ while($2==label[npile]){ --npile } align="" nbsp=(int((npile+1)/2) + int(npile/2)*2)*nbtab if( nbsp>nbcar/2. ) nbsp=nbcar/2. while( nbsp>7){ nbsp -= 8; align=align " " } while( nbsp>0 ){ --nbsp ; align=align " " } } while( ll<6 ){ ++ll ; printf " " } printf "%s", align ll=ll+length(align) nbsp=(int((npile+2)/2) + int((npile+1)/2)*2)*nbtab if( nbsp>nbcar/2. ) nbsp=nbcar/2. nbsp=nbsp-length(align) # nbsp=length($ii) # if( nbsp+length(align)>nbcar/2. ) nbsp=nbcar/2.-length(align) while( nbsp>7){ nbsp -= 8; align=align " " } while( nbsp>0 ){ --nbsp ; align=align " " } pastrop=1 for(i=ii;i<=NF;i++){ if( ll>nbcar ){ pastrop=0 } if( ll+length($i)>=nbcar ){ if(++nbsuite>=59) nbsuite-=11 printf "\n %c%s", nbsuite, align ll=9+length(align) } if(i!=ii) { printf " "; ++ll } printf "%s",$i ll=ll+length($i) } printf "\n" if(pastrop==0) print debcom, "*** Too Much Cars" if( contaft==1 ){ printf "%d",$2 ll=length($2) while($2==label[npile]) npile -= 1 nbsp=6+(int((npile+1)/2) + int(npile/2)*2)*nbtab while( nbsp>ll+7 ){ ll += 8; printf " " } while( nbsp>ll ){ ll += 1; printf " " } printf "CONTINUE\n" contaft=0 } if( $1 == "ELSE" ){ npile += 1 facto[npile]="NOT " facto[npile] } if($1=="DO"){ npile += 1 label[npile]=$2 itdeb=$5 itfin=$7 itstep=$9 if(itdeb+0==itdeb && itfin+0==itfin){ itdelt=itfin-itdeb if(itstep+0==itstep){ facto[npile]=sprintf "* %g", itdelt/itstep+1 } else { facto[npile]=sprintf "* %g/(%s)+1",itdelt,itstep } } else if(itstep+0==1) { if(itdeb+0==1) { facto[npile]="* " itfin } else if(itdeb+0==itdeb) { facto[npile]=sprintf "* %s-%g", itfin, itdeb-1 } else if(itfin+0==itfin) { facto[npile]=sprintf "* %g-%s", itfin+1, itdeb } else { facto[npile]="* ((" itfin ")-(" itdeb ")+" 1 ")" } } else if(itstep+0==-1) { if(itfin+0==1) { facto[npile]="* " itdeb } else if(itfin+0==itfin) { facto[npile]=sprintf "* %s-%g", itdeb, itfin-1 } else if(itdeb+0==itdeb) { facto[npile]=sprintf "* %g-%s", itdeb+1, itfin } else { facto[npile]="* ((" itdeb ")-(" itfin ")+" 1 ")" } } else { facto[npile]="* (((" itfin ")-(" itdeb "))/(" itstep ")+1)" } } if( $1=="IF" && $NF=="THEN" ){ npile += 1 label[npile]=-1 facto[npile]="IF" i=2 while(i<=NF && $i!="THEN"){ facto[npile]=facto[npile] " " $i i += 1 } continue } if($NF=="THEN"){ i=2 while(i<=NF && $i!="THEN"){ facto[npile]=facto[npile] " " $i i += 1 } } if( npile>0 && NF==1 && $1 == "END" ){ print debcom, "Something Going WRONG !!!!!!" for(i=npile;i>0;i--){ printf "%s %s\n",debcom,facto[i] } } continue } ' | sed -e 's/\/ /g; s/\ / /g; s/ *$//' | eval $pr $propt str=" $str" done exit 0 @//E*O*F Fpr// chmod u=rwx,g=rx,o=rx Fpr echo Inspecting for damage in transit... temp=/tmp/shar$$; dtemp=/tmp/.shar$$ trap "rm -f $temp $dtemp; exit" 0 1 2 3 15 cat > $temp <<\!!! 70 233 1316 Fpr.l 676 1976 15738 Fpr 746 2209 17054 total !!! wc Fpr.l Fpr | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp if [ -s $dtemp ] then echo "Ouch [diff of wc output]:" ; cat $dtemp else echo "No problems found." fi exit 0 -- +------------------------------------+-----------------------------------+ | Nathan MAMAN | E-mail : maman@mirsa.inria.fr | | INRIA Centre de Sophia-Antipolis | Phone : (33) 93 65 77 95 | | 2004, Route des Lucioles | Telex : 97 00 50 F | | 06565 Valbonne CEDEX France | Fax : (33) 93 65 77 66 | +------------------------------------+-----------------------------------+