public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: binutils + i18n
@ 2001-09-16  9:22 H . J . Lu
  2001-09-17  6:54 ` Nick Clifton
  2001-09-18 22:37 ` H . J . Lu
  0 siblings, 2 replies; 19+ messages in thread
From: H . J . Lu @ 2001-09-16  9:22 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

Here is a new patch. If there is no objection by next Tuesday, I
suggest we check it in. I will test it thoroughly on Linux under
LANG="en_US" by rebuilding a complete, working Linux/x86 and
Linux/mips.


H.J.
----
Delivered-To: hjl@lucon.org
From: Bruno Haible <haible@ilog.fr>
Date: Sun, 16 Sep 2001 17:46:16 +0200 (CEST)
To: Ian Lance Taylor <ian@zembu.com>
Cc: "H . J . Lu" <hjl@lucon.org>
Subject: Re: binutils + i18n
X-Mailer: VM 6.72 under 21.1 (patch 8) "Bryce Canyon" XEmacs Lucid

Ian Lance Taylor writes:

> I object, subject to further explanation.  I think that any patch
> ought to use the existing safe-ctype.h header file, rather than
> introduce a new c-ctype.h file.

H.J. Lu writes:
> I sugggest you update your patch so that onone objects it. Then
> we check it in and test it.

Here is an updated patch, relative to last week's CVS snapshot.
Please check it in soon. I worked three hours just to update it.



[-- Attachment #2: locale.patch.bz2 --]
[-- Type: application/x-bzip2, Size: 41871 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-09-16  9:22 PATCH: binutils + i18n H . J . Lu
@ 2001-09-17  6:54 ` Nick Clifton
  2001-09-18 22:37 ` H . J . Lu
  1 sibling, 0 replies; 19+ messages in thread
From: Nick Clifton @ 2001-09-17  6:54 UTC (permalink / raw)
  To: Bruno Haible, H . J . Lu; +Cc: binutils

Hi H.J.  Hi Bruno,

> Here is a new patch. If there is no objection by next Tuesday, I
> suggest we check it in. I will test it thoroughly on Linux under
> LANG="en_US" by rebuilding a complete, working Linux/x86 and
> Linux/mips.

Looks good to me.

Cheers
        Nick

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-09-16  9:22 PATCH: binutils + i18n H . J . Lu
  2001-09-17  6:54 ` Nick Clifton
@ 2001-09-18 22:37 ` H . J . Lu
  2001-09-19  1:06   ` Alan Modra
  1 sibling, 1 reply; 19+ messages in thread
From: H . J . Lu @ 2001-09-18 22:37 UTC (permalink / raw)
  To: binutils; +Cc: haible

On Sun, Sep 16, 2001 at 09:22:25AM -0700, H . J . Lu wrote:
> Here is a new patch. If there is no objection by next Tuesday, I
> suggest we check it in. I will test it thoroughly on Linux under
> LANG="en_US" by rebuilding a complete, working Linux/x86 and
> Linux/mips.
> 

FYI, since there were no objections, I checked it in. I tested the
native build on Linux/x86 with all BFD targets enabled, including
64bit BFD. I also tested the cross build to alpha-linux, arm-linux,
cris-linux, hppa-linux, ia64-linux, m68k-linux, mips64el-linux,
mips64-linux, mipsel-linux, build-mips-linux, ppc-linux, s390-linux,
s390x-linux, sh-linux, sparc64-linux and sparc-linux. Please report
any problems related to this checkin.


H.J.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-09-18 22:37 ` H . J . Lu
@ 2001-09-19  1:06   ` Alan Modra
  2001-09-19  8:39     ` H . J . Lu
  0 siblings, 1 reply; 19+ messages in thread
From: Alan Modra @ 2001-09-19  1:06 UTC (permalink / raw)
  To: H . J . Lu; +Cc: binutils

On Tue, Sep 18, 2001 at 10:37:35PM -0700, H . J . Lu wrote:
> 
> FYI, since there were no objections, I checked it in.

I'll bet no one checked over the patch in any detail.  :)

	* config/tc-i370.c: Fix typo in last change.

Index: gas/config/tc-i370.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i370.c,v
retrieving revision 1.11
diff -u -p -r1.11 tc-i370.c
--- tc-i370.c	2001/09/19 05:33:24	1.11
+++ tc-i370.c	2001/09/19 08:04:11
@@ -30,7 +30,7 @@
 
 #include <stdio.h>
 #include "as.h"
-#include "c=ctype.h"
+#include "safe-ctype.h"
 #include "subsegs.h"
 #include "struc-symbol.h"
 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-09-19  1:06   ` Alan Modra
@ 2001-09-19  8:39     ` H . J . Lu
  0 siblings, 0 replies; 19+ messages in thread
From: H . J . Lu @ 2001-09-19  8:39 UTC (permalink / raw)
  To: binutils

On Wed, Sep 19, 2001 at 05:35:49PM +0930, Alan Modra wrote:
> On Tue, Sep 18, 2001 at 10:37:35PM -0700, H . J . Lu wrote:
> > 
> > FYI, since there were no objections, I checked it in.
> 
> I'll bet no one checked over the patch in any detail.  :)
> 
> 	* config/tc-i370.c: Fix typo in last change.
> 

Thanks. I fixed one typo in the original patch. I am not sure if this
is the last one :-). Let's test it as much as we can.


H.J.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-09-19 11:53 ` H . J . Lu
  2001-09-20  8:56   ` Bruno Haible
@ 2001-10-20 15:24   ` H . J . Lu
  1 sibling, 0 replies; 19+ messages in thread
From: H . J . Lu @ 2001-10-20 15:24 UTC (permalink / raw)
  To: haible; +Cc: binutils

On Wed, Sep 19, 2001 at 11:53:52AM -0700, H . J . Lu wrote:
> On Tue, Sep 18, 2001 at 10:39:23PM -0700, H . J . Lu wrote:
> > On Sun, Sep 16, 2001 at 09:22:25AM -0700, H . J . Lu wrote:
> > > Here is a new patch. If there is no objection by next Tuesday, I
> > > suggest we check it in. I will test it thoroughly on Linux under
> > > LANG="en_US" by rebuilding a complete, working Linux/x86 and
> > > Linux/mips.
> > > 
> > 
> > FYI, since there were no objections, I checked it in. I tested the
> 

gas/config/tc-arm.c still uses isdigit:

# grep isdigit *.?
tc-arm.c:  if (!isdigit (*str) && *str != '-')
tc-arm.c:  for (imm = 0; *str && isdigit (*str); ++str)
tc-arm.c:  if (!isdigit (*p))
tc-arm.c:  for (offset = 0; *p && isdigit (*p); ++p)

Is that intentional?


H.J.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* re: PATCH: binutils + i18n
  2001-10-10  3:33       ` matthew green
  2001-10-10  6:33         ` Nick Clifton
@ 2001-10-20  9:26         ` Bruno Haible
  1 sibling, 0 replies; 19+ messages in thread
From: Bruno Haible @ 2001-10-20  9:26 UTC (permalink / raw)
  To: matthew green; +Cc: Nick Clifton, binutils, cgen

matthew green wrote on 10 October:

> my point is that locale shouldn't matter for a gas parser,
> except it's error messages.  whatever the locale, the input
> should be treated identically...

You are right, and my patch does exactly what you want.

Before this patch, the regular expression looked like
"move[ \t\n]*" and used case-insensitive comparison inside regexec,
i.e. it called tolower/toupper, which are locale dependent.

With the patch, the regular expression looks like
"[mM][oO][vV][eE][ \t\n]*" and uses case-sensitive comparison inside
regexec, i.e. no locale dependent calls. Also the conversion from
"move" to "[mM][oO][vV][eE]" uses the macros from "safe-ctype.h" which
are locale independent.

Bruno

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-10-10  3:33       ` matthew green
@ 2001-10-10  6:33         ` Nick Clifton
  2001-10-20  9:26         ` Bruno Haible
  1 sibling, 0 replies; 19+ messages in thread
From: Nick Clifton @ 2001-10-10  6:33 UTC (permalink / raw)
  To: matthew green; +Cc: binutils, cgen, Bruno Haible

Hi Matthew,

> hmm, my point is that locale shouldn't matter for a gas parser,
> except it's error messages.  whatever the locale, the input
> should be treated identically...

Right, and Bruno's patch is a partial fix for this problem.  Whilst it
does not remove all the locale affects from the parsing, it does mean
the parsing [for cgen generated assemblers] is now properly case
insensitive, regardless of locale.

Cheers
        Nick

^ permalink raw reply	[flat|nested] 19+ messages in thread

* re: PATCH: binutils + i18n
  2001-10-10  2:11     ` Nick Clifton
@ 2001-10-10  3:33       ` matthew green
  2001-10-10  6:33         ` Nick Clifton
  2001-10-20  9:26         ` Bruno Haible
  0 siblings, 2 replies; 19+ messages in thread
From: matthew green @ 2001-10-10  3:33 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, cgen, Bruno Haible

   
   >    opcodes/ChangeLog:
   >    2001-09-22  Bruno Haible  <haible@clisp.cons.org>
   >    
   >    	* cgen-asm.in (*_cgen_build_insn_regex): Generate a case sensitive
   >    	regular expression.  Fix some formatting problems.
   >    	* fr30-asm.c: Regenerate.
   >    	* openrisc-asm.c: Regenerate.
   >    	* m32r-asm.c: Regenerate.
   > 
   > hmmmmm..  do we really want to have instruction parsing be dependant
   > on locale?  shouldn't these parsers be static based on the instruction
   > set and thus ignore locale completely?
   
   Hmmm, I think that this would be good, but I suspect that it might need
   some customised regexp routines to achieve it.  I believe that the
   point of Bruno's patch is that passing the REG_ICASE flag to regcomp()
   does not work if the current locale is Turkish, (and probably some
   other locales as well).  So either regcomp needs to be fixed, or else
   Bruno's patch needs to be applied.
   
   For now I will assume that regcomp will not change, so I am going to
   check in his patch.


hmm, my point is that locale shouldn't matter for a gas parser,
except it's error messages.  whatever the locale, the input
should be treated identically...  (i may be confused and this
isn't the issue at hand.)



.mrg.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-10-09 16:29   ` matthew green
@ 2001-10-10  2:11     ` Nick Clifton
  2001-10-10  3:33       ` matthew green
  0 siblings, 1 reply; 19+ messages in thread
From: Nick Clifton @ 2001-10-10  2:11 UTC (permalink / raw)
  To: matthew green; +Cc: binutils, cgen, Bruno Haible

Hi Matthew,

>    opcodes/ChangeLog:
>    2001-09-22  Bruno Haible  <haible@clisp.cons.org>
>    
>    	* cgen-asm.in (*_cgen_build_insn_regex): Generate a case sensitive
>    	regular expression.  Fix some formatting problems.
>    	* fr30-asm.c: Regenerate.
>    	* openrisc-asm.c: Regenerate.
>    	* m32r-asm.c: Regenerate.
> 
> hmmmmm..  do we really want to have instruction parsing be dependant
> on locale?  shouldn't these parsers be static based on the instruction
> set and thus ignore locale completely?

Hmmm, I think that this would be good, but I suspect that it might need
some customised regexp routines to achieve it.  I believe that the
point of Bruno's patch is that passing the REG_ICASE flag to regcomp()
does not work if the current locale is Turkish, (and probably some
other locales as well).  So either regcomp needs to be fixed, or else
Bruno's patch needs to be applied.

For now I will assume that regcomp will not change, so I am going to
check in his patch.

Cheers
        Nick

^ permalink raw reply	[flat|nested] 19+ messages in thread

* re: PATCH: binutils + i18n
  2001-10-09 10:55 ` Nick Clifton
@ 2001-10-09 16:29   ` matthew green
  2001-10-10  2:11     ` Nick Clifton
  0 siblings, 1 reply; 19+ messages in thread
From: matthew green @ 2001-10-09 16:29 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, cgen, Bruno Haible

   
   opcodes/ChangeLog:
   2001-09-22  Bruno Haible  <haible@clisp.cons.org>
   
   	* cgen-asm.in (*_cgen_build_insn_regex): Generate a case sensitive
   	regular expression.  Fix some formatting problems.
   	* fr30-asm.c: Regenerate.
   	* openrisc-asm.c: Regenerate.
   	* m32r-asm.c: Regenerate.

hmmmmm..  do we really want to have instruction parsing be dependant
on locale?  shouldn't these parsers be static based on the instruction
set and thus ignore locale completely?


.mrg.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-09-22  8:09 Bruno Haible
  2001-09-22  9:52 ` Andreas Jaeger
@ 2001-10-09 10:55 ` Nick Clifton
  2001-10-09 16:29   ` matthew green
  1 sibling, 1 reply; 19+ messages in thread
From: Nick Clifton @ 2001-10-09 10:55 UTC (permalink / raw)
  To: cgen, Bruno Haible; +Cc: binutils

Hi Bruno,

> Here is the promised patch to get rid of the locale dependency of
> case conversion in regcomp/regexec calls.
> 
> This is three times the same patch, to files marked as "generated by 
> CGEN". It would be a good idea to apply this patch to CGEN also, but I
> don't know where its sources reside.

On the other hand I do :-)  It is the file cgen-asm.in in the opcodes
directory.  So here is your patch, applied to that file.  I am
forwarding this patch to the cgen project so that they can approve it,
and when/if they do I will check it in, together with the regenerated
files.

So - CGEN MAINTAINERS - may I apply Bruno's patch ?

Cheers
        Nick

opcodes/ChangeLog:
2001-09-22  Bruno Haible  <haible@clisp.cons.org>

	* cgen-asm.in (*_cgen_build_insn_regex): Generate a case sensitive
	regular expression.  Fix some formatting problems.
	* fr30-asm.c: Regenerate.
	* openrisc-asm.c: Regenerate.
	* m32r-asm.c: Regenerate.

Index: cgen-asm.in
===================================================================
RCS file: /cvs/src/src/opcodes/cgen-asm.in,v
retrieving revision 1.8
diff -p -r1.8 cgen-asm.in
*** cgen-asm.in	2001/10/09 08:54:57	1.8
--- cgen-asm.in	2001/10/09 17:51:31
*************** char * 
*** 74,140 ****
  
    syn = CGEN_SYNTAX_STRING (CGEN_OPCODE_SYNTAX (opc));
  
!   /* Mnemonics come first in the syntax string  */
!   if (! CGEN_SYNTAX_MNEMONIC_P (* syn)) return "missing mnemonic in syntax string";
    ++syn;
  
!   /* copy the literal mnemonic out of the insn */
!   memset (rx, 0, CGEN_MAX_RX_ELEMENTS);
!   mnem_len = strlen(mnem);
!   memcpy (rx, mnem, mnem_len);
!   rx += mnem_len;
  
!   /* copy any remaining literals from the syntax string into the rx */
!   for(; * syn != 0 && rx < rxbuf + (CGEN_MAX_RX_ELEMENTS - 9); ++syn, ++rx) 
      {
        if (CGEN_SYNTAX_CHAR_P (* syn)) 
  	{
! 	 char tmp = CGEN_SYNTAX_CHAR (* syn);
! 	 switch (tmp) 
!            {
! 	     /* escape any regex metacharacters in the syntax */
! 	   case '.': case '[': case '\\': 
! 	   case '*': case '^': case '$': 
  
  #ifdef CGEN_ESCAPE_EXTENDED_REGEX
! 	   case '?': case '{': case '}': 
! 	   case '(': case ')': case '*':
! 	   case '|': case '+': case ']':
  #endif
  
! 	     * rx++ = '\\';
! 	     break;  
! 	   }
! 	 /* insert syntax char into rx */
! 	* rx = tmp;
  	}
        else
  	{
! 	  /* replace non-syntax fields with globs */
! 	  * rx = '.';
! 	  * ++rx = '*';
  	}
      }
  
!   /* trailing whitespace ok */
    * rx++ = '['; 
    * rx++ = ' '; 
    * rx++ = '\t'; 
    * rx++ = ']'; 
    * rx++ = '*'; 
  
!   /* but anchor it after that */
    * rx++ = '$'; 
    * rx = '\0';
  
    CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t));
!   reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB|REG_ICASE);
  
    if (reg_err == 0) 
      return NULL;
    else
      {
        static char msg[80];
        regerror (reg_err, (regex_t *) CGEN_INSN_RX (insn), msg, 80);
        regfree ((regex_t *) CGEN_INSN_RX (insn));
        free (CGEN_INSN_RX (insn));
--- 74,171 ----
  
    syn = CGEN_SYNTAX_STRING (CGEN_OPCODE_SYNTAX (opc));
  
!   /* Mnemonics come first in the syntax string.  */
!   if (! CGEN_SYNTAX_MNEMONIC_P (* syn))
!     return _("missing mnemonic in syntax string");
    ++syn;
+ 
+   /* Generate a case sensitive regular expression that emulates case
+      insensitive matching in the "C" locale.  We cannot generate a case
+      insensitive regular expression because in Turkish locales, 'i' and 'I'
+      are not equal modulo case conversion.  */
+ 
+   /* Copy the literal mnemonic out of the insn.  */
+   for (; *mnem; mnem++)
+     {
+       char c = *mnem;
  
!       if (ISALPHA (c))
! 	{
! 	  *rx++ = '[';
! 	  *rx++ = TOLOWER (c);
! 	  *rx++ = TOUPPER (c);
! 	  *rx++ = ']';
! 	}
!       else
! 	*rx++ = c;
!     }
  
!   /* Copy any remaining literals from the syntax string into the rx.  */
!   for(; * syn != 0 && rx <= rxbuf + (CGEN_MAX_RX_ELEMENTS - 7 - 4); ++syn)
      {
        if (CGEN_SYNTAX_CHAR_P (* syn)) 
  	{
! 	  char c = CGEN_SYNTAX_CHAR (* syn);
  
+ 	  switch (c) 
+ 	    {
+ 	      /* Escape any regex metacharacters in the syntax.  */
+ 	    case '.': case '[': case '\\': 
+ 	    case '*': case '^': case '$': 
+ 
  #ifdef CGEN_ESCAPE_EXTENDED_REGEX
! 	    case '?': case '{': case '}': 
! 	    case '(': case ')': case '*':
! 	    case '|': case '+': case ']':
  #endif
+ 	      *rx++ = '\\';
+ 	      *rx++ = c;
+ 	      break;
+ 
+ 	    default:
+ 	      if (ISALPHA (c))
+ 		{
+ 		  *rx++ = '[';
+ 		  *rx++ = TOLOWER (c);
+ 		  *rx++ = TOUPPER (c);
+ 		  *rx++ = ']';
+ 		}
+ 	      else
+ 		*rx++ = c;
+ 	      break;
+ 	    }
  
! 	  /* Insert syntax char into rx.  */
! 	  *rx++ = c;
  	}
        else
  	{
! 	  /* Replace non-syntax fields with globs.  */
! 	  *rx++ = '.';
! 	  *rx++ = '*';
  	}
      }
  
!   /* Trailing whitespace ok.  */
    * rx++ = '['; 
    * rx++ = ' '; 
    * rx++ = '\t'; 
    * rx++ = ']'; 
    * rx++ = '*'; 
  
!   /* But anchor it after that.  */
    * rx++ = '$'; 
    * rx = '\0';
  
    CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t));
!   reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB);
  
    if (reg_err == 0) 
      return NULL;
    else
      {
        static char msg[80];
+ 
        regerror (reg_err, (regex_t *) CGEN_INSN_RX (insn), msg, 80);
        regfree ((regex_t *) CGEN_INSN_RX (insn));
        free (CGEN_INSN_RX (insn));

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-09-22  9:52 ` Andreas Jaeger
@ 2001-09-22 10:24   ` Bruno Haible
  0 siblings, 0 replies; 19+ messages in thread
From: Bruno Haible @ 2001-09-22 10:24 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: binutils

Andreas Jaeger writes:

> The top level maintainers mentions:
> cgen/; cgen parts of opcodes/, sim/ & include/
> 	cgen: http://sources.redhat.com/cgen/
> 	Patches to cgen@sources.redhat.com

Thanks for the pointer.

Actually, CGEN now doesn't use case-insensitive regular expressions.
Either it was in CGEN and has been removed, or the files fr30-asm.c,
openrisc-asm.c, m32r-asm.c were modified after being generated by
CGEN. In any case, my patch to binutils is complete and CGEN doesn't
need modifications

Bruno

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-09-22  8:09 Bruno Haible
@ 2001-09-22  9:52 ` Andreas Jaeger
  2001-09-22 10:24   ` Bruno Haible
  2001-10-09 10:55 ` Nick Clifton
  1 sibling, 1 reply; 19+ messages in thread
From: Andreas Jaeger @ 2001-09-22  9:52 UTC (permalink / raw)
  To: Bruno Haible; +Cc: binutils

Bruno Haible <haible@ilog.fr> writes:

> Here is the promised patch to get rid of the locale dependency of case
> conversion in regcomp/regexec calls.
>
> This is three times the same patch, to files marked as "generated by
> CGEN". It would be a good idea to apply this patch to CGEN also, but I
> don't know where its sources reside.

If you check out the full sourceware archive, you get a cgen
subdirectory.

The top level maintainers mentions:
cgen/; cgen parts of opcodes/, sim/ & include/
	cgen: http://sources.redhat.com/cgen/
	Patches to cgen@sources.redhat.com
	May need separate opcodes/ or sim/ approval for
		commits of regenerated files there.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
@ 2001-09-22  8:09 Bruno Haible
  2001-09-22  9:52 ` Andreas Jaeger
  2001-10-09 10:55 ` Nick Clifton
  0 siblings, 2 replies; 19+ messages in thread
From: Bruno Haible @ 2001-09-22  8:09 UTC (permalink / raw)
  To: binutils

Here is the promised patch to get rid of the locale dependency of case
conversion in regcomp/regexec calls.

This is three times the same patch, to files marked as "generated by
CGEN". It would be a good idea to apply this patch to CGEN also, but I
don't know where its sources reside.


opcodes/ChangeLog:
2001-09-22  Bruno Haible  <haible@clisp.cons.org>

	* fr30-asm.c (fr30_cgen_build_insn_regex): Generate a case sensitive
	regular expression.
	* openrisc-asm.c (openrisc_cgen_build_insn_regex): Likewise.
	* m32r-asm.c (m32r_cgen_build_insn_regex): Likewise.

*** binutils-010912/opcodes/fr30-asm.c.bak	Sat Sep 15 17:08:26 2001
--- binutils-010912/opcodes/fr30-asm.c	Sat Sep 22 01:25:18 2001
*************** fr30_cgen_build_insn_regex (insn)
*** 346,352 ****
  {  
    CGEN_OPCODE *opc = CGEN_INSN_OPCODE (insn);
    const char *mnem = CGEN_INSN_MNEMONIC (insn);
-   int mnem_len;
    char rxbuf[CGEN_MAX_RX_ELEMENTS];
    char *rx = rxbuf;
    const CGEN_SYNTAX_CHAR_TYPE *syn;
--- 346,351 ----
*************** fr30_cgen_build_insn_regex (insn)
*** 358,398 ****
    if (! CGEN_SYNTAX_MNEMONIC_P (* syn)) return "missing mnemonic in syntax string";
    ++syn;
  
    /* copy the literal mnemonic out of the insn */
!   memset (rx, 0, CGEN_MAX_RX_ELEMENTS);
!   mnem_len = strlen(mnem);
!   memcpy (rx, mnem, mnem_len);
!   rx += mnem_len;
  
    /* copy any remaining literals from the syntax string into the rx */
!   for(; * syn != 0 && rx < rxbuf + (CGEN_MAX_RX_ELEMENTS - 9); ++syn, ++rx) 
      {
        if (CGEN_SYNTAX_CHAR_P (* syn)) 
  	{
! 	 char tmp = CGEN_SYNTAX_CHAR (* syn);
! 	 switch (tmp) 
!            {
! 	     /* escape any regex metacharacters in the syntax */
! 	   case '.': case '[': case '\\': 
! 	   case '*': case '^': case '$': 
  
  #ifdef CGEN_ESCAPE_EXTENDED_REGEX
! 	   case '?': case '{': case '}': 
! 	   case '(': case ')': case '*':
! 	   case '|': case '+': case ']':
  #endif
  
! 	     * rx++ = '\\';
! 	     break;  
! 	   }
! 	 /* insert syntax char into rx */
! 	* rx = tmp;
  	}
        else
  	{
  	  /* replace non-syntax fields with globs */
! 	  * rx = '.';
! 	  * ++rx = '*';
  	}
      }
  
--- 357,424 ----
    if (! CGEN_SYNTAX_MNEMONIC_P (* syn)) return "missing mnemonic in syntax string";
    ++syn;
  
+   /* Generate a case sensitive regular expression that emulates case
+      insensitive matching in the "C" locale.  We cannot generate a case
+      insensitive regular expression because in Turkish locales, 'i' and 'I'
+      are not equal modulo case conversion.  */
+ 
    /* copy the literal mnemonic out of the insn */
!   for (; *mnem; mnem++)
!     {
!       char c = *mnem;
! 
!       if (ISALPHA (c))
! 	{
! 	  *rx++ = '[';
! 	  *rx++ = TOLOWER (c);
! 	  *rx++ = TOUPPER (c);
! 	  *rx++ = ']';
! 	}
!       else
! 	*rx++ = c;
!     }
  
    /* copy any remaining literals from the syntax string into the rx */
!   for(; * syn != 0 && rx <= rxbuf + (CGEN_MAX_RX_ELEMENTS - 7 - 4); ++syn)
      {
        if (CGEN_SYNTAX_CHAR_P (* syn)) 
  	{
! 	  char c = CGEN_SYNTAX_CHAR (* syn);
! 	  switch (c) 
! 	    {
! 	      /* escape any regex metacharacters in the syntax */
! 	    case '.': case '[': case '\\': 
! 	    case '*': case '^': case '$': 
  
  #ifdef CGEN_ESCAPE_EXTENDED_REGEX
! 	    case '?': case '{': case '}': 
! 	    case '(': case ')': case '*':
! 	    case '|': case '+': case ']':
  #endif
  
! 	      *rx++ = '\\';
! 	      *rx++ = c;
! 	      break;
! 	    default:
! 	      if (ISALPHA (c))
! 		{
! 		  *rx++ = '[';
! 		  *rx++ = TOLOWER (c);
! 		  *rx++ = TOUPPER (c);
! 		  *rx++ = ']';
! 		}
! 	      else
! 		*rx++ = c;
! 	      break;
! 	    }
! 	  /* insert syntax char into rx */
! 	  *rx++ = c;
  	}
        else
  	{
  	  /* replace non-syntax fields with globs */
! 	  *rx++ = '.';
! 	  *rx++ = '*';
  	}
      }
  
*************** fr30_cgen_build_insn_regex (insn)
*** 408,414 ****
    * rx = '\0';
  
    CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t));
!   reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB|REG_ICASE);
  
    if (reg_err == 0) 
      return NULL;
--- 434,440 ----
    * rx = '\0';
  
    CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t));
!   reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB);
  
    if (reg_err == 0) 
      return NULL;
*** binutils-010912/opcodes/openrisc-asm.c.bak	Sat Sep 15 17:12:27 2001
--- binutils-010912/opcodes/openrisc-asm.c	Sat Sep 22 01:25:22 2001
*************** openrisc_cgen_build_insn_regex (insn)
*** 278,284 ****
  {  
    CGEN_OPCODE *opc = CGEN_INSN_OPCODE (insn);
    const char *mnem = CGEN_INSN_MNEMONIC (insn);
-   int mnem_len;
    char rxbuf[CGEN_MAX_RX_ELEMENTS];
    char *rx = rxbuf;
    const CGEN_SYNTAX_CHAR_TYPE *syn;
--- 278,283 ----
*************** openrisc_cgen_build_insn_regex (insn)
*** 290,330 ****
    if (! CGEN_SYNTAX_MNEMONIC_P (* syn)) return "missing mnemonic in syntax string";
    ++syn;
  
    /* copy the literal mnemonic out of the insn */
!   memset (rx, 0, CGEN_MAX_RX_ELEMENTS);
!   mnem_len = strlen(mnem);
!   memcpy (rx, mnem, mnem_len);
!   rx += mnem_len;
  
    /* copy any remaining literals from the syntax string into the rx */
!   for(; * syn != 0 && rx < rxbuf + (CGEN_MAX_RX_ELEMENTS - 9); ++syn, ++rx) 
      {
        if (CGEN_SYNTAX_CHAR_P (* syn)) 
  	{
! 	 char tmp = CGEN_SYNTAX_CHAR (* syn);
! 	 switch (tmp) 
!            {
! 	     /* escape any regex metacharacters in the syntax */
! 	   case '.': case '[': case '\\': 
! 	   case '*': case '^': case '$': 
  
  #ifdef CGEN_ESCAPE_EXTENDED_REGEX
! 	   case '?': case '{': case '}': 
! 	   case '(': case ')': case '*':
! 	   case '|': case '+': case ']':
  #endif
  
! 	     * rx++ = '\\';
! 	     break;  
! 	   }
! 	 /* insert syntax char into rx */
! 	* rx = tmp;
  	}
        else
  	{
  	  /* replace non-syntax fields with globs */
! 	  * rx = '.';
! 	  * ++rx = '*';
  	}
      }
  
--- 289,356 ----
    if (! CGEN_SYNTAX_MNEMONIC_P (* syn)) return "missing mnemonic in syntax string";
    ++syn;
  
+   /* Generate a case sensitive regular expression that emulates case
+      insensitive matching in the "C" locale.  We cannot generate a case
+      insensitive regular expression because in Turkish locales, 'i' and 'I'
+      are not equal modulo case conversion.  */
+ 
    /* copy the literal mnemonic out of the insn */
!   for (; *mnem; mnem++)
!     {
!       char c = *mnem;
! 
!       if (ISALPHA (c))
! 	{
! 	  *rx++ = '[';
! 	  *rx++ = TOLOWER (c);
! 	  *rx++ = TOUPPER (c);
! 	  *rx++ = ']';
! 	}
!       else
! 	*rx++ = c;
!     }
  
    /* copy any remaining literals from the syntax string into the rx */
!   for(; * syn != 0 && rx <= rxbuf + (CGEN_MAX_RX_ELEMENTS - 7 - 4); ++syn)
      {
        if (CGEN_SYNTAX_CHAR_P (* syn)) 
  	{
! 	  char c = CGEN_SYNTAX_CHAR (* syn);
! 	  switch (c) 
! 	    {
! 	      /* escape any regex metacharacters in the syntax */
! 	    case '.': case '[': case '\\': 
! 	    case '*': case '^': case '$': 
  
  #ifdef CGEN_ESCAPE_EXTENDED_REGEX
! 	    case '?': case '{': case '}': 
! 	    case '(': case ')': case '*':
! 	    case '|': case '+': case ']':
  #endif
  
! 	      *rx++ = '\\';
! 	      *rx++ = c;
! 	      break;
! 	    default:
! 	      if (ISALPHA (c))
! 		{
! 		  *rx++ = '[';
! 		  *rx++ = TOLOWER (c);
! 		  *rx++ = TOUPPER (c);
! 		  *rx++ = ']';
! 		}
! 	      else
! 		*rx++ = c;
! 	      break;
! 	    }
! 	  /* insert syntax char into rx */
! 	  *rx++ = c;
  	}
        else
  	{
  	  /* replace non-syntax fields with globs */
! 	  *rx++ = '.';
! 	  *rx++ = '*';
  	}
      }
  
*************** openrisc_cgen_build_insn_regex (insn)
*** 340,346 ****
    * rx = '\0';
  
    CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t));
!   reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB|REG_ICASE);
  
    if (reg_err == 0) 
      return NULL;
--- 366,372 ----
    * rx = '\0';
  
    CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t));
!   reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB);
  
    if (reg_err == 0) 
      return NULL;
*** binutils-010912/opcodes/m32r-asm.c.bak	Sat Sep 15 17:09:32 2001
--- binutils-010912/opcodes/m32r-asm.c	Sat Sep 22 01:25:26 2001
*************** m32r_cgen_build_insn_regex (insn)
*** 354,360 ****
  {  
    CGEN_OPCODE *opc = CGEN_INSN_OPCODE (insn);
    const char *mnem = CGEN_INSN_MNEMONIC (insn);
-   int mnem_len;
    char rxbuf[CGEN_MAX_RX_ELEMENTS];
    char *rx = rxbuf;
    const CGEN_SYNTAX_CHAR_TYPE *syn;
--- 354,359 ----
*************** m32r_cgen_build_insn_regex (insn)
*** 366,406 ****
    if (! CGEN_SYNTAX_MNEMONIC_P (* syn)) return "missing mnemonic in syntax string";
    ++syn;
  
    /* copy the literal mnemonic out of the insn */
!   memset (rx, 0, CGEN_MAX_RX_ELEMENTS);
!   mnem_len = strlen(mnem);
!   memcpy (rx, mnem, mnem_len);
!   rx += mnem_len;
  
    /* copy any remaining literals from the syntax string into the rx */
!   for(; * syn != 0 && rx < rxbuf + (CGEN_MAX_RX_ELEMENTS - 9); ++syn, ++rx) 
      {
        if (CGEN_SYNTAX_CHAR_P (* syn)) 
  	{
! 	 char tmp = CGEN_SYNTAX_CHAR (* syn);
! 	 switch (tmp) 
!            {
! 	     /* escape any regex metacharacters in the syntax */
! 	   case '.': case '[': case '\\': 
! 	   case '*': case '^': case '$': 
  
  #ifdef CGEN_ESCAPE_EXTENDED_REGEX
! 	   case '?': case '{': case '}': 
! 	   case '(': case ')': case '*':
! 	   case '|': case '+': case ']':
  #endif
  
! 	     * rx++ = '\\';
! 	     break;  
! 	   }
! 	 /* insert syntax char into rx */
! 	* rx = tmp;
  	}
        else
  	{
  	  /* replace non-syntax fields with globs */
! 	  * rx = '.';
! 	  * ++rx = '*';
  	}
      }
  
--- 365,432 ----
    if (! CGEN_SYNTAX_MNEMONIC_P (* syn)) return "missing mnemonic in syntax string";
    ++syn;
  
+   /* Generate a case sensitive regular expression that emulates case
+      insensitive matching in the "C" locale.  We cannot generate a case
+      insensitive regular expression because in Turkish locales, 'i' and 'I'
+      are not equal modulo case conversion.  */
+ 
    /* copy the literal mnemonic out of the insn */
!   for (; *mnem; mnem++)
!     {
!       char c = *mnem;
! 
!       if (ISALPHA (c))
! 	{
! 	  *rx++ = '[';
! 	  *rx++ = TOLOWER (c);
! 	  *rx++ = TOUPPER (c);
! 	  *rx++ = ']';
! 	}
!       else
! 	*rx++ = c;
!     }
  
    /* copy any remaining literals from the syntax string into the rx */
!   for(; * syn != 0 && rx <= rxbuf + (CGEN_MAX_RX_ELEMENTS - 7 - 4); ++syn)
      {
        if (CGEN_SYNTAX_CHAR_P (* syn)) 
  	{
! 	  char c = CGEN_SYNTAX_CHAR (* syn);
! 	  switch (c) 
! 	    {
! 	      /* escape any regex metacharacters in the syntax */
! 	    case '.': case '[': case '\\': 
! 	    case '*': case '^': case '$': 
  
  #ifdef CGEN_ESCAPE_EXTENDED_REGEX
! 	    case '?': case '{': case '}': 
! 	    case '(': case ')': case '*':
! 	    case '|': case '+': case ']':
  #endif
  
! 	      *rx++ = '\\';
! 	      *rx++ = c;
! 	      break;
! 	    default:
! 	      if (ISALPHA (c))
! 		{
! 		  *rx++ = '[';
! 		  *rx++ = TOLOWER (c);
! 		  *rx++ = TOUPPER (c);
! 		  *rx++ = ']';
! 		}
! 	      else
! 		*rx++ = c;
! 	      break;
! 	    }
! 	  /* insert syntax char into rx */
! 	  *rx++ = c;
  	}
        else
  	{
  	  /* replace non-syntax fields with globs */
! 	  *rx++ = '.';
! 	  *rx++ = '*';
  	}
      }
  
*************** m32r_cgen_build_insn_regex (insn)
*** 416,422 ****
    * rx = '\0';
  
    CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t));
!   reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB|REG_ICASE);
  
    if (reg_err == 0) 
      return NULL;
--- 442,448 ----
    * rx = '\0';
  
    CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t));
!   reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB);
  
    if (reg_err == 0) 
      return NULL;

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-09-20  8:56   ` Bruno Haible
@ 2001-09-21  5:40     ` Alan Modra
  0 siblings, 0 replies; 19+ messages in thread
From: Alan Modra @ 2001-09-21  5:40 UTC (permalink / raw)
  To: Bruno Haible; +Cc: H . J . Lu, binutils

On Thu, Sep 20, 2001 at 05:57:06PM +0200, Bruno Haible wrote:
> gas/ChangeLog:
> 2001-09-19  Bruno Haible  <haible@clisp.cons.org>
> 
> 	* config/tc-openrisc.c: Don't include <ctype.h>.
> 
> opcodes/ChangeLog:
> 2001-09-19  Bruno Haible  <haible@clisp.cons.org>
> 
> 	* arc-dis.c: Don't include <ctype.h>.
> 	* openrisc-desc.c: Likewise.
> 	* openrisc-ibld.c: Likewise.

Committed.

Alan

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
  2001-09-19 11:53 ` H . J . Lu
@ 2001-09-20  8:56   ` Bruno Haible
  2001-09-21  5:40     ` Alan Modra
  2001-10-20 15:24   ` H . J . Lu
  1 sibling, 1 reply; 19+ messages in thread
From: Bruno Haible @ 2001-09-20  8:56 UTC (permalink / raw)
  To: H . J . Lu; +Cc: binutils

H . J . Lu writes:

> There are still a few "#include <ctype.h>" left:
> 
> ./include/mpw/mpw.h:#include <ctype.h>

This code doesn't appear to be included by any of the real binutils files.

> ./bfd/doc/chew.c:#include <ctype.h>

This is a standalone program which doesn't use gettext and can therefore
continue to use <ctype.h>.

> ./opcodes/arc-dis.c:#include <ctype.h>
> ./opcodes/openrisc-desc.c:#include <ctype.h>
> ./opcodes/openrisc-ibld.c:#include <ctype.h>
> ./gas/config/tc-openrisc.c:#include <ctype.h>

Please find below a patch for these.

> ./intl/finddomain.c:#include <ctype.h>
> ./intl/l10nflist.c:#include <ctype.h>
> ./intl/localealias.c:#include <ctype.h>

These deal really with internationalizable strings. No need to change them.

> ./libiberty/regex.c:#  include <wctype.h>
> ./libiberty/regex.c:# include <ctype.h>

grep 're[_g]\(comp\|exec\)' shows that these LC_CTYPE dependent functions
are indeed used, in
  opcodes/fr30-asm.c
  opcodes/m32r-asm.c
  opcodes/m32r-asm.c
But the regular expressions are all of the form "fixedpart.*fixedpart[ \t]*$".
(See m32r_cgen_build_insn_regex et al.) Therefore its i18n dependency is
reduced to the locale dependent case comparison. Which means that the only
problem is that in a turkish locale,
  1. 'i' and 'I' won't be recognized as equivalent
  2. that the 'i without dot' and 'I with dot above' characters would become
     valid in assembler source.
(2) is not important, but (1) is critical, because it means that some
assembler source which compiles in most locales of the world will not pass
in turkish locale. I will work on a patch for this.

Bruno


===================================================================
Here is the first additional patch.

gas/ChangeLog:
2001-09-19  Bruno Haible  <haible@clisp.cons.org>

	* config/tc-openrisc.c: Don't include <ctype.h>.

opcodes/ChangeLog:
2001-09-19  Bruno Haible  <haible@clisp.cons.org>

	* arc-dis.c: Don't include <ctype.h>.
	* openrisc-desc.c: Likewise.
	* openrisc-ibld.c: Likewise.

*** gas/config/tc-openrisc.c.bak	Thu May 10 13:32:52 2001
--- gas/config/tc-openrisc.c	Thu Sep 20 03:17:43 2001
***************
*** 20,26 ****
     Boston, MA 02111-1307, USA.  */
  
  #include <stdio.h>
- #include <ctype.h>
  #include "as.h"
  #include "subsegs.h"
  #include "symcat.h"
--- 20,25 ----
*** opcodes/arc-dis.c.bak	Thu Sep 20 03:20:28 2001
--- opcodes/arc-dis.c	Thu Sep 20 03:20:47 2001
***************
*** 26,32 ****
  #include <string.h>
  #include "opintl.h"
  
- #include <ctype.h>
  #include <stdarg.h>
  #include "arc-dis.h"
  #include "arc-ext.h"
--- 26,31 ----
*** opcodes/openrisc-desc.c.bak	Sun Aug 12 22:16:29 2001
--- opcodes/openrisc-desc.c	Thu Sep 20 03:23:55 2001
***************
*** 23,29 ****
  */
  
  #include "sysdep.h"
- #include <ctype.h>
  #include <stdio.h>
  #include <stdarg.h>
  #include "ansidecl.h"
--- 23,28 ----
*** opcodes/openrisc-ibld.c.bak	Sun Aug 12 22:16:29 2001
--- opcodes/openrisc-ibld.c	Thu Sep 20 03:23:55 2001
***************
*** 25,31 ****
     Keep that in mind.  */
  
  #include "sysdep.h"
- #include <ctype.h>
  #include <stdio.h>
  #include "ansidecl.h"
  #include "dis-asm.h"
--- 25,30 ----

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
@ 2001-09-20  3:44 Peter.Targett
  0 siblings, 0 replies; 19+ messages in thread
From: Peter.Targett @ 2001-09-20  3:44 UTC (permalink / raw)
  To: binutils

> There are still a few "#include <ctype.h>" left:

> # find -name *.[ch] | xargs grep ctype.h | grep  include | grep -v
safe-ctype.h
> ./opcodes/arc-dis.c:#include <ctype.h>
> ...

I tested this #include by removing it since ./opcodes/arc-dis.c did'nt appear
to make any references to isspace(), etc..

Index: opcodes/arc-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/arc-dis.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 arc-dis.c
*** arc-dis.c  2001/08/21 08:51:12 1.5
--- arc-dis.c  2001/09/20 10:32:53
***************
*** 26,32 ****
  #include <string.h>
  #include "opintl.h"

- #include <ctype.h>
  #include <stdarg.h>
  #include "arc-dis.h"
  #include "arc-ext.h"
--- 26,31 ----

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: PATCH: binutils + i18n
       [not found] <20010918223923.A20929@lucon.org>
@ 2001-09-19 11:53 ` H . J . Lu
  2001-09-20  8:56   ` Bruno Haible
  2001-10-20 15:24   ` H . J . Lu
  0 siblings, 2 replies; 19+ messages in thread
From: H . J . Lu @ 2001-09-19 11:53 UTC (permalink / raw)
  To: haible; +Cc: binutils

On Tue, Sep 18, 2001 at 10:39:23PM -0700, H . J . Lu wrote:
> On Sun, Sep 16, 2001 at 09:22:25AM -0700, H . J . Lu wrote:
> > Here is a new patch. If there is no objection by next Tuesday, I
> > suggest we check it in. I will test it thoroughly on Linux under
> > LANG="en_US" by rebuilding a complete, working Linux/x86 and
> > Linux/mips.
> > 
> 
> FYI, since there were no objections, I checked it in. I tested the

Hi Bruno,

There are still a few "#include <ctype.h>" left:

# find -name *.[ch] | xargs grep ctype.h | grep  include | grep -v safe-ctype.h
./opcodes/arc-dis.c:#include <ctype.h>
./opcodes/openrisc-desc.c:#include <ctype.h>
./opcodes/openrisc-ibld.c:#include <ctype.h>
./bfd/doc/chew.c:#include <ctype.h>
./libiberty/regex.c:#  include <wctype.h>
./libiberty/regex.c:# include <ctype.h>
./include/mpw/mpw.h:#include <ctype.h>
./gas/config/tc-openrisc.c:#include <ctype.h>
./intl/finddomain.c:#include <ctype.h>
./intl/l10nflist.c:#include <ctype.h>
./intl/localealias.c:#include <ctype.h>

Could you please double check them?

Thanks.


H.J.

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2001-10-20 15:24 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-16  9:22 PATCH: binutils + i18n H . J . Lu
2001-09-17  6:54 ` Nick Clifton
2001-09-18 22:37 ` H . J . Lu
2001-09-19  1:06   ` Alan Modra
2001-09-19  8:39     ` H . J . Lu
     [not found] <20010918223923.A20929@lucon.org>
2001-09-19 11:53 ` H . J . Lu
2001-09-20  8:56   ` Bruno Haible
2001-09-21  5:40     ` Alan Modra
2001-10-20 15:24   ` H . J . Lu
2001-09-20  3:44 Peter.Targett
2001-09-22  8:09 Bruno Haible
2001-09-22  9:52 ` Andreas Jaeger
2001-09-22 10:24   ` Bruno Haible
2001-10-09 10:55 ` Nick Clifton
2001-10-09 16:29   ` matthew green
2001-10-10  2:11     ` Nick Clifton
2001-10-10  3:33       ` matthew green
2001-10-10  6:33         ` Nick Clifton
2001-10-20  9:26         ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).