From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d5e5c645a7ec696f,start X-Google-Attributes: gid103376,public From: mazzanti@iei.pi.cnr.it (Franco Mazzanti) Subject: Ada Code Formatting (Ada source diff) Date: 1996/09/05 Message-ID: #1/1 X-Deja-AN: 178632872 organization: IEI-CNR newsgroups: comp.lang.ada Date: 1996-09-05T00:00:00+00:00 List-Id: Some time ago on this thread it has been said (by Robert Dewar?): > A useful utility would be an Ada specific diff, with an option to ignore > white space, ignore line changes, ignore reformatting of comments, or > igore comments completely. > Supposing GNAT is installed, the following simple CSH script, compares the sources of two files containing a set of compilation units, and report any difference which is not due to indenting, casing or comments. It has been tested on Sun/Solaris1 but should be easily portable to any Unix system since if just calls gnatchop, gnatf and diff. Franco Mazzanti ----------------------- cut and make executable --------------------------- #!/bin/csh ############################################################################ # src-diff # :compares the Ada sources inside two files omitting the # differences caused by indentations, case of identifiers or comments # # assumes gnatf and gnatchop are properly installed and visible through PATH # assumes "diff" is available ############################################################################ if ($#argv == '0' || $#argv == '1') then echo 'usage: src-diff ' exit endif set dir1=/tmp/$$src1 set dir2=/tmp/$$src2 mkdir $dir1 mkdir $dir2 gnatchop $1 $dir1 >/dev/null gnatchop $2 $dir2 >/dev/null cd $dir1 foreach unit (`/bin/ls *.ad?`) gnatf -s -do ${dir1}//$unit > ${dir1}/$unit.do gnatf -s -do ${dir2}/$unit > ${dir2}/$unit.do diff ${dir1}/$unit.tree ${dir2}/$unit.do end /bin/rm -r $dir1 $dir2 ############################################################################