Re: texlive 2008/2009, hyphen pattern handling
On Di, 05 Mai 2009, Norbert Preining wrote:
> Here is a patch to update-fontlang that works as follows:
ups, here ...
> - calling it as update-language calls recursively update-language-dat
> and update-language-def
> - calling it as one of the -dat -def variants work is done, the include
> file function is changed to use another function that reads and works
> through the file and echos out the right things.
>
> Tested and working, needs some error cases testing, and some good eyes.
>
> Still, if someone has a better idea ...
-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at> Vienna University of Technology
Debian Developer <preining@debian.org> Debian TeX Group
gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
Ah, " said Arthur, "this is obviously some strange usage
of the word safe that I wasn't previously aware of.
--- Douglas Adams, The Hitchhikers Guide to the Galaxy
Index: update-fontlang
===================================================================
--- update-fontlang (revision 3899)
+++ update-fontlang (working copy)
@@ -26,12 +26,35 @@
SYSPATH_BASE=/var/lib/texmf
+HYPHENMODE=nohyphen
+
if [ "$progname" = "update-language" ] ; then
- CNFDIR=language.d
+ update-language-dat
+ update-language-def
+ exit 0
+elif [ "$progname" = "update-language-def" ] ; then
+ CNFDIR=hyphen.d
+ HYPHENMODE=etex
# System-wide configuration directory
SYSWIDE_CONFDIR=/etc/texmf/$CNFDIR
CHECKFILE="$SYSWIDE_CONFDIR/00tex.cnf"
EXT="cnf"
+ MEMORY_DIR=/var/lib/tex-common/hyphen-cnf
+ PATH_COMPONENT=tex/generic/config
+ SYSWIDE_VARD="$SYSPATH_BASE/$PATH_COMPONENT"
+ DEFAULT_OUTPUTFILE_BASENAME=language.def
+ SYSWIDE_DEFAULT_OUTPUTFILE="$SYSWIDE_VARD/$DEFAULT_OUTPUTFILE_BASENAME"
+ CC="%" # for COMMENTCHAR
+ # in printf, %% is one %
+ PCC="%%" # for printfCOMMENTCHAR
+ SHORT_DESC="Generate language.def, the hyphenation configuration file for eTeX and friends"
+elif [ "$progname" = "update-language-dat" ] ; then
+ CNFDIR=hyphen.d
+ HYPHENMODE=latex
+ # System-wide configuration directory
+ SYSWIDE_CONFDIR=/etc/texmf/$CNFDIR
+ CHECKFILE="$SYSWIDE_CONFDIR/00tex.cnf"
+ EXT="cnf"
MEMORY_DIR=/var/lib/tex-common/language-cnf
PATH_COMPONENT=tex/generic/config
SYSWIDE_VARD="$SYSPATH_BASE/$PATH_COMPONENT"
@@ -106,14 +129,82 @@
exit $rc
}
+do_one_hyphen_line()
+{
+ line="$1"
+ case "$line" in
+ ${CC}*) echo "$line" >> "$tempfile" ; return ;;
+ esac
+ set -- $line
+ name=""
+ lhm=""
+ rhm=""
+ synonyms=""
+ f=""
+ while [ ! "$1" = "" ] ; do
+ case "$1" in
+ name=*) name="${1/#name=/}" ;;
+ lefthyphenmin=*) lhm="${1/#lefthyphenmin=/}" ;;
+ righthyphenmin=*) rhm="${1/#righthyphenmin=/}" ;;
+ synonyms=*) synonyms="${1/#synonyms=/}" ;;
+ file=*) f="${1/#file=/}" ;;
+ *) echo "Unknown AddHypen directive ==$line==!" >&2 ; return ;;
+ esac
+ shift
+ done
+ if [ "$name$lhm$rhm$synonyms$f" = "" ] ; then
+ return
+ fi
+ if [ ! "$lhm$rhm$synonyms$f" = "" ] ; then
+ if [ "$name" = "" ] ; then
+ echo "the line $line does not contain a name= directive, ignored!" >&2
+ return
+ fi
+ fi
+ if [ ! "$name$lhm$rhm$synonyms" = "" ] ; then
+ if [ "$f" = "" ] ; then
+ echo "the line $line does not contain a file= directive, ignored!" >&2
+ return
+ fi
+ fi
+ if [ "$HYPHENMODE" = "etex" ] ; then
+ echo "\\addlanguage{$name}{$f}{}{$lhm}{$rhm}" >> "$tempfile"
+ else
+ echo "$name $f" >> "$tempfile"
+ fi
+ if [ ! "$synonyms" = "" ] ; then
+ {
+ IFS=",$IFS"
+ for s in $synonyms ; do
+ if [ "$HYPHENMODE" = "etex" ] ; then
+ echo "\\addlanguage{$s}{$f}{}{$lhm}{$rhm}" >> "$tempfile"
+ else
+ echo "=$s" >> "$tempfile"
+ fi
+ done
+ }
+ fi
+}
+include_hyphen_file_core()
+{
+ file="$1"
+ cat "$1" | while read line ; do
+ do_one_hyphen_line "$line"
+ done
+}
+
# include_file <file path>
include_file()
{
file="$1"
printf "\n${PCC}${PCC}${PCC} From file: $file\n" >>"$tempfile"
- cat "$file" >>"$tempfile"
+ if [ $HYPHENMODE = "nohyphen" ] ; then
+ cat "$file" >>"$tempfile"
+ else
+ include_hyphen_file_core "$file"
+ fi
echo "${CC}${CC}${CC} End of file: $file" >>"$tempfile"
case "$file" in
*/10texlive-latex-base.cnf)
Reply to: