File: make-library-index

package info (click to toggle)
coq 8.16.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 40,596 kB
  • sloc: ml: 219,376; sh: 3,545; python: 3,231; ansic: 2,529; makefile: 767; lisp: 279; javascript: 63; xml: 24; sed: 2
file content (56 lines) | stat: -rwxr-xr-x 1,343 bytes parent folder | download
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
52
53
54
55
56
#!/bin/bash

# Instantiate links to library files in index template

FILE=$1
HIDDEN=$2

cp -f $FILE.template tmp
echo -n "Building file index-list.prehtml... "

LIBDIRS=`find theories/* user-contrib/* -type d ! -name .coq-native`

for k in $LIBDIRS; do
    if [[ $k =~ "user-contrib" ]]; then
        BASE_PREFIX=""
    else
        BASE_PREFIX="Coq."
    fi
    d=`basename $k`
      ls $k | grep -q \.v'$'
      if [ $? = 0 ]; then
	for j in $k/*.v; do
	    b=`basename $j .v`
	    rm -f tmp2
	    grep -q $k/$b.v tmp
	    a=$?
	    grep -q $k/$b.v $HIDDEN
	    h=$?
	    if [ $a = 0 ]; then
	        if [ $h = 0 ]; then
                    echo Error: $FILE and $HIDDEN both mention $k/$b.v; exit 1
                else
		    p=`echo $k | sed 's:^[^/]*/::' | sed 's:/:.:g'`
		    sed -e "s:$k/$b.v:<a href=\"$BASE_PREFIX$p.$b.html\">$b</a>:g" tmp > tmp2
		    mv -f tmp2 tmp
                fi
	    else
	        if [ $h = 0 ]; then
		    # Skipping file from the index
                    :
                else
                    echo Error: none of $FILE and $HIDDEN mention $k/$b.v
                    exit 1
	        fi

            fi
	done
      fi
    rm -f tmp2
    sed -e "s/#$d#//" tmp > tmp2
    mv -f tmp2 tmp
done
a=`grep theories tmp`
if [ $? = 0 ]; then echo Error: extra files:; echo $a; exit 1; fi
mv tmp $FILE
echo Done