gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, master, updated. gawk-4.1.0-5418-g66ef06a5


From: Arnold Robbins
Subject: [SCM] gawk branch, master, updated. gawk-4.1.0-5418-g66ef06a5
Date: Tue, 31 Oct 2023 03:23:38 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, master has been updated
       via  66ef06a5cd2eaa827ebe309a08313e5f01357c41 (commit)
      from  2ba196f7b9c4de8cc28ea16dafdc151479fb7907 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=66ef06a5cd2eaa827ebe309a08313e5f01357c41

commit 66ef06a5cd2eaa827ebe309a08313e5f01357c41
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Oct 31 09:23:18 2023 +0200

    Fix for unicode on Cygwin.

diff --git a/ChangeLog b/ChangeLog
index 85fa6ea2..6777bd0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-10-31         Corinna Vinschen      <vinschen@redhat.com>
+
+       * awk.h (wcitomb): Add declaration.
+       * node.c (parse_escape): Use it on Cygwin.
+
 2023-10-24         Arnold D. Robbins     <arnold@skeeve.com>
 
        * eval.c (setup_frame): Fix a potential use after free
diff --git a/awk.h b/awk.h
index 0d1dc85b..cbc0a7e8 100644
--- a/awk.h
+++ b/awk.h
@@ -86,6 +86,9 @@ extern int errno;
 /* We can handle multibyte strings.  */
 #include <wchar.h>
 #include <wctype.h>
+#ifdef __CYGWIN__ /* Define helper function for large Unicode values */
+extern size_t wcitomb (char *s, int wc, mbstate_t *ps);
+#endif
 
 #ifdef STDC_HEADERS
 #include <float.h>
diff --git a/node.c b/node.c
index ba1f686c..f08a57d7 100644
--- a/node.c
+++ b/node.c
@@ -720,6 +720,9 @@ parse_escape(const char **string_ptr, const char **result, 
size_t *nbytes)
                }
 #ifdef __MINGW32__
                n = w32_wc_to_lc (i, buf);
+#elif defined (__CYGWIN__)
+               memset(& mbs, 0, sizeof(mbs));
+               n = wcitomb(buf, i, & mbs);
 #else
                memset(& mbs, 0, sizeof(mbs));
                n = wcrtomb(buf, i, & mbs);
diff --git a/posix/ChangeLog b/posix/ChangeLog
index 36db3d58..e8cc19db 100644
--- a/posix/ChangeLog
+++ b/posix/ChangeLog
@@ -1,3 +1,7 @@
+2023-10-31         Corinna Vinschen      <vinschen@redhat.com>
+
+       * gawkmisc.c (wcitomb): New function for Cygwin.
+
 2023-05-07         Arnold D. Robbins     <arnold@skeeve.com>
 
        * 5.2.2: Release tar ball made.
diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c
index 58fb520b..0b30d746 100644
--- a/posix/gawkmisc.c
+++ b/posix/gawkmisc.c
@@ -316,3 +316,22 @@ cygwin_premain2(int argc, char **argv, struct per_process 
*myself)
        setmode(fileno (stdin), O_TEXT);
 }
 #endif
+
+#ifdef __CYGWIN__
+size_t
+wcitomb (char *s, int wc, mbstate_t *ps)
+{
+       /* If s is NULL, behave as if s pointed to an internal buffer and wc
+          was a null wide character (L'').  wcrtomb will do that for us*/
+       if (wc <= 0xffff || !s)
+               return wcrtomb (s, (wchar_t) wc, ps);
+
+       wchar_t wc_arr[2];
+       const wchar_t *wcp = wc_arr;
+
+       wc -= 0x10000;
+       wc_arr[0] = (wc >> 10) + 0xd800;
+       wc_arr[1] = (wc & 0x3ff) + 0xdc00;
+       return wcsnrtombs (s, &wcp, 2, SIZE_MAX, ps);
+}
+#endif

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |  5 +++++
 awk.h            |  3 +++
 node.c           |  3 +++
 posix/ChangeLog  |  4 ++++
 posix/gawkmisc.c | 19 +++++++++++++++++++
 5 files changed, 34 insertions(+)


hooks/post-receive
-- 
gawk



reply via email to

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