merge from gcc
[external/binutils.git] / opcodes / maxq-dis.c
index dfdd4d0..2f82c4d 100644 (file)
@@ -1,25 +1,25 @@
 /* Instruction printing code for the MAXQ
 
-   Copyright 2004, 2005 Free Software Foundation, Inc.
+   Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
 
    Written by Vineet Sharma(vineets@noida.hcltech.com) Inderpreet
    S.(inderpreetb@noida.hcltech.com)
 
-   This file is part of GDB.
+   This file is part of the GNU opcodes library.
 
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the Free 
-   Software Foundation; either version 2 of the License, or (at your option)
+   This library is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
-   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-   for more details.
+   It is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
 
    You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation, Inc., 59 
-   Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   with this program; if not, write to the Free Software Foundation, Inc., 
+   51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include "sysdep.h"
 #include "dis-asm.h"
@@ -151,21 +151,21 @@ static char *
 get_reg_name (unsigned char reg_code, type1 arg_pos)
 {
   unsigned char module;
-  unsigned char index;
+  unsigned char r_index;
   int ix = 0;
   reg_entry const *reg_x;
   mem_access_syntax const *syntax;
   mem_access *mem_acc;
 
   module = 0;
-  index = 0;
+  r_index = 0;
   module = (reg_code & MASK_LOW_BYTE);
-  index = (reg_code & MASK_HIGH_BYTE);
-  index = index >> 4;
+  r_index = (reg_code & MASK_HIGH_BYTE);
+  r_index = r_index >> 4;
 
   /* Search the system register table.  */
   for (reg_x = &system_reg_table[0]; reg_x->reg_name != NULL; ++reg_x)
-    if ((reg_x->Mod_name == module) && (reg_x->Mod_index == index))
+    if ((reg_x->Mod_name == module) && (reg_x->Mod_index == r_index))
       return reg_x->reg_name;
 
   /* Serch pheripheral table.  */
@@ -173,7 +173,7 @@ get_reg_name (unsigned char reg_code, type1 arg_pos)
     {
       reg_x = &new_reg_table[ix];
 
-      if ((reg_x->Mod_name == module) && (reg_x->Mod_index == index))
+      if ((reg_x->Mod_name == module) && (reg_x->Mod_index == r_index))
        return reg_x->reg_name;
     }
 
@@ -182,7 +182,7 @@ get_reg_name (unsigned char reg_code, type1 arg_pos)
       if (reg_code == mem_acc->opcode)
        {
          for (syntax = mem_access_syntax_table;
-              mem_access_syntax_table != NULL || mem_access_syntax_table->name;
+              syntax != NULL && syntax->name;
               ++syntax)
            if (!strcmp (mem_acc->name, syntax->name))
              {
@@ -195,7 +195,7 @@ get_reg_name (unsigned char reg_code, type1 arg_pos)
     }
 
   memset (unres_reg_name, 0, 20);
-  sprintf (unres_reg_name, "%01x%01xh", index, module);
+  sprintf (unres_reg_name, "%01x%01xh", r_index, module);
 
   return unres_reg_name;
 }