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/texk/bibtex8 | |
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/texk/bibtex8')
-rw-r--r-- | Build/source/texk/bibtex8/ChangeLog | 20 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/Makefile.am | 11 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/Makefile.in | 13 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/bibtex-1.c | 44 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/bibtex.h | 4 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/gblvars.h | 4 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/tests/sort.aux | 4 | ||||
-rwxr-xr-x | Build/source/texk/bibtex8/tests/sort.test | 22 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/tests/sort1.bbl | 15 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/tests/sort1.csf | 275 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/tests/sort2.bbl | 15 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/tests/sort2.csf | 114 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/tests/sort3.bbl | 15 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/tests/sort3.csf | 281 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/tests/testdata.bib | 43 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/tests/teststyle.bst | 36 | ||||
-rw-r--r-- | Build/source/texk/bibtex8/utils.c | 82 |
17 files changed, 901 insertions, 97 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) ... "); |