summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-02-12 04:16:58 +0000
committerMike Frysinger <vapier@gentoo.org>2005-02-12 04:16:58 +0000
commit38fa8ffcb1f2dd14e3bc68d40f57a329bf709bf7 (patch)
treeaea540e029f5e0ec9a70bd67d70a40fc7f0189ed /sys-apps/gawk/files
parentold (diff)
downloadgentoo-2-38fa8ffcb1f2dd14e3bc68d40f57a329bf709bf7.tar.gz
gentoo-2-38fa8ffcb1f2dd14e3bc68d40f57a329bf709bf7.tar.bz2
gentoo-2-38fa8ffcb1f2dd14e3bc68d40f57a329bf709bf7.zip
Add some patches from Fedora and xmlgawk support #57857 by Alcino Dall Igna Junior.
(Portage version: 2.0.51-r15)
Diffstat (limited to 'sys-apps/gawk/files')
-rw-r--r--sys-apps/gawk/files/digest-gawk-3.1.4-r22
-rw-r--r--sys-apps/gawk/files/gawk-3.1.3-getpgrp_void.patch47
-rw-r--r--sys-apps/gawk/files/gawk-3.1.4-flonum.patch105
-rw-r--r--sys-apps/gawk/files/gawk-3.1.4-nextc.patch28
-rw-r--r--sys-apps/gawk/files/gawk-3.1.4-uplow.patch212
5 files changed, 394 insertions, 0 deletions
diff --git a/sys-apps/gawk/files/digest-gawk-3.1.4-r2 b/sys-apps/gawk/files/digest-gawk-3.1.4-r2
new file mode 100644
index 000000000000..96e092b1b324
--- /dev/null
+++ b/sys-apps/gawk/files/digest-gawk-3.1.4-r2
@@ -0,0 +1,2 @@
+MD5 3c8935efb9fdc7202720894279ad04a7 gawk-3.1.4.tar.gz 2260582
+MD5 7ff33a3753997f38a2a8343cc14796d2 patch_3.1.4__xml_20040813 50667
diff --git a/sys-apps/gawk/files/gawk-3.1.3-getpgrp_void.patch b/sys-apps/gawk/files/gawk-3.1.3-getpgrp_void.patch
new file mode 100644
index 000000000000..13d01310211b
--- /dev/null
+++ b/sys-apps/gawk/files/gawk-3.1.3-getpgrp_void.patch
@@ -0,0 +1,47 @@
+Ripped from Fedora.
+
+--- gawk-3.1.3/main.c.getpgrp_void 2004-01-26 12:08:26.000000000 +0100
++++ gawk-3.1.3/main.c 2004-01-26 12:15:22.000000000 +0100
+@@ -874,14 +874,11 @@
+
+ PROCINFO_node = install("PROCINFO",
+ node((NODE *) NULL, Node_var_array, (NODE *) NULL));
+-
+ #ifdef GETPGRP_VOID
+-#define getpgrp_arg() /* nothing */
++ value = getpgrp();
+ #else
+-#define getpgrp_arg() getpid()
++ value = getpgrp(getpid());
+ #endif
+-
+- value = getpgrp(getpgrp_arg());
+ aptr = assoc_lookup(PROCINFO_node, tmp_string("pgrpid", 6), FALSE);
+ *aptr = make_number(value);
+
+--- gawk-3.1.3/io.c.getpgrp_void 2004-01-26 12:08:36.000000000 +0100
++++ gawk-3.1.3/io.c 2004-01-26 12:16:04.000000000 +0100
+@@ -1422,11 +1422,6 @@
+ return 0;
+ }
+
+-#ifdef GETPGRP_VOID
+-#define getpgrp_arg() /* nothing */
+-#else
+-#define getpgrp_arg() getpid()
+-#endif
+
+ /* pidopen --- "open" /dev/pid, /dev/ppid, and /dev/pgrpid */
+
+@@ -1440,7 +1435,11 @@
+ warning(_("use `PROCINFO[\"%s\"]' instead of `%s'"), cp, name);
+
+ if (name[6] == 'g')
++#ifdef GETPGRP_VOID
++ sprintf(tbuf, "%d\n", (int) getpgrp());
++#else
+ sprintf(tbuf, "%d\n", (int) getpgrp(getpgrp_arg()));
++#endif
+ else if (name[6] == 'i')
+ sprintf(tbuf, "%d\n", (int) getpid());
+ else
diff --git a/sys-apps/gawk/files/gawk-3.1.4-flonum.patch b/sys-apps/gawk/files/gawk-3.1.4-flonum.patch
new file mode 100644
index 000000000000..5ba45cdd05ad
--- /dev/null
+++ b/sys-apps/gawk/files/gawk-3.1.4-flonum.patch
@@ -0,0 +1,105 @@
+Ripped from Fedora.
+
+--- gawk-3.1.4/node.c.flonum 2004-07-28 15:45:04.000000000 +0200
++++ gawk-3.1.4/node.c 2004-11-09 15:53:03.353119096 +0100
+@@ -91,7 +91,7 @@
+
+ if (do_non_decimal_data) {
+ errno = 0;
+- if (! do_traditional && isnondecimal(cp)) {
++ if (! do_traditional && isnondecimal(cp, TRUE)) {
+ n->numbr = nondec2awknum(cp, cpend - cp);
+ goto finish;
+ }
+@@ -584,3 +584,38 @@
+ return c;
+ }
+ }
++
++/* isnondecimal --- return true if number is not a decimal number */
++
++int
++isnondecimal(const char *str, int use_locale)
++{
++ int dec_point = '.';
++#if ENABLE_NLS && defined(HAVE_LOCALE_H)
++ if (use_locale)
++ dec_point = loc.decimal_point[0]; /* XXX --- assumes one char */
++#endif
++
++ if (str[0] != '0')
++ return FALSE;
++
++ /* leading 0x or 0X */
++ if (str[1] == 'x' || str[1] == 'X')
++ return TRUE;
++
++ /*
++ * Numbers with '.', 'e', or 'E' are decimal.
++ * Have to check so that things like 00.34 are handled right.
++ *
++ * These beasts can have trailing whitespace. Deal with that too.
++ */
++ for (; *str != '\0'; str++) {
++ if (*str == 'e' || *str == 'E' || *str == dec_point)
++ return FALSE;
++ else if (! ISDIGIT(*str))
++ break;
++ }
++
++ return TRUE;
++}
++
+--- gawk-3.1.4/awkgram.y.flonum 2004-07-26 16:11:12.000000000 +0200
++++ gawk-3.1.4/awkgram.y 2004-11-09 15:53:03.355118792 +0100
+@@ -2069,12 +2069,14 @@
+ eof_warned = TRUE;
+ }
+ tokadd('\0');
+- if (! do_traditional && isnondecimal(tokstart)) {
+- static short warned = FALSE;
+- if (do_lint && ! warned) {
+- warned = TRUE;
+- lintwarn("numeric constant `%.*s' treated as octal or hexadecimal",
+- strlen(tokstart)-1, tokstart);
++ if (! do_traditional && isnondecimal(tokstart, FALSE)) {
++ if (do_lint) {
++ if (ISDIGIT(tokstart[1])) /* not an 'x' or 'X' */
++ lintwarn("numeric constant `%.*s' treated as octal",
++ strlen(tokstart)-1, tokstart);
++ else if (tokstart[1] == 'x' || tokstart[1] == 'X')
++ lintwarn("numeric constant `%.*s' treated as hexadecimal",
++ strlen(tokstart)-1, tokstart);
+ }
+ yylval.nodeval = make_number(nondec2awknum(tokstart, strlen(tokstart)));
+ } else
+--- gawk-3.1.4/builtin.c.flonum 2004-07-13 09:55:28.000000000 +0200
++++ gawk-3.1.4/builtin.c 2004-11-09 15:53:03.357118488 +0100
+@@ -2779,7 +2779,7 @@
+
+ if ((tmp->flags & (NUMBER|NUMCUR)) != 0)
+ d = (double) force_number(tmp);
+- else if (isnondecimal(tmp->stptr))
++ else if (isnondecimal(tmp->stptr, TRUE))
+ d = nondec2awknum(tmp->stptr, tmp->stlen);
+ else
+ d = (double) force_number(tmp);
+--- gawk-3.1.4/awk.h.flonum 2004-07-26 16:11:05.000000000 +0200
++++ gawk-3.1.4/awk.h 2004-11-09 15:53:03.358118336 +0100
+@@ -742,8 +742,6 @@
+ /* ------------------------- Pseudo-functions ------------------------- */
+
+ #define is_identchar(c) (isalnum(c) || (c) == '_')
+-#define isnondecimal(str) (((str)[0]) == '0' && (ISDIGIT((str)[1]) \
+- || (str)[1] == 'x' || (str)[1] == 'X'))
+
+ #define var_uninitialized(n) ((n)->var_value == Nnull_string)
+
+@@ -1138,6 +1136,7 @@
+ extern int avoid_dfa P((NODE *re, char *str, size_t len)); /* temporary */
+ extern int reisstring P((const char *text, size_t len, Regexp *re, const char *buf));
+ extern int remaybelong P((const char *text, size_t len));
++extern int isnondecimal P((const char *str, int use_locale));
+
+ /* strncasecmp.c */
+ #ifndef BROKEN_STRNCASECMP
diff --git a/sys-apps/gawk/files/gawk-3.1.4-nextc.patch b/sys-apps/gawk/files/gawk-3.1.4-nextc.patch
new file mode 100644
index 000000000000..bbed6591e24a
--- /dev/null
+++ b/sys-apps/gawk/files/gawk-3.1.4-nextc.patch
@@ -0,0 +1,28 @@
+Ripped from Fedora.
+
+--- gawk-3.1.4/awkgram.y.nextc 2004-11-09 15:53:03.355118792 +0100
++++ gawk-3.1.4/awkgram.y 2004-11-09 16:05:46.091165288 +0100
+@@ -1433,6 +1433,11 @@
+ nextc(void)
+ {
+ if (gawk_mb_cur_max > 1) {
++ if (!lexptr || lexptr >= lexend)
++ if (!get_src_buf()) {
++ return EOF;
++ }
++
+ /* Update the buffer index. */
+ cur_ring_idx = (cur_ring_idx == RING_BUFFER_SIZE - 1)? 0 :
+ cur_ring_idx + 1;
+@@ -1444,11 +1449,6 @@
+ mbstate_t tmp_state;
+ size_t mbclen;
+
+- if (!lexptr || lexptr >= lexend)
+- if (!get_src_buf()) {
+- return EOF;
+- }
+-
+ for (idx = 0 ; lexptr + idx < lexend ; idx++) {
+ tmp_state = cur_mbstate;
+ mbclen = mbrlen(lexptr, idx + 1, &tmp_state);
diff --git a/sys-apps/gawk/files/gawk-3.1.4-uplow.patch b/sys-apps/gawk/files/gawk-3.1.4-uplow.patch
new file mode 100644
index 000000000000..2db5185595df
--- /dev/null
+++ b/sys-apps/gawk/files/gawk-3.1.4-uplow.patch
@@ -0,0 +1,212 @@
+Ripped from Fedora.
+
+--- gawk-3.1.4/builtin.c.uplow 2004-11-09 15:53:03.357118488 +0100
++++ gawk-3.1.4/builtin.c 2004-11-09 15:55:25.455516248 +0100
+@@ -1652,51 +1652,116 @@
+ fflush(rp->fp);
+ }
+
++/* wide_tolower_toupper --- lower- or uppercase a multibute string */
++
++typedef int (*isw_func)(wint_t);
++typedef wint_t (*tow_func)(wint_t);
++
++static NODE *
++wide_tolower_toupper(NODE *t1, isw_func iswu, tow_func towl)
++{
++#ifdef MBS_SUPPORT
++ register unsigned char *cp, *cpe;
++ register unsigned char *cp2;
++ size_t mbclen;
++ mbstate_t mbs, prev_mbs;
++ wchar_t wc;
++ NODE *t2;
++ /*
++ * Since the lowercase char and its uppercase equivalent may occupy
++ * different number of bytes (Turkish `i'), we cannot say the length
++ * of the output string.
++ * This approach is adapted from format_tree().
++ */
++ unsigned char *obuf;
++ size_t osiz, ofre;
++
++ /*
++ * Better 2 spare bytes than 1, consistently with make_str_node().
++ * And we need gawk_mb_cur_max free bytes before we convert the last
++ * char, so we add (gawk_mb_cur_max - 1).
++ */
++ osiz = t1->stlen + 2 + (gawk_mb_cur_max - 1);
++ ofre = osiz - 2;
++ emalloc(obuf, char *, osiz, "wide_tolower_toupper");
++
++ memset(&mbs, 0, sizeof(mbstate_t));
++ cp = (unsigned char *)t1->stptr;
++ cpe = (unsigned char *)(t1->stptr + t1->stlen);
++ cp2 = obuf;
++ while (cp < cpe) {
++ if (ofre < gawk_mb_cur_max) {
++ size_t olen = cp2 - obuf;
++ ofre += osiz;
++ osiz *= 2;
++ erealloc(obuf, char *, osiz, "wide_tolower_toupper");
++ cp2 = obuf + olen;
++ }
++ prev_mbs = mbs;
++ mbclen = (size_t) mbrtowc(&wc, (char *) cp, cpe - cp,
++ &mbs);
++ if (mbclen == 0 || mbclen == (size_t) -1 || mbclen == (size_t) -2) {
++ /* Null wide char, or a problem appeared. */
++ *cp2++ = *cp++;
++ ofre--;
++ continue;
++ }
++
++ /* If the character doesn't need change, copy it. */
++ if (!(*iswu)(wc)) {
++ ofre -= mbclen;
++ while (mbclen--)
++ *cp2++ = *cp++;
++ continue;
++ }
++
++ /* Increment the input pointer. */
++ cp += mbclen;
++
++ /* Write the modified wide character. */
++ mbclen = wcrtomb((char *) cp2, (*towl)(wc), &prev_mbs);
++
++ if (mbclen > 0 && mbclen < (size_t) -2) {
++ /* Increment the output pointer. */
++ cp2 += mbclen;
++ ofre -= mbclen;
++ } else {
++ /* A problem appeared. */
++ cp2++;
++ ofre--;
++ }
++ }
++ t2 = make_str_node(obuf, cp2 - obuf, ALREADY_MALLOCED);
++ t2->flags |= TEMP;
++ return t2;
++#else
++ cant_happen();
++ return NULL;
++#endif
++}
++
+ /* do_tolower --- lower case a string */
+
+ NODE *
+ do_tolower(NODE *tree)
+ {
+ NODE *t1, *t2;
+- register unsigned char *cp, *cp2;
+-#ifdef MBS_SUPPORT
+- size_t mbclen = 0;
+- mbstate_t mbs, prev_mbs;
+- if (gawk_mb_cur_max > 1)
+- memset(&mbs, 0, sizeof(mbstate_t));
+-#endif
+
+ t1 = tree_eval(tree->lnode);
+ if (do_lint && (t1->flags & (STRING|STRCUR)) == 0)
+ lintwarn(_("tolower: received non-string argument"));
+ t1 = force_string(t1);
+- t2 = tmp_string(t1->stptr, t1->stlen);
+- for (cp = (unsigned char *)t2->stptr,
+- cp2 = (unsigned char *)(t2->stptr + t2->stlen); cp < cp2; cp++)
+-#ifdef MBS_SUPPORT
+- if (gawk_mb_cur_max > 1) {
+- wchar_t wc;
+- prev_mbs = mbs;
+- mbclen = (size_t) mbrtowc(&wc, (char *) cp, cp2 - cp,
+- &mbs);
+- if ((mbclen != 1) && (mbclen != (size_t) -1) &&
+- (mbclen != (size_t) -2) && (mbclen != 0)) {
+- /* a multibyte character. */
+- if (iswupper(wc)) {
+- wc = towlower(wc);
+- wcrtomb((char *) cp, wc, &prev_mbs);
+- }
+- /* Adjust the pointer. */
+- cp += mbclen - 1;
+- } else {
+- /* Otherwise we treat it as a singlebyte character. */
+- if (ISUPPER(*cp))
+- *cp = tolower(*cp);
+- }
+- } else
+-#endif
+- if (ISUPPER(*cp))
+- *cp = TOLOWER(*cp);
++
++ if (gawk_mb_cur_max > 1)
++ t2 = wide_tolower_toupper(t1, &iswupper, &towlower);
++ else {
++ register unsigned char *cp, *cpe;
++ t2 = tmp_string(t1->stptr, t1->stlen);
++ for (cp = (unsigned char *)t2->stptr,
++ cpe = (unsigned char *)(t2->stptr + t2->stlen); cp < cpe; cp++)
++ if (ISUPPER(*cp))
++ *cp = TOLOWER(*cp);
++ }
+ free_temp(t1);
+ return t2;
+ }
+@@ -1707,45 +1772,22 @@
+ do_toupper(NODE *tree)
+ {
+ NODE *t1, *t2;
+- register unsigned char *cp, *cp2;
+-#ifdef MBS_SUPPORT
+- size_t mbclen = 0;
+- mbstate_t mbs, prev_mbs;
+- if (gawk_mb_cur_max > 1)
+- memset(&mbs, 0, sizeof(mbstate_t));
+-#endif
+
+ t1 = tree_eval(tree->lnode);
+ if (do_lint && (t1->flags & (STRING|STRCUR)) == 0)
+ lintwarn(_("toupper: received non-string argument"));
+ t1 = force_string(t1);
+- t2 = tmp_string(t1->stptr, t1->stlen);
+- for (cp = (unsigned char *)t2->stptr,
+- cp2 = (unsigned char *)(t2->stptr + t2->stlen); cp < cp2; cp++)
+-#ifdef MBS_SUPPORT
+- if (gawk_mb_cur_max > 1) {
+- wchar_t wc;
+- prev_mbs = mbs;
+- mbclen = (size_t) mbrtowc(&wc, (char *) cp, cp2 - cp,
+- &mbs);
+- if ((mbclen != 1) && (mbclen != (size_t) -1) &&
+- (mbclen != (size_t) -2) && (mbclen != 0)) {
+- /* a multibyte character. */
+- if (iswlower(wc)) {
+- wc = towupper(wc);
+- wcrtomb((char *) cp, wc, &prev_mbs);
+- }
+- /* Adjust the pointer. */
+- cp += mbclen - 1;
+- } else {
+- /* Otherwise we treat it as a singlebyte character. */
+- if (ISLOWER(*cp))
+- *cp = toupper(*cp);
+- }
+- } else
+-#endif
+- if (ISLOWER(*cp))
+- *cp = TOUPPER(*cp);
++
++ if (gawk_mb_cur_max > 1)
++ t2 = wide_tolower_toupper(t1, &iswlower, &towupper);
++ else {
++ register unsigned char *cp, *cpe;
++ t2 = tmp_string(t1->stptr, t1->stlen);
++ for (cp = (unsigned char *)t2->stptr,
++ cpe = (unsigned char *)(t2->stptr + t2->stlen); cp < cpe; cp++)
++ if (ISLOWER(*cp))
++ *cp = TOUPPER(*cp);
++ }
+ free_temp(t1);
+ return t2;
+ }