[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6470] add_next remove unused parameter
From: |
Gavin D. Smith |
Subject: |
[6470] add_next remove unused parameter |
Date: |
Mon, 27 Jul 2015 10:07:10 +0000 |
Revision: 6470
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6470
Author: gavin
Date: 2015-07-27 10:07:07 +0000 (Mon, 27 Jul 2015)
Log Message:
-----------
add_next remove unused parameter
Modified Paths:
--------------
trunk/tp/Texinfo/Convert/Line.pm
trunk/tp/Texinfo/Convert/Paragraph.pm
trunk/tp/Texinfo/Convert/Plaintext.pm
trunk/tp/Texinfo/Convert/UnFilled.pm
trunk/tp/Texinfo/Convert/XSParagraph/XSParagraph.xs
trunk/tp/Texinfo/Convert/XSParagraph/xspara.c
trunk/tp/t/paragraph.t
Modified: trunk/tp/Texinfo/Convert/Line.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Line.pm 2015-07-27 09:14:15 UTC (rev 6469)
+++ trunk/tp/Texinfo/Convert/Line.pm 2015-07-27 10:07:07 UTC (rev 6470)
@@ -151,26 +151,24 @@
return $result;
}
-sub add_next($;$$$$)
+sub add_next($;$$$)
{
my $line = shift;
my $word = shift;
- my $space = shift;
my $end_sentence = shift;
my $transparent = shift;
$line->{'end_line_count'} = 0;
- return $line->_add_next($word, $space, $end_sentence, $transparent);
+ return $line->_add_next($word, $end_sentence, $transparent);
}
my $end_sentence_character = quotemeta('.?!');
my $after_punctuation_characters = quotemeta('"\')]');
-# add a word and/or spaces and end of sentence.
-sub _add_next($;$$$$)
+# add a word and/or end of sentence.
+sub _add_next($;$$$)
{
my $line = shift;
my $word = shift;
- my $space = shift;
my $end_sentence = shift;
my $transparent = shift;
my $result = '';
@@ -210,14 +208,7 @@
print STDERR "WORD+.L $word -> $line->{'word'}\n";
}
}
- if (defined($space)) {
- if ($line->{'protect_spaces'}) {
- $result .= $line->_add_text($space);
- } else {
- $result .= $line->_add_pending_word();
- $line->{'space'} = $space;
- }
- }
+
if (defined($end_sentence)) {
$line->{'end_sentence'} = $end_sentence;
}
Modified: trunk/tp/Texinfo/Convert/Paragraph.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Paragraph.pm 2015-07-27 09:14:15 UTC (rev
6469)
+++ trunk/tp/Texinfo/Convert/Paragraph.pm 2015-07-27 10:07:07 UTC (rev
6470)
@@ -167,28 +167,25 @@
my $end_sentence_character = quotemeta('.?!');
my $after_punctuation_characters = quotemeta('"\')]');
-# Add $WORD and/or $SPACE, returning the text to be added to the paragraph.
+# Add $WORD to paragraph, returning the text to be added to the paragraph.
# Any end of sentence punctuation in $WORD that should be allowed to end a
# sentence but which would otherwise be preceded by an upper-case letter
should
# instead by preceded by a backspace character.
-sub add_next($;$$$$)
+sub add_next($;$$$)
{
my $paragraph = shift;
my $word = shift;
- my $space = shift;
my $end_sentence = shift;
my $transparent = shift;
$paragraph->{'end_line_count'} = 0;
- return _add_next($paragraph, $word, $space, $end_sentence,
- $transparent);
+ return _add_next($paragraph, $word, $end_sentence, $transparent);
}
-# add a word and/or spaces and end of sentence.
-sub _add_next($;$$$$$$)
+# add a word and/or end of sentence.
+sub _add_next($;$$$$)
{
my $paragraph = shift;
my $word = shift;
- my $space = shift;
my $end_sentence = shift;
my $transparent = shift;
my $newlines_impossible = shift;
@@ -255,18 +252,6 @@
$result .= _cut_line($paragraph);
}
}
- if (defined($space)) {
- if ($paragraph->{'protect_spaces'}) {
- $result .= _add_text($paragraph, $space);
- } else {
- $result .= _add_pending_word($paragraph);
- $paragraph->{'space'} = $space;
- if ($paragraph->{'counter'} + length($paragraph->{'space'})
- > $paragraph->{'max'}) {
- $result .= _cut_line($paragraph);
- }
- }
- }
if (defined($end_sentence)) {
$paragraph->{'end_sentence'} = $end_sentence;
}
@@ -418,7 +403,7 @@
}
$result .= _add_next($paragraph, $added_word, undef, undef,
- undef, !$newline_possible_flag);
+ !$newline_possible_flag);
# Check if it is considered as an end of sentence. There are two things
# to check: one, that we have a ., ! or ?; and second, that it is not
Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm 2015-07-27 09:14:15 UTC (rev
6469)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm 2015-07-27 10:07:07 UTC (rev
6470)
@@ -1760,7 +1760,7 @@
$formatter->{'container'}->end_line());
} elsif ($command eq '.' or $command eq '?' or $command eq '!') {
$result .= _count_added($self, $formatter->{'container'},
- $formatter->{'container'}->add_next($command, undef, 1));
+ $formatter->{'container'}->add_next($command, 1));
} elsif ($command eq ' ' or $command eq "\n" or $command eq "\t") {
$result .= _count_added($self, $formatter->{'container'},
$formatter->{'container'}->add_next($no_brace_commands{$command}));
@@ -1799,7 +1799,7 @@
if ($punctuation_no_arg_commands{$command}) {
$result .= _count_added($self, $formatter->{'container'},
- $formatter->{'container'}->add_next($text, undef, 1));
+ $formatter->{'container'}->add_next($text, 1));
} elsif ($command eq 'tie') {
$formatter->{'w'}++;
$result .= _count_added($self, $formatter->{'container'},
@@ -1918,7 +1918,7 @@
}
$result .= _count_added($self, $formatter->{'container'},
$formatter->{'container'}->add_next($text_before,
- undef, undef, 1))
+ undef, 1))
if ($text_before ne '');
if ($root->{'args'}) {
$result .= $self->_convert($root->{'args'}->[0]);
@@ -1935,7 +1935,7 @@
}
$result .= _count_added($self, $formatter->{'container'},
$formatter->{'container'}->add_next($text_after,
- undef, undef, 1))
+ undef, 1))
if ($text_after ne '');
if ($command eq 'w') {
$formatter->{'w'}--;
@@ -2059,7 +2059,7 @@
}
$result .= _count_added($self, $formatter->{'container'},
$formatter->{'container'}->add_next("($formatted_footnote_number)",
- undef, undef, 1));
+ undef, 1));
if ($self->get_conf('footnotestyle') eq 'separate' and $self->{'node'}) {
$result .= $self->_convert({'contents' =>
[{'text' => ' ('},
Modified: trunk/tp/Texinfo/Convert/UnFilled.pm
===================================================================
--- trunk/tp/Texinfo/Convert/UnFilled.pm 2015-07-27 09:14:15 UTC (rev
6469)
+++ trunk/tp/Texinfo/Convert/UnFilled.pm 2015-07-27 10:07:07 UTC (rev
6470)
@@ -146,12 +146,11 @@
return '';
}
-# add a word and/or spaces and end of sentence.
-sub add_next($;$$$$)
+# add a word and/or end of sentence.
+sub add_next($;$$$)
{
my $line = shift;
my $word = shift;
- my $space = shift;
my $end_sentence = shift;
my $transparent = shift;
$line->{'end_line_count'} = 0;
@@ -160,9 +159,6 @@
if (defined($word)) {
$result .= $line->_add_text($word);
}
- if (defined($space)) {
- $result .= $line->_add_text($space);
- }
return $result;
}
Modified: trunk/tp/Texinfo/Convert/XSParagraph/XSParagraph.xs
===================================================================
--- trunk/tp/Texinfo/Convert/XSParagraph/XSParagraph.xs 2015-07-27 09:14:15 UTC
(rev 6469)
+++ trunk/tp/Texinfo/Convert/XSParagraph/XSParagraph.xs 2015-07-27 10:07:07 UTC
(rev 6470)
@@ -196,14 +196,9 @@
if (items > 0)
{
- items--; /* space */
- }
-
- if (items > 0)
- {
- if (SvOK(ST(3)))
+ if (SvOK(ST(2)))
{
- end_sentence = (int)SvIV(ST(3));
+ end_sentence = (int)SvIV(ST(2));
}
items--;
}
@@ -217,6 +212,7 @@
text = SvPV (text_in, text_len);
//xspara_set_state (paragraph);
+ //fprintf (stderr, "end sentence %d\n", end_sentence);
retval = xspara_add_next (text, text_len, end_sentence);
xspara_get_state (paragraph);
Modified: trunk/tp/Texinfo/Convert/XSParagraph/xspara.c
===================================================================
--- trunk/tp/Texinfo/Convert/XSParagraph/xspara.c 2015-07-27 09:14:15 UTC
(rev 6469)
+++ trunk/tp/Texinfo/Convert/XSParagraph/xspara.c 2015-07-27 10:07:07 UTC
(rev 6470)
@@ -13,7 +13,7 @@
#include <wchar.h>
#include <wctype.h>
-/* See "How do I use all this in extensions in 'man perlguts'. */
+/* See "How do I use all this in extensions" in 'man perlguts'. */
#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
@@ -526,12 +526,9 @@
void
xspara__add_next (TEXT *result,
char *word, int word_len,
- char *space,
int end_sentence,
int transparent)
{
- //return word;
-
if (word) // 196
{
if (state.word.end == 0 && !state.invisible_pending_word)
@@ -617,30 +614,11 @@
}
}
- if (space) // 247
- {
- if (state.protect_spaces)
- ;
- /* The Perl code uses a non-existent "_add_text" function. Presumably
- this part of the code is never reached. */
- else
- {
- xspara__add_pending_word (result, 0);
-
- state.space.end = 0;
- state.space_counter = 0;
- text_append (&state.space, space);
- state.space_counter++;
- if (state.counter + state.space_counter > state.max)
- xspara__cut_line (result); // 255
- }
- }
-
if (end_sentence != -2)
{
+ //fprintf (stderr, "end sentence %d\n", end_sentence);
state.end_sentence = end_sentence;
}
-
}
/* Like _add_next but zero end_line_count at beginning. */
@@ -652,7 +630,7 @@
text_init (&t);
state.end_line_count = 0;
//fprintf (stderr, "PASSED EOS %d\n", end_sentence);
- xspara__add_next (&t, text, text_len, 0, end_sentence, 0);
+ xspara__add_next (&t, text, text_len, end_sentence, 0);
if (t.space > 0)
return t.text;
@@ -980,7 +958,7 @@
memcpy (added_word, p, char_len);
added_word[char_len] = '\0';
- xspara__add_next (&result, added_word, char_len, NULL, -2, 0);
+ xspara__add_next (&result, added_word, char_len, -2, 0);
free (added_word);
/* Now check if it is considered as an end of sentence, and
Modified: trunk/tp/t/paragraph.t
===================================================================
--- trunk/tp/t/paragraph.t 2015-07-27 09:14:15 UTC (rev 6469)
+++ trunk/tp/t/paragraph.t 2015-07-27 10:07:07 UTC (rev 6470)
@@ -175,7 +175,7 @@
$para = Texinfo::Convert::Paragraph->new();
$result = '';
$result .= $para->add_text("A");
-$result .= $para->add_next('_', undef, undef, 1);
+$result .= $para->add_next('_', undef, 1);
$result .= $para->add_text(".)");
$result .= $para->add_text(" Next");
$result .= $para->end();
@@ -248,7 +248,7 @@
$para = Texinfo::Convert::Paragraph->new();
$result = '';
$result .= $para->add_text("a ");
-$result .= $para->add_next('...', undef, 1);
+$result .= $para->add_next('...', 1);
$result .= $para->add_text("c");
$result .= $para->end();
is ($result, "a ...c\n", 'add end sentence and text');
@@ -282,7 +282,7 @@
$para = Texinfo::Convert::Paragraph->new();
$result = '';
$result .= $para->add_text('aA');
-$result .= $para->add_next('.', undef, 1);
+$result .= $para->add_next('.', 1);
$result .= $para->add_text(' after');
$result .= $para->end();
is ($result, "aA. after\n", 'force end sentence after upper case');
@@ -290,7 +290,7 @@
$para = Texinfo::Convert::Paragraph->new();
$result = '';
$result .= $para->add_text('aa');
-$result .= $para->add_next('.', undef, 1);
+$result .= $para->add_next('.', 1);
$result .= $para->add_text('b c');
$result .= $para->end();
is ($result, "aa.b c\n", 'force end sentence followed by text');
@@ -544,7 +544,7 @@
$line = Texinfo::Convert::Line->new();
$result = '';
$result .= $line->add_text("A");
-$result .= $line->add_next('_', undef, undef, 1);
+$result .= $line->add_next('_', undef, 1);
$result .= $line->add_text(".)");
$result .= $line->add_text(" Next");
$result .= $line->end();
@@ -571,7 +571,7 @@
$para = Texinfo::Convert::Line->new();
$result = '';
$result .= $line->add_text('aA');
-$result .= $line->add_next('.', undef, 1);
+$result .= $line->add_next('.', 1);
$result .= $line->add_text(' after');
$result .= $line->end();
is ($result, "aA. after", 'line force end sentence after upper case');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6470] add_next remove unused parameter,
Gavin D. Smith <=