summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-03-01 18:42:45 +0000
committerKarl Berry <karl@freefriends.org>2010-03-01 18:42:45 +0000
commit3dfed15293bcc13fe005211af237271d15e33670 (patch)
tree9cdb2a26bde6a8f70857d6918a9f339755321b73 /Build/source/texk
parentf437f873abf5f480b2fa40298e1423082409b6e7 (diff)
bibtex 0.99d-test1 from Oren, breaking .bbl lines only at whitespace
git-svn-id: svn://tug.org/texlive/trunk@17253 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/web2c/ChangeLog10
-rw-r--r--Build/source/texk/web2c/bibtex.ch36
-rw-r--r--Build/source/texk/web2c/bibtex.web78
-rw-r--r--Build/source/texk/web2c/tests/longline.bib24
-rw-r--r--Build/source/texk/web2c/tests/longline.tex14
5 files changed, 116 insertions, 46 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 2fe43bf253e..5618b0fae0c 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,13 @@
+2010-03-01 Karl Berry <karl@tug.org>
+
+ * bibtex.web: 0.99d test 1 from Oren, breaking .bbl lines only at
+ whitespace.
+ * bibtex.ch: remove no-longer-needed workaround for \% break.
+
+ * tests/longline.tex,
+ * tests/longline.bib: new test files.
+ (Still working on their incorporation into make check.)
+
2010-02-22 Karl Berry <karl@tug.org>
* configure.ac: (web2_version): move to 2010/dev.
diff --git a/Build/source/texk/web2c/bibtex.ch b/Build/source/texk/web2c/bibtex.ch
index 9a3376af6be..a9d02437095 100644
--- a/Build/source/texk/web2c/bibtex.ch
+++ b/Build/source/texk/web2c/bibtex.ch
@@ -1101,24 +1101,24 @@ end;
% ignored. This is a special case of the general problem that we shouldn't
% split macro invocations either -- however, the best way to avoid that is
% not to split lines at all.
-@x [324] Check whether we're trying to break a \% combo.
-out_buf[end_ptr] := out_buf[max_print_line-1]; {save this character}
-out_buf[max_print_line-1] := comment; {so \TeX\ does the thing right}
-out_buf_length := max_print_line;
-break_ptr := out_buf_length - 1; {the `|-1|' allows for the restoration}
-output_bbl_line; {output what we can,}
-out_buf[max_print_line-1] := out_buf[end_ptr]; {restore this character}
-@y
-if out_buf[max_print_line-1] = comment then {assume \% combo here}
- out_buf_length := max_print_line - 1
-else
- out_buf_length := max_print_line;
-break_ptr := out_buf_length - 1; {the `|-1|' allows for the restoration}
-out_buf[end_ptr] := out_buf[break_ptr]; {save this character}
-out_buf[break_ptr] := comment; {so \TeX\ does the thing right}
-output_bbl_line; {output what we can,}
-out_buf[break_ptr] := out_buf[end_ptr]; {restore this character}
-@z
+% @x [324] Check whether we're trying to break a \% combo.
+% out_buf[end_ptr] := out_buf[max_print_line-1]; {save this character}
+% out_buf[max_print_line-1] := comment; {so \TeX\ does the thing right}
+% out_buf_length := max_print_line;
+% break_ptr := out_buf_length - 1; {the `|-1|' allows for the restoration}
+% output_bbl_line; {output what we can,}
+% out_buf[max_print_line-1] := out_buf[end_ptr]; {restore this character}
+% @y
+% if out_buf[max_print_line-1] = comment then {assume \% combo here}
+% out_buf_length := max_print_line - 1
+% else
+% out_buf_length := max_print_line;
+% break_ptr := out_buf_length - 1; {the `|-1|' allows for the restoration}
+% out_buf[end_ptr] := out_buf[break_ptr]; {save this character}
+% out_buf[break_ptr] := comment; {so \TeX\ does the thing right}
+% output_bbl_line; {output what we can,}
+% out_buf[break_ptr] := out_buf[end_ptr]; {restore this character}
+% @z
@x [327] Add check for fieldinfo[] overflow.
field_ptr := cite_ptr*num_fields + fn_info[ex_fn_loc];
diff --git a/Build/source/texk/web2c/bibtex.web b/Build/source/texk/web2c/bibtex.web
index e465a33c48d..614143d5e2c 100644
--- a/Build/source/texk/web2c/bibtex.web
+++ b/Build/source/texk/web2c/bibtex.web
@@ -1,4 +1,5 @@
-% This program is copyright (C) 1985 by Oren Patashnik; all rights reserved.
+% This program is copyright (C) 1985, 1988, 2010 by Oren Patashnik;
+% all rights reserved.
% Copying of this file is authorized only if (1) you are Oren Patashnik, or if
% (2) you make absolutely no changes to your copy. (The WEB system provides
% for alterations via an auxiliary file; the master file should stay intact.)
@@ -32,8 +33,12 @@
% Version 0.99c was released in February 1988. It removed two begin-end pairs
% that, for convention only, surrounded entire modules, but that elicited
% label-related complaints from some compilers.
+% Version 0.99d was released in March 2010. It made output lines breakable
+% only at white_space (so that, for example, URLs would not be broken).
+% Other known bugs (all minor) will be fixed in a subsequent release.
+% THIS IS BibTeX 0.99d TEST VERSION 1; PLEASE DO NOT RELEASE
-% Please report any bugs to Oren Patashnik (PATASHNIK@@SCORE.STANFORD.EDU)
+% Please report any bugs to biblio@@tug.org
% Although considerable effort has been expended to make the BibTeX program
% correct and reliable, no warranty is implied; the author disclaims any
@@ -131,7 +136,7 @@ style writers would be eternally grateful, if only they knew.
The |banner| string defined here should be changed whenever \BibTeX\
gets modified.
-@d banner=='This is BibTeX, Version 0.99c' {printed when the program starts}
+@d banner=='This is BibTeX, Version 0.99dtest' {printed when the program starts}
@
@@ -7573,14 +7578,16 @@ This procedure adds to the output buffer the given string in
length of the current string in |out_buf|, and thus also gives the
location for the next character. If there are enough characters
present in the output buffer, it writes one or more lines out to the
-\.{.bbl} file. It may break a line at any |white_space| character it
-likes, but if it does, it will add two |space|s to the next output
-line.
+\.{.bbl} file. It breaks a line only at a |white_space| character,
+and when it does, it adds two |space|s to the next output line.
@<Procedures and functions for style-file function execution@>=
procedure add_out_pool (@!p_str : str_number);
+label loop1_exit,loop2_exit;
var break_ptr : buf_pointer; {the first character following the line break}
@!end_ptr : buf_pointer; {temporary end-of-buffer pointer}
+break_pt_found : boolean; {a suitable |white_space| character}
+unbreakable_tail : boolean; {because it contains no |white_space| character}
begin
p_ptr1 := str_start[p_str];
p_ptr2 := str_start[p_str+1];
@@ -7594,7 +7601,8 @@ while (p_ptr1 < p_ptr2) do
incr(out_buf_ptr);
end;
out_buf_length := out_buf_ptr;
-while (out_buf_length > max_print_line) do
+unbreakable_tail := false;
+while ((out_buf_length > max_print_line) and (not unbreakable_tail)) do
@<Break that line@>;
end;
@@ -7604,19 +7612,25 @@ Here we break the line by looking for a |white_space| character,
backwards from |out_buf[max_print_line]| until
|out_buf[min_print_line]|; we break at the |white_space| and indent
the next line two |space|s. The next module handles things when
-there's no |white_space| character to break at.
+there's no |white_space| character to break at. (It seems that the
+annoyances to the average user of a warning message when there's an
+output line longer than |max_print_line| outweigh the benefits, so we
+don't issue such warnings in the current code.)
@<Break that line@>=
begin
end_ptr := out_buf_length;
out_buf_ptr := max_print_line;
+break_pt_found := false;
while ((lex_class[out_buf[out_buf_ptr]] <> white_space) and
(out_buf_ptr >= min_print_line)) do
decr(out_buf_ptr);
if (out_buf_ptr = min_print_line-1) then {no |white_space| character}
- @<Break that unbreakable line@>
+ @<Break that unbreakably long line@> {(if |white_space| follows)}
else
- begin {hit a |white_space| character}
+ break_pt_found := true; {hit a |white_space| character}
+if (break_pt_found) then
+ begin
out_buf_length := out_buf_ptr;
break_ptr := out_buf_length + 1;
output_bbl_line; {output what we can}
@@ -7636,27 +7650,35 @@ end
@
-If there's no |white_space| character to break the line at, we break
-it at |out_buf[max_print_line-1]|, append a |comment| character, and
-don't indent the next line.
+If there's no |white_space| character up through
+|out_buf[max_print_line]|, we instead break the line at the first
+following |white_space| character, if one exists. And if, starting
+with that |white_space| character, there are multiple consecutive
+|white_space| characters, |out_buf_ptr| points to the last of them.
+If no |white_space| character exists, we haven't found a viable break
+point, so we don't break the line (yet).
-@<Break that unbreakable line@>=
+@<Break that unbreakably long line@>=
begin
-out_buf[end_ptr] := out_buf[max_print_line-1]; {save this character}
-out_buf[max_print_line-1] := comment; {so \TeX\ does the thing right}
-out_buf_length := max_print_line;
-break_ptr := out_buf_length - 1; {the `|-1|' allows for the restoration}
-output_bbl_line; {output what we can,}
-out_buf[max_print_line-1] := out_buf[end_ptr]; {restore this character}
-out_buf_ptr := 0;
-tmp_ptr := break_ptr;
-while (tmp_ptr < end_ptr) do {and slide the rest down}
- begin
- out_buf[out_buf_ptr] := out_buf[tmp_ptr];
- incr(out_buf_ptr);
- incr(tmp_ptr);
+out_buf_ptr := max_print_line + 1; {|break_pt_found| is still |false|}
+while (out_buf_ptr < end_ptr) do
+ if (lex_class[out_buf[out_buf_ptr]] <> white_space) then
+ incr(out_buf_ptr)
+ else
+ goto loop1_exit;
+loop1_exit:
+if (out_buf_ptr = end_ptr) then
+ unbreakable_tail := true {because no |white_space| character}
+else {hit |white_space|, and |out_buf_ptr < end_ptr|}
+ begin
+ break_pt_found := true;
+ while (out_buf_ptr+1 < end_ptr) do {look for more |white_space|}
+ if (lex_class[out_buf[out_buf_ptr+1]] = white_space) then
+ incr(out_buf_ptr) {which then points to |white_space|}
+ else
+ goto loop2_exit;
+loop2_exit:
end;
-out_buf_length := end_ptr - break_ptr;
end
diff --git a/Build/source/texk/web2c/tests/longline.bib b/Build/source/texk/web2c/tests/longline.bib
new file mode 100644
index 00000000000..096fc495314
--- /dev/null
+++ b/Build/source/texk/web2c/tests/longline.bib
@@ -0,0 +1,24 @@
+@misc{long-bare,
+ howpublished = "http://long.example.org/1234567890a1234567890b1234567890c1234567890d1234567890e1234567890f1234567890g",
+}
+
+@misc{long-with-author,
+ author = "Long Author",
+ howpublished = "http://long.example.org/1234567890a1234567890b1234567890c1234567890d1234567890e1234567890f1234567890g",
+}
+
+@misc{long-full,
+ author = "Full Long Author",
+ title = "http://long.example.org/1234567890a1234567890b1234567890c1234567890d1234567890e1234567890f1234567890g",
+ note = "Some note.",
+}
+
+@misc{long-author,
+ author = "Really Long Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaauthor",
+ title = "Titleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee too",
+}
+
+@misc{normal,
+ author = "Normal Author",
+ howpublished = "http://example.org/",
+}
diff --git a/Build/source/texk/web2c/tests/longline.tex b/Build/source/texk/web2c/tests/longline.tex
new file mode 100644
index 00000000000..44c76395609
--- /dev/null
+++ b/Build/source/texk/web2c/tests/longline.tex
@@ -0,0 +1,14 @@
+% $Id$
+% Public domain. Originally written 2010, Karl Berry.
+% Test for bibtex not breaking when longer than max_print_line.
+
+\input btxmac
+
+\let\mbox = \hbox
+
+\bibliography{longline}
+\bibliographystyle{plain}
+
+\nocite{*}
+
+\end