Rev 16107 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#! /bin/sh
#LL="env LC_COLLATE=POSIX LANG=POSIX LC_CTYPE=fr_FR.UTF-8"
LL="env LC_ALL=C LC_CTYPE=C LANG=C"
thisdir=`pwd`
lastdir=$thisdir
if [ -z "$wims_home" ]; then wims_home=$w_wims_home; fi
while [ -z "$wims_home" ] && [ "$lastdir" != "/" ]
do
wims_home=`cat $lastdir/.wimshome 2>/dev/null`
lastdir=`dirname $lastdir`
done
if [ -z "$wims_home" ]; then
echo WIMS home directory not found.
exit;
fi
proc=$wims_home/public_html/scripts/deduc
if [ ! -d def ]; then exit; fi
if [ ! -d src ]; then exit; fi
deff=`cd def; ls *.def 2>/dev/null`
for i in $deff
do
dd=`echo $i | sed 's!\.def!.ded!g'`
if [ ! -f src/$dd ]; then
echo Removing def/$i.
rm -f def/$i >/dev/null;
fi
done
sext=ded
cd src
if [ -d cpp ]; then
cd cpp
incf=`ls *.inc 2>/dev/null`
for i in $incf
do
list=`egrep -a -l '#[[:blank:]]*include[[:blank:]]+"'$i'"' *.inc 2>/dev/null`
for j in $list
do
if [ $i -nt $j ]; then touch $j; fi
done
done
for i in $incf
do
list=`egrep -a -l '#[[:blank:]]*include[[:blank:]]+"'$i'"' *.cpp 2>/dev/null`
for j in $list
do
if [ $i -nt $j ]; then touch $j; fi
done
done
pref=`ls *.cpp 2>/dev/null`
for i in $pref
do
list=`$LL grep . $i | head -1 | grep target \
| tr ',:;./?*#~$\\ ' ' ' \
| awk -F'=' '{print $2}'`
test=`grep -E '^[[:blank:]]*#[[:blank:]]*include' $i \
| grep -E -v '^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*"[[:alnum:]_]+.inc"'`
if [ ! -z "$test" ]; then
echo $i: include violation. $test
list=
fi
grep . $i | awk 'BEGIN {l=0}; {l++}; l>1 {print}' >cpp.tmp
for j in $list
do
if [ ! -f ../$j.$sext ] || [ $i -nt ../$j.$sext ]; then
echo "Preprocessing: $i -> ../$j.$sext"
cat <<@ >../$j.$sext
%% This file is generated by preprocessor!
%% Do not edit it by hand.
%% Edit the source file cpp/$i.
@
cpp -P -C -nostdinc -A- -DTARGET_$j -A"TARGET($j)" cpp.tmp >>../$j.$sext
fi
done
rm -f cpp.tmp
done
cd ..
fi
srcf=`ls *.ded 2>/dev/null`
cd ..
oef2wims_mdef="methods variables context environ equivalence startname goal newobject minsteps options"
export oef2wims_mdef
for i in $srcf
do
dd=`echo $i | sed 's!\.ded!.def!g'`
if [ ! -f def/$dd ] || [ src/$i -nt def/$dd ]; then
# echo $dd
rm -f def/$dd 2>/dev/null
$wims_home/bin/oef2wims src/$i def/$dd
fi
done
rm -f Exindex Extitles >/dev/null
list=`cd def; ls *.def 2>/dev/null | sed 's/\.def//g'`
if [ -z "$list" ]; then exit; fi
titlist=
for i in $list
do
tit=`awk -F= 'NF>=2 {print $2; exit}' def/$i.def | $LL tr ',\11' '; '`
echo "$i:$tit" >>Extitles
titlist="$titlist$tit
"
done
$wims_home/bin/dicsort Extitles
if [ -s Extitles.sorted ]; then
mv Extitles.sorted Extitles
fi
echo "$titlist" >tmp1
echo "$list" >tmp2
llist=`$LL paste tmp1 tmp2 | $LL sort -t ' ' -f -k 1,1`
list=`echo "$llist" | awk -F'\11' 'length()>2 {print $2}' |$LL tr '\n' ','`
titlist=`echo "$llist" | awk -F'\11' 'length()>2 {print $1}' | $LL tr '\n' ','`
rm -f tmp1 tmp2
cat >Exindex <<@
!set exolist =!char 1 to -2 of $list
!set titlelist=!char 1 to -2 of $titlist
!set exototal =!itemcnt \$exolist
@