summaryrefslogtreecommitdiff
path: root/Build/source/texk/bibtexu
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2010-03-17 16:16:27 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2010-03-17 16:16:27 +0000
commit59d1decd10c6e2cf2cb3c19cc2631ba9dbb01ecc (patch)
treeb666a6719d5d5306cadad38cc2e27a20f8e7cdc3 /Build/source/texk/bibtexu
parent14e6c07a24c083be3baf78cdec6e0bfcb31c7e52 (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/bibtexu')
-rw-r--r--Build/source/texk/bibtexu/ChangeLog16
-rw-r--r--Build/source/texk/bibtexu/bibtex-1.c44
-rw-r--r--Build/source/texk/bibtexu/bibtex.h4
-rw-r--r--Build/source/texk/bibtexu/gblvars.h4
-rw-r--r--Build/source/texk/bibtexu/utils.c80
5 files changed, 60 insertions, 88 deletions
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) ... ");