texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7765] Fix building extsnions on MinGW.


From: eliz
Subject: [7765] Fix building extsnions on MinGW.
Date: Sun, 30 Apr 2017 10:57:26 -0400 (EDT)

Revision: 7765
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7765
Author:   eliz
Date:     2017-04-30 10:57:26 -0400 (Sun, 30 Apr 2017)
Log Message:
-----------
Fix building extsnions on MinGW.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Convert/XSParagraph/xspara.c
    trunk/tp/Texinfo/MiscXS/misc.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2017-04-29 19:28:12 UTC (rev 7764)
+++ trunk/ChangeLog     2017-04-30 14:57:26 UTC (rev 7765)
@@ -1,3 +1,20 @@
+2017-04-30  Eli Zaretskii  <address@hidden>
+
+       * tp/Texinfo/Convert/XSParagraph/xspara.c [_WIN32]: Include
+       ctype.h, to work around MinGW compilation errors due to Gnulib
+       replacement of wint_t type.
+       (iswspace, iswupper) [_WIN32]: Rename to call w32_iswspace and
+       w32_iswupper, to avoid conflicts with system headers, due to
+       Gnulib replacement of wint_t type.
+       (iswupper) [_WIN32]: Copy argument from wint_t variable to a
+       wchar_t variable, which is what GetStringTypeW expects.
+
+       * tp/Texinfo/MiscXS/misc.c [_WIN32]: Include ctype.h, to work
+       around MinGW compilation errors due to Gnulib replacement of
+       wint_t type.
+       (xs_unicode_text): Use dTHX to avoid perl error about undefined
+       "my_perl" due to Perl's 'malloc' being used.
+
 2017-04-29  Gavin Smith  <address@hidden>
 
        * tp/Texinfo/Parser.pm (_next_text): Strip \r from end of line.

Modified: trunk/tp/Texinfo/Convert/XSParagraph/xspara.c
===================================================================
--- trunk/tp/Texinfo/Convert/XSParagraph/xspara.c       2017-04-29 19:28:12 UTC 
(rev 7764)
+++ trunk/tp/Texinfo/Convert/XSParagraph/xspara.c       2017-04-30 14:57:26 UTC 
(rev 7765)
@@ -23,6 +23,12 @@
 #include <locale.h>
 #ifndef _WIN32
 #include <langinfo.h>
+#else  /* _WIN32 */
+/* Workaround for problems caused in mingw.org's MinGW build by
+   Gnulib's wchar.h overriding the wint_t type definition, which
+   causes compilation errors when perl.h is included below, because
+   perl.h includes ctype.h.  */
+#include <ctype.h>
 #endif
 #include <wchar.h>
 #include <wctype.h>
@@ -102,6 +108,16 @@
 #include <windows.h>
 #include <errno.h>
 
+/* If Gnulib overrides wint_t with a wider type, we cannot use
+   iswspace etc. names, whose prototypes were seen with the original
+   wint_t in effect.  */
+#ifdef GNULIB_defined_wint_t
+# undef iswspace
+# define iswspace(w) w32_iswspace(w)
+# undef iswupper
+# define iswupper(w) w32_iswupper(w)
+#endif
+
 char *
 w32_setlocale (int category, const char *value)
 {
@@ -198,9 +214,10 @@
 }
 
 int
-iswupper (wint_t wc)
+iswupper (wint_t wi)
 {
   WORD char_type;
+  wchar_t wc = wi;
   BOOL status = GetStringTypeW (CT_CTYPE1, &wc, 1, &char_type);
 
   if (!status || (char_type & C1_UPPER) == 0)

Modified: trunk/tp/Texinfo/MiscXS/misc.c
===================================================================
--- trunk/tp/Texinfo/MiscXS/misc.c      2017-04-29 19:28:12 UTC (rev 7764)
+++ trunk/tp/Texinfo/MiscXS/misc.c      2017-04-30 14:57:26 UTC (rev 7765)
@@ -23,6 +23,12 @@
 #include <locale.h>
 #ifndef _WIN32
 #include <langinfo.h>
+#else  /* _WIN32 */
+/* Workaround for problems caused in mingw.org's MinGW build by
+   Gnulib's wchar.h overriding the wint_t type definition, which
+   causes compilation errors when perl.h is included below, because
+   perl.h includes ctype.h.  */
+#include <ctype.h>
 #endif
 #include <wchar.h>
 #include <wctype.h>
@@ -461,6 +467,8 @@
   char *new;
   int new_space, new_len;
 
+  dTHX; /* Perl boilerplate. */
+
   if (in_code)
     return text;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]