OSDN Git Service

* components.cxx (operator<<): Move this function template ..
authorbje <bje>
Wed, 11 Jul 2001 01:10:37 +0000 (01:10 +0000)
committerbje <bje>
Wed, 11 Jul 2001 01:10:37 +0000 (01:10 +0000)
(operator>>): .. and this one from here ..
* components.h (operator<<): .. to here.
(operator>>): .. and here.

sid/component/interrupt/ChangeLog
sid/component/interrupt/components.cxx
sid/component/interrupt/components.h

index eef91af..574c4e6 100644 (file)
@@ -1,3 +1,10 @@
+2001-07-11  Ben Elliston  <bje@redhat.com>
+
+       * components.cxx (operator<<): Move this function template ..
+       (operator>>): .. and this one from here ..
+       * components.h (operator<<): .. to here.
+       (operator>>): .. and here.
+
 2001-07-06  Frank Ch. Eigler  <fche@redhat.com>
 
        * components.h (IntController fiq_read_word): Provide dummy body.
index 4b85062..75e4802 100644 (file)
@@ -8,91 +8,6 @@
 #include "tconfig.h"
 #include "components.h"
 
-
-
-
-  // XXX: this should be in components.cxx, but GCC does not seem to
-  //      like these being outside of the class.
-template<class bus_size>
-ostream& operator<< (ostream& op, const IntController<bus_size>& copy_obj)
-{
-  op << "IRQEnable " << copy_obj.irq_enabled << " ";
-  op << "IRQPend "   << copy_obj.irq_pending;
-  op << " FIQEnable " << copy_obj.fiq_enabled;
-  op << " FIQPend "   << copy_obj.fiq_pending;
-  op << endl;
-  
-  op << "Pins ";
-  op << copy_obj.reset_pin << " ";
-  op << copy_obj.irq_pin;
-  op << " " << copy_obj.fiq_pin;
-  
-  for (unsigned i = 0; i < copy_obj.irq_lines.size(); i++)
-    op << " " << *static_cast<input_pin*>(copy_obj.irq_lines[i]);
-  for (unsigned i = 0; i < copy_obj.fiq_lines.size(); i++)
-    op << " " << *static_cast<input_pin*>(copy_obj.fiq_lines[i]);
-  
-  // NB: no whitespace at end!
-  
-  return op;
-}
-
-template <class bus_size>
-istream& operator>> (istream& ip, IntController<bus_size>& ovwrite_obj)
-{
-  string coding;
-  
-  ip >> coding;
-  if (coding != "IRQEnable")
-    {
-      ip.setstate(ios::badbit);
-      return ip;
-    }
-  ip >> ovwrite_obj.irq_enabled;
-  
-  ip >> coding;
-  if (coding != "IRQPend")
-    {
-      ip.setstate(ios::badbit);
-      return ip;
-    }
-  ip >> ovwrite_obj.irq_pending;           
-  
-  ip >> coding;
-  if ( coding != "FIQEnable")
-    {
-      ip.setstate(ios::badbit);
-      return ip;
-    }
-  ip >> ovwrite_obj.fiq_enabled;
-  
-  ip >> coding;
-  if ( coding != "FIQPend")
-    {
-      ip.setstate(ios::badbit);
-      return ip;
-    }
-  ip >> ovwrite_obj.fiq_pending;
-  
-  ip >> coding;
-  if (coding != "Pins" )
-    {
-      ip.setstate (ios::badbit);
-      return ip;
-    }
-  ip >> ovwrite_obj.reset_pin;
-  ip >> ovwrite_obj.irq_pin;
-  ip >> ovwrite_obj.fiq_pin;
-  
-  for (unsigned i = 0; i < ovwrite_obj.irq_lines.size(); i++)
-    ip >> *static_cast<input_pin*>(ovwrite_obj.irq_lines[i]);
-  for (unsigned i = 0; i < ovwrite_obj.fiq_lines.size(); i++)
-    ip >> *static_cast<input_pin*>(ovwrite_obj.fiq_lines[i]);
-  
-  return ip;
-}
-
-
 // --- m a i n   d r i v e r ---
 
 static vector<string>
index c31c08a..a21253f 100644 (file)
@@ -265,7 +265,7 @@ IntController<bus_size>::IntController<bus_size>
   interrupt_lines* tmpline = NULL;
   string tmpstr = "";
   
-  for (int i = 0; i < num_irq; ++i)
+  for (unsigned i = 0; i < num_irq; ++i)
     {
       tmpline = new interrupt_lines (i, this,
        &IntController<bus_size>::irq_src_driven);
@@ -283,7 +283,7 @@ IntController<bus_size>::IntController<bus_size>
       tmpstr = "";
     }
 
-  for (int i = 0; i < num_fiq; ++i)
+  for (unsigned i = 0; i < num_fiq; ++i)
     {
       tmpline = new interrupt_lines (i, this,
        &IntController<bus_size>::fiq_src_driven);
@@ -371,5 +371,83 @@ IntController<bus_size>::reset(host_int_4 reset_val)
 }
 
 
+template<class bus_size>
+ostream& operator<< (ostream& op, const IntController<bus_size>& copy_obj)
+{
+  op << "IRQEnable " << copy_obj.irq_enabled << " ";
+  op << "IRQPend "   << copy_obj.irq_pending;
+  op << " FIQEnable " << copy_obj.fiq_enabled;
+  op << " FIQPend "   << copy_obj.fiq_pending;
+  op << endl;
+  
+  op << "Pins ";
+  op << copy_obj.reset_pin << " ";
+  op << copy_obj.irq_pin;
+  op << " " << copy_obj.fiq_pin;
+  
+  for (unsigned i = 0; i < copy_obj.irq_lines.size(); i++)
+    op << " " << *static_cast<input_pin*>(copy_obj.irq_lines[i]);
+  for (unsigned i = 0; i < copy_obj.fiq_lines.size(); i++)
+    op << " " << *static_cast<input_pin*>(copy_obj.fiq_lines[i]);
+  
+  // NB: no whitespace at end!
+  
+  return op;
+}
+
+template <class bus_size>
+istream& operator>> (istream& ip, IntController<bus_size>& ovwrite_obj)
+{
+  string coding;
+  
+  ip >> coding;
+  if (coding != "IRQEnable")
+    {
+      ip.setstate(ios::badbit);
+      return ip;
+    }
+  ip >> ovwrite_obj.irq_enabled;
+  
+  ip >> coding;
+  if (coding != "IRQPend")
+    {
+      ip.setstate(ios::badbit);
+      return ip;
+    }
+  ip >> ovwrite_obj.irq_pending;           
+  
+  ip >> coding;
+  if ( coding != "FIQEnable")
+    {
+      ip.setstate(ios::badbit);
+      return ip;
+    }
+  ip >> ovwrite_obj.fiq_enabled;
+  
+  ip >> coding;
+  if ( coding != "FIQPend")
+    {
+      ip.setstate(ios::badbit);
+      return ip;
+    }
+  ip >> ovwrite_obj.fiq_pending;
+  
+  ip >> coding;
+  if (coding != "Pins" )
+    {
+      ip.setstate (ios::badbit);
+      return ip;
+    }
+  ip >> ovwrite_obj.reset_pin;
+  ip >> ovwrite_obj.irq_pin;
+  ip >> ovwrite_obj.fiq_pin;
+  
+  for (unsigned i = 0; i < ovwrite_obj.irq_lines.size(); i++)
+    ip >> *static_cast<input_pin*>(ovwrite_obj.irq_lines[i]);
+  for (unsigned i = 0; i < ovwrite_obj.fiq_lines.size(); i++)
+    ip >> *static_cast<input_pin*>(ovwrite_obj.fiq_lines[i]);
+  
+  return ip;
+}
 
 #endif // COMPONENTS_H