Subversion Repositories wimsdev

Rev

Rev 16107 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
#! /bin/sh
2
 
16107 bpr 3
#LL="env LC_COLLATE=POSIX LANG=POSIX LC_CTYPE=fr_FR.UTF-8"
11566 bpr 4
LL="env LC_ALL=C LC_CTYPE=C LANG=C"
20 reyssat 5
thisdir=`pwd`
6
lastdir=$thisdir
16107 bpr 7
 
20 reyssat 8
if [ -z "$wims_home" ]; then wims_home=$w_wims_home; fi
9
 
10
while [ -z "$wims_home" ] && [ "$lastdir" != "/" ]
11
do
16107 bpr 12
  wims_home=`cat $lastdir/.wimshome 2>/dev/null`
13
  lastdir=`dirname $lastdir`
20 reyssat 14
done
15
if [ -z "$wims_home" ]; then
16107 bpr 16
  echo WIMS home directory not found.
17
  exit;
20 reyssat 18
fi
19
proc=$wims_home/public_html/scripts/deduc
20
 
21
if [ ! -d def ]; then exit; fi
22
if [ ! -d src ]; then exit; fi
23
 
24
deff=`cd def; ls *.def 2>/dev/null`
25
for i in $deff
26
do
16107 bpr 27
  dd=`echo $i | sed 's!\.def!.ded!g'`
28
  if [ ! -f src/$dd ]; then
29
    echo Removing def/$i.
30
    rm -f def/$i >/dev/null;
31
  fi
20 reyssat 32
done
33
 
34
sext=ded
35
cd src
36
if [ -d cpp ]; then
16107 bpr 37
  cd cpp
38
  incf=`ls *.inc 2>/dev/null`
39
  for i in $incf
20 reyssat 40
  do
16107 bpr 41
    list=`egrep -a -l '#[[:blank:]]*include[[:blank:]]+"'$i'"' *.inc 2>/dev/null`
42
    for j in $list
43
    do
44
      if [ $i -nt $j ]; then touch $j; fi
45
    done
20 reyssat 46
  done
16107 bpr 47
  for i in $incf
20 reyssat 48
  do
16107 bpr 49
    list=`egrep -a -l '#[[:blank:]]*include[[:blank:]]+"'$i'"' *.cpp 2>/dev/null`
50
    for j in $list
51
    do
52
      if [ $i -nt $j ]; then touch $j; fi
53
    done
54
  done
55
  pref=`ls *.cpp 2>/dev/null`
56
  for i in $pref
57
  do
58
    list=`$LL grep . $i | head -1 | grep target \
59
 	  | tr ',:;./?*#~$\\ ' '                  ' \
60
 	  | awk -F'=' '{print $2}'`
61
    test=`grep -E '^[[:blank:]]*#[[:blank:]]*include' $i \
62
 	  | grep -E -v '^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*"[[:alnum:]_]+.inc"'`
63
    if [ ! -z "$test" ]; then
64
      echo $i: include violation. $test
65
      list=
66
    fi
67
    grep . $i | awk 'BEGIN {l=0}; {l++}; l>1 {print}' >cpp.tmp
68
    for j in $list
69
    do
70
      if [ ! -f ../$j.$sext ] || [ $i -nt ../$j.$sext ]; then
71
        echo "Preprocessing: $i -> ../$j.$sext"
72
        cat <<@ >../$j.$sext
20 reyssat 73
%% This file is generated by preprocessor!
74
%% Do not edit it by hand.
75
%% Edit the source file cpp/$i.
76
 
77
@
16107 bpr 78
        cpp -P -C -nostdinc -A- -DTARGET_$j -A"TARGET($j)" cpp.tmp >>../$j.$sext
79
      fi
80
    done
81
    rm -f cpp.tmp
20 reyssat 82
  done
16107 bpr 83
  cd ..
20 reyssat 84
fi
85
 
86
srcf=`ls *.ded 2>/dev/null`
87
cd ..
88
oef2wims_mdef="methods variables context environ equivalence startname goal newobject minsteps options"
89
export oef2wims_mdef
90
for i in $srcf
91
do
16107 bpr 92
  dd=`echo $i | sed 's!\.ded!.def!g'`
93
  if [ ! -f def/$dd ] || [ src/$i -nt def/$dd ]; then
94
    # echo $dd
95
    rm -f def/$dd 2>/dev/null
96
    $wims_home/bin/oef2wims src/$i def/$dd
97
  fi
20 reyssat 98
done
99
 
100
rm -f Exindex Extitles >/dev/null
101
list=`cd def; ls *.def 2>/dev/null | sed 's/\.def//g'`
102
 
103
if [ -z "$list" ]; then exit; fi
104
titlist=
105
for i in $list
106
do
16107 bpr 107
  tit=`awk -F= 'NF>=2 {print $2; exit}' def/$i.def | $LL tr ',\11' '; '`
108
  echo "$i:$tit" >>Extitles
109
  titlist="$titlist$tit
20 reyssat 110
"
111
done
112
$wims_home/bin/dicsort Extitles
113
if [ -s Extitles.sorted ]; then
114
 mv Extitles.sorted Extitles
115
fi
116
 
117
echo "$titlist" >tmp1
118
echo "$list" >tmp2
11566 bpr 119
llist=`$LL paste tmp1 tmp2 | $LL sort -t '	' -f -k 1,1`
120
list=`echo "$llist" | awk -F'\11' 'length()>2 {print $2}' |$LL tr '\n' ','`
121
titlist=`echo "$llist" | awk -F'\11' 'length()>2 {print $1}' | $LL tr '\n' ','`
20 reyssat 122
 
16107 bpr 123
rm -f tmp1 tmp2
20 reyssat 124
cat >Exindex <<@
125
!set exolist  =!char 1 to -2 of $list
126
!set titlelist=!char 1 to -2 of $titlist
127
!set exototal =!itemcnt \$exolist
128
 
129
@