texlive[50224] Build/source/texk/bibtex-x: bibtexu: add trace for

commits+hironobu at tug.org commits+hironobu at tug.org
Mon Mar 4 12:43:10 CET 2019


Revision: 50224
          http://tug.org/svn/texlive?view=revision&revision=50224
Author:   hironobu
Date:     2019-03-04 12:43:10 +0100 (Mon, 04 Mar 2019)
Log Message:
-----------
bibtexu: add trace for sorting

Modified Paths:
--------------
    trunk/Build/source/texk/bibtex-x/ChangeLog
    trunk/Build/source/texk/bibtex-x/bibtex-2.c

Modified: trunk/Build/source/texk/bibtex-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/bibtex-x/ChangeLog	2019-03-04 11:35:09 UTC (rev 50223)
+++ trunk/Build/source/texk/bibtex-x/ChangeLog	2019-03-04 11:43:10 UTC (rev 50224)
@@ -1,10 +1,17 @@
 2019-03-04  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 
+	Both BibTeX8 and BibTeXu:
+	* bibtex-2.c: Add trace for sorting. (There is no related
+	code in the original BibTeX, but can be useful.)
+	Suppress compiler warnings.
 	* bibtex.c, utils.c: Print ICU version in BibTeXu.
+
+	BibTeXu only:
+	* bibtex-2.c: Use u_strFromUTF8() instead of icu_toUChars()
+	while sorting for BibTeXu. Close UConverter properly.
+	* bibtex-4.c: Fix x_purify() for BibTeXu.
 	* utils.c: Default to Flag_8bit in BibTeXu. We should NOT
 	read any csf file in BibTeXu. (BibTeX8 is unaffected)
-	* bibtex-4.c: Fix x_purify() for BibTeXu.
-	* bibtex-2.c: Suppress compiler warnings.
 
 2017-04-27  Karl Berry  <karl at tug.org>
 

Modified: trunk/Build/source/texk/bibtex-x/bibtex-2.c
===================================================================
--- trunk/Build/source/texk/bibtex-x/bibtex-2.c	2019-03-04 11:35:09 UTC (rev 50223)
+++ trunk/Build/source/texk/bibtex-x/bibtex-2.c	2019-03-04 11:43:10 UTC (rev 50224)
@@ -2949,6 +2949,10 @@
 			char2;
 #endif
 
+#ifdef TRACE
+  if (Flag_trace)
+    TRACE_PR_LN3 ("Comparing entry %ld and %ld ...", arg1, arg2);
+#endif                      			/* TRACE */
   ptr1 = (arg1 * num_ent_strs) + sort_key_num;
   ptr2 = (arg2 * num_ent_strs) + sort_key_num;
 #ifdef UTF_8
@@ -2955,8 +2959,15 @@
   lenk1 = strlen((char *)&ENTRY_STRS(ptr1, 0));
   lenk2 = strlen((char *)&ENTRY_STRS(ptr2, 0));
 
+/*
+icu_toUChars() seems not working here, using u_strFromUTF8 instead. (04/mar/2019)
+*/
+/*
   uchlen1 = icu_toUChars(entry_strs, (ptr1 * (ENT_STR_SIZE+1)), lenk1, uch1, ucap);
   uchlen2 = icu_toUChars(entry_strs, (ptr2 * (ENT_STR_SIZE+1)), lenk2, uch2, ucap);
+*/
+  u_strFromUTF8(uch1, ucap, &uchlen1, (char *)&ENTRY_STRS(ptr1, 0), lenk1, &err1);
+  u_strFromUTF8(uch2, ucap, &uchlen2, (char *)&ENTRY_STRS(ptr2, 0), lenk2, &err1);
 
   if(Flag_location)
     ucol1 = ucol_open(Str_location, &err1);
@@ -2965,6 +2976,10 @@
   if (!U_SUCCESS(err1))
     printf("there is a error: U_ZERO_ERROR, open a ucol.");
   u_less = !ucol_greaterOrEqual(ucol1, uch1, uchlen1, uch2, uchlen2);
+#ifdef TRACE
+  if (Flag_trace)
+    TRACE_PR_LN2 ("... first is smaller than second? -- %s (ICU)", (u_less?"T":"F"));
+#endif                      			/* TRACE */
 
   ucol_close(ucol1);
   return u_less;
@@ -3011,6 +3026,10 @@
     INCR (char_ptr);
   END
 Exit_Label:
+#ifdef TRACE
+  if (Flag_trace)
+    TRACE_PR_LN2 ("... first is smaller than second? -- %s", (less_than?"T":"F"));
+#endif                      			/* TRACE */
   return (less_than);
 #endif
 END
@@ -3126,6 +3145,7 @@
 	BEGIN
 		printf("2there is a error: U_ZERO_ERROR");
 	END
+	ucnv_close(ucon1);
 	
 	return len;
 END



More information about the tex-live-commits mailing list