diff options
author | Jean-Marc Zucconi <jmz@FreeBSD.org> | 2004-06-15 01:54:48 +0000 |
---|---|---|
committer | Jean-Marc Zucconi <jmz@FreeBSD.org> | 2004-06-15 01:54:48 +0000 |
commit | 00743191f18ff85d98c42393ce92c69e2f93f0ec (patch) | |
tree | c04d919a4f4b0e55977697843770b35b2b9c5156 /textproc/ispell | |
parent | 13c7544f14338cfb15b853625d4426f3c8e6b7f7 (diff) | |
download | ports-00743191f18ff85d98c42393ce92c69e2f93f0ec.tar.gz ports-00743191f18ff85d98c42393ce92c69e2f93f0ec.zip |
Notes
Diffstat (limited to 'textproc/ispell')
-rw-r--r-- | textproc/ispell/Makefile | 3 | ||||
-rw-r--r-- | textproc/ispell/files/unsq.pl | 85 |
2 files changed, 87 insertions, 1 deletions
diff --git a/textproc/ispell/Makefile b/textproc/ispell/Makefile index f8e51c8848dd..f57fce48d59a 100644 --- a/textproc/ispell/Makefile +++ b/textproc/ispell/Makefile @@ -7,7 +7,7 @@ PORTNAME?= ispell PORTVERSION?= 3.2.06 -PORTREVISION?= 10 +PORTREVISION?= 11 CATEGORIES+= textproc MASTER_SITES= http://fmg-www.cs.ucla.edu/geoff/tars/ DISTNAME= ispell-3.2.06 # needed for slave ports / options @@ -205,6 +205,7 @@ post-patch: .endif .if defined(ISPELL_NO) @cd ${WRKDIR}/norsk && ${PATCH} < ${FILESDIR}/NO.patch 2>/dev/null + @${MKDIR} ${WRKDIR}/bin && ${CP} ${FILESDIR}/unsq.pl ${WRKDIR}/bin && ${CHMOD} +x ${WRKDIR}/bin/unsq.pl .endif .if defined(ISPELL_NL) @cd ${WRKDIR} && ${PATCH} < ${FILESDIR}/NL.patch 2>/dev/null diff --git a/textproc/ispell/files/unsq.pl b/textproc/ispell/files/unsq.pl new file mode 100644 index 000000000000..6134c75c3eb6 --- /dev/null +++ b/textproc/ispell/files/unsq.pl @@ -0,0 +1,85 @@ +#!/usr/bin/perl + +# sq(eeze) / unsq(eeze) - pre-compressor for sorted word lists +# Copyright (C) 2000 Björn Jacke <bjoern.jacke@gmx.de> +# +# This program comes with ABSOLUTELY NO WARRANTY; it may be copied or modified +# under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. + +# This is a `multi-call-program'. If it's called as `unsq' or `unsq.pl' +# it decompresses -- otherwise it is in compress mode. Input and Output only +# via STDIN and STDOUT. It does almost the same job as the sq/unsq from +# Ispell -- just better ;-) +# +# PS: For best compression results use POSIX sorting order in spite of any +# other locale-depending sorting order (set LC_ALL and LC_COLLATE to POSIX) + +# version 1.2 + + +@size_arr = qw(0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J + K L M N O P Q R S T U V W X Y Z a b c d + e f g h i j k l m n o p q r s t u v w x y z); +$MAX_PREFIX = $#size_arr; + + +sub trunc { + + if ($word eq $prev) { + $same = length($word); + } + else { + $same = 0; + while (substr($word,$same,1) eq substr($prev,$same,1)) { + $same++; + } + } + + if ($same > $MAX_PREFIX) { + $same = $MAX_PREFIX; + } + + print STDOUT $size_arr[$same], substr($word,$same); + + $prev = $word; +} + + +sub expand { + + # keep relevant part of previous word: + $prev = substr($prev, 0, $to_num{substr($word,0,1)} ); + # strip first (meta)-character from word: + $word = substr($word,1); + # concatenate new word and name it prev ... + $prev = "$prev$word"; + print STDOUT $prev; +} + + + +###### main ###### + +$0 =~ s/.*?unsq(\.pl)?$/unsq/i; + +$prev = ""; + + +if ($0 eq "unsq") { + + $i = 0; + foreach (@size_arr) { + $to_num{$_} = $i++; + } + $do_it = \&expand; +} + +else { + $do_it = \&trunc; +} + + +while ($word = <STDIN>) { + &$do_it; +} |