File: ExamAllMacs.scr

package info (click to toggle)
fcode-utils 1.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 46,768 kB
  • sloc: ansic: 9,717; csh: 241; makefile: 129; sh: 17
file content (51 lines) | stat: -rwxr-xr-x 1,455 bytes parent folder | download | duplicates (20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!  /bin/csh -f
#
#  Examine the results of the AllMacros detokenization.
#   All but the last items are in pairs...

set ExamFil = AllMacros.DeTok
if ( ! -f $ExamFil ) then
    echo Missing Examination-target file -- $ExamFil
    exit 237
endif

#  Get the line number that starts the simple pairs,
#    identified by a text message.
set firstlin = `grep -n 'Start of simple pairs' $ExamFil | awk -F: '{print $1+1}'`
set lastlin = `grep -n 'End of simple pairs' $ExamFil | awk -F: '{print $1}'`


#  Get the line numbers of the final phrase-item pair,
#    identified by a text message.
set lastphrase = `grep -n 'Last phrase-item' $ExamFil | awk -F: '{print $1+1}'`

#  We'll need a pair o temp-files
#  First, repository for one of each pair of lines
set reposfil = /tmp/$0:t.1.$$
#  Second, accumulation of differences
set accumfil = /tmp/$0:t.2.$$

#  Set up to compare two by two.
#  Start with the final phrase-item pair
set flin = $lastphrase[1]
set slin = $lastphrase[2]
set linnum = $firstlin
while ( $linnum < $lastlin )
    sed -n ${flin}p $ExamFil | sed -e 'sX^ *[0-9]*: XX' > ${reposfil}
    sed -n ${slin}p $ExamFil | sed -e 'sX^ *[0-9]*: XX' | diff - ${reposfil} | tee -a ${accumfil}

    set flin = $linnum
    @ linnum++
    set slin = $linnum
    @ linnum++
end

if ( ! -z ${accumfil} ) then
    cp -p ${accumfil} ./$0.Results.$$
    echo Errors seen in $ExamFil.  See ./$0.Results.$$  for diffs
endif

rm -f ${reposfil} ${accumfil}