use fprintf_func callback to print code


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1435 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/ppc-dis.c b/ppc-dis.c
index fcced17..0da1be9 100644
--- a/ppc-dis.c
+++ b/ppc-dis.c
@@ -3067,7 +3067,9 @@
 const int powerpc_num_macros =
   sizeof (powerpc_macros) / sizeof (powerpc_macros[0]);
 
-static int print_insn_powerpc(FILE *, uint32_t insn, unsigned memaddr, int dialect);
+static int
+print_insn_powerpc (disassemble_info *info, uint32_t insn, unsigned memaddr,
+		    int dialect);
 
 /* Print a big endian PowerPC instruction.  For convenience, also
    disassemble instructions supported by the Motorola PowerPC 601.  */
@@ -3083,14 +3085,14 @@
         opc = bfd_getb32(buf);
     else
         opc = bfd_getl32(buf);
-    return print_insn_powerpc (info->stream, opc, pc,
+    return print_insn_powerpc (info, opc, pc,
                                PPC | B32 | M601);
 }
 
 /* Print a PowerPC or POWER instruction.  */
 
 static int
-print_insn_powerpc (FILE *out, uint32_t insn, unsigned memaddr,
+print_insn_powerpc (disassemble_info *info, uint32_t insn, unsigned memaddr,
 		    int dialect)
 {
   const struct powerpc_opcode *opcode;
@@ -3136,9 +3138,9 @@
 		continue;
 
       /* The instruction is valid.  */
-      fprintf(out, "%s", opcode->name);
+      (*info->fprintf_func)(info->stream, "%s", opcode->name);
       if (opcode->operands[0] != 0)
-		fprintf(out, "\t");
+		(*info->fprintf_func)(info->stream, "\t");
 
       /* Now extract and print the operands.  */
       need_comma = 0;
@@ -3175,26 +3177,26 @@
 
 		  if (need_comma)
 		    {
-		      fprintf(out, ",");
+		      (*info->fprintf_func)(info->stream, ",");
 		      need_comma = 0;
 		    }
 
 		  /* Print the operand as directed by the flags.  */
 		  if ((operand->flags & PPC_OPERAND_GPR) != 0)
-		    fprintf(out, "r%d", value);
+		    (*info->fprintf_func)(info->stream, "r%d", value);
 		  else if ((operand->flags & PPC_OPERAND_FPR) != 0)
-		    fprintf(out, "f%d", value);
+		    (*info->fprintf_func)(info->stream, "f%d", value);
 		  else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0)
-		    fprintf(out, "%08X", memaddr + value);
+		    (*info->fprintf_func)(info->stream, "%08X", memaddr + value);
 		  else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
-		    fprintf(out, "%08X", value & 0xffffffff);
+		    (*info->fprintf_func)(info->stream, "%08X", value & 0xffffffff);
 		  else if ((operand->flags & PPC_OPERAND_CR) == 0
 			   || (dialect & PPC_OPCODE_PPC) == 0)
-		    fprintf(out, "%d", value);
+		    (*info->fprintf_func)(info->stream, "%d", value);
 		  else
 		    {
 		      if (operand->bits == 3)
-				fprintf(out, "cr%d", value);
+				(*info->fprintf_func)(info->stream, "cr%d", value);
 		      else
 			{
 			  static const char *cbnames[4] = { "lt", "gt", "eq", "so" };
@@ -3203,20 +3205,20 @@
 
 			  cr = value >> 2;
 			  if (cr != 0)
-			    fprintf(out, "4*cr%d", cr);
+			    (*info->fprintf_func)(info->stream, "4*cr%d", cr);
 			  cc = value & 3;
 			  if (cc != 0)
 			    {
 			      if (cr != 0)
-					fprintf(out, "+");
-			      fprintf(out, "%s", cbnames[cc]);
+					(*info->fprintf_func)(info->stream, "+");
+			      (*info->fprintf_func)(info->stream, "%s", cbnames[cc]);
 			    }
 			}
 	    }
 
 	  if (need_paren)
 	    {
-	      fprintf(out, ")");
+	      (*info->fprintf_func)(info->stream, ")");
 	      need_paren = 0;
 	    }
 
@@ -3224,7 +3226,7 @@
 	    need_comma = 1;
 	  else
 	    {
-	      fprintf(out, "(");
+	      (*info->fprintf_func)(info->stream, "(");
 	      need_paren = 1;
 	    }
 	}
@@ -3234,7 +3236,7 @@
     }
 
   /* We could not find a match.  */
-  fprintf(out, ".long 0x%x", insn);
+  (*info->fprintf_func)(info->stream, ".long 0x%x", insn);
 
   return 4;
 }