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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
#!/usr/bin/env bash
#
# Author: Mattias Gaertner
#
# Creates the fpdoc HTML output for the LCL
# Creates an chm file, if HTMLFMT is set to chm,
# otherwise it create html docs
#
#
#set -x
set -e
FPDoc=$1
if [ -z $FPDoc ]; then
FPDoc=fpdoc
fi
FPDocFooter=$2
FPCDocDir=$3
PackageName=lcl
XMLSrcDir=../xml/lcl/
PasSrcDir=../../lcl/
InputFileList=inputfile.txt
# list with units in a preseeded order.
# missing units will be dropped from this list, other units added.
# units not in import order will mutilate links.
PreorderUnitList=( lclbase fpcadds lclstrconsts masks fileutil utf8process lcltype lclproc tmschema lresources lclclasses )
PreorderUnitList+=( avglvltree graphmath graphtype lmessages interfacebase lclrescache graphics imglist themes actnlist clipbrd stdactns )
PreorderUnitList+=( graphics controls forms stdctrls extctrls buttons dialogs comctrls )
PreorderUnitList+=( lazhelpintf printers grids dbgrids menus )
#------------------
inarray()
{ local tofind=$1 element;
shift; for element; do [[ $element = "$tofind" ]] && return; done; return 1;
}
# Usage: inarray "$value" "${array[@]}"
UnitListArr=()
# create output directory
mkdir -p $PackageName
# Copy the css file to it
cp fpdoc.css $PackageName/
# create unit list
cd $PasSrcDir
FindUnitList=(*.pp *.pas)
cd -
# test for preorder unit existance, add them to unitlist.
for preorder in ${PreorderUnitList[@]}; do
if [ -f $PasSrcDir/$preorder.pp ]
then
UnitListArr+=($preorder.pp)
fi
if [ -f $PasSrcDir/$preorder.pas ]
then
UnitListArr+=($preorder.pas)
fi
done
#echo 1 ${UnitListArr[@]}
for foundunit in ${FindUnitList[@]}; do
if ! inarray "$foundunit" "${UnitListArr[@]}"
then
UnitListArr+=($foundunit)
fi
done
UnitList=
for foundunit in ${UnitListArr[@]}; do
UnitList+="$foundunit "
done
# echo 2 $UnitList
# create description file list
DescrFiles=''
for unit in $UnitList; do
ShortFile=${unit%.pp}
ShortFile=${ShortFile%.pas}
DescrFiles="$DescrFiles --descr=../$XMLSrcDir$ShortFile.xml"
done
# create input file list
CurInputFileList=$PackageName/$InputFileList
rm -f $CurInputFileList
for unit in $UnitList; do
echo ../${PasSrcDir}$unit -Fi../${PasSrcDir}include >> $CurInputFileList
done
if [ -z "$HTMLFMT" ]; then
HTMLFMT=html
fi
FPDocParams="--content=lcl.xct --package=lcl --descr=../${XMLSrcDir}lcl.xml --format=$HTMLFMT"
if [ "$HTMLFMT" == "chm" ]; then
FPDocParams="$FPDocParams --css-file=../fpdoc.css --auto-toc --auto-index --make-searchable --output=lcl.chm"
fi
if [ -n "$FOOTERDATE" ]; then
FPDocParams="$FPDocParams --footer-date=$FOOTERDATE"
fi
if [ -n "$FPDocFooter" ]; then
FPDocParams="$FPDocParams --footer=$FPDocFooter"
fi
if [ -n "$FPCDocDir" ]; then
if [ "$HTMLFMT" == "chm" ]; then
FPDocParams="$FPDocParams --import=$FPCDocDir/rtl.xct,ms-its:rtl.chm::/ --import=$FPCDocDir/fcl.xct,ms-its:fcl.chm::/"
if [ -f lazutils/lazutils.xct ]
then
FPDocParams="$FPDocParams --import=../lazutils/lazutils.xct,ms-its:lazutils.chm::/"
else
echo lazutils/lazutils.xct not found!
fi
else
FPDocParams="$FPDocParams --import=$FPCDocDir/rtl.xct,../rtl/ --import=$FPCDocDir/fcl.xct,../fcl/"
fi
fi
cd $PackageName
$FPDoc $DescrFiles --input=@$InputFileList $FPDocParams
cd -
# end.
|