texlive[43238] Build/source/texk/dvisvgm: locale portability patch

commits+karl at tug.org commits+karl at tug.org
Wed Feb 15 23:52:41 CET 2017


Revision: 43238
          http://tug.org/svn/texlive?view=revision&revision=43238
Author:   karl
Date:     2017-02-15 23:52:41 +0100 (Wed, 15 Feb 2017)
Log Message:
-----------
locale portability patch from Martin; autoreconf

Modified Paths:
--------------
    trunk/Build/source/texk/dvisvgm/Makefile.in
    trunk/Build/source/texk/dvisvgm/config.h.in
    trunk/Build/source/texk/dvisvgm/configure
    trunk/Build/source/texk/dvisvgm/configure.ac
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.am
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/sfd.c
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splinefont.h
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c

Added Paths:
-----------
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.c
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.h

Modified: trunk/Build/source/texk/dvisvgm/Makefile.in
===================================================================
--- trunk/Build/source/texk/dvisvgm/Makefile.in	2017-02-15 22:47:54 UTC (rev 43237)
+++ trunk/Build/source/texk/dvisvgm/Makefile.in	2017-02-15 22:52:41 UTC (rev 43238)
@@ -14,7 +14,7 @@
 
 @SET_MAKE@
 
-# $Id: Makefile.am 43103 2017-01-31 18:39:23Z karl $
+# $Id: Makefile.am 43208 2017-02-13 17:57:19Z karl $
 # Makefile.am for the TeX Live subdirectory texk/dvisvgm/
 #
 # Copyright 2015-2017 Karl Berry <tex-live at tug.org>

Modified: trunk/Build/source/texk/dvisvgm/config.h.in
===================================================================
--- trunk/Build/source/texk/dvisvgm/config.h.in	2017-02-15 22:47:54 UTC (rev 43237)
+++ trunk/Build/source/texk/dvisvgm/config.h.in	2017-02-15 22:52:41 UTC (rev 43238)
@@ -165,6 +165,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the `uselocale' function. */
+#undef HAVE_USELOCALE
+
 /* Define to 1 if you have the `vprintf' function. */
 #undef HAVE_VPRINTF
 

Modified: trunk/Build/source/texk/dvisvgm/configure
===================================================================
--- trunk/Build/source/texk/dvisvgm/configure	2017-02-15 22:47:54 UTC (rev 43237)
+++ trunk/Build/source/texk/dvisvgm/configure	2017-02-15 22:52:41 UTC (rev 43238)
@@ -19325,18 +19325,6 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-for ac_func in ftime gettimeofday
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
 for ac_header in sys/time.h sys/timeb.h xlocale.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -22596,7 +22584,7 @@
 done
 
 
-for ac_func in memset strcasecmp strtol
+for ac_func in ftime gettimeofday memset strcasecmp strtol uselocale
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

Modified: trunk/Build/source/texk/dvisvgm/configure.ac
===================================================================
--- trunk/Build/source/texk/dvisvgm/configure.ac	2017-02-15 22:47:54 UTC (rev 43237)
+++ trunk/Build/source/texk/dvisvgm/configure.ac	2017-02-15 22:52:41 UTC (rev 43238)
@@ -40,7 +40,6 @@
 AC_PROG_RANLIB
 AC_LANG(C)
 
-AC_CHECK_FUNCS([ftime gettimeofday])
 AC_CHECK_HEADERS([sys/time.h sys/timeb.h xlocale.h])
 AC_HEADER_TIOCGWINSZ
 
@@ -159,7 +158,7 @@
 AC_FUNC_MALLOC
 AC_FUNC_STAT
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([memset strcasecmp strtol])
+AC_CHECK_FUNCS([ftime gettimeofday memset strcasecmp strtol uselocale])
 
 AC_ARG_ENABLE([woff],
 	[AS_HELP_STRING([--disable-woff], [Disable WOFF support @<:@no@:>@])],

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in	2017-02-15 22:47:54 UTC (rev 43237)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/Makefile.in	2017-02-15 22:52:41 UTC (rev 43238)
@@ -167,7 +167,7 @@
 CTAGS = ctags
 DIST_SUBDIRS = $(SUBDIRS)
 am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING INSTALL NEWS \
-	README ar-lib ltmain.sh
+	README
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
   dir0=`pwd`; \

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.am
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.am	2017-02-15 22:47:54 UTC (rev 43237)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.am	2017-02-15 22:52:41 UTC (rev 43238)
@@ -14,6 +14,8 @@
 	fontforge/edgelist2.h \
 	fontforge/encoding.c \
 	fontforge/encoding.h \
+	fontforge/fflocale.c \
+	fontforge/fflocale.h \
 	fontforge/fontforge-config.h \
 	fontforge/fontforge.h \
 	fontforge/fontforgevw.h \

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in	2017-02-15 22:47:54 UTC (rev 43237)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in	2017-02-15 22:52:41 UTC (rev 43238)
@@ -125,12 +125,12 @@
 	fontforge/asmfpst.$(OBJEXT) fontforge/autohint.$(OBJEXT) \
 	fontforge/char.$(OBJEXT) fontforge/cjk.$(OBJEXT) \
 	fontforge/cvundoes.$(OBJEXT) fontforge/dumppfa.$(OBJEXT) \
-	fontforge/encoding.$(OBJEXT) fontforge/fvfonts.$(OBJEXT) \
-	fontforge/gwwiconv.$(OBJEXT) fontforge/lookups.$(OBJEXT) \
-	fontforge/macbinary.$(OBJEXT) fontforge/macenc.$(OBJEXT) \
-	fontforge/mathconstants.$(OBJEXT) fontforge/memory.$(OBJEXT) \
-	fontforge/mm.$(OBJEXT) fontforge/namelist.$(OBJEXT) \
-	fontforge/nouiutil.$(OBJEXT) \
+	fontforge/encoding.$(OBJEXT) fontforge/fflocale.$(OBJEXT) \
+	fontforge/fvfonts.$(OBJEXT) fontforge/gwwiconv.$(OBJEXT) \
+	fontforge/lookups.$(OBJEXT) fontforge/macbinary.$(OBJEXT) \
+	fontforge/macenc.$(OBJEXT) fontforge/mathconstants.$(OBJEXT) \
+	fontforge/memory.$(OBJEXT) fontforge/mm.$(OBJEXT) \
+	fontforge/namelist.$(OBJEXT) fontforge/nouiutil.$(OBJEXT) \
 	fontforge/nowakowskittfinstr.$(OBJEXT) \
 	fontforge/parsepfa.$(OBJEXT) fontforge/parsettf.$(OBJEXT) \
 	fontforge/parsettfatt.$(OBJEXT) fontforge/psread.$(OBJEXT) \
@@ -394,6 +394,8 @@
 	fontforge/edgelist2.h \
 	fontforge/encoding.c \
 	fontforge/encoding.h \
+	fontforge/fflocale.c \
+	fontforge/fflocale.h \
 	fontforge/fontforge-config.h \
 	fontforge/fontforge.h \
 	fontforge/fontforgevw.h \
@@ -520,6 +522,8 @@
 	fontforge/$(DEPDIR)/$(am__dirstamp)
 fontforge/encoding.$(OBJEXT): fontforge/$(am__dirstamp) \
 	fontforge/$(DEPDIR)/$(am__dirstamp)
+fontforge/fflocale.$(OBJEXT): fontforge/$(am__dirstamp) \
+	fontforge/$(DEPDIR)/$(am__dirstamp)
 fontforge/fvfonts.$(OBJEXT): fontforge/$(am__dirstamp) \
 	fontforge/$(DEPDIR)/$(am__dirstamp)
 fontforge/gwwiconv.$(OBJEXT): fontforge/$(am__dirstamp) \
@@ -621,6 +625,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote at fontforge/$(DEPDIR)/cvundoes.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at fontforge/$(DEPDIR)/dumppfa.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at fontforge/$(DEPDIR)/encoding.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at fontforge/$(DEPDIR)/fflocale.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at fontforge/$(DEPDIR)/fvfonts.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at fontforge/$(DEPDIR)/gwwiconv.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at fontforge/$(DEPDIR)/lookups.Po at am__quote@

Added: trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.c
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.c	                        (rev 0)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.c	2017-02-15 22:52:41 UTC (rev 43238)
@@ -0,0 +1,44 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "fflocale.h"
+
+void switch_to_c_locale(ff_locale_t * tmplocale_p, ff_locale_t * oldlocale_p) {
+#ifdef HAVE_USELOCALE
+  *tmplocale_p = newlocale(LC_NUMERIC_MASK, "C", NULL);
+  if (*tmplocale_p == NULL)
+    fprintf(stderr, "Failed to create temporary locale.\n");
+  else if ((*oldlocale_p = uselocale(*tmplocale_p)) == NULL) {
+    fprintf(stderr, "Failed to change locale.\n");
+    freelocale(*tmplocale_p); *tmplocale_p = NULL;
+  }
+#else
+  *tmplocale_p = setlocale(LC_NUMERIC, "C");
+  if (*tmplocale_p)
+	  *oldlocale_p = strdup(*tmplocale_p);
+  else {
+    *oldlocale_p = NULL;
+    fprintf(stderr, "Failed to change locale.\n");
+  }
+#endif
+}
+
+void switch_to_old_locale(ff_locale_t * tmplocale_p, ff_locale_t * oldlocale_p) {
+#ifdef HAVE_USELOCALE
+  if (*oldlocale_p)
+    uselocale(*oldlocale_p);
+  else
+    uselocale(LC_GLOBAL_LOCALE);
+  *oldlocale_p = NULL; // This ends the lifecycle of the temporary old locale storage.
+  if (*tmplocale_p) {
+    freelocale(*tmplocale_p);
+    *tmplocale_p = NULL;
+  }
+#else
+  if (*oldlocale_p) {
+    setlocale(LC_NUMERIC, *oldlocale_p);
+    free(*oldlocale_p);
+    *oldlocale_p = NULL;
+  }
+#endif
+}

Added: trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.h
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.h	                        (rev 0)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/fflocale.h	2017-02-15 22:52:41 UTC (rev 43238)
@@ -0,0 +1,23 @@
+#ifndef FFLOCALE_H
+#define FFLOCALE_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <locale.h>
+#ifdef HAVE_XLOCALE_H
+#include <xlocale.h>
+#endif
+
+#ifdef HAVE_USELOCALE
+typedef locale_t ff_locale_t;
+#else
+typedef char* ff_locale_t;
+#endif // HAVE_USELOCALE
+
+void switch_to_c_locale(ff_locale_t *tmplocale_p, ff_locale_t *oldlocale_p);
+void switch_to_old_locale(ff_locale_t *tmplocale_p, ff_locale_t *oldlocale_p);
+
+#endif /* FFLOCALE_H */
+

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/sfd.c
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/sfd.c	2017-02-15 22:47:54 UTC (rev 43237)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/sfd.c	2017-02-15 22:52:41 UTC (rev 43238)
@@ -4646,7 +4646,7 @@
     }
     if ( sfd==NULL )
 return( NULL );
-    locale_t tmplocale; locale_t oldlocale; // Declare temporary locale storage.
+    ff_locale_t tmplocale, oldlocale; // Declare temporary locale storage.
     switch_to_c_locale(&tmplocale, &oldlocale); // Switch to the C locale temporarily and cache the old locale.
     ff_progress_change_stages(2);
     if ( (version = SFDStartsCorrectly(sfd,tok))!=-1 )

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splinefont.h
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splinefont.h	2017-02-15 22:47:54 UTC (rev 43237)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splinefont.h	2017-02-15 22:52:41 UTC (rev 43238)
@@ -33,15 +33,12 @@
 #include <basics.h>
 #include <dlist.h>
 #include "configure-fontforge.h"
+#include "fflocale.h"
 #ifdef HAVE_ICONV
 # include <iconv.h>
 #else
 # include <gwwiconv.h>
 #endif
-#include <locale.h>
-#ifdef HAVE_XLOCALE_H
-#include <xlocale.h>
-#endif
 #include <gnetwork.h>
 
 #ifdef FONTFORGE_CONFIG_USE_DOUBLE
@@ -2554,57 +2551,4 @@
 
 #include "ustring.h"
 
-#ifdef _WIN32
-#define BAD_LOCALE_HACK
-typedef char* locale_t;
-#define LC_GLOBAL_LOCALE ((locale_t)-1)
-#define LC_ALL_MASK LC_ALL
-#define LC_COLLATE_MASK LC_COLLATE
-#define LC_CTYPE_MASK LC_CTYPE
-#define LC_MONETARY_MASK LC_MONETARY
-#define LC_NUMERIC_MASK LC_NUMERIC
-#define LC_TIME_MASK LC_TIME
 #endif
-
-static inline void switch_to_c_locale(locale_t * tmplocale_p, locale_t * oldlocale_p) {
-#ifndef BAD_LOCALE_HACK
-  *tmplocale_p = newlocale(LC_NUMERIC_MASK, "C", NULL);
-  if (*tmplocale_p == NULL) fprintf(stderr, "Failed to create temporary locale.\n");
-  else if ((*oldlocale_p = uselocale(*tmplocale_p)) == NULL) {
-    fprintf(stderr, "Failed to change locale.\n");
-    freelocale(*tmplocale_p); *tmplocale_p = NULL;
-  }
-#else
-  // Yes, it is dirty. But so is an operating system that doesn't support threaded locales.
-  *oldlocale_p = (locale_t)copy(setlocale(LC_NUMERIC_MASK, "C"));
-  if (*oldlocale_p == NULL) fprintf(stderr, "Failed to change locale.\n");
-#endif
-}
-
-static inline void switch_to_old_locale(locale_t * tmplocale_p, locale_t * oldlocale_p) {
-#ifndef BAD_LOCALE_HACK
-  if (*oldlocale_p != NULL) { uselocale(*oldlocale_p); } else { uselocale(LC_GLOBAL_LOCALE); }
-  *oldlocale_p = NULL; // This ends the lifecycle of the temporary old locale storage.
-  if (*tmplocale_p != NULL) { freelocale(*tmplocale_p); *tmplocale_p = NULL; }
-#else
-  if (*oldlocale_p != NULL) {
-    setlocale(LC_NUMERIC_MASK, (char*)(*oldlocale_p));
-    free((char*)(*oldlocale_p));
-    *oldlocale_p = NULL;
-  }
-#endif
-}
-
-#if 0
-#define DECLARE_TEMP_LOCALE() char oldloc[25];
-#define SWITCH_TO_C_LOCALE() strncpy( oldloc,setlocale(LC_NUMERIC,NULL),24 ); oldloc[24]='\0'; setlocale(LC_NUMERIC,"C");
-#define SWITCH_TO_OLD_LOCALE() setlocale(LC_NUMERIC,oldloc);
-#else
-#define DECLARE_TEMP_LOCALE() locale_t tmplocale; locale_t oldlocale; // Declare temporary locale storage.
-#define SWITCH_TO_C_LOCALE() switch_to_c_locale(&tmplocale, &oldlocale); // Switch to the C locale temporarily and cache the old locale.
-#define SWITCH_TO_OLD_LOCALE() switch_to_old_locale(&tmplocale, &oldlocale); // Switch to the cached locale.
-#endif
-
-
-
-#endif

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c	2017-02-15 22:47:54 UTC (rev 43237)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c	2017-02-15 22:52:41 UTC (rev 43238)
@@ -5925,7 +5925,7 @@
 
     short_too_long_warned = 0; // This is a static variable defined for putshort.
     /* TrueType probably doesn't need this, but OpenType does for floats in dictionaries */
-    locale_t tmplocale; locale_t oldlocale; // Declare temporary locale storage.
+    ff_locale_t tmplocale, oldlocale; // Declare temporary locale storage.
     switch_to_c_locale(&tmplocale, &oldlocale); // Switch to the C locale temporarily and cache the old locale.
 
     if ( format==ff_otfcid || format== ff_cffcid ) {



More information about the tex-live-commits mailing list