Fix formatting
authorNick Clifton <nickc@redhat.com>
Fri, 2 Jun 2000 18:09:28 +0000 (18:09 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 2 Jun 2000 18:09:28 +0000 (18:09 +0000)
opcodes/ChangeLog
opcodes/h8300-dis.c

index c7205c9ee11059914364e229d5fbd41a8e63b709..201f3d28dd4f71ce9a1152304d0c934f657fbf67 100644 (file)
@@ -1,3 +1,12 @@
+2000-06-02  Kazu Hirata  <kazu@hxi.com>=0A=
+
+       * h8300-dis.c: Follow the GNU coding style.
+       (bfd_h8_disassemble) Fix a typo.
+       
+2000-06-02  Nick Clifton  <nickc@cygnus.com>
+
+       * h8300-dis.c (bfd_h8_disassemble): 
+
 2000-06-01  Kazu Hirata  <kazu@hxi.com>
 
        * h8300-dis.c (bfd_h8_disassemble_init): Fix a typo.
index 180f60038b6f865dc3cc79b08ed9e035972aeabb..7afdbc96f85d3e525c220f53547af3f2bfa1c22e 100644 (file)
@@ -38,23 +38,19 @@ bfd_h8_disassemble_init ()
       int n2 = 0;
 
       if ((int) p->data.nib[0] < 16)
-       {
-         n1 = (int) p->data.nib[0];
-       }
+       n1 = (int) p->data.nib[0];
       else
        n1 = 0;
       
       if ((int) p->data.nib[1] < 16)
-       {
-         n2 = (int) p->data.nib[1];
-       }
+       n2 = (int) p->data.nib[1];
       else
        n2 = 0;
 
       /* Just make sure there are an even number of nibbles in it, and
         that the count is the same as the length.  */
       for (i = 0; p->data.nib[i] != E; i++)
-       /*EMPTY*/ ;
+       /*EMPTY*/;
       
       if (i & 1)
        abort ();
@@ -81,13 +77,11 @@ bfd_h8_disassemble (addr, info, mode)
       "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
       "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7"
     };
-  
   static CONST char *lregnames[] =
     {
       "er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7",
       "er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7"
     };
-
   int rs = 0;
   int rd = 0;
   int rdisp = 0;
@@ -99,7 +93,7 @@ bfd_h8_disassemble (addr, info, mode)
   char CONST **pregnames = mode != 0 ? lregnames : wregnames;
   int status;
   int l;
-  unsigned char data[20];  
+  unsigned char data[20];
   void *stream = info->stream;
   fprintf_ftype fprintf = info->fprintf_func;
 
@@ -110,14 +104,14 @@ bfd_h8_disassemble (addr, info, mode)
     }
 
   status = info->read_memory_func (addr, data, 2, info);
-  if (status != 0) 
+  if (status != 0)
     {
       info->memory_error_func (status, addr, info);
       return -1;
     }
   
   for (l = 2; status == 0 && l < 10; l += 2)
-    status = info->read_memory_func(addr+l, data+l, 2, info);
+    status = info->read_memory_func (addr + l, data+l, 2, info);
 
   /* Find the exact opcode/arg combo.  */
   while (q->name)
@@ -134,24 +128,26 @@ bfd_h8_disassemble (addr, info, mode)
          
          thisnib = (len & 1) ? (thisnib & 0xf) : ((thisnib >> 4) & 0xf);
          
-         if (looking_for < 16 && looking_for >=0) 
+         if (looking_for < 16 && looking_for >= 0)
            {
-             if (looking_for != thisnib) 
+             if (looking_for != thisnib)
                goto fail;
            }
-         else 
+         else
            {
              if ((int) looking_for & (int) B31)
                {
-                 if (! (((int) thisnib & 0x8) != 0)) 
+                 if (! (((int) thisnib & 0x8) != 0))
                    goto fail;
+                 
                  looking_for = (op_type) ((int) looking_for & ~(int) B31);
                }
              
              if ((int) looking_for & (int) B30)
                {
-                 if (!(((int) thisnib & 0x8) == 0)) 
+                 if (!(((int) thisnib & 0x8) == 0))
                    goto fail;
+                 
                  looking_for = (op_type) ((int) looking_for & ~(int) B30);
                }
 
@@ -159,9 +155,10 @@ bfd_h8_disassemble (addr, info, mode)
                {
                  if ((looking_for & 2) != (thisnib & 2))
                    goto fail;
+                 
                  abs = (thisnib & 0x8) ? 2 : 1;
-               }                 
-             else if (looking_for & (REG | IND|INC|DEC))
+               }
+             else if (looking_for & (REG | IND | INC | DEC))
                {
                  if (looking_for & SRC)
                    rs = thisnib;
@@ -175,10 +172,7 @@ bfd_h8_disassemble (addr, info, mode)
                }
              else if (looking_for & ABSJMP)
                {
-                 abs =
-                   (data[1] << 16)
-                     | (data[2] << 8)
-                       | (data[3]);
+                 abs = (data[1] << 16) | (data[2] << 8) | (data[3]);
                }
              else if (looking_for & MEMIND)
                {
@@ -190,16 +184,17 @@ bfd_h8_disassemble (addr, info, mode)
                  
                  abs = (data[i] << 24)
                    | (data[i + 1] << 16)
-                     | (data[i + 2] << 8)
-                       | (data[i+ 3]);
+                   | (data[i + 2] << 8)
+                   | (data[i+ 3]);
 
                  plen = 32;
                }
              else if (looking_for & L_24)
                {
                  int i = len >> 1;
-                 abs = (data[i] << 16) | (data[i + 1] << 8)|  (data[i+2]);
-                 plen =24;
+                 
+                 abs = (data[i] << 16) | (data[i + 1] << 8) | (data[i + 2]);
+                 plen = 24;
                }
              else if (looking_for & IGNORE)
                {
@@ -211,7 +206,7 @@ bfd_h8_disassemble (addr, info, mode)
                }
              else if (looking_for & KBIT)
                {
-                 switch (thisnib) 
+                 switch (thisnib)
                    {
                    case 9:
                      abs = 4;
@@ -228,7 +223,7 @@ bfd_h8_disassemble (addr, info, mode)
                }
              else if (looking_for & L_8)
                {
-                 plen = 8;               
+                 plen = 8;
                  abs = data[len >> 1];
                }
              else if (looking_for & L_3)
@@ -295,10 +290,10 @@ bfd_h8_disassemble (addr, info, mode)
                          {
                            fprintf (stream, "#0x%x", (unsigned) bit);
                          }
-                       else if (x & (IMM|KBIT|DBIT))
+                       else if (x & (IMM | KBIT | DBIT))
                          {
                            /* Bletch.  For shal #2,er0 and friends.  */
-                           if (*(args+1) & SRC_IN_DST)
+                           if (*(args + 1) & SRC_IN_DST)
                              abs = 2;
 
                            fprintf (stream, "#0x%x", (unsigned) abs);
@@ -342,7 +337,7 @@ bfd_h8_disassemble (addr, info, mode)
                          {
                            fprintf (stream, "@0x%x:8", (unsigned) abs);
                          }
-                       else if (x & (ABS|ABSJMP))
+                       else if (x & (ABS | ABSJMP))
                          {
                            fprintf (stream, "@0x%x:%d", (unsigned) abs, plen);
                          }
@@ -352,21 +347,24 @@ bfd_h8_disassemble (addr, info, mode)
                          }
                        else if (x & PCREL)
                          {
-                           if (x & L_16) 
+                           if (x & L_16)
                              {
                                abs += 2;
-                               fprintf (stream, ".%s%d (%x)", (short) abs > 0 ? "+" : "", (short) abs,
-                                        addr + (short) abs + 2);
+                               fprintf (stream,
+                                        ".%s%d (%x)", (short) abs > 0 ? "+" : "",
+                                        (short) abs, addr + (short) abs + 2);
                              }
                            else
                              {
-                               fprintf (stream, ".%s%d (%x)", (char) abs > 0 ? "+" : "", (char) abs,
-                                        addr + (char) abs + 2);
+                               fprintf (stream,
+                                        ".%s%d (%x)", (char) abs > 0 ? "+" : "",
+                                        (char) abs, addr + (char) abs + 2);
                              }
                          }
                        else if (x & DISP)
                          {
-                           fprintf (stream, "@(0x%x:%d,%s)", abs,plen, pregnames[rdisp]);
+                           fprintf (stream, "@(0x%x:%d,%s)",
+                                    abs,plen, pregnames[rdisp]);
                          }
                        else if (x & CCR)
                          {
@@ -384,13 +382,12 @@ bfd_h8_disassemble (addr, info, mode)
                        args++;
                      }
                  }
+                 
                  return q->length;
                }
              else
-               {
-                 /* xgettext:c-format */
-                 fprintf (stream, _("Don't understand %x \n"), looking_for);
-               }
+               /* xgettext:c-format */
+               fprintf (stream, _("Don't understand %x \n"), looking_for);
            }
          
          len++;
@@ -401,33 +398,34 @@ bfd_h8_disassemble (addr, info, mode)
       q++;
     }
 
-  /* Fell of the end.  */
+  /* Fell off the end.  */
   fprintf (stream, "%02x %02x        .word\tH'%x,H'%x",
           data[0], data[1],
           data[0], data[1]);
+  
   return 2;
 }
 
-int 
+int
 print_insn_h8300 (addr, info)
-     bfd_vma addr; 
+     bfd_vma addr;
      disassemble_info *info;
 {
-  return bfd_h8_disassemble (addr, info , 0);
+  return bfd_h8_disassemble (addr, info, 0);
 }
 
-int 
+int
 print_insn_h8300h (addr, info)
      bfd_vma addr;
      disassemble_info *info;
 {
-  return bfd_h8_disassemble (addr, info , 1);
+  return bfd_h8_disassemble (addr, info, 1);
 }
 
-int 
+int
 print_insn_h8300s (addr, info)
      bfd_vma addr;
      disassemble_info *info;
 {
-  return bfd_h8_disassemble (addr, info , 2);
+  return bfd_h8_disassemble (addr, info, 2);
 }