diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-03-17 16:16:27 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-03-17 16:16:27 +0000 |
commit | 59d1decd10c6e2cf2cb3c19cc2631ba9dbb01ecc (patch) | |
tree | b666a6719d5d5306cadad38cc2e27a20f8e7cdc3 /Build/source | |
parent | 14e6c07a24c083be3baf78cdec6e0bfcb31c7e52 (diff) |
bibtex/bibtex8/bibtexu: more dynamic arrays
git-svn-id: svn://tug.org/texlive/trunk@17471 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
24 files changed, 1041 insertions, 214 deletions
diff --git a/Build/source/texk/bibtex8/ChangeLog b/Build/source/texk/bibtex8/ChangeLog index bc92dac5b76..3dd0081f05a 100644 --- a/Build/source/texk/bibtex8/ChangeLog +++ b/Build/source/texk/bibtex8/ChangeLog @@ -1,3 +1,23 @@ +2010-03-17 Peter Breitenlohner <peb@mppmu.mpg.de> + + * bibtex-1.c (check_cite_overflow): Reallocate cite_info, + cite_list, entry_exists, and type_list. + * bibtex.h (MAX_CITES): Initial allocation as in bibtex.web. + * gblvars.h (M_cites): Removed. + * utils.c (parse_cmd_line, usage): Ignore/remove --mcites. + +2010-03-16 Peter Breitenlohner <peb@mppmu.mpg.de> + + * bibtex-1.c, utils.c: Delay allocation of entry_ints and + entry_strs until the required size is known. + * bibtex.h (MAX_ENT_INTS, MAX_ENT_STRS): Removed. + * gblvars.h (M_entstrs, Max_Ent_Ints, Max_Ent_Strs): Removed. + * utils.c (parse_cmd_line, usage): Ignore/remove --mentstrs. + + * tests/sort.test: New shell script to test csfiles. + * tests/sort[123].{bbl,csf}, tests/test{data.bib,style.bst}: + Test data from Philipp Lehman <lehman@gmx.net>. + 2010-03-15 Peter Breitenlohner <peb@mppmu.mpg.de> * tests/bibtex.test: New shell script to test 7-bit mode. diff --git a/Build/source/texk/bibtex8/Makefile.am b/Build/source/texk/bibtex8/Makefile.am index a1c987f885c..fded8d43632 100644 --- a/Build/source/texk/bibtex8/Makefile.am +++ b/Build/source/texk/bibtex8/Makefile.am @@ -61,12 +61,17 @@ dist_btdoc_DATA = \ ## Tests. ## -TESTS = tests/bibtex.test +TESTS = tests/bibtex.test tests/sort.test EXTRA_DIST = $(TESTS) DISTCLEANFILES = - -## bibtex.test +## tests/bibtex.test DISTCLEANFILES += tests/xexampl.aux tests/xexampl.bbl tests/xexampl.blg +## tests/sort.test +EXTRA_DIST += tests/sort.aux \ + tests/sort1.bbl tests/sort2.bbl tests/sort3.bbl \ + tests/sort1.csf tests/sort2.csf tests/sort3.csf \ + tests/testdata.bib tests/teststyle.bst +DISTCLEANFILES += tests/xsort.aux tests/xsort.bbl tests/xsort.blg ## Not used ## diff --git a/Build/source/texk/bibtex8/Makefile.in b/Build/source/texk/bibtex8/Makefile.in index 7da1677e846..c79f929da25 100644 --- a/Build/source/texk/bibtex8/Makefile.in +++ b/Build/source/texk/bibtex8/Makefile.in @@ -286,11 +286,14 @@ dist_btdoc_DATA = \ csfile.txt \ file_id.diz -TESTS = tests/bibtex.test -EXTRA_DIST = $(TESTS) bt371csf.zip dos-dj.mak dos-emx.mak os2.mak \ - unix.mak csf/00readme.txt csf/COPYING csf/HISTORY \ - csf/file_id.diz -DISTCLEANFILES = tests/xexampl.aux tests/xexampl.bbl tests/xexampl.blg +TESTS = tests/bibtex.test tests/sort.test +EXTRA_DIST = $(TESTS) tests/sort.aux tests/sort1.bbl tests/sort2.bbl \ + tests/sort3.bbl tests/sort1.csf tests/sort2.csf \ + tests/sort3.csf tests/testdata.bib tests/teststyle.bst \ + bt371csf.zip dos-dj.mak dos-emx.mak os2.mak unix.mak \ + csf/00readme.txt csf/COPYING csf/HISTORY csf/file_id.diz +DISTCLEANFILES = tests/xexampl.aux tests/xexampl.bbl tests/xexampl.blg \ + tests/xsort.aux tests/xsort.bbl tests/xsort.blg all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am diff --git a/Build/source/texk/bibtex8/bibtex-1.c b/Build/source/texk/bibtex8/bibtex-1.c index c78d3c52e1a..f2a1b8e6680 100644 --- a/Build/source/texk/bibtex8/bibtex-1.c +++ b/Build/source/texk/bibtex8/bibtex-1.c @@ -2349,16 +2349,13 @@ BEGIN * value to which all integers are initialized. ***************************************************************************/ BEGIN - if ((num_ent_ints * num_cites) > Max_Ent_Ints) - BEGIN - BIB_XRETALLOC ("entry_ints", entry_ints, Integer_T, - Max_Ent_Ints, (long) (num_ent_ints + 1) * (num_cites + 1)); - END - int_ent_ptr = 0; - while (int_ent_ptr < (num_ent_ints * num_cites)) + int_ent_ptr = (num_ent_ints + 1) * (num_cites + 1); + entry_ints = (Integer_T *) mymalloc ((unsigned long) sizeof (Integer_T) + * (unsigned long) int_ent_ptr, "entry_ints"); + while (int_ent_ptr > 0) BEGIN + DECR (int_ent_ptr); entry_ints[int_ent_ptr] = 0; - INCR (int_ent_ptr); END END /*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 287 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -2370,16 +2367,14 @@ BEGIN * null string, the value to which all strings are initialized. ***************************************************************************/ BEGIN - if ((num_ent_strs * num_cites) > Max_Ent_Strs) - BEGIN - PRINT2 ("%ld: ", (long) (num_ent_strs * num_cites)); - BIBTEX_OVERFLOW ("total number of string entry-variables ", Max_Ent_Strs); - END - str_ent_ptr = 0; - while (str_ent_ptr < (num_ent_strs * num_cites)) + str_ent_ptr = (num_ent_strs + 1) * (num_cites + 1); + entry_strs = (ASCIICode_T *) mymalloc ((unsigned long) sizeof (ASCIICode_T) + * (unsigned long) (ENT_STR_SIZE + 1) + * (unsigned long) str_ent_ptr, "entry_strs"); + while (str_ent_ptr > 0) BEGIN + DECR (str_ent_ptr); ENTRY_STRS(str_ent_ptr,0) = END_OF_STRING; - INCR (str_ent_ptr); END END /*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 288 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -2749,9 +2744,20 @@ void check_cite_overflow (CiteNumber_T last_cite) BEGIN if (last_cite == Max_Cites) BEGIN - PRINT_POOL_STR (hash_text[cite_loc]); - PRINT_LN (" is the key:"); - BIBTEX_OVERFLOW ("number of cite keys ", Max_Cites); + BIB_XRETALLOC_NOSET ("cite_info", cite_info, StrNumber_T, + Max_Cites, Max_Cites + MAX_CITES); + BIB_XRETALLOC_NOSET ("cite_list", cite_list, StrNumber_T, + Max_Cites, Max_Cites + MAX_CITES); + BIB_XRETALLOC_NOSET ("entry_exists", entry_exists, Boolean_T, + Max_Cites, Max_Cites + MAX_CITES); + BIB_XRETALLOC ("type_list", type_list, HashPtr2_T, + Max_Cites, Max_Cites + MAX_CITES); + while (last_cite < Max_Cites) + BEGIN + type_list[last_cite] = EMPTY; + cite_info[last_cite] = ANY_VALUE; + INCR (last_cite); + END END END /*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 138 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/Build/source/texk/bibtex8/bibtex.h b/Build/source/texk/bibtex8/bibtex.h index 57225a9e1e8..dd5dbf1fb13 100644 --- a/Build/source/texk/bibtex8/bibtex.h +++ b/Build/source/texk/bibtex8/bibtex.h @@ -268,9 +268,7 @@ #define MAX_BIB_FILES 20 #define BUF_SIZE 10000 -#define MAX_CITES 2000 -#define MAX_ENT_INTS 3000 -#define MAX_ENT_STRS 3000 +#define MAX_CITES 750 #define MAX_FIELDS 5000 #define MAX_STRINGS 12000 #define POOL_SIZE 65000L diff --git a/Build/source/texk/bibtex8/gblvars.h b/Build/source/texk/bibtex8/gblvars.h index 63bc744df38..a7e3a610f4d 100644 --- a/Build/source/texk/bibtex8/gblvars.h +++ b/Build/source/texk/bibtex8/gblvars.h @@ -435,8 +435,6 @@ __EXTERN__ Boolean_T Flag_huge; __EXTERN__ Boolean_T Flag_stats; __EXTERN__ Boolean_T Flag_trace; __EXTERN__ Boolean_T Flag_wolfgang; -__EXTERN__ Integer_T M_cites; -__EXTERN__ Integer_T M_entstrs; __EXTERN__ Integer_T M_min_crossrefs; __EXTERN__ Integer_T M_strings; __EXTERN__ char *Str_auxfile; @@ -455,8 +453,6 @@ __EXTERN__ Integer_T Hash_Prime; __EXTERN__ Integer_T Hash_Size; __EXTERN__ Integer_T Max_Bib_Files; __EXTERN__ Integer_T Max_Cites; -__EXTERN__ Integer_T Max_Ent_Ints; -__EXTERN__ Integer_T Max_Ent_Strs; __EXTERN__ Integer_T Max_Fields; __EXTERN__ Integer_T Max_Strings; __EXTERN__ Integer_T Min_Crossrefs; diff --git a/Build/source/texk/bibtex8/tests/sort.aux b/Build/source/texk/bibtex8/tests/sort.aux new file mode 100644 index 00000000000..8b9b435001f --- /dev/null +++ b/Build/source/texk/bibtex8/tests/sort.aux @@ -0,0 +1,4 @@ +\relax +\citation{*} +\bibstyle{teststyle} +\bibdata{testdata} diff --git a/Build/source/texk/bibtex8/tests/sort.test b/Build/source/texk/bibtex8/tests/sort.test new file mode 100755 index 00000000000..e8afa6a720b --- /dev/null +++ b/Build/source/texk/bibtex8/tests/sort.test @@ -0,0 +1,22 @@ +#! /bin/sh + +# Copyright (C) 2010 Peter Breitenlohner <tex-live@tug.org> +# You may freely use, modify and/or distribute this file. + +test -d tests || mkdir -p tests + +cp $srcdir/tests/sort.aux tests/xsort.aux + +for i in 1 2 3; do + +rm -f xsort.bbl + +TEXMFCNF=$srcdir/../kpathsea \ + BSTINPUTS=$srcdir/tests \ + BIBINPUTS=$srcdir/tests \ + ./bibtex8 --csfile $srcdir/tests/sort$i.csf tests/xsort || exit 1 + +diff $srcdir/tests/sort$i.bbl tests/xsort.bbl || exit 1 + +done + diff --git a/Build/source/texk/bibtex8/tests/sort1.bbl b/Build/source/texk/bibtex8/tests/sort1.bbl new file mode 100644 index 00000000000..4cee6977490 --- /dev/null +++ b/Build/source/texk/bibtex8/tests/sort1.bbl @@ -0,0 +1,15 @@ +\section*{Test result} +\begin{itemize} +\item Aa AA aa +\item Åå ÅÅ åå +\item Ää ÄÄ ää +\item Bb BB bb +\item Cc CC cc +\item Oo OO oo +\item Øø ØØ øø +\item Öö ÖÖ öö +\item Xx XX xx +\item Yy YY yy +\item Zz ZZ zz +\end{itemize} +\endinput diff --git a/Build/source/texk/bibtex8/tests/sort1.csf b/Build/source/texk/bibtex8/tests/sort1.csf new file mode 100644 index 00000000000..8871a2eb4b3 --- /dev/null +++ b/Build/source/texk/bibtex8/tests/sort1.csf @@ -0,0 +1,275 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% CHARACTER SET: ISO 8859-1 (Latin 1) +% +% ISO 8859-1 is the system character set used by Unix/X Windows and +% MS Windows. +% +% SORTING ORDER: Latin countries +% +% Alphabetical sorting order of Aa..Zz (including accented characters). +% +% This is a BibTeX Codepage and Sort definition file (CSF). It is +% used to define the 8-bit character set used by BibTeX and the +% order in which those characters should be sorted. The file +% format is documented below this header section. +% +% This file will only work with the 8-bit implementation of BibTeX +% written by Niel Kempson and Alejandro Aguilar-Sierra: +% +% http://www.ctan.org/tex-archive/biblio/bibtex/8-bit/ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% FILE FORMAT +% +% The codepage and sorting order (CS) file defines how BibTeX will treat an +% 8-bit character set, specifically which characters are to be treated as +% letters, the upper/lower case relationships between characters, and the +% sorting order of characters. +% +% The CS file may contain a number of sections, each presented in the +% form of a TeX macro: +% +% \section-name{ +% <section definitions> +% } +% +% Four sections are currently supported: \lowupcase, \lowercase, \uppercase +% and \order. The syntax of the four supported sections is summarised below. +% +% 8-bit characters may be entered naturally, but to avoid problems with +% character set translation or corruption, they can also be entered using +% the TeX-style portable notation for character codes, i.e. ^^XX, where XX +% is the hexadecimal value ofthe character code. +% +% Reading of the sections ends when the first '}' character is reached, so +% '}' can't be included in a section. You can't use ^^7d either. +% +% The percent sign ('%') is used to introduce a trailing comment - it and +% all remaining characters on a line are ignored. ^^25 has the same effect. +% +% +% \lowupcase section +% +% The \lowupcase section of the CS file is used to define the lower +% /upper and upper/lower case relationship of pairs of specified +% characters. It is only used if the relationship is symmetrical - use +% \lowercase or \upcase if it isn't. +% +% The syntax of the \lowupcase section is: +% +% \lowupcase{ +% <LC-1> <UC-1> % Comment begins with a percent sign +% <LC-2> <UC-2> +% ... +% <LC-N> <UC-N> +% } +% +% Each <LC-n> <UC-n> pair of characters defines that the upper case +% equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of +% <UC-n> is <LC-n>. +% +% You cannot redefine the lower or upper case equivalent of an ASCII +% character (code < 128), so all instances of <LC-n> and <UC-n> +% (i.e. both sides of the relationship) must have codes > 127. +% +% +% \lowercase section +% +% The \lowercase section of the CS file is used to define the lower case +% equivalent of specified characters. It should normally only be used +% if the relationship isn't symmetrical - use \lowupcase if it is. +% +% The syntax of the \lowercase section is: +% +% \lowercase{ +% <UC-1> <LC-1> % Comment begins with a percent sign +% <UC-2> <LC-2> +% ... +% <UC-N> <LC-N> +% } +% +% Each <LC-n> <UC-n> pair of characters defines that the lower case +% equivalent of <UC-n> is <LC-n>. +% +% You cannot redefine the lower case equivalent of an ASCII character +% (code < 128), so all instances of <UC-n> (i.e. the left hand side +% of the relationship) must have codes > 127. +% +% +% \uppercase section +% +% The \uppercase section of the CS file is used to define the upper case +% equivalent of specified characters. It should normally only be used +% if the relationship isn't symmetrical - use \lowupcase if it is. +% +% The syntax of the \uppercase section is: +% +% \uppercase{ +% <LC-1> <UC-1> % Comment begins with a percent sign +% <LC-2> <UC-2> +% ... +% <LC-N> <UC-N> +% } +% +% Each <LC-n> <UC-n> pair of characters defines that the upper case +% case equivalent of <LC-n> is <UC-n>. +% +% You cannot redefine the upper case equivalent of an ASCII character +% (code < 128), so all instances of <LC-n> (i.e. the left hand side +% of the relationship) must have codes > 127. +% +% +% \order section +% +% The \order section of the CS file is used to define the order in which +% characters are sorted. +% +% The syntax of the \order section is: +% +% \order{ +% <char-1> % Comment begins with a percent sign +% <char-2> <char-3> % whitespace between the chars +% <char-4> - <char-5> % a hyphen between the chars +% <char-4> _ <char-5> % an underscore between the chars +% ... +% <char-n> +% } +% +% All characters on the same line are given the same sorting weight. +% +% The construct <char-1> <underscore> <char-2> is used to denote that +% all characters in the range <char-1> to <char-2> should be given the +% same sorting weight. For example, "A _ Z" would cause all ASCII +% upper case alphabetical characters to have the same sorting weight +% and would be equivalent to placing all 26 characters on the same line. +% +% The construct <char-1> <hyphen> <char-2> is used to denote that all +% characters in the range <char-1> to <char-2> should be given an +% ascending set of sorting weights, starting with <char-1> and ending +% with <char-2>. For example, "A - Z" would cause all upper case ASCII +% alphabetical characters to be sorted in ascending order and would be +% equivalent to placing 'A' on the first line, 'B' on the second, +% through to 'Z' on the 26th line. +% +% The characters at the beginning of the order section are given a lower +% sorting weight than characters occuring later. When sorting +% alphabetically, characters with the lowest weight come first. +% +% All characters not in the \order section (including ASCII characters) +% are given the same very high sorting weight to ensure that they come +% last when sorting alphabetically. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% CHARACTER SET + +\lowupcase{ % Lowercase Uppercase + % Code TeX Code TeX + % + à À % ^^e0 \`{a} ^^c0 \`{A} + á Á % ^^e1 \'{a} ^^c1 \'{A} + â Â % ^^e2 \^{a} ^^c2 \^{A} + ã Ã % ^^e3 \~{a} ^^c3 \~{A} + ä Ä % ^^e4 \"{a} ^^c4 \"{A} + å Å % ^^e5 \aa ^^c5 \AA + æ Æ % ^^e6 \ae ^^c6 \AE + ç Ç % ^^e7 \c{c} ^^c7 \c{C} + è È % ^^e8 \`{e} ^^c8 \`{E} + é É % ^^e9 \'{e} ^^c9 \'{E} + ê Ê % ^^ea \^{e} ^^ca \^{E} + ë Ë % ^^eb \"{e} ^^cb \"{E} + ì Ì % ^^ec \`{\i} ^^cc \`{I} + í Í % ^^ed \'{\i} ^^cd \'{I} + î Î % ^^ee \^{\i} ^^ce \^{I} + ï Ï % ^^ef \"{\i} ^^cf \"{I} + ð Ð % ^^f0 \dh ^^d0 \DH + ñ Ñ % ^^f1 \~{n} ^^d1 \~{N} + ò Ò % ^^f2 \`{o} ^^d2 \`{O} + ó Ó % ^^f3 \'{o} ^^d3 \'{O} + ô Ô % ^^f4 \^{o} ^^d4 \^{O} + õ Õ % ^^f5 \~{o} ^^d5 \~{O} + ö Ö % ^^f6 \"{o} ^^d6 \"{O} + ø Ø % ^^f8 \o ^^d8 \O + ù Ù % ^^f9 \`{u} ^^d9 \`{U} + ú Ú % ^^fa \'{u} ^^da \'{U} + û Û % ^^fb \^{u} ^^db \^{U} + ü Ü % ^^fc \"{u} ^^dc \"{U} + ý Ý % ^^fd \'{y} ^^dd \'{Y} + þ Þ % ^^fe \th ^^de \TH +} + +% SORTING ORDER + +\order{ + 0-9 + A + À Á Â Ã Å Ä Æ + a + à á â ã å ä æ + B + b + C Ç + c ç + D Ð + d ð + E + È É Ê Ë + e + è é ê ë + F + f + G + g + H + h + I + Ì Í Î Ï + i + ì í î ï + J + j + K + k + L + l + M + m + N Ñ + n ñ + O + Ò Ó Ô Õ Ö Ø + o + ò ó ô õ ö ø + P + p + Q + q + R + r + S + s ß + T Þ + t þ + U + Ù Ú Û Ü + u + ù ú û ü + V + v + W + w + X + x + Y + Ý + y + ý ÿ + Z + z +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Build/source/texk/bibtex8/tests/sort2.bbl b/Build/source/texk/bibtex8/tests/sort2.bbl new file mode 100644 index 00000000000..15464fe5b18 --- /dev/null +++ b/Build/source/texk/bibtex8/tests/sort2.bbl @@ -0,0 +1,15 @@ +\section*{Test result} +\begin{itemize} +\item Aa AA aa +\item Ää ÄÄ ää +\item Bb BB bb +\item Cc CC cc +\item Oo OO oo +\item Öö ÖÖ öö +\item Xx XX xx +\item Yy YY yy +\item Zz ZZ zz +\item Øø ØØ øø +\item Åå ÅÅ åå +\end{itemize} +\endinput diff --git a/Build/source/texk/bibtex8/tests/sort2.csf b/Build/source/texk/bibtex8/tests/sort2.csf new file mode 100644 index 00000000000..6ac91cd7443 --- /dev/null +++ b/Build/source/texk/bibtex8/tests/sort2.csf @@ -0,0 +1,114 @@ +% CHARACTER SET + +\lowupcase{ % Lowercase Uppercase + % Code TeX Code TeX + % + à À % ^^e0 \`{a} ^^c0 \`{A} + á Á % ^^e1 \'{a} ^^c1 \'{A} + â Â % ^^e2 \^{a} ^^c2 \^{A} + ã Ã % ^^e3 \~{a} ^^c3 \~{A} + ä Ä % ^^e4 \"{a} ^^c4 \"{A} + å Å % ^^e5 \aa ^^c5 \AA + æ Æ % ^^e6 \ae ^^c6 \AE + ç Ç % ^^e7 \c{c} ^^c7 \c{C} + è È % ^^e8 \`{e} ^^c8 \`{E} + é É % ^^e9 \'{e} ^^c9 \'{E} + ê Ê % ^^ea \^{e} ^^ca \^{E} + ë Ë % ^^eb \"{e} ^^cb \"{E} + ì Ì % ^^ec \`{\i} ^^cc \`{I} + í Í % ^^ed \'{\i} ^^cd \'{I} + î Î % ^^ee \^{\i} ^^ce \^{I} + ï Ï % ^^ef \"{\i} ^^cf \"{I} + ð Ð % ^^f0 \dh ^^d0 \DH + ñ Ñ % ^^f1 \~{n} ^^d1 \~{N} + ò Ò % ^^f2 \`{o} ^^d2 \`{O} + ó Ó % ^^f3 \'{o} ^^d3 \'{O} + ô Ô % ^^f4 \^{o} ^^d4 \^{O} + õ Õ % ^^f5 \~{o} ^^d5 \~{O} + ö Ö % ^^f6 \"{o} ^^d6 \"{O} + ø Ø % ^^f8 \o ^^d8 \O + ù Ù % ^^f9 \`{u} ^^d9 \`{U} + ú Ú % ^^fa \'{u} ^^da \'{U} + û Û % ^^fb \^{u} ^^db \^{U} + ü Ü % ^^fc \"{u} ^^dc \"{U} + ý Ý % ^^fd \'{y} ^^dd \'{Y} + þ Þ % ^^fe \th ^^de \TH +} + +% SORTING ORDER + +\order{ + 0-9 + A + À Á Â Ã Ä + a + à á â ã ä + B + b + C Ç + c ç + D Ð + d ð + E + È É Ê Ë + e + è é ê ë + F + f + G + g + H + h + I + Ì Í Î Ï + i + ì í î ï + J + j + K + k + L + l + M + m + N Ñ + n ñ + O + Ò Ó Ô Õ Ö + o + ò ó ô õ ö + P + p + Q + q + R + r + S + s ß + T Þ + t þ + U + Ù Ú Û Ü + u + ù ú û ü + V + v + W + w + X + x + Y + Ý + y + ý ÿ + Z + z + Æ + æ + Ø + ø + Å + å +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Build/source/texk/bibtex8/tests/sort3.bbl b/Build/source/texk/bibtex8/tests/sort3.bbl new file mode 100644 index 00000000000..a2ec3bea9b7 --- /dev/null +++ b/Build/source/texk/bibtex8/tests/sort3.bbl @@ -0,0 +1,15 @@ +\section*{Test result} +\begin{itemize} +\item Aa AA aa +\item Bb BB bb +\item Cc CC cc +\item Oo OO oo +\item Øø ØØ øø +\item Xx XX xx +\item Yy YY yy +\item Zz ZZ zz +\item Åå ÅÅ åå +\item Ää ÄÄ ää +\item Öö ÖÖ öö +\end{itemize} +\endinput diff --git a/Build/source/texk/bibtex8/tests/sort3.csf b/Build/source/texk/bibtex8/tests/sort3.csf new file mode 100644 index 00000000000..909cf0f60ed --- /dev/null +++ b/Build/source/texk/bibtex8/tests/sort3.csf @@ -0,0 +1,281 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% CHARACTER SET: ISO 8859-1 (Latin 1) +% +% ISO 8859-1 is the system character set used by Unix/X Windows and +% MS Windows. +% +% SORTING ORDER: Swedish +% +% Alphabetical sorting order of Aa..Zz (including accented characters). +% +% This is a BibTeX Codepage and Sort definition file (CSF). It is +% used to define the 8-bit character set used by BibTeX and the +% order in which those characters should be sorted. The file +% format is documented below this header section. +% +% This file will only work with the 8-bit implementation of BibTeX +% written by Niel Kempson and Alejandro Aguilar-Sierra: +% +% http://www.ctan.org/tex-archive/biblio/bibtex/8-bit/ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% FILE FORMAT +% +% The codepage and sorting order (CS) file defines how BibTeX will treat an +% 8-bit character set, specifically which characters are to be treated as +% letters, the upper/lower case relationships between characters, and the +% sorting order of characters. +% +% The CS file may contain a number of sections, each presented in the +% form of a TeX macro: +% +% \section-name{ +% <section definitions> +% } +% +% Four sections are currently supported: \lowupcase, \lowercase, \uppercase +% and \order. The syntax of the four supported sections is summarised below. +% +% 8-bit characters may be entered naturally, but to avoid problems with +% character set translation or corruption, they can also be entered using +% the TeX-style portable notation for character codes, i.e. ^^XX, where XX +% is the hexadecimal value ofthe character code. +% +% Reading of the sections ends when the first '}' character is reached, so +% '}' can't be included in a section. You can't use ^^7d either. +% +% The percent sign ('%') is used to introduce a trailing comment - it and +% all remaining characters on a line are ignored. ^^25 has the same effect. +% +% +% \lowupcase section +% +% The \lowupcase section of the CS file is used to define the lower +% /upper and upper/lower case relationship of pairs of specified +% characters. It is only used if the relationship is symmetrical - use +% \lowercase or \upcase if it isn't. +% +% The syntax of the \lowupcase section is: +% +% \lowupcase{ +% <LC-1> <UC-1> % Comment begins with a percent sign +% <LC-2> <UC-2> +% ... +% <LC-N> <UC-N> +% } +% +% Each <LC-n> <UC-n> pair of characters defines that the upper case +% equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of +% <UC-n> is <LC-n>. +% +% You cannot redefine the lower or upper case equivalent of an ASCII +% character (code < 128), so all instances of <LC-n> and <UC-n> +% (i.e. both sides of the relationship) must have codes > 127. +% +% +% \lowercase section +% +% The \lowercase section of the CS file is used to define the lower case +% equivalent of specified characters. It should normally only be used +% if the relationship isn't symmetrical - use \lowupcase if it is. +% +% The syntax of the \lowercase section is: +% +% \lowercase{ +% <UC-1> <LC-1> % Comment begins with a percent sign +% <UC-2> <LC-2> +% ... +% <UC-N> <LC-N> +% } +% +% Each <LC-n> <UC-n> pair of characters defines that the lower case +% equivalent of <UC-n> is <LC-n>. +% +% You cannot redefine the lower case equivalent of an ASCII character +% (code < 128), so all instances of <UC-n> (i.e. the left hand side +% of the relationship) must have codes > 127. +% +% +% \uppercase section +% +% The \uppercase section of the CS file is used to define the upper case +% equivalent of specified characters. It should normally only be used +% if the relationship isn't symmetrical - use \lowupcase if it is. +% +% The syntax of the \uppercase section is: +% +% \uppercase{ +% <LC-1> <UC-1> % Comment begins with a percent sign +% <LC-2> <UC-2> +% ... +% <LC-N> <UC-N> +% } +% +% Each <LC-n> <UC-n> pair of characters defines that the upper case +% case equivalent of <LC-n> is <UC-n>. +% +% You cannot redefine the upper case equivalent of an ASCII character +% (code < 128), so all instances of <LC-n> (i.e. the left hand side +% of the relationship) must have codes > 127. +% +% +% \order section +% +% The \order section of the CS file is used to define the order in which +% characters are sorted. +% +% The syntax of the \order section is: +% +% \order{ +% <char-1> % Comment begins with a percent sign +% <char-2> <char-3> % whitespace between the chars +% <char-4> - <char-5> % a hyphen between the chars +% <char-4> _ <char-5> % an underscore between the chars +% ... +% <char-n> +% } +% +% All characters on the same line are given the same sorting weight. +% +% The construct <char-1> <underscore> <char-2> is used to denote that +% all characters in the range <char-1> to <char-2> should be given the +% same sorting weight. For example, "A _ Z" would cause all ASCII +% upper case alphabetical characters to have the same sorting weight +% and would be equivalent to placing all 26 characters on the same line. +% +% The construct <char-1> <hyphen> <char-2> is used to denote that all +% characters in the range <char-1> to <char-2> should be given an +% ascending set of sorting weights, starting with <char-1> and ending +% with <char-2>. For example, "A - Z" would cause all upper case ASCII +% alphabetical characters to be sorted in ascending order and would be +% equivalent to placing 'A' on the first line, 'B' on the second, +% through to 'Z' on the 26th line. +% +% The characters at the beginning of the order section are given a lower +% sorting weight than characters occuring later. When sorting +% alphabetically, characters with the lowest weight come first. +% +% All characters not in the \order section (including ASCII characters) +% are given the same very high sorting weight to ensure that they come +% last when sorting alphabetically. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% CHARACTER SET + +\lowupcase{ % Lowercase Uppercase + % Code TeX Code TeX + % + à À % ^^e0 \`{a} ^^c0 \`{A} + á Á % ^^e1 \'{a} ^^c1 \'{A} + â Â % ^^e2 \^{a} ^^c2 \^{A} + ã Ã % ^^e3 \~{a} ^^c3 \~{A} + ä Ä % ^^e4 \"{a} ^^c4 \"{A} + å Å % ^^e5 \aa ^^c5 \AA + æ Æ % ^^e6 \ae ^^c6 \AE + ç Ç % ^^e7 \c{c} ^^c7 \c{C} + è È % ^^e8 \`{e} ^^c8 \`{E} + é É % ^^e9 \'{e} ^^c9 \'{E} + ê Ê % ^^ea \^{e} ^^ca \^{E} + ë Ë % ^^eb \"{e} ^^cb \"{E} + ì Ì % ^^ec \`{\i} ^^cc \`{I} + í Í % ^^ed \'{\i} ^^cd \'{I} + î Î % ^^ee \^{\i} ^^ce \^{I} + ï Ï % ^^ef \"{\i} ^^cf \"{I} + ð Ð % ^^f0 \dh ^^d0 \DH + ñ Ñ % ^^f1 \~{n} ^^d1 \~{N} + ò Ò % ^^f2 \`{o} ^^d2 \`{O} + ó Ó % ^^f3 \'{o} ^^d3 \'{O} + ô Ô % ^^f4 \^{o} ^^d4 \^{O} + õ Õ % ^^f5 \~{o} ^^d5 \~{O} + ö Ö % ^^f6 \"{o} ^^d6 \"{O} + ø Ø % ^^f8 \o ^^d8 \O + ù Ù % ^^f9 \`{u} ^^d9 \`{U} + ú Ú % ^^fa \'{u} ^^da \'{U} + û Û % ^^fb \^{u} ^^db \^{U} + ü Ü % ^^fc \"{u} ^^dc \"{U} + ý Ý % ^^fd \'{y} ^^dd \'{Y} + þ Þ % ^^fe \th ^^de \TH +} + +% SORTING ORDER + +\order{ + 0-9 + A + À Á Â Ã Æ + a + à á â ã æ + B + b + C Ç + c ç + D Ð + d ð + E + È É Ê Ë + e + è é ê ë + F + f + G + g + H + h + I + Ì Í Î Ï + i + ì í î ï + J + j + K + k + L + l + M + m + N Ñ + n ñ + O + Ò Ó Ô Õ Ø + o + ò ó ô õ ø + P + p + Q + q + R + r + S + s ß + T Þ + t þ + U + Ù Ú Û Ü + u + ù ú û ü + V + v + W + w + X + x + Y + Ý + y + ý ÿ + Z + z + Å + å + Ä + ä + Ö + ö +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Build/source/texk/bibtex8/tests/testdata.bib b/Build/source/texk/bibtex8/tests/testdata.bib new file mode 100644 index 00000000000..c17aa9c838d --- /dev/null +++ b/Build/source/texk/bibtex8/tests/testdata.bib @@ -0,0 +1,43 @@ +@Type{8bit-1, + field = {Øø}, +} + +@Type{8bit-2, + field = {Åå}, +} + +@Type{8bit-3, + field = {Ää}, +} + +@Type{8bit-4, + field = {Öö}, +} + +@Type{aa, + field = {Aa}, +} + +@Type{bb, + field = {Bb}, +} + +@Type{cc, + field = {Cc}, +} + +@Type{oo, + field = {Oo}, +} + +@Type{xx, + field = {Xx}, +} + +@Type{yy, + field = {Yy}, +} + +@Type{zz, + field = {Zz}, +} diff --git a/Build/source/texk/bibtex8/tests/teststyle.bst b/Build/source/texk/bibtex8/tests/teststyle.bst new file mode 100644 index 00000000000..72f7525c7b5 --- /dev/null +++ b/Build/source/texk/bibtex8/tests/teststyle.bst @@ -0,0 +1,36 @@ +ENTRY {field}{}{} + +FUNCTION {output_entry} { + "\item " field * " " * + field "u" change.case$ * " " * + field "l" change.case$ * + write$ newline$ +} + +FUNCTION {type} {output_entry} + +READ + +FUNCTION {set_sortkey} { + field 'sort.key$ := +} + +ITERATE {set_sortkey} + +SORT + +FUNCTION {output_beg} { + "\section*{Test result}" write$ newline$ + "\begin{itemize}" write$ newline$ +} + +FUNCTION {output_end} { + "\end{itemize}" write$ newline$ + "\endinput" write$ newline$ +} + +EXECUTE {output_beg} + +ITERATE {call.type$} + +EXECUTE {output_end} diff --git a/Build/source/texk/bibtex8/utils.c b/Build/source/texk/bibtex8/utils.c index b3f386cd454..fddf106f69c 100644 --- a/Build/source/texk/bibtex8/utils.c +++ b/Build/source/texk/bibtex8/utils.c @@ -185,9 +185,9 @@ static struct option long_options[] = { {"wolfgang", VALUE_NONE, 0, 'W'}, {"min_crossrefs", VALUE_REQD, 0, 'M'}, - {"mcites", VALUE_REQD, 0, '\x0A'}, + {"mcites", VALUE_REQD, 0, '\x0A'}, /* obsolete */ {"mentints", VALUE_REQD, 0, '\x0B'}, /* obsolete */ - {"mentstrs", VALUE_REQD, 0, '\x0C'}, + {"mentstrs", VALUE_REQD, 0, '\x0C'}, /* obsolete */ {"mfields", VALUE_REQD, 0, '\x0D'}, /* obsolete */ {"mpool", VALUE_REQD, 0, '\x0E'}, /* obsolete */ {"mstrings", VALUE_REQD, 0, '\x0F'}, @@ -303,18 +303,15 @@ static void allocate_arrays (void) /* ** Boolean_T entry_ints[Max_Ent_Ints + 1]; + ** allocated when num_ent_ints and num_cites are known */ - bytes_required = (Max_Ent_Ints + 1) * (unsigned long) sizeof (Integer_T); - entry_ints = (Integer_T *) mymalloc (bytes_required, "entry_ints"); + entry_ints = NULL; /* ** ASCIICode_T entry_strs[Max_Ent_Strs + 1][ENT_STR_SIZE + 1]; + ** allocated when num_ent_strs and num_cites are known */ - bytes_required = (unsigned long) (Max_Ent_Strs + 1) - * (unsigned long) (ENT_STR_SIZE + 1) - * (unsigned long) sizeof (ASCIICode_T); - - entry_strs = (ASCIICode_T *) mymalloc (bytes_required, "entry_strs"); + entry_strs = NULL; /* ** ASCIICode_T ex_buf[Buf_Size + 1]; @@ -939,9 +936,9 @@ FILE *open_op_file (void) ** required for automatic inclusion of the cross ** referenced entry in the citation list ** (default = 2) -** --mcites ## allow ## \\cites in the .aux files +** --mcites ## ignored ** --mentints ## ignored -** --mentstrs ## allow ## string entries in the .bib databases +** --mentstrs ## ignored ** --mfields ## ignored ** --mpool ## ignored ** --mstrings ## allow ## unique strings @@ -989,7 +986,7 @@ void parse_cmd_line (int argc, char **argv) Flag_big = TRUE; break; - case 'c': /**************** -C, --csfile *************/ + case 'c': /**************** -c, --csfile *************/ Str_csfile = optarg; break; @@ -1034,28 +1031,11 @@ void parse_cmd_line (int argc, char **argv) break; case '\x0A': /**************** --mcites *****************/ - M_cites = checklong (optarg); - if (M_cites < 0) { - mark_fatal (); - usage ("invalid max number of cites `%s'\n", optarg); - } - break; - case '\x0B': /**************** --mentints ***************/ - (void) checklong (optarg); /******** ignored ********/ - break; - case '\x0C': /**************** --mentstrs ***************/ - M_entstrs = checklong (optarg); - if (M_entstrs < 0) { - mark_fatal (); - usage ("invalid max number of string entries `%s'\n", - optarg); - } - break; - case '\x0D': /**************** --mfields ****************/ case '\x0E': /**************** --mpool *****************/ + case '\x10': /**************** --mwizfuns ***************/ (void) checklong (optarg); /******** ignored ********/ break; @@ -1067,10 +1047,6 @@ void parse_cmd_line (int argc, char **argv) } break; - case '\x10': /**************** --mwizfuns ***************/ - (void) checklong (optarg); /******** ignored ********/ - break; - default: /**************** Unknown argument ********/ mark_fatal (); usage ("unknown option"); @@ -1178,8 +1154,6 @@ void report_bibtex_capacity (void) LOG_CAPACITY (LIT_STK_SIZE); LOG_CAPACITY (Max_Bib_Files); LOG_CAPACITY (Max_Cites); - LOG_CAPACITY (Max_Ent_Ints); - LOG_CAPACITY (Max_Ent_Strs); LOG_CAPACITY (Max_Fields); LOG_CAPACITY (MAX_GLOB_STRS); LOG_CAPACITY (MAX_PRINT_LINE); @@ -1311,9 +1285,9 @@ static void compute_hash_prime (void) ** Hash_Prime *** computed from Hash_Size *** ** Hash_Size *** determined from Max_Strings *** ** Max_Bib_Files *** initialy 20, increased as required *** -** Max_Cites Y 750 2,000 5,000 7,500 -** Max_Ent_Ints *** initialy 3000, increased as required *** -** Max_Ent_Strs Y 3,000 6,000 10,000 10,000 +** Max_Cites *** initialy 750, increased as required *** +** Max_Ent_Ints *** as required *** +** Max_Ent_Strs *** as required *** ** Max_Fields *** initialy 5000, increased as required *** ** Max_Strings Y 4,000 10,000 19,000 30,000 ** Pool_Size *** initialy 65,000, increased as required *** @@ -1326,26 +1300,18 @@ void set_array_sizes (void) { debug_msg (DBG_MEM, "Setting BibTeX's capacity ... "); - Max_Cites = 750; - Max_Ent_Strs = 3000; Max_Strings = 4000; Min_Crossrefs = 2; if (Flag_big) { - Max_Cites = 2000; - Max_Ent_Strs = 5000; Max_Strings = 10000; } if (Flag_huge) { - Max_Cites = 5000; - Max_Ent_Strs = 10000; Max_Strings = 19000; } if (Flag_wolfgang) { - Max_Cites = 7500; - Max_Ent_Strs = 10000; Max_Strings = 30000; } @@ -1353,13 +1319,7 @@ void set_array_sizes (void) Max_Bib_Files = MAX_BIB_FILES; - if (M_cites > 0) - Max_Cites = M_cites; - - Max_Ent_Ints = MAX_ENT_INTS; - - if (M_entstrs > 0) - Max_Ent_Strs = M_entstrs; + Max_Cites = MAX_CITES; Max_Fields = MAX_FIELDS; @@ -1387,10 +1347,8 @@ void set_array_sizes (void) Hash_Prime, Hash_Size); debug_msg (DBG_MEM, "Buf_Size = %d, Max_Bib_Files = %d", Buf_Size, Max_Bib_Files); - debug_msg (DBG_MEM, "Max_Cites = %d, Max_Ent_Ints = %d", - Max_Cites, Max_Ent_Ints); - debug_msg (DBG_MEM, "Max_Ent_Strs = %d, Max_Fields = %d", - Max_Ent_Strs, Max_Fields); + debug_msg (DBG_MEM, "Max_Cites = %d, Max_Fields = %d", + Max_Cites, Max_Fields); debug_msg (DBG_MEM, "Max_Strings = %d, Pool_Size = %d", Max_Strings, Pool_Size); debug_msg (DBG_MEM, "Min_Crossrefs = %d, Wiz_Fn_Space = %d", @@ -1482,12 +1440,10 @@ void usage (const char *printf_fmt, ...) FSO (" -v --version report BibTeX version\n\n"); - FSO (" -B --big set large BibTeX capacity\n"); - FSO (" -H --huge set huge BibTeX capacity\n"); - FSO (" -W --wolfgang set really huge BibTeX capacity for Wolfgang\n"); + FSO (" -B --big same as --mstrings 10000\n"); + FSO (" -H --huge same as --mstrings 19000\n"); + FSO (" -W --wolfgang same as --mstrings 30000\n"); FSO (" -M --min_crossrefs ## set min_crossrefs to ##\n"); - FSO (" --mcites ## allow ## \\cites in the .aux files\n"); - FSO (" --mentstrs ## allow ## string entries in the .bib databases\n"); FSO (" --mstrings ## allow ## unique strings\n"); debug_msg (DBG_MISC, "calling longjmp (Exit_Program_Flag) ... "); diff --git a/Build/source/texk/bibtexu/ChangeLog b/Build/source/texk/bibtexu/ChangeLog index 9167bc45137..58776f6f766 100644 --- a/Build/source/texk/bibtexu/ChangeLog +++ b/Build/source/texk/bibtexu/ChangeLog @@ -1,3 +1,19 @@ +2010-03-17 Peter Breitenlohner <peb@mppmu.mpg.de> + + * bibtex-1.c (check_cite_overflow): Reallocate cite_info, + cite_list, entry_exists, and type_list. + * bibtex.h (MAX_CITES): Initial allocation as in bibtex.web. + * gblvars.h (M_cites): Removed. + * utils.c (parse_cmd_line, usage): Ignore/remove --mcites. + +2010-03-16 Peter Breitenlohner <peb@mppmu.mpg.de> + + * bibtex-1.c, utils.c: Delay allocation of entry_ints and + entry_strs until the required size is known. + * bibtex.h (MAX_ENT_INTS, MAX_ENT_STRS): Removed. + * gblvars.h (M_entstrs, Max_Ent_Ints, Max_Ent_Strs): Removed. + * utils.c (parse_cmd_line, usage): Ignore/remove --mentstrs. + 2010-03-15 Peter Breitenlohner <peb@mppmu.mpg.de> * tests/bibtex.test: New shell script to test 7-bit mode. diff --git a/Build/source/texk/bibtexu/bibtex-1.c b/Build/source/texk/bibtexu/bibtex-1.c index 5f575fc353e..66067bd3371 100644 --- a/Build/source/texk/bibtexu/bibtex-1.c +++ b/Build/source/texk/bibtexu/bibtex-1.c @@ -2360,16 +2360,13 @@ BEGIN * value to which all integers are initialized. ***************************************************************************/ BEGIN - if ((num_ent_ints * num_cites) > Max_Ent_Ints) - BEGIN - BIB_XRETALLOC ("entry_ints", entry_ints, Integer_T, - Max_Ent_Ints, (long) (num_ent_ints + 1) * (num_cites + 1)); - END - int_ent_ptr = 0; - while (int_ent_ptr < (num_ent_ints * num_cites)) + int_ent_ptr = (num_ent_ints + 1) * (num_cites + 1); + entry_ints = (Integer_T *) mymalloc ((unsigned long) sizeof (Integer_T) + * (unsigned long) int_ent_ptr, "entry_ints"); + while (int_ent_ptr > 0) BEGIN + DECR (int_ent_ptr); entry_ints[int_ent_ptr] = 0; - INCR (int_ent_ptr); END END /*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 287 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -2381,16 +2378,14 @@ BEGIN * null string, the value to which all strings are initialized. ***************************************************************************/ BEGIN - if ((num_ent_strs * num_cites) > Max_Ent_Strs) - BEGIN - PRINT2 ("%ld: ", (long) (num_ent_strs * num_cites)); - BIBTEX_OVERFLOW ("total number of string entry-variables ", Max_Ent_Strs); - END - str_ent_ptr = 0; - while (str_ent_ptr < (num_ent_strs * num_cites)) + str_ent_ptr = (num_ent_strs + 1) * (num_cites + 1); + entry_strs = (ASCIICode_T *) mymalloc ((unsigned long) sizeof (ASCIICode_T) + * (unsigned long) (ENT_STR_SIZE + 1) + * (unsigned long) str_ent_ptr, "entry_strs"); + while (str_ent_ptr > 0) BEGIN + DECR (str_ent_ptr); ENTRY_STRS(str_ent_ptr,0) = END_OF_STRING; - INCR (str_ent_ptr); END END /*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 288 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ @@ -2760,9 +2755,20 @@ void check_cite_overflow (CiteNumber_T last_cite) BEGIN if (last_cite == Max_Cites) BEGIN - PRINT_POOL_STR (hash_text[cite_loc]); - PRINT_LN (" is the key:"); - BIBTEX_OVERFLOW ("number of cite keys ", Max_Cites); + BIB_XRETALLOC_NOSET ("cite_info", cite_info, StrNumber_T, + Max_Cites, Max_Cites + MAX_CITES); + BIB_XRETALLOC_NOSET ("cite_list", cite_list, StrNumber_T, + Max_Cites, Max_Cites + MAX_CITES); + BIB_XRETALLOC_NOSET ("entry_exists", entry_exists, Boolean_T, + Max_Cites, Max_Cites + MAX_CITES); + BIB_XRETALLOC ("type_list", type_list, HashPtr2_T, + Max_Cites, Max_Cites + MAX_CITES); + while (last_cite < Max_Cites) + BEGIN + type_list[last_cite] = EMPTY; + cite_info[last_cite] = ANY_VALUE; + INCR (last_cite); + END END END /*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 138 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/Build/source/texk/bibtexu/bibtex.h b/Build/source/texk/bibtexu/bibtex.h index 416387a7dea..a30395c518a 100644 --- a/Build/source/texk/bibtexu/bibtex.h +++ b/Build/source/texk/bibtexu/bibtex.h @@ -268,9 +268,7 @@ #define MAX_BIB_FILES 20 #define BUF_SIZE 10000 -#define MAX_CITES 2000 -#define MAX_ENT_INTS 3000 -#define MAX_ENT_STRS 3000 +#define MAX_CITES 750 #define MAX_FIELDS 5000 #define MAX_STRINGS 12000 #define POOL_SIZE 65000L diff --git a/Build/source/texk/bibtexu/gblvars.h b/Build/source/texk/bibtexu/gblvars.h index 584438e2969..b56b60bc214 100644 --- a/Build/source/texk/bibtexu/gblvars.h +++ b/Build/source/texk/bibtexu/gblvars.h @@ -440,8 +440,6 @@ __EXTERN__ Boolean_T Flag_huge; __EXTERN__ Boolean_T Flag_stats; __EXTERN__ Boolean_T Flag_trace; __EXTERN__ Boolean_T Flag_wolfgang; -__EXTERN__ Integer_T M_cites; -__EXTERN__ Integer_T M_entstrs; __EXTERN__ Integer_T M_min_crossrefs; __EXTERN__ Integer_T M_strings; __EXTERN__ char *Str_auxfile; @@ -460,8 +458,6 @@ __EXTERN__ Integer_T Hash_Prime; __EXTERN__ Integer_T Hash_Size; __EXTERN__ Integer_T Max_Bib_Files; __EXTERN__ Integer_T Max_Cites; -__EXTERN__ Integer_T Max_Ent_Ints; -__EXTERN__ Integer_T Max_Ent_Strs; __EXTERN__ Integer_T Max_Fields; __EXTERN__ Integer_T Max_Strings; __EXTERN__ Integer_T Min_Crossrefs; diff --git a/Build/source/texk/bibtexu/utils.c b/Build/source/texk/bibtexu/utils.c index 7200a149a4b..f01d64b080a 100644 --- a/Build/source/texk/bibtexu/utils.c +++ b/Build/source/texk/bibtexu/utils.c @@ -193,9 +193,9 @@ static struct option long_options[] = { {"wolfgang", VALUE_NONE, 0, 'W'}, {"min_crossrefs", VALUE_REQD, 0, 'M'}, - {"mcites", VALUE_REQD, 0, '\x0A'}, + {"mcites", VALUE_REQD, 0, '\x0A'}, /* obsolete */ {"mentints", VALUE_REQD, 0, '\x0B'}, /* obsolete */ - {"mentstrs", VALUE_REQD, 0, '\x0C'}, + {"mentstrs", VALUE_REQD, 0, '\x0C'}, /* obsolete */ {"mfields", VALUE_REQD, 0, '\x0D'}, /* obsolete */ {"mpool", VALUE_REQD, 0, '\x0E'}, /* obsolete */ {"mstrings", VALUE_REQD, 0, '\x0F'}, @@ -311,18 +311,15 @@ static void allocate_arrays (void) /* ** Boolean_T entry_ints[Max_Ent_Ints + 1]; + ** allocated when num_ent_ints and num_cites are known */ - bytes_required = (Max_Ent_Ints + 1) * (unsigned long) sizeof (Integer_T); - entry_ints = (Integer_T *) mymalloc (bytes_required, "entry_ints"); + entry_ints = NULL; /* ** ASCIICode_T entry_strs[Max_Ent_Strs + 1][ENT_STR_SIZE + 1]; + ** allocated when num_ent_strs and num_cites are known */ - bytes_required = (unsigned long) (Max_Ent_Strs + 1) - * (unsigned long) (ENT_STR_SIZE + 1) - * (unsigned long) sizeof (ASCIICode_T); - - entry_strs = (ASCIICode_T *) mymalloc (bytes_required, "entry_strs"); + entry_strs = NULL; /* ** ASCIICode_T ex_buf[Buf_Size + 1]; @@ -955,9 +952,9 @@ FILE *open_op_file (void) ** required for automatic inclusion of the cross ** referenced entry in the citation list ** (default = 2) -** --mcites ## allow ## \\cites in the .aux files +** --mcites ## ignored ** --mentints ## ignored -** --mentstrs ## allow ## string entries in the .bib databases +** --mentstrs ## ignored ** --mfields ## ignored ** --mpool ## ignored ** --mstrings ## allow ## unique strings @@ -1062,28 +1059,11 @@ Get the option, and change the flag. 23/sep/2009 break; case '\x0A': /**************** --mcites *****************/ - M_cites = checklong (optarg); - if (M_cites < 0) { - mark_fatal (); - usage ("invalid max number of cites `%s'\n", optarg); - } - break; - case '\x0B': /**************** --mentints ***************/ - (void) checklong (optarg); /******** ignored ********/ - break; - case '\x0C': /**************** --mentstrs ***************/ - M_entstrs = checklong (optarg); - if (M_entstrs < 0) { - mark_fatal (); - usage ("invalid max number of string entries `%s'\n", - optarg); - } - break; - case '\x0D': /**************** --mfields ****************/ case '\x0E': /**************** --mpool *****************/ + case '\x10': /**************** --mwizfuns ***************/ (void) checklong (optarg); /******** ignored ********/ break; @@ -1095,10 +1075,6 @@ Get the option, and change the flag. 23/sep/2009 } break; - case '\x10': /**************** --mwizfuns ***************/ - (void) checklong (optarg); /******** ignored ********/ - break; - default: /**************** Unknown argument ********/ mark_fatal (); usage ("unknown option"); @@ -1206,8 +1182,6 @@ void report_bibtex_capacity (void) LOG_CAPACITY (LIT_STK_SIZE); LOG_CAPACITY (Max_Bib_Files); LOG_CAPACITY (Max_Cites); - LOG_CAPACITY (Max_Ent_Ints); - LOG_CAPACITY (Max_Ent_Strs); LOG_CAPACITY (Max_Fields); LOG_CAPACITY (MAX_GLOB_STRS); LOG_CAPACITY (MAX_PRINT_LINE); @@ -1339,9 +1313,9 @@ static void compute_hash_prime (void) ** Hash_Prime *** computed from Hash_Size *** ** Hash_Size *** determined from Max_Strings *** ** Max_Bib_Files *** initialy 20, increased as required *** -** Max_Cites Y 750 2,000 5,000 7,500 -** Max_Ent_Ints *** initialy 3000, increased as required *** -** Max_Ent_Strs Y 3,000 6,000 10,000 10,000 +** Max_Cites *** initialy 750, increased as required *** +** Max_Ent_Ints *** as required *** +** Max_Ent_Strs *** as required *** ** Max_Fields *** initialy 5000, increased as required *** ** Max_Strings Y 4,000 10,000 19,000 30,000 ** Pool_Size *** initialy 65,000, increased as required *** @@ -1354,26 +1328,18 @@ void set_array_sizes (void) { debug_msg (DBG_MEM, "Setting BibTeX's capacity ... "); - Max_Cites = 750; - Max_Ent_Strs = 3000; Max_Strings = 4000; Min_Crossrefs = 2; if (Flag_big) { - Max_Cites = 2000; - Max_Ent_Strs = 5000; Max_Strings = 10000; } if (Flag_huge) { - Max_Cites = 5000; - Max_Ent_Strs = 10000; Max_Strings = 19000; } if (Flag_wolfgang) { - Max_Cites = 7500; - Max_Ent_Strs = 10000; Max_Strings = 30000; } @@ -1381,13 +1347,7 @@ void set_array_sizes (void) Max_Bib_Files = MAX_BIB_FILES; - if (M_cites > 0) - Max_Cites = M_cites; - - Max_Ent_Ints = MAX_ENT_INTS; - - if (M_entstrs > 0) - Max_Ent_Strs = M_entstrs; + Max_Cites = MAX_CITES; Max_Fields = MAX_FIELDS; @@ -1415,10 +1375,8 @@ void set_array_sizes (void) Hash_Prime, Hash_Size); debug_msg (DBG_MEM, "Buf_Size = %d, Max_Bib_Files = %d", Buf_Size, Max_Bib_Files); - debug_msg (DBG_MEM, "Max_Cites = %d, Max_Ent_Ints = %d", - Max_Cites, Max_Ent_Ints); - debug_msg (DBG_MEM, "Max_Ent_Strs = %d, Max_Fields = %d", - Max_Ent_Strs, Max_Fields); + debug_msg (DBG_MEM, "Max_Cites = %d, Max_Fields = %d", + Max_Cites, Max_Fields); debug_msg (DBG_MEM, "Max_Strings = %d, Pool_Size = %d", Max_Strings, Pool_Size); debug_msg (DBG_MEM, "Min_Crossrefs = %d, Wiz_Fn_Space = %d", @@ -1509,12 +1467,10 @@ void usage (const char *printf_fmt, ...) FSO (" -l --language input the option language, ex: -l fr\n"); FSO (" -o --location input the option location, ex: -o fr\n\n"); - FSO (" -B --big set large BibTeX capacity\n"); - FSO (" -H --huge set huge BibTeX capacity\n"); - FSO (" -W --wolfgang set really huge BibTeX capacity for Wolfgang\n"); + FSO (" -B --big same as --mstrings 10000\n"); + FSO (" -H --huge same as --mstrings 19000\n"); + FSO (" -W --wolfgang same as --mstrings 30000\n"); FSO (" -M --min_crossrefs ## set min_crossrefs to ##\n"); - FSO (" --mcites ## allow ## \\cites in the .aux files\n"); - FSO (" --mentstrs ## allow ## string entries in the .bib databases\n"); FSO (" --mstrings ## allow ## unique strings\n"); debug_msg (DBG_MISC, "calling longjmp (Exit_Program_Flag) ... "); diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 25f9b2b6176..f009c76dd2a 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,6 +1,17 @@ +2010-03-17 Peter Breitenlohner <peb@mppmu.mpg.de> + + * bibtex.ch (max_cites): Dynamically resize the cite_list, + type_list, entry_exists, and cite_info arrays. + +2010-03-16 Peter Breitenlohner <peb@mppmu.mpg.de> + + * bibtex.ch (entry_ints, entry_strs): Delay allocation until + the required size is known. + (max_ent_ints, max_ent_strs): Removed. + 2010-03-11 Peter Breitenlohner <peb@mppmu.mpg.de> - am/bootstrap.am: Use suffix rules to create tangleboot.p, + * am/bootstrap.am: Use suffix rules to create tangleboot.p, ctangleboot.c, and cwebboot.[ch] from distributed `in' files. * bibtex.ch: Check and correct module numbers. Parameter diff --git a/Build/source/texk/web2c/bibtex.ch b/Build/source/texk/web2c/bibtex.ch index 5d5e0cff9be..6c0cf265d56 100644 --- a/Build/source/texk/web2c/bibtex.ch +++ b/Build/source/texk/web2c/bibtex.ch @@ -97,19 +97,18 @@ begin standard_input := stdin; standard_output := stdout; @# -max_ent_ints := MAX_ENT_INTS; -max_ent_strs := MAX_ENT_STRS; pool_size := POOL_SIZE; buf_size := BUF_SIZE; max_bib_files := MAX_BIB_FILES; max_fields := MAX_FIELDS; +max_cites := MAX_CITES; wiz_fn_space := WIZ_FN_SPACE; @# {Add one to the sizes because that's what bibtex uses.} bib_file := XTALLOC (max_bib_files + 1, alpha_file); bib_list := XTALLOC (max_bib_files + 1, str_number); -entry_ints := XTALLOC (max_ent_ints + 1, integer); -entry_strs := XTALLOC ((max_ent_strs + 1) * (ent_str_size + 1), ASCII_code); +entry_ints := nil; +entry_strs := nil; wiz_functions := XTALLOC (wiz_fn_space + 1, hash_ptr2); field_info := XTALLOC (max_fields + 1, str_number); s_preamble := XTALLOC (max_bib_files + 1, str_number); @@ -121,6 +120,11 @@ out_buf := XTALLOC (buf_size + 1, ASCII_code); name_tok := XTALLOC (buf_size + 1, buf_pointer); name_sep_char := XTALLOC (buf_size + 1, ASCII_code); @# +cite_list := XTALLOC (max_cites + 1, str_number); +type_list := XTALLOC (max_cites + 1, hash_ptr2); +entry_exists := XTALLOC (max_cites + 1, boolean); +cite_info := XTALLOC (max_cites + 1, str_number); +@# set_max_strings; str_start := XTALLOC (max_strings + 1, pool_pointer); @# @@ -191,7 +195,7 @@ end. @y [still 14] @!MAX_BIB_FILES=20; {initial number of \.{.bib} files allowed} @!POOL_SIZE=65000; {initial number of characters in strings} -@!max_cites=5000; {maximum number of distinct cite keys; must be +@!MAX_CITES=750; {initial number of distinct cite keys; must be |<=max_strings|} @!WIZ_FN_SPACE=3000; {initial amount of |wiz_defined|-function space} {|min_crossrefs| can be set at runtime now.} @@ -207,10 +211,6 @@ end. must be |<=buf_size|} @!max_fields=17250; {maximum number of fields (entries $\times$ fields, @y -@!MAX_ENT_INTS=3000; {initial number of |int_entry_var|s - (entries $\times$ |int_entry_var|s)} -@!MAX_ENT_STRS=3000; {initial number of |str_entry_var|s - (entries $\times$ |str_entry_var|s)} @!ent_str_size=250; {maximum size of a |str_entry_var|; must be |<=buf_size|} @!glob_str_size=5000; {maximum size of a |str_global_var|; must be |<=buf_size|} @@ -240,10 +240,9 @@ end. @<Globals in the outer block@>= @y @<Globals in the outer block@>= -@!max_ent_ints: integer; -@!max_ent_strs: integer; @!pool_size: integer; @!max_bib_files: integer; +@!max_cites: integer; @!wiz_fn_space: integer; @!max_fields: integer; @# @@ -897,6 +896,43 @@ log_pr_newline; end; @z +@x [130] cite_list is dynamically allocated. +@!cite_list : packed array[cite_number] of str_number; {the cite-key list} +@y +@!cite_list : ^str_number; {the cite-key list} +@z + +@x [131] max_cites is no longer const. +@!cite_number = 0..max_cites; {gives the |cite_list| range} +@y +@!cite_number = integer; {gives the |cite_list| range} +@z + +@x [139] Dynamic max_cites. +if (last_cite = max_cites) then + begin + print_pool_str (hash_text[cite_loc]); + print_ln (' is the key:'); + overflow('number of cite keys ',max_cites); +@y +if (last_cite = max_cites) then + begin + BIB_XRETALLOC_NOSET ('cite_list', cite_list, str_number, + max_cites, max_cites + MAX_CITES); + BIB_XRETALLOC_NOSET ('type_list', type_list, hash_ptr2, + max_cites, max_cites + MAX_CITES); + BIB_XRETALLOC_NOSET ('entry_exists', entry_exists, boolean, + max_cites, max_cites + MAX_CITES); + BIB_XRETALLOC ('cite_info', cite_info, str_number, + max_cites, max_cites + MAX_CITES); + while (last_cite < max_cites) do + begin + type_list[last_cite] := empty;@/ + cite_info[last_cite] := any_value; {to appeas \PASCAL's boolean evaluation} + incr(last_cite); + end; +@z + % [142] Don't pad with blanks. % Don't use a path to search for subsidiary aux files, either. @x @@ -935,7 +971,7 @@ hack1; bst_done: a_close (bst_file); @z -% max_ent_ints, max_ent_strs, max_fields are no longer const. +% max_ent_ints and max_ent_strs are gone, max_fields is no longer const. @x [161] quote_next_fn and end_of_def are Pascal consts, instead of web macros. @d quote_next_fn = hash_base - 1 {special marker used in defining functions} @d end_of_def = hash_max + 1 {another such special marker} @@ -1022,6 +1058,22 @@ if (single_ptr + wiz_def_ptr > wiz_fn_space) then @y @z +@x [220] type_list is dynamically allocated. +@!type_list : packed array[cite_number] of hash_ptr2; +@y +@!type_list : ^hash_ptr2; +@z +@x [220] entry_exists also. +@!entry_exists : packed array[cite_number] of boolean; +@y +@!entry_exists : ^boolean; +@z +@x [220] cite_info also. +@!cite_info : packed array[cite_number] of str_number; {extra |cite_list| info} +@y +@!cite_info : ^str_number; {extra |cite_list| info} +@z + @x [225] Be silent unless verbose. print ('Database file #',bib_ptr+1:0,': '); print_bib_name;@/ @@ -1117,36 +1169,24 @@ if ((cite_xptr + 1) * num_fields > max_fields) then confusion ('field_info index is out of range'); @z -@x [288] Reallocate on overflow. +@x [288] Allocate entry_ints as needed. if (num_ent_ints*num_cites > max_ent_ints) then begin print (num_ent_ints*num_cites,': '); overflow('total number of integer entry-variables ',max_ent_ints); end; @y -if (num_ent_ints*num_cites > max_ent_ints) then - BIB_XRETALLOC ('entry_ints', entry_ints, integer, max_ent_ints, - (num_ent_ints + 1) * (num_cites + 1)); +entry_ints := XTALLOC ((num_ent_ints + 1) * (num_cites + 1), integer); @z -@x [289] Reallocate entry_strs. +@x [289] Allocate entry_strs as needed. if (num_ent_strs*num_cites > max_ent_strs) then begin print (num_ent_strs*num_cites,': '); overflow('total number of string entry-variables ',max_ent_strs); end; @y -{Have to include the maximum size of each string in the reallocation, - unfortunately, since we're faking a two-dimensional array. And then - decrease |max_ent_strs| again, because it's the number of strings, not - the number of characters (which is what we're allocating.)} -if (num_ent_strs * num_cites > max_ent_strs) then begin - BIB_XRETALLOC ('entry_strs', entry_strs, ASCII_code, max_ent_strs, - (num_ent_strs + 1) * (num_cites + 1) * (ent_str_size + 1)); - max_ent_strs := num_ent_strs * num_cites; - {The new values are initialized in the next few statements from - \.{bibtex.web}.} -end; +entry_strs := XTALLOC ((num_ent_strs + 1) * (num_cites + 1) * (ent_str_size + 1), ASCII_code); @z @x [289] Macroize entry_strs[][]. |