aboutsummaryrefslogtreecommitdiff
path: root/textproc/p5-Text-Reflow
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2004-10-07 12:49:34 +0000
committerMathieu Arnold <mat@FreeBSD.org>2004-10-07 12:49:34 +0000
commit353dcfe314eaccc7622df89fdae1346667fdd61b (patch)
tree64c403bc6b29d29c486274caa9a10a0a0c36360a /textproc/p5-Text-Reflow
parent17847a3b1acce7ff0ac2b4b71d871e86272bac1a (diff)
downloadports-353dcfe314eaccc7622df89fdae1346667fdd61b.tar.gz
ports-353dcfe314eaccc7622df89fdae1346667fdd61b.zip
Update to use the perl version of the algorithm over the C version for 5.8.5
because it uses 64 bit integers by default and it messes very badly with some pack/unpack things on the perl part and some << and >> on the C part, so, use the perl part everywhere. Approved by: portmgr (krion)
Notes
Notes: svn path=/head/; revision=118573
Diffstat (limited to 'textproc/p5-Text-Reflow')
-rw-r--r--textproc/p5-Text-Reflow/Makefile4
-rw-r--r--textproc/p5-Text-Reflow/files/5.8-Reflow.pm63
2 files changed, 67 insertions, 0 deletions
diff --git a/textproc/p5-Text-Reflow/Makefile b/textproc/p5-Text-Reflow/Makefile
index cbe8a8257a49..1724028c57b6 100644
--- a/textproc/p5-Text-Reflow/Makefile
+++ b/textproc/p5-Text-Reflow/Makefile
@@ -7,6 +7,7 @@
PORTNAME= Text-Reflow
PORTVERSION= 1.05
+PORTREVISION= 1
CATEGORIES= textproc perl5
MASTER_SITES= ${MASTER_SITE_PERL_CPAN}
MASTER_SITE_SUBDIR= Text
@@ -21,6 +22,9 @@ MAN3= Text::Reflow.3
.include <bsd.port.pre.mk>
+.if ${PERL_LEVEL} > 500800
+EXTRA_PATCHES= ${PATCHDIR}/5.8-Reflow.pm
+.endif
.if ${PERL_LEVEL} < 500601
IGNORE= "Requires perl 5.6.1"
.endif
diff --git a/textproc/p5-Text-Reflow/files/5.8-Reflow.pm b/textproc/p5-Text-Reflow/files/5.8-Reflow.pm
new file mode 100644
index 000000000000..d9321fdb875e
--- /dev/null
+++ b/textproc/p5-Text-Reflow/files/5.8-Reflow.pm
@@ -0,0 +1,63 @@
+--- Reflow.pm~ Thu Oct 23 17:58:32 2003
++++ Reflow.pm Thu Oct 7 14:30:16 2004
+@@ -32,7 +32,7 @@
+
+ $Text::Reflow::VERSION = "1.05";
+
+-bootstrap Text::Reflow $Text::Reflow::VERSION;
++#bootstrap Text::Reflow $Text::Reflow::VERSION;
+
+ # Preloaded methods go here.
+
+@@ -41,17 +41,17 @@
+ # bootstrap Text::Reflow $VERSION;
+ # above, and take the _ from the front of this perl version:
+
+-sub _reflow_trial($$$$$$$$$$) {
++sub reflow_trial($$$$$$$$$$) {
+ my ($optimum, $maximum, $wordcount,
+ $penaltylimit, $semantic, $shortlast,
+ $word_len, $space_len, $extra, $result) = @_;
+ my ($lastbreak, @linkbreak);
+ my ($j, $k, $interval, $penalty, @totalpenalty, $bestsofar);
+ my (@best_linkbreak, $best_lastbreak, $opt);
+- my @optimum = unpack("N*", pack("H*", $optimum));
+- my @word_len = unpack("N*", pack("H*", $word_len));
+- my @space_len = unpack("N*", pack("H*", $space_len));
+- my @extra = unpack("N*", pack("H*", $extra));
++ my @optimum = unpack("j*", pack("H*", $optimum));
++ my @word_len = unpack("j*", pack("H*", $word_len));
++ my @space_len = unpack("j*", pack("H*", $space_len));
++ my @extra = unpack("j*", pack("H*", $extra));
+ my $best = $penaltylimit * 21;
+ foreach $opt (@optimum) {
+ @linkbreak = ();
+@@ -101,7 +101,7 @@
+ }
+ } # Next $opt
+ # Return the best breaks:
+- $result = unpack("H*", pack("N*", ($best_lastbreak, @best_linkbreak)));
++ $result = unpack("H*", pack("j*", ($best_lastbreak, @best_linkbreak)));
+ return($result);
+ }
+
+@@ -511,14 +511,14 @@
+ $linkbreak[$wordcount] = 0;
+ # Create space for the result:
+ my $result = " " x (($wordcount + 2) * 8);
+- $result = reflow_trial(unpack("H*", pack("N*", @$optimum)),
++ $result = reflow_trial(unpack("H*", pack("j*", @$optimum)),
+ $maximum, $wordcount,
+ $penaltylimit, $semantic, $shortlast,
+- unpack("H*", pack("N*", @word_len)),
+- unpack("H*", pack("N*", @space_len)),
+- unpack("H*", pack("N*", @extra)),
++ unpack("H*", pack("j*", @word_len)),
++ unpack("H*", pack("j*", @space_len)),
++ unpack("H*", pack("j*", @extra)),
+ $result);
+- @linkbreak = unpack("N*", pack("H*", $result));
++ @linkbreak = unpack("j*", pack("H*", $result));
+ @linkbreak = map { $_ + 0 } @linkbreak;
+ $lastbreak = shift(@linkbreak);
+ compute_output();