public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
[parent not found: <200108171934.MAA23915@cygnus.com>]
* [patch] *-dis.c: Fix formatting.
@ 2001-08-17 12:33 Kazu Hirata
  0 siblings, 0 replies; 11+ messages in thread
From: Kazu Hirata @ 2001-08-17 12:33 UTC (permalink / raw)
  To: binutils

Hi,

Attached is a patch to fix formatting of *-dis.c.  OK to apply?

Thanks,

Kazu Hirata

2001-08-17  Kazu Hirata  <kazu@hxi.com>

	* avr-dis.c: Fix formatting.
	* i370-dis.c: Likewise.
	* i860-dis.c: Likewise.

Index: avr-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/avr-dis.c,v
retrieving revision 1.9
diff -u -r1.9 avr-dis.c
--- avr-dis.c	2001/03/13 22:58:34	1.9
+++ avr-dis.c	2001/08/17 19:22:55
@@ -1,5 +1,5 @@
 /* Disassemble AVR instructions.
-   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
 
    Contributed by Denis Chertykov <denisc@overta.ru>
 
@@ -22,9 +22,7 @@
 #include "dis-asm.h"
 #include "opintl.h"
 
-
-struct avr_opcodes_s
-{
+struct avr_opcodes_s {
   char *name;
   char *constraints;
   char *opcode;
@@ -37,8 +35,7 @@
 #define AVR_INSN(NAME, CONSTR, OPCODE, SIZE, ISA, BIN) \
 {#NAME, CONSTR, OPCODE, SIZE, ISA, BIN, 0},
 
-struct avr_opcodes_s avr_opcodes[] =
-{
+struct avr_opcodes_s avr_opcodes[] = {
   #include "opcode/avr.h"
   {NULL, NULL, NULL, 0, 0, 0, 0}
 };
@@ -66,7 +63,7 @@
 	insn = (insn & 0xf) | ((insn & 0x0200) >> 5); /* source register */
       else
 	insn = (insn & 0x01f0) >> 4; /* destination register */
-      
+
       sprintf (buf, "r%d", insn);
       break;
 
@@ -76,11 +73,11 @@
       else
 	sprintf (buf, "r%d", 16 + ((insn & 0xf0) >> 4));
       break;
-      
+
     case 'w':
       sprintf (buf, "r%d", 24 + ((insn & 0x30) >> 3));
       break;
-      
+
     case 'a':
       if (regs)
 	sprintf (buf, "r%d", 16 + (insn & 7));
@@ -131,11 +128,11 @@
     case 'b':
       {
 	unsigned int x;
-	
+
 	x = (insn & 7);
 	x |= (insn >> 7) & (3 << 3);
 	x |= (insn >> 8) & (1 << 5);
-	
+
 	if (insn & 0x8)
 	  *buf++ = 'Y';
 	else
@@ -144,12 +141,12 @@
 	sprintf (comment, "0x%02x", x);
       }
       break;
-      
+
     case 'h':
       sprintf (buf, "0x%x",
 	       ((((insn & 1) | ((insn & 0x1f0) >> 3)) << 16) | insn2) * 2);
       break;
-      
+
     case 'L':
       {
 	int rel_addr = (((insn & 0xfff) ^ 0x800) - 0x800) * 2;
@@ -169,7 +166,7 @@
     case 'i':
       sprintf (buf, "0x%04X", insn2);
       break;
-      
+
     case 'M':
       sprintf (buf, "0x%02X", ((insn & 0xf00) >> 4) | (insn & 0xf));
       sprintf (comment, "%d", ((insn & 0xf00) >> 4) | (insn & 0xf));
@@ -180,7 +177,7 @@
       fprintf (stderr, _("Internal disassembler error"));
       ok = 0;
       break;
-      
+
     case 'K':
       {
 	unsigned int x;
@@ -190,15 +187,15 @@
 	sprintf (comment, "%d", x);
       }
       break;
-      
+
     case 's':
       sprintf (buf, "%d", insn & 7);
       break;
-      
+
     case 'S':
       sprintf (buf, "%d", (insn >> 4) & 7);
       break;
-      
+
     case 'P':
       {
 	unsigned int x;
@@ -212,24 +209,24 @@
     case 'p':
       {
 	unsigned int x;
-	
+
 	x = (insn >> 3) & 0x1f;
 	sprintf (buf, "0x%02x", x);
 	sprintf (comment, "%d", x);
       }
       break;
-      
+
     case '?':
       *buf = '\0';
       break;
-      
+
     default:
       sprintf (buf, "??");
       fprintf (stderr, _("unknown constraint `%c'"), constraint);
       ok = 0;
     }
 
-    return ok;
+  return ok;
 }
 
 static unsigned short avrdis_opcode PARAMS ((bfd_vma, disassemble_info *));
@@ -241,18 +238,17 @@
 {
   bfd_byte buffer[2];
   int status;
-  status = info->read_memory_func(addr, buffer, 2, info);
+  status = info->read_memory_func (addr, buffer, 2, info);
   if (status != 0)
     {
-      info->memory_error_func(status, addr, info);
+      info->memory_error_func (status, addr, info);
       return -1;
     }
   return bfd_getl16 (buffer);
 }
 
-
 int
-print_insn_avr(addr, info)
+print_insn_avr (addr, info)
      bfd_vma addr;
      disassemble_info *info;
 {
@@ -268,13 +264,13 @@
   if (!initialized)
     {
       initialized = 1;
-      
+
       for (opcode = avr_opcodes; opcode->name; opcode++)
 	{
-	  char * s;
+	  char *s;
 	  unsigned int bin = 0;
 	  unsigned int mask = 0;
-	
+
 	  for (s = opcode->opcode; *s; ++s)
 	    {
 	      bin <<= 1;
@@ -289,13 +285,13 @@
     }
 
   insn = avrdis_opcode (addr, info);
-  
+
   for (opcode = avr_opcodes; opcode->name; opcode++)
     {
       if ((insn & opcode->bin_mask) == opcode->bin_opcode)
 	break;
     }
-  
+
   /* Special case: disassemble `ldd r,b+0' as `ld r,b', and
      `std b+0,r' as `st b,r' (next entry in the table).  */
 
Index: i370-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/i370-dis.c,v
retrieving revision 1.2
diff -u -r1.2 i370-dis.c
--- i370-dis.c	2000/04/14 04:16:58	1.2
+++ i370-dis.c	2001/08/17 19:22:56
@@ -1,6 +1,6 @@
 
 /* i370-dis.c -- Disassemble Instruction 370 (ESA/390) instructions
-   Copyright 1994, 2000 Free Software Foundation, Inc.
+   Copyright 1994, 2000, 2001 Free Software Foundation, Inc.
    PowerPC version written by Ian Lance Taylor, Cygnus Support
    Rewritten for i370 ESA/390 support by Linas Vepstas <linas@linas.org>
 
@@ -26,8 +26,7 @@
 #include "opcode/i370.h"
 
 /* This file provides several disassembler functions, all of which use
-   the disassembler interface defined in dis-asm.h.
-*/
+   the disassembler interface defined in dis-asm.h.  */
 
 int
 print_insn_i370 (memaddr, info)
@@ -47,11 +46,11 @@
       return -1;
     }
 
-  /* Cast the bytes into the insn (in a host-endian indep way) */
+  /* Cast the bytes into the insn (in a host-endian indep way).  */
   insn.i[0] = (buffer[0] << 24) & 0xff000000;
   insn.i[0] |= (buffer[1] << 16) & 0xff0000;
   insn.i[0] |= (buffer[2] << 8) & 0xff00;
-  insn.i[0] |= buffer[3]  & 0xff;
+  insn.i[0] |= buffer[3] & 0xff;
   insn.i[1] = (buffer[4] << 24) & 0xff000000;
   insn.i[1] |= (buffer[5] << 16) & 0xff0000;
 
@@ -65,99 +64,99 @@
       i370_insn_t masked;
       int invalid;
 
-      /* Mask off operands, and look for a match ... */
+      /* Mask off operands, and look for a match ...  */
       masked = insn;
       if (2 == opcode->len)
-        {
-          masked.i[0] >>= 16;
-          masked.i[0] &= 0xffff;
-        }
+	{
+	  masked.i[0] >>= 16;
+	  masked.i[0] &= 0xffff;
+	}
       masked.i[0] &= opcode->mask.i[0];
-      if (masked.i[0] != opcode->opcode.i[0]) continue;
+      if (masked.i[0] != opcode->opcode.i[0])
+	continue;
 
       if (6 == opcode->len)
-        {
-          masked.i[1] &= opcode->mask.i[1];
-          if (masked.i[1] != opcode->opcode.i[1]) continue;
-        }
+	{
+	  masked.i[1] &= opcode->mask.i[1];
+	  if (masked.i[1] != opcode->opcode.i[1])
+	    continue;
+	}
 
-      /* Found a match.  adjust a tad */
+      /* Found a match.  Adjust a tad.  */
       if (2 == opcode->len)
-        {
-          insn.i[0] >>= 16;
-          insn.i[0] &= 0xffff;
-        }
+	{
+	  insn.i[0] >>= 16;
+	  insn.i[0] &= 0xffff;
+	}
 
       /* Make two passes over the operands.  First see if any of them
          have extraction functions, and, if they do, make sure the
          instruction is valid.  */
       invalid = 0;
       for (opindex = opcode->operands; *opindex != 0; opindex++)
-        {
-          operand = i370_operands + *opindex;
-          if (operand->extract)
-            (*operand->extract) (insn, &invalid);
-        }
-      if (invalid) continue;
+	{
+	  operand = i370_operands + *opindex;
+	  if (operand->extract)
+	    (*operand->extract) (insn, &invalid);
+	}
+      if (invalid)
+	continue;
 
       /* The instruction is valid.  */
       (*info->fprintf_func) (info->stream, "%s", opcode->name);
       if (opcode->operands[0] != 0)
-        (*info->fprintf_func) (info->stream, "\t");
+	(*info->fprintf_func) (info->stream, "\t");
 
       /* Now extract and print the operands.  */
       for (opindex = opcode->operands; *opindex != 0; opindex++)
-        {
-          long value;
+	{
+	  long value;
 
-          operand = i370_operands + *opindex;
+	  operand = i370_operands + *opindex;
 
-          /* Extract the value from the instruction.  */
-          if (operand->extract)
-            value = (*operand->extract) (insn, (int *) NULL);
-          else
-            {
-              value = (insn.i[0] >> operand->shift) & ((1 << operand->bits) - 1);
-            }
-
-          /* Print the operand as directed by the flags.  */
-          if ((operand->flags & I370_OPERAND_OPTIONAL) != 0)
-            {
-              if (value)
-                (*info->fprintf_func) (info->stream, "(r%ld)", value);
-            }
-          else if ((operand->flags & I370_OPERAND_SBASE) != 0)
-            {
-              (*info->fprintf_func) (info->stream, "(r%ld)", value);
-            }
-          else if ((operand->flags & I370_OPERAND_INDEX) != 0)
-            {
-              if (value)
-                (*info->fprintf_func) (info->stream, "(r%ld,", value);
-              else
-                (*info->fprintf_func) (info->stream, "(,");
-            }
-          else if ((operand->flags & I370_OPERAND_LENGTH) != 0)
-            {
-              (*info->fprintf_func) (info->stream, "(%ld,", value);
-            }
-          else if ((operand->flags & I370_OPERAND_BASE) != 0)
-            (*info->fprintf_func) (info->stream, "r%ld)", value);
-          else if ((operand->flags & I370_OPERAND_GPR) != 0)
-            (*info->fprintf_func) (info->stream, "r%ld,", value);
-          else if ((operand->flags & I370_OPERAND_FPR) != 0)
-            (*info->fprintf_func) (info->stream, "f%ld,", value);
-          else if ((operand->flags & I370_OPERAND_RELATIVE) != 0)
-            (*info->fprintf_func) (info->stream, "%ld", value);
-          else
-            (*info->fprintf_func) (info->stream, " %ld, ", value);
+	  /* Extract the value from the instruction.  */
+	  if (operand->extract)
+	    value = (*operand->extract) (insn, (int *) NULL);
+	  else
+	    {
+	      value = (insn.i[0] >> operand->shift) & ((1 << operand->bits) - 1);
+	    }
+
+	  /* Print the operand as directed by the flags.  */
+	  if ((operand->flags & I370_OPERAND_OPTIONAL) != 0)
+	    {
+	      if (value)
+		(*info->fprintf_func) (info->stream, "(r%ld)", value);
+	    }
+	  else if ((operand->flags & I370_OPERAND_SBASE) != 0)
+	    {
+	      (*info->fprintf_func) (info->stream, "(r%ld)", value);
+	    }
+	  else if ((operand->flags & I370_OPERAND_INDEX) != 0)
+	    {
+	      if (value)
+		(*info->fprintf_func) (info->stream, "(r%ld,", value);
+	      else
+		(*info->fprintf_func) (info->stream, "(,");
+	    }
+	  else if ((operand->flags & I370_OPERAND_LENGTH) != 0)
+	    {
+	      (*info->fprintf_func) (info->stream, "(%ld,", value);
+	    }
+	  else if ((operand->flags & I370_OPERAND_BASE) != 0)
+	    (*info->fprintf_func) (info->stream, "r%ld)", value);
+	  else if ((operand->flags & I370_OPERAND_GPR) != 0)
+	    (*info->fprintf_func) (info->stream, "r%ld,", value);
+	  else if ((operand->flags & I370_OPERAND_FPR) != 0)
+	    (*info->fprintf_func) (info->stream, "f%ld,", value);
+	  else if ((operand->flags & I370_OPERAND_RELATIVE) != 0)
+	    (*info->fprintf_func) (info->stream, "%ld", value);
+	  else
+	    (*info->fprintf_func) (info->stream, " %ld, ", value);
+	}
 
-        }
-
       return opcode->len;
-
     }
-
 
   /* We could not find a match.  */
   (*info->fprintf_func) (info->stream, ".short 0x%02x%02x", buffer[0], buffer[1]);
Index: i860-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/i860-dis.c,v
retrieving revision 1.2
diff -u -r1.2 i860-dis.c
--- i860-dis.c	2000/08/09 03:33:42	1.2
+++ i860-dis.c	2001/08/17 19:22:56
@@ -1,5 +1,5 @@
 /* Disassembler for the i860.
-   Copyright 2000 Free Software Foundation, Inc.
+   Copyright 2000, 2001 Free Software Foundation, Inc.
 
    Contributed by Jason Eckhardt <jle@cygnus.com>.
 
@@ -24,29 +24,30 @@
 #define I860_REG_PREFIX "%"
 
 /* Integer register names (encoded as 0..31 in the instruction).  */
-static const char *const grnames[] = 
- {"r0",  "r1",  "sp",  "fp",  "r4",  "r5",  "r6",  "r7",
+static const char *const grnames[] = {
+  "r0",  "r1",  "sp",  "fp",  "r4",  "r5",  "r6",  "r7",
   "r8",  "r9",  "r10", "r11", "r12", "r13", "r14", "r15",
   "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
-  "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"};
+  "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
+};
 
 /* FP register names (encoded as 0..31 in the instruction).  */
-static const char *const frnames[] = 
- {"f0",  "f1",  "f2",  "f3",  "f4",  "f5",  "f6",  "f7",
+static const char *const frnames[] = {
+  "f0",  "f1",  "f2",  "f3",  "f4",  "f5",  "f6",  "f7",
   "f8",  "f9",  "f10", "f11", "f12", "f13", "f14", "f15",
   "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
-  "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"};
+  "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"
+};
 
 /* Control/status register names (encoded as 0..5 in the instruction).  */
-static const char *const crnames[] = 
- {"fir", "psr", "dirbase", "db", "fsr", "epsr", "", ""};
+static const char *const crnames[] = {
+  "fir", "psr", "dirbase", "db", "fsr", "epsr", "", ""
+};
 
-
 /* Prototypes.  */
-static int sign_ext		PARAMS((unsigned int, int)); 
+static int sign_ext		PARAMS((unsigned int, int));
 static void print_br_address	PARAMS((disassemble_info *, bfd_vma, long));
 
-
 /* True if opcode is xor, xorh, and, andh, or, orh, andnot, andnoth.  */
 #define BITWISE_OP(op)  ((op) == 0x30 || (op) == 0x31		\
 			 || (op) == 0x34 || (op) == 0x35	\
@@ -55,7 +56,6 @@
 			 || (op) == 0x33 || (op) == 0x37	\
 			 || (op) == 0x3b || (op) == 0x3f)
 
-
 /* Sign extend N-bit number.  */
 static int
 sign_ext (x, n)
@@ -68,7 +68,6 @@
   return t;
 }
 
-
 /* Print a PC-relative branch offset.  VAL is the sign extended value
    from the branch instruction.  */
 static void
@@ -78,12 +77,12 @@
      long val;
 {
 
-  long adj = (long)memaddr + 4 + (val << 2);
+  long adj = (long) memaddr + 4 + (val << 2);
 
   (*info->fprintf_func) (info->stream, "0x%08x", adj);
-	    
+
   /* Attempt to obtain a symbol for the target address.  */
-	
+
   if (info->print_address_func && adj != 0)
     {
       (*info->fprintf_func) (info->stream, "\t// ");
@@ -91,7 +90,6 @@
     }
 }
 
-
 /* Print one instruction.  */
 int
 print_insn_i860 (memaddr, info)
@@ -138,7 +136,7 @@
       const char *s;
       int val;
 
-      /* If this a flop and its dual bit is set, prefix with 'd.'.  */ 	
+      /* If this a flop and its dual bit is set, prefix with 'd.'.  */
       if ((insn & 0xfc000000) == 0x48000000 && (insn & 0x200))
 	(*info->fprintf_func) (info->stream, "d.%s\t", opcode->name);
       else
@@ -285,4 +283,3 @@
 
   return sizeof (insn);
 }
-

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [patch] *-dis.c: Fix formatting.
@ 2001-08-12  8:42 Kazu Hirata
  0 siblings, 0 replies; 11+ messages in thread
From: Kazu Hirata @ 2001-08-12  8:42 UTC (permalink / raw)
  To: binutils

Hi,

Attached is a patch to fix formatting of *-dis.c.  OK to apply?

Thanks,

Kazu Hirata

2001-08-12  Kazu Hirata  <kazu@hxi.com>

	* mcore-dis.c: Fix formatting.
	* mips-dis.c: Likewise.
	* pj-dis.c: Likewise.
	* z8k-dis.c: Likewise.

Index: mcore-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/mcore-dis.c,v
retrieving revision 1.15
diff -u -r1.15 mcore-dis.c
--- mcore-dis.c	2001/03/13 22:58:36	1.15
+++ mcore-dis.c	2001/08/12 15:39:28
@@ -24,8 +24,7 @@
 #include "dis-asm.h"
 
 /* Mask for each mcore_opclass: */
-static const unsigned short imsk[] =
-{
+static const unsigned short imsk[] = {
     /* O0  */ 0xFFFF,
     /* OT  */ 0xFFFC,
     /* O1  */ 0xFFF0,
@@ -34,7 +33,7 @@
     /* X1  */ 0xFFF0,
     /* OI  */ 0xFE00,
     /* OB  */ 0xFE00,
-	      
+
     /* OMa */ 0xFFF0,
     /* SI  */ 0xFE00,
     /* I7  */ 0xF800,
@@ -43,7 +42,7 @@
     /* BL  */ 0xFF00,
     /* LR  */ 0xF000,
     /* LJ  */ 0xFF00,
-	      
+
     /* RM  */ 0xFFF0,
     /* RQ  */ 0xFFF0,
     /* JSR */ 0xFFF0,
@@ -52,33 +51,31 @@
     /* OBRb*/ 0xFF80,
     /* OBRc*/ 0xFF00,
     /* OBR2*/ 0xFE00,
-	      
+
     /* O1R1*/ 0xFFF0,
     /* OMb */ 0xFF80,
     /* OMc */ 0xFF00,
     /* SIa */ 0xFE00,
 
-  /* MULSH */ 0xFF00,    
+  /* MULSH */ 0xFF00,
   /* OPSR  */ 0xFFF8,   /* psrset/psrclr */
-		 
+
     /* JC  */ 0,		/* JC,JU,JL don't appear in object */
     /* JU  */ 0,
     /* JL  */ 0,
     /* RSI */ 0,
     /* DO21*/ 0,
-    /* OB2 */ 0 		/* OB2 won't appear in object. */
+    /* OB2 */ 0 		/* OB2 won't appear in object.  */
 };
 
-static const char * grname[] =
-{
+static const char *grname[] = {
  "r0",  "r1",  "r2",  "r3",  "r4",  "r5",  "r6",  "r7",
  "r8",  "r9", "r10", "r11", "r12", "r13", "r14", "r15"
 };
 
 static const char X[] = "??";
 
-static const char * crname[] =
-{
+static const char *crname[] = {
   "psr",  "vbr", "epsr", "fpsr", "epc",  "fpc",  "ss0",  "ss1",
   "ss2",  "ss3", "ss4",  "gcr",  "gsr",     X,      X,      X,
      X,      X,      X,      X,      X,     X,      X,      X,
@@ -87,10 +84,10 @@
 
 static const unsigned isiz[] = { 2, 0, 1, 0 };
 
-int 
+int
 print_insn_mcore (memaddr, info)
      bfd_vma memaddr;
-     struct disassemble_info * info;
+     struct disassemble_info *info;
 {
   unsigned char       ibytes[4];
   fprintf_ftype       fprintf = info->fprintf_func;
@@ -103,7 +100,7 @@
 
   status = info->read_memory_func (memaddr, ibytes, 2, info);
 
-  if (status != 0) 
+  if (status != 0)
     {
       info->memory_error_func (status, memaddr, info);
       return -1;
@@ -117,7 +114,7 @@
     abort ();
 
   /* Just a linear search of the table.  */
-  for (op = mcore_table; op->name != 0; op ++)
+  for (op = mcore_table; op->name != 0; op++)
     if (op->inst == (inst & imsk[op->opclass]))
       break;
 
@@ -125,10 +122,10 @@
     fprintf (stream, ".short 0x%04x", inst);
   else
     {
-      const char * name = grname[inst & 0x0F];
-      
+      const char *name = grname[inst & 0x0F];
+
       fprintf (stream, "%s", op->name);
-      
+
       switch (op->opclass)
 	{
 	case O0: break;
@@ -157,21 +154,21 @@
 	case LS: fprintf (stream, "\t%s, (%s, %d)", grname[(inst >> 8) & 0xF],
 			  name, ((inst >> 4) & 0xF) << isiz[(inst >> 13) & 3]);
 	  break;
-	  
+
 	case BR:
 	  {
 	    long val = inst & 0x3FF;
-	    
+
 	    if (inst & 0x400)
 	      val |= 0xFFFFFC00;
-	    
-	    fprintf (stream, "\t0x%x", memaddr + 2 + (val<<1));
-	    
+
+	    fprintf (stream, "\t0x%x", memaddr + 2 + (val << 1));
+
 	    if (strcmp (op->name, "bsr") == 0)
 	      {
 		/* For bsr, we'll try to get a symbol for the target.  */
 		val = memaddr + 2 + (val << 1);
-		
+
 		if (info->print_address_func && val != 0)
 		  {
 		    fprintf (stream, "\t// ");
@@ -180,36 +177,36 @@
 	      }
 	  }
 	  break;
-	  
+
 	case BL:
 	  {
 	    long val;
 	    val = (inst & 0x000F);
 	    fprintf (stream, "\t%s, 0x%x",
-		    grname[(inst >> 4) & 0xF], memaddr - (val << 1));
+		     grname[(inst >> 4) & 0xF], memaddr - (val << 1));
 	  }
 	  break;
-	  
+
 	case LR:
 	  {
 	    unsigned long val;
-	    
+
 	    val = (memaddr + 2 + ((inst & 0xFF) << 2)) & 0xFFFFFFFC;
-	    
+
 	    status = info->read_memory_func (val, ibytes, 4, info);
-	    if (status != 0) 
+	    if (status != 0)
 	      {
 		info->memory_error_func (status, memaddr, info);
 		break;
 	      }
-	    
+
 	    if (info->endian == BFD_ENDIAN_LITTLE)
 	      val = (ibytes[3] << 24) | (ibytes[2] << 16)
 		| (ibytes[1] << 8) | (ibytes[0]);
 	    else
 	      val = (ibytes[0] << 24) | (ibytes[1] << 16)
 		| (ibytes[2] << 8) | (ibytes[3]);
-	    
+
 	    /* Removed [] around literal value to match ABI syntax 12/95.  */
 	    fprintf (stream, "\t%s, 0x%X", grname[(inst >> 8) & 0xF], val);
 
@@ -218,15 +215,15 @@
 		       (memaddr + 2 + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
 	  }
 	  break;
-	  
+
 	case LJ:
 	  {
 	    unsigned long val;
-	    
+
 	    val = (memaddr + 2 + ((inst & 0xFF) << 2)) & 0xFFFFFFFC;
-	    
+
 	    status = info->read_memory_func (val, ibytes, 4, info);
-	    if (status != 0) 
+	    if (status != 0)
 	      {
 		info->memory_error_func (status, memaddr, info);
 		break;
@@ -238,7 +235,7 @@
 	    else
 	      val = (ibytes[0] << 24) | (ibytes[1] << 16)
 		| (ibytes[2] << 8) | (ibytes[3]);
-	    
+
 	    /* Removed [] around literal value to match ABI syntax 12/95.  */
 	    fprintf (stream, "\t0x%X", val);
 	    /* For jmpi/jsri, we'll try to get a symbol for the target.  */
@@ -254,26 +251,25 @@
 	      }
 	  }
 	  break;
-	  
+
 	case OPSR:
 	  {
-	    static char * fields[] = 
-	    {
-	      "af", "ie",    "fe",    "fe,ie", 
+	    static char *fields[] = {
+	      "af", "ie",    "fe",    "fe,ie",
 	      "ee", "ee,ie", "ee,fe", "ee,fe,ie"
 	    };
-	    
+
 	    fprintf (stream, "\t%s", fields[inst & 0x7]);
 	  }
 	  break;
-	  
+
 	default:
 	  /* If the disassembler lags the instruction set.  */
 	  fprintf (stream, "\tundecoded operands, inst is 0x%04x", inst);
 	  break;
 	}
     }
-  
+
   /* Say how many bytes we consumed.  */
   return 2;
 }
Index: mips-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/mips-dis.c,v
retrieving revision 1.18
diff -u -r1.18 mips-dis.c
--- mips-dis.c	2001/08/10 16:22:08	1.18
+++ mips-dis.c	2001/08/12 15:39:28
@@ -28,7 +28,7 @@
 /* FIXME: These are needed to figure out if the code is mips16 or
    not. The low bit of the address is often a good indicator.  No
    symbol table is available when this code runs out in an embedded
-   system as when it is used for disassembler support in a monitor. */
+   system as when it is used for disassembler support in a monitor.  */
 
 #if !defined(EMBEDDED_ENV)
 #define SYMTAB_AVAILABLE 1
@@ -54,13 +54,11 @@
 /* FIXME: These should be shared with gdb somehow.  */
 
 /* The mips16 register names.  */
-static const char * const mips16_reg_names[] =
-{
+static const char * const mips16_reg_names[] = {
   "s0", "s1", "v0", "v1", "a0", "a1", "a2", "a3"
 };
 
-static const char * const mips32_reg_names[] =
-{
+static const char * const mips32_reg_names[] = {
   "zero", "at",	  "v0",	 "v1",	 "a0",	  "a1",	   "a2",   "a3",
   "t0",	  "t1",	  "t2",	 "t3",	 "t4",	  "t5",	   "t6",   "t7",
   "s0",	  "s1",	  "s2",	 "s3",	 "s4",	  "s5",	   "s6",   "s7",
@@ -74,8 +72,7 @@
   "epc",  "prid"
 };
 
-static const char * const mips64_reg_names[] =
-{
+static const char * const mips64_reg_names[] = {
   "zero", "at",	  "v0",	  "v1",	  "a0",	   "a1",    "a2",   "a3",
   "a4",	  "a5",	  "a6",   "a7",	  "t0",	   "t1",    "t2",   "t3",
   "s0",	  "s1",	  "s2",	  "s3",	  "s4",	   "s5",    "s6",   "s7",
@@ -93,7 +90,7 @@
    table to use.  */
 static const char * const *reg_names = NULL;
 \f
-/* Print insn arguments for 32/64-bit code */
+/* Print insn arguments for 32/64-bit code.  */
 
 static void
 print_insn_arg (d, l, pc, info)
@@ -129,10 +126,10 @@
     case 'i':
     case 'u':
       (*info->fprintf_func) (info->stream, "0x%x",
-			(l >> OP_SH_IMMEDIATE) & OP_MASK_IMMEDIATE);
+			     (l >> OP_SH_IMMEDIATE) & OP_MASK_IMMEDIATE);
       break;
 
-    case 'j': /* same as i, but sign-extended */
+    case 'j': /* Same as i, but sign-extended.  */
     case 'o':
       delta = (l >> OP_SH_DELTA) & OP_MASK_DELTA;
       if (delta & 0x8000)
@@ -155,13 +152,13 @@
 
     case 'a':
       (*info->print_address_func)
-	((((pc + 4) & ~ (bfd_vma) 0x0fffffff)
+	((((pc + 4) & ~(bfd_vma) 0x0fffffff)
 	  | (((l >> OP_SH_TARGET) & OP_MASK_TARGET) << 2)),
 	 info);
       break;
 
     case 'p':
-      /* sign extend the displacement */
+      /* Sign extend the displacement.  */
       delta = (l >> OP_SH_DELTA) & OP_MASK_DELTA;
       if (delta & 0x8000)
 	delta |= ~0xffff;
@@ -177,25 +174,25 @@
 
     case 'U':
       {
-      /* First check for both rd and rt being equal. */
-      unsigned int reg = (l >> OP_SH_RD) & OP_MASK_RD;
-      if (reg == ((l >> OP_SH_RT) & OP_MASK_RT))
-        (*info->fprintf_func) (info->stream, "%s",
-                               reg_names[reg]);
-      else
-        {
-          /* If one is zero use the other. */
-          if (reg == 0)
-            (*info->fprintf_func) (info->stream, "%s",
-                                   reg_names[(l >> OP_SH_RT) & OP_MASK_RT]);
-          else if (((l >> OP_SH_RT) & OP_MASK_RT) == 0)
-            (*info->fprintf_func) (info->stream, "%s",
-                                   reg_names[reg]);
-          else /* Bogus, result depends on processor. */
-            (*info->fprintf_func) (info->stream, "%s or %s",
-                                   reg_names[reg],
-                                   reg_names[(l >> OP_SH_RT) & OP_MASK_RT]);
-          }
+	/* First check for both rd and rt being equal.  */
+	unsigned int reg = (l >> OP_SH_RD) & OP_MASK_RD;
+	if (reg == ((l >> OP_SH_RT) & OP_MASK_RT))
+	  (*info->fprintf_func) (info->stream, "%s",
+				 reg_names[reg]);
+	else
+	  {
+	    /* If one is zero use the other.  */
+	    if (reg == 0)
+	      (*info->fprintf_func) (info->stream, "%s",
+				     reg_names[(l >> OP_SH_RT) & OP_MASK_RT]);
+	    else if (((l >> OP_SH_RT) & OP_MASK_RT) == 0)
+	      (*info->fprintf_func) (info->stream, "%s",
+				     reg_names[reg]);
+	    else /* Bogus, result depends on processor.  */
+	      (*info->fprintf_func) (info->stream, "%s or %s",
+				     reg_names[reg],
+				     reg_names[(l >> OP_SH_RT) & OP_MASK_RT]);
+	  }
       }
       break;
 
@@ -294,7 +291,7 @@
     }
 }
 \f
-/* Figure out the MIPS ISA and CPU based on the machine number. */
+/* Figure out the MIPS ISA and CPU based on the machine number.  */
 
 static void
 mips_isa_type (mach, isa, cputype)
@@ -398,7 +395,7 @@
 /* Check if the object uses NewABI conventions.  */
 
 static int
-is_newabi(header)
+is_newabi (header)
      Elf_Internal_Ehdr *header;
 {
   if ((header->e_flags
@@ -443,7 +440,7 @@
 		  break;
 		}
 	    }
-        }
+	}
 
       init = 1;
     }
@@ -477,9 +474,9 @@
 	      d = op->args;
 	      if (d != NULL && *d != '\0')
 		{
-		    (*info->fprintf_func) (info->stream, "\t");
+		  (*info->fprintf_func) (info->stream, "\t");
 		  for (; *d != '\0'; d++)
-		      print_insn_arg (d, word, memaddr, info);
+		    print_insn_arg (d, word, memaddr, info);
 		}
 
 	      return INSNLEN;
@@ -530,8 +527,8 @@
     {
       Elf_Internal_Ehdr *header;
 
-      header = elf_elfheader(bfd_asymbol_bfd(*(info->symbols)));
-      if (is_newabi(header))
+      header = elf_elfheader (bfd_asymbol_bfd (*(info->symbols)));
+      if (is_newabi (header))
 	reg_names = mips64_reg_names;
     }
 
@@ -541,7 +538,7 @@
       unsigned long insn;
 
       if (endianness == BFD_ENDIAN_BIG)
-        insn = (unsigned long) bfd_getb32 (buffer);
+	insn = (unsigned long) bfd_getb32 (buffer);
       else
 	insn = (unsigned long) bfd_getl32 (buffer);
 
@@ -791,7 +788,7 @@
     case 'X':
       (*info->fprintf_func) (info->stream, "%s",
 			     mips32_reg_names[((l >> MIPS16OP_SH_REGR32)
-					& MIPS16OP_MASK_REGR32)]);
+					       & MIPS16OP_MASK_REGR32)]);
       break;
 
     case 'Y':
@@ -1051,7 +1048,7 @@
 		      baseaddr = memaddr - 2;
 		  }
 	      }
-	    val = (baseaddr & ~ ((1 << shift) - 1)) + immed;
+	    val = (baseaddr & ~((1 << shift) - 1)) + immed;
 	    (*info->print_address_func) (val, info);
 	    info->target = val;
 	  }
Index: pj-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/pj-dis.c,v
retrieving revision 1.4
diff -u -r1.4 pj-dis.c
--- pj-dis.c	2001/07/24 00:48:04	1.4
+++ pj-dis.c	2001/08/12 15:39:28
@@ -1,5 +1,5 @@
 /* pj-dis.c -- Disassemble picoJava instructions.
-   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
    Contributed by Steve Chamberlain, of Transmeta (sac@pobox.com).
 
 This program is free software; you can redistribute it and/or modify
@@ -33,10 +33,10 @@
 
   int status = info->read_memory_func (memaddr, ival, 4, info);
 
-  *iptr = (ival[0] << 24) 
-    | (ival[1] << 16) 
-    | (ival[2] << 8) 
-    | (ival[3] << 0) ;
+  *iptr = (ival[0] << 24)
+    | (ival[1] << 16)
+    | (ival[2] << 8)
+    | (ival[3] << 0);
 
   return status;
 }
@@ -72,7 +72,7 @@
       fprintf_fn (stream, "%s", op->name);
 
       /* The tableswitch instruction is followed by the default
-	 address, low value, high value and the destinations. */
+	 address, low value, high value and the destinations.  */
 
       if (strcmp (op->name, "tableswitch") == 0)
 	{
@@ -111,8 +111,8 @@
 
       /* The lookupswitch instruction is followed by the default
 	 address, element count and pairs of values and
-	 addresses. */
-	    
+	 addresses.  */
+
       if (strcmp (op->name, "lookupswitch") == 0)
 	{
 	  int count;
Index: z8k-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/z8k-dis.c,v
retrieving revision 1.7
diff -u -r1.7 z8k-dis.c
--- z8k-dis.c	2001/07/24 00:48:04	1.7
+++ z8k-dis.c	2001/08/12 15:39:28
@@ -1,5 +1,5 @@
 /* Disassemble z8000 code.
-   Copyright 1992, 1993, 1998, 2000
+   Copyright 1992, 1993, 1998, 2000, 2001
    Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
@@ -269,7 +269,6 @@
       tabl_index++;
     }
   return -1;
-
 }
 
 static void
@@ -334,22 +333,22 @@
 	  switch (datum_value)
 	    {
 	    case ARG_DISP16:
-              instr_data->displacement = instr_data->insn_start + 4 +
-                (signed short) (instr_word & 0xffff);
+	      instr_data->displacement = instr_data->insn_start + 4
+		+ (signed short) (instr_word & 0xffff);
 	      nibl_count += 3;
 	      break;
 	    case ARG_DISP12:
-              if (instr_word & 0x800)
+	      if (instr_word & 0x800)
 		{
 		  /* neg. 12 bit displacement */
 		  instr_data->displacement = instr_data->insn_start + 2
 		    - (signed short) ((instr_word & 0xfff) | 0xf000) * 2;
 		}
-              else
+	      else
 		{
 		  instr_data->displacement = instr_data->insn_start + 2
 		    - (instr_word & 0x0fff) * 2;
-              }
+		}
 	      nibl_count += 2;
 	      break;
 	    default:
@@ -411,15 +410,15 @@
 		  FETCH_DATA (info, nibl_count + 8);
 		  instr_long = (instr_data->words[nibl_count] << 16)
 		    | (instr_data->words[nibl_count + 4]);
-		  instr_data->address = ((instr_word & 0x7f00) << 8) +
-		    (instr_long & 0xffff);
+		  instr_data->address = ((instr_word & 0x7f00) << 8)
+		    + (instr_long & 0xffff);
 		  nibl_count += 7;
-                  seg_length = 2;
+		  seg_length = 2;
 		}
 	      else
 		{
-		  instr_data->address = ((instr_word & 0x7f00) << 8) +
-		    (instr_word & 0x00ff);
+		  instr_data->address = ((instr_word & 0x7f00) << 8)
+		    + (instr_word & 0x00ff);
 		  nibl_count += 3;
 		}
 	    }
@@ -434,11 +433,13 @@
 	  instr_data->ctrl_code = instr_nibl & 0x7;
 	  break;
 	case CLASS_0DISP7:
-	  instr_data->displacement = instr_data->insn_start + 2 - (instr_byte & 0x7f) * 2;
+	  instr_data->displacement =
+	    instr_data->insn_start + 2 - (instr_byte & 0x7f) * 2;
 	  nibl_count += 1;
 	  break;
 	case CLASS_1DISP7:
-	  instr_data->displacement = instr_data->insn_start + 2 - (instr_byte & 0x7f) * 2;
+	  instr_data->displacement =
+	    instr_data->insn_start + 2 - (instr_byte & 0x7f) * 2;
 	  nibl_count += 1;
 	  break;
 	case CLASS_01II:
@@ -459,12 +460,13 @@
 	case CLASS_REGN0:
 	  instr_data->arg_reg[datum_value] = instr_nibl;
 	  break;
-        case CLASS_DISP8:
-	  instr_data->displacement = instr_data->insn_start + 2  + (signed char)instr_byte * 2;
+	case CLASS_DISP8:
+	  instr_data->displacement =
+	    instr_data->insn_start + 2 + (signed char) instr_byte * 2;
 	  nibl_count += 1;
-          break;
+	  break;
 	default:
-          abort ();
+	  abort ();
 	  break;
 	}
 
@@ -566,14 +568,14 @@
 	  strcat (out_str, tmp_str);
 	  break;
 	case CLASS_PR:
-          if (is_segmented)
-            sprintf (tmp_str, "rr%ld", instr_data->arg_reg[datum_value]);
-          else
-            sprintf (tmp_str, "r%ld", instr_data->arg_reg[datum_value]);
+	  if (is_segmented)
+	    sprintf (tmp_str, "rr%ld", instr_data->arg_reg[datum_value]);
+	  else
+	    sprintf (tmp_str, "r%ld", instr_data->arg_reg[datum_value]);
 	  strcat (out_str, tmp_str);
 	  break;
 	default:
-          abort ();
+	  abort ();
 	  break;
 	}
     }

^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <no.id>]
* [patch] *-dis.c: Fix formatting.
@ 2001-07-23  7:53 Kazu Hirata
  0 siblings, 0 replies; 11+ messages in thread
From: Kazu Hirata @ 2001-07-23  7:53 UTC (permalink / raw)
  To: binutils

Hi,

Attached is a patch to fix formatting of *-dis.c.  OK to apply?

Thanks,

Kazu Hirata

2001-07-23  Kazu Hirata  <kazu@hxi.com>

	* m68k-dis.c: Fix formatting.
	* pj-dis.c: Likewise.
	* z8k-dis.c: Likewise.

Index: m68k-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/m68k-dis.c,v
retrieving revision 1.7
diff -u -r1.7 m68k-dis.c
--- m68k-dis.c	2001/06/06 14:28:00	1.7
+++ m68k-dis.c	2001/07/23 14:44:22
@@ -37,7 +37,7 @@
 fetch_arg PARAMS ((unsigned char *, int, int, disassemble_info *));
 
 static void
-print_base PARAMS ((int, bfd_vma, disassemble_info*));
+print_base PARAMS ((int, bfd_vma, disassemble_info *));
 
 static unsigned char *
 print_indexed PARAMS ((int, unsigned char *, bfd_vma, disassemble_info *));
@@ -46,24 +46,22 @@
 print_insn_arg PARAMS ((const char *, unsigned char *, unsigned char *,
 			bfd_vma, disassemble_info *));
 
-CONST char * CONST fpcr_names[] =
-  {
+CONST char * CONST fpcr_names[] = {
     "", "%fpiar", "%fpsr", "%fpiar/%fpsr", "%fpcr",
     "%fpiar/%fpcr", "%fpsr/%fpcr", "%fpiar/%fpsr/%fpcr"
-  };
+};
 
-static char *const reg_names[] =
-  {
+static char *const reg_names[] = {
     "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",
     "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp",
     "%ps", "%pc"
-  };
+};
 
 /* Sign-extend an (unsigned char). */
 #if __STDC__ == 1
-#define COERCE_SIGNED_CHAR(ch) ((signed char)(ch))
+#define COERCE_SIGNED_CHAR(ch) ((signed char) (ch))
 #else
-#define COERCE_SIGNED_CHAR(ch) ((int)(((ch) ^ 0x80) & 0xFF) - 128)
+#define COERCE_SIGNED_CHAR(ch) ((int) (((ch) ^ 0x80) & 0xFF) - 128)
 #endif
 
 /* Get a 1 byte signed integer.  */
@@ -107,15 +105,13 @@
    there should be a special case to handle this... */
 #define NEXTPACKED(p) \
   (p += 12, FETCH_DATA (info, p), 0.0)
-
 \f
 /* Maximum length of an instruction.  */
 #define MAXLEN 22
 
 #include <setjmp.h>
 
-struct private
-{
+struct private {
   /* Points to first byte not fetched.  */
   bfd_byte *max_fetched;
   bfd_byte the_buffer[MAXLEN];
@@ -127,7 +123,7 @@
    to ADDR (exclusive) are valid.  Returns 1 for success, longjmps
    on error.  */
 #define FETCH_DATA(info, addr) \
-  ((addr) <= ((struct private *)(info->private_data))->max_fetched \
+  ((addr) <= ((struct private *) (info->private_data))->max_fetched \
    ? 1 : fetch_data ((info), (addr)))
 
 static int
@@ -156,12 +152,15 @@
 /* This function is used to print to the bit-bucket. */
 static int
 #ifdef __STDC__
-dummy_printer (FILE * file ATTRIBUTE_UNUSED,
-	       const char * format ATTRIBUTE_UNUSED, ...)
+dummy_printer (FILE *file ATTRIBUTE_UNUSED,
+	       const char *format ATTRIBUTE_UNUSED, ...)
 #else
-dummy_printer (file) FILE *file ATTRIBUTE_UNUSED;
+dummy_printer (file)
+     FILE *file ATTRIBUTE_UNUSED;
 #endif
- { return 0; }
+{
+  return 0;
+}
 
 static void
 dummy_print_address (vma, info)
@@ -188,7 +187,7 @@
   struct private priv;
   bfd_byte *buffer = priv.the_buffer;
   fprintf_ftype save_printer = info->fprintf_func;
-  void (*save_print_address) PARAMS((bfd_vma, struct disassemble_info*))
+  void (*save_print_address) PARAMS ((bfd_vma, struct disassemble_info *))
     = info->print_address_func;
   int major_opcode;
   static int numopcodes[16];
@@ -356,7 +355,7 @@
 	{
 	  if (d[1] == 'l' && p - buffer < 6)
 	    p = buffer + 6;
-	  else if (p - buffer < 4 && d[1] != 'C' && d[1] != '8' )
+	  else if (p - buffer < 4 && d[1] != 'C' && d[1] != '8')
 	    p = buffer + 4;
 	}
       if ((d[0] == 'L' || d[0] == 'l') && d[1] == 'w' && p - buffer < 4)
@@ -415,8 +414,8 @@
 
   save_p = p;
   info->print_address_func = dummy_print_address;
-  info->fprintf_func = (fprintf_ftype)dummy_printer;
-  for ( ; *d; d += 2)
+  info->fprintf_func = (fprintf_ftype) dummy_printer;
+  for (; *d; d += 2)
     {
       int eaten = print_insn_arg (d, buffer, p, memaddr + (p - buffer), info);
       if (eaten >= 0)
@@ -425,11 +424,11 @@
 	goto invalid;
       else
 	{
-	  (*info->fprintf_func)(info->stream,
-				/* xgettext:c-format */
-				_("<internal error in opcode table: %s %s>\n"),
-				best->name,
-				best->args);
+	  (*info->fprintf_func) (info->stream,
+				 /* xgettext:c-format */
+				 _("<internal error in opcode table: %s %s>\n"),
+				 best->name,
+				 best->args);
 	  goto invalid;
 	}
 
@@ -501,7 +500,7 @@
         (*info->fprintf_func)
 	  (info->stream,
 	   "%s@",
-	   reg_names [fetch_arg (buffer, place, 3, info) + 8]);
+	   reg_names[fetch_arg (buffer, place, 3, info) + 8]);
         break;
       }
 
@@ -625,7 +624,7 @@
     case 'O':
       val = fetch_arg (buffer, place, 6, info);
       if (val & 0x20)
-	(*info->fprintf_func) (info->stream, "%s", reg_names [val & 7]);
+	(*info->fprintf_func) (info->stream, "%s", reg_names[val & 7]);
       else
 	(*info->fprintf_func) (info->stream, "%d", val);
       break;
@@ -650,7 +649,7 @@
       else if (place == 'C')
 	{
 	  val = fetch_arg (buffer, place, 7, info);
-	  if ( val > 63 )		/* This is a signed constant. */
+	  if (val > 63)		/* This is a signed constant. */
 	    val -= 128;
 	  (*info->fprintf_func) (info->stream, "{#%d}", val);
 	}
@@ -684,7 +683,7 @@
       if (place == 'b')
 	disp = NEXTBYTE (p);
       else if (place == 'B')
-	disp = COERCE_SIGNED_CHAR(buffer[1]);
+	disp = COERCE_SIGNED_CHAR (buffer[1]);
       else if (place == 'w' || place == 'W')
 	disp = NEXTWORD (p);
       else if (place == 'l' || place == 'L' || place == 'C')
@@ -818,7 +817,7 @@
 
 	    case 4:
 	      flt_p = 1;	/* Assume it's a float... */
-	      switch( place )
+	      switch (place)
 	      {
 		case 'b':
 		  val = NEXTBYTE (p);
@@ -836,25 +835,25 @@
 		  break;
 
 		case 'f':
-		  NEXTSINGLE(flval, p);
+		  NEXTSINGLE (flval, p);
 		  break;
 
 		case 'F':
-		  NEXTDOUBLE(flval, p);
+		  NEXTDOUBLE (flval, p);
 		  break;
 
 		case 'x':
-		  NEXTEXTEND(flval, p);
+		  NEXTEXTEND (flval, p);
 		  break;
 
 		case 'p':
-		  flval = NEXTPACKED(p);
+		  flval = NEXTPACKED (p);
 		  break;
 
 		default:
 		  return -1;
 	      }
-	      if ( flt_p )	/* Print a float? */
+	      if (flt_p)	/* Print a float? */
 		(*info->fprintf_func) (info->stream, "#%g", flval);
 	      else
 		(*info->fprintf_func) (info->stream, "#%d", val);
@@ -1206,7 +1205,7 @@
      disassemble_info *info;
 {
   register int word;
-  static char *const scales[] = {"", ":2", ":4", ":8"};
+  static char *const scales[] = { "", ":2", ":4", ":8" };
   bfd_vma base_disp;
   bfd_vma outer_disp;
   char buf[40];
Index: pj-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/pj-dis.c,v
retrieving revision 1.3
diff -u -r1.3 pj-dis.c
--- pj-dis.c	2001/03/13 22:58:37	1.3
+++ pj-dis.c	2001/07/23 14:44:22
@@ -16,7 +16,6 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-
 #include <stdio.h>
 #include "sysdep.h"
 #include "opcode/pj.h"
@@ -24,7 +23,8 @@
 
 extern const pj_opc_info_t pj_opc_info[512];
 
-static int get_int (memaddr, iptr, info)
+static int
+get_int (memaddr, iptr, info)
      bfd_vma memaddr;
      int *iptr;
      struct disassemble_info *info;
@@ -84,7 +84,7 @@
 	  if ((status = get_int (addr, &val, info)))
 	    goto fail;
 
-	  fprintf_fn (stream," default: ");
+	  fprintf_fn (stream, " default: ");
 	  (*info->print_address_func) (val + insn_start, info);
 	  addr += 4;
 
@@ -96,15 +96,16 @@
 	    goto fail;
 	  addr += 4;
 
-	  while (lowval <= highval) {
-	    if ((status = get_int (addr, &val, info)))
-	      goto fail;
-	    fprintf_fn (stream," %d:[", lowval);
-	    (*info->print_address_func) (val + insn_start, info);
-	    fprintf_fn (stream," ]");
-	    addr += 4;
-	    lowval++;
-	  }
+	  while (lowval <= highval)
+	    {
+	      if ((status = get_int (addr, &val, info)))
+		goto fail;
+	      fprintf_fn (stream, " %d:[", lowval);
+	      (*info->print_address_func) (val + insn_start, info);
+	      fprintf_fn (stream, " ]");
+	      addr += 4;
+	      lowval++;
+	    }
 	  return addr - insn_start;
 	}
 
@@ -122,26 +123,27 @@
 	    goto fail;
 	  addr += 4;
 
-	  fprintf_fn (stream," default: ");
+	  fprintf_fn (stream, " default: ");
 	  (*info->print_address_func) (val + insn_start, info);
 
 	  if ((status = get_int (addr, &count, info)))
 	    goto fail;
 	  addr += 4;
 
-	  while (count--) {
-	    if ((status = get_int (addr, &val, info)))
-	      goto fail;
-	    addr += 4;
-	    fprintf_fn (stream," %d:[", val);
-
-	    if ((status = get_int (addr, &val, info)))
-	      goto fail;
-	    addr += 4;
-
-	    (*info->print_address_func) (val + insn_start, info);
-	    fprintf_fn (stream," ]");
-	  }
+	  while (count--)
+	    {
+	      if ((status = get_int (addr, &val, info)))
+		goto fail;
+	      addr += 4;
+	      fprintf_fn (stream, " %d:[", val);
+
+	      if ((status = get_int (addr, &val, info)))
+		goto fail;
+	      addr += 4;
+
+	      (*info->print_address_func) (val + insn_start, info);
+	      fprintf_fn (stream, " ]");
+	    }
 	  return addr - insn_start;
 	}
       for (a = 0; op->arg[a]; a++)
Index: z8k-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/z8k-dis.c,v
retrieving revision 1.6
diff -u -r1.6 z8k-dis.c
--- z8k-dis.c	2001/06/06 17:01:35	1.6
+++ z8k-dis.c	2001/07/23 14:44:22
@@ -26,8 +26,7 @@
 \f
 #include <setjmp.h>
 \f
-typedef struct
-{
+typedef struct {
   /* These are all indexed by nibble number (i.e only every other entry
      of bytes is used, and every 4th entry of words).  */
   unsigned char nibbles[24];
@@ -49,14 +48,13 @@
   unsigned long ctrl_code;
   unsigned long flags;
   unsigned long interrupts;
-}
-instr_data_s;
+} instr_data_s;
 
 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
    to ADDR (exclusive) are valid.  Returns 1 for success, longjmps
    on error.  */
 #define FETCH_DATA(info, nibble) \
-  ((nibble) < ((instr_data_s *)(info->private_data))->max_fetched \
+  ((nibble) < ((instr_data_s *) (info->private_data))->max_fetched \
    ? 1 : fetch_data ((info), (nibble)))
 
 static int
@@ -105,8 +103,7 @@
   return 1;
 }
 
-static char *codes[16] =
-{
+static char *codes[16] = {
   "f",
   "lt",
   "le",
@@ -125,8 +122,7 @@
   "nc/uge"
 };
 
-static char *ctrl_names[8] =
-{
+static char *ctrl_names[8] = {
   "<invld>",
   "flags",
   "fcw",
@@ -325,8 +321,8 @@
     {
       FETCH_DATA (info, nibl_count + 4 - (nibl_count % 4));
       instr_nibl = instr_data->nibbles[nibl_count];
-      instr_byte = instr_data->bytes[nibl_count&~1];
-      instr_word = instr_data->words[nibl_count&~3];
+      instr_byte = instr_data->bytes[nibl_count & ~1];
+      instr_word = instr_data->words[nibl_count & ~3];
 
       tabl_datum = z8k_table[instr_data->tabl_index].byte_info[loop];
       datum_class = tabl_datum & CLASS_MASK;
@@ -339,15 +335,17 @@
 	    {
 	    case ARG_DISP16:
               instr_data->displacement = instr_data->insn_start + 4 +
-                (signed short)(instr_word & 0xffff);
+                (signed short) (instr_word & 0xffff);
 	      nibl_count += 3;
 	      break;
 	    case ARG_DISP12:
-              if (instr_word & 0x800) {  /* neg. 12 bit displacement */
-                instr_data->displacement = instr_data->insn_start + 2 -
-                  (signed short)((instr_word & 0xfff) | 0xf000) * 2;
-              }
-              else {
+              if (instr_word & 0x800)
+		{  /* neg. 12 bit displacement */
+		  instr_data->displacement = instr_data->insn_start + 2 -
+		    (signed short) ((instr_word & 0xfff) | 0xf000) * 2;
+		}
+              else
+		{
                 instr_data->displacement = instr_data->insn_start + 2 - (instr_word & 0x0fff) * 2;
               }
 	      nibl_count += 2;
@@ -474,7 +472,7 @@
 }
 
 static void
-unparse_instr (instr_data,is_segmented)
+unparse_instr (instr_data, is_segmented)
      instr_data_s *instr_data;
      int is_segmented;
 {

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

end of thread, other threads:[~2001-08-21 19:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200108121542.IAA18490@cygnus.com>
2001-08-13  1:05 ` [patch] *-dis.c: Fix formatting Nick Clifton
     [not found] <200108171934.MAA23915@cygnus.com>
2001-08-17 21:34 ` Andrew Cagney
2001-08-17 22:28   ` Alan Modra
2001-08-18 10:08     ` Andrew Cagney
2001-08-19  6:33       ` Alan Modra
2001-08-21 19:58         ` Andrew Cagney
2001-08-18 10:08     ` Andrew Cagney
2001-08-17 12:33 Kazu Hirata
  -- strict thread matches above, loose matches on Subject: below --
2001-08-12  8:42 Kazu Hirata
     [not found] <no.id>
2001-07-23 17:10 ` Alan Modra
2001-07-23  7:53 Kazu Hirata

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).