Index: trunk/MagicSoft/Mars/mbase/MAGIC.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MAGIC.h	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MAGIC.h	(revision 7804)
@@ -21,4 +21,9 @@
 #endif
 
+#ifndef R__FOR_EACH
+#define R__FOR_EACH ForEach
+#endif
+
+
 //
 // Values for the eventloop control
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 7804)
@@ -736,5 +736,5 @@
 // gui elements to a macro-file.
 //
-void MEvtLoop::StreamPrimitive(ofstream &out) const
+void MEvtLoop::StreamPrimitive(ostream &out) const
 {
     out << "   MEvtLoop " << GetUniqueName();
@@ -747,5 +747,5 @@
 //
 //
-void MEvtLoop::SavePrimitive(ofstream &out, Option_t *opt)
+void MEvtLoop::SavePrimitive(ostream &out, Option_t *opt)
 {
     TString options = opt;
@@ -767,5 +767,5 @@
         {
             *fLog << err << "MEvtLoop::SavePrimitive - Error: old file not closed." << endl;
-            gListOfPrimitives->ForEach(TObject, ResetBit)(BIT(15));
+            gListOfPrimitives->R__FOR_EACH(TObject, ResetBit)(BIT(15));
             delete gListOfPrimitives;
         }
@@ -788,7 +788,12 @@
         return;
 
-    gListOfPrimitives->ForEach(TObject, ResetBit)(BIT(15));
+    gListOfPrimitives->R__FOR_EACH(TObject, ResetBit)(BIT(15));
     delete gListOfPrimitives;
     gListOfPrimitives = 0;
+}
+
+void MEvtLoop::SavePrimitive(ofstream &out, Option_t *o)
+{
+    SavePrimitive(static_cast<ostream&>(out), o);
 }
 
@@ -1041,5 +1046,6 @@
     }
 
-    return ReadEnv(TEnv(config), "", print);
+    const TEnv env(config);
+    return ReadEnv(env, "", print);
 }
 
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 7804)
@@ -37,5 +37,5 @@
     Bool_t HasDuplicateNames(TObjArray &arr, const TString txt) const;
 
-    void StreamPrimitive(ofstream &out) const;
+    void StreamPrimitive(ostream &out) const;
 
     Bool_t ProcessGuiEvents(Int_t num);
@@ -78,4 +78,5 @@
     void MakeMacro(const char *filename="evtloop.C");
 
+    void SavePrimitive(ostream &out, Option_t *o="");
     void SavePrimitive(ofstream &out, Option_t *o="");
 
Index: trunk/MagicSoft/Mars/mbase/MLog.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 7804)
@@ -264,5 +264,5 @@
     SetBit(kIsUnderlined);
 
-    fPlugins->ForEach(MLogPlugin, Underline)();
+    fPlugins->R__FOR_EACH(MLogPlugin, Underline)();
 
     if (TestBit(eNoColors))
@@ -353,6 +353,6 @@
         fOut->write(fBase, len);
 
-    fPlugins->ForEach(MLogPlugin, SetColor)(fOutputLevel);
-    fPlugins->ForEach(MLogPlugin, WriteBuffer)(fBase, len);
+    fPlugins->R__FOR_EACH(MLogPlugin, SetColor)(fOutputLevel);
+    fPlugins->R__FOR_EACH(MLogPlugin, WriteBuffer)(fBase, len);
 
     if (fDevice&eGui && fGui)
Index: trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 7804)
@@ -682,5 +682,5 @@
 // gui elements to a macro-file.
 //
-void MParContainer::SavePrimitive(ofstream &out, Option_t *o)
+void MParContainer::SavePrimitive(ostream &out, Option_t *o)
 {
     static UInt_t uid = 0;
@@ -698,9 +698,14 @@
 }
 
+void MParContainer::SavePrimitive(ofstream &out, Option_t *o)
+{
+    SavePrimitive(static_cast<ostream&>(out));
+}
+
 // --------------------------------------------------------------------------
 //
 // Creates the string written by SavePrimitive and returns it.
 //
-void MParContainer::StreamPrimitive(ofstream &out) const
+void MParContainer::StreamPrimitive(ostream &out) const
 {
     out << "   // Using MParContainer::StreamPrimitive" << endl;
Index: trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 7804)
@@ -94,4 +94,5 @@
     virtual void   Print(Option_t *option="") const;
     virtual Int_t  Sizeof() const;
+    virtual void   SavePrimitive(ostream &out, Option_t *o="");
     virtual void   SavePrimitive(ofstream &out, Option_t *o="");
 
@@ -108,8 +109,5 @@
     virtual void SetDisplay(MStatusDisplay *d) { fDisplay = d; }
 
-    // FIXME: Change to ostream! Seems to be difficult, because
-    //        MTaskListStreamPrimitive calls SavePrimitive(ofstream&).
-    //        Maybe with a cast?
-    virtual void StreamPrimitive(ofstream &out) const;
+    virtual void StreamPrimitive(ostream &out) const;
 
     TMethodCall *GetterMethod(const char *name) const;
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 7804)
@@ -160,5 +160,5 @@
 void MParList::SetLogStream(MLog *log)
 {
-    fContainer->ForEach(MParContainer, SetLogStream)(log);
+    fContainer->R__FOR_EACH(MParContainer, SetLogStream)(log);
     MParContainer::SetLogStream(log);
 }
@@ -166,5 +166,5 @@
 void MParList::SetDisplay(MStatusDisplay *d)
 {
-    fContainer->ForEach(MParContainer, SetDisplay)(d);
+    fContainer->R__FOR_EACH(MParContainer, SetDisplay)(d);
     MParContainer::SetDisplay(d);
 }
@@ -659,5 +659,5 @@
 void MParList::SetReadyToSave(Bool_t flag)
 {
-    fContainer->ForEach(MParContainer, SetReadyToSave)(flag);
+    fContainer->R__FOR_EACH(MParContainer, SetReadyToSave)(flag);
     MParContainer::SetReadyToSave(flag);
 }
@@ -669,5 +669,5 @@
 void MParList::Reset()
 {
-    fContainer->ForEach(MParContainer, Reset)();
+    fContainer->R__FOR_EACH(MParContainer, Reset)();
 }
 
@@ -841,5 +841,5 @@
 }
 
-void MParList::SavePrimitive(ofstream &out, Option_t *o)
+void MParList::SavePrimitive(ostream &out, Option_t *o)
 {
     Bool_t saved = IsSavedAsPrimitive();
@@ -867,4 +867,9 @@
 }
 
+void MParList::SavePrimitive(ofstream &out, Option_t *o)
+{
+    SavePrimitive(static_cast<ostream&>(out), o);
+}
+
 // --------------------------------------------------------------------------
 //
@@ -873,5 +878,5 @@
 // gui elements to a macro-file.
 //
-void MParList::StreamPrimitive(ofstream &out) const
+void MParList::StreamPrimitive(ostream &out) const
 {
     out << "   MParList " << GetUniqueName();
@@ -894,5 +899,5 @@
 {
     MParContainer::GetNames(arr);
-    fContainer->ForEach(MParContainer, GetNames)(arr);
+    fContainer->R__FOR_EACH(MParContainer, GetNames)(arr);
 }
 
@@ -905,5 +910,5 @@
 {
     MParContainer::SetNames(arr);
-    fContainer->ForEach(MParContainer, SetNames)(arr);
+    fContainer->R__FOR_EACH(MParContainer, SetNames)(arr);
 }
 
Index: trunk/MagicSoft/Mars/mbase/MParList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.h	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MParList.h	(revision 7804)
@@ -35,5 +35,5 @@
     enum { kIsOwner = BIT(14) };
 
-    void StreamPrimitive(ofstream &out) const;
+    void StreamPrimitive(ostream &out) const;
 
     void Init(const char *name, const char *title);
@@ -97,4 +97,5 @@
     void SetNames(TObjArray &arr);
 
+    void SavePrimitive(ostream &out, Option_t *o="");
     void SavePrimitive(ofstream &out, Option_t *o="");
 
Index: trunk/MagicSoft/Mars/mbase/MString.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MString.h	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MString.h	(revision 7804)
@@ -13,9 +13,12 @@
 public:
     MString(const char *txt=0)  : TString(txt) { }
-    MString(const TString &txt) : TString(txt) { }
+    MString(const MString &txt) : TString(txt) { }
 
     MString &Print(const char *fmt, va_list &ap);
     MString &Print(const char *fmt, ...);
+
+#ifndef __CINT__
     static MString Form(const char *fmt, ...);
+#endif
 
     ClassDef(MString, 1) // Tool to make Form() thread safe against other TStrings
Index: trunk/MagicSoft/Mars/mbase/MTask.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 7804)
@@ -455,5 +455,5 @@
 // and afterwards set the filter for this task.
 //
-void MTask::SavePrimitive(ofstream &out, Option_t *o)
+void MTask::SavePrimitive(ostream &out, Option_t *o)
 {
     MParContainer::SavePrimitive(out);
@@ -471,4 +471,9 @@
     if (fSerialNumber>0)
         out << "   " << GetUniqueName() << ".SetSerialNumber(" << fSerialNumber <<");" << endl;
+}
+
+void MTask::SavePrimitive(ofstream &out, Option_t *o)
+{
+    SavePrimitive(static_cast<ostream&>(out), o);
 }
 
Index: trunk/MagicSoft/Mars/mbase/MTask.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.h	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MTask.h	(revision 7804)
@@ -120,4 +120,5 @@
     virtual Int_t CallPostProcess();
 
+    void SavePrimitive(ostream &out, Option_t *o="");
     void SavePrimitive(ofstream &out, Option_t *o="");
 
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 7804)
@@ -144,5 +144,5 @@
 void MTaskList::SetLogStream(MLog *log)
 {
-    fTasks->ForEach(MTask, SetLogStream)(log);
+    fTasks->R__FOR_EACH(MTask, SetLogStream)(log);
     MTask::SetLogStream(log);
 }
@@ -154,5 +154,5 @@
 void MTaskList::SetDisplay(MStatusDisplay *d)
 {
-    fTasks->ForEach(MTask, SetDisplay)(d);
+    fTasks->R__FOR_EACH(MTask, SetDisplay)(d);
     MTask::SetDisplay(d);
 }
@@ -160,5 +160,5 @@
 void MTaskList::SetAccelerator(Byte_t acc)
 {
-    fTasks->ForEach(MTask, SetAccelerator)(acc);
+    fTasks->R__FOR_EACH(MTask, SetAccelerator)(acc);
     MTask::SetAccelerator(acc);
 }
@@ -171,5 +171,5 @@
 void MTaskList::SetSerialNumber(Byte_t num)
 {
-    fTasks->ForEach(MTask, SetSerialNumber)(num);
+    fTasks->R__FOR_EACH(MTask, SetSerialNumber)(num);
     MTask::SetSerialNumber(num);
 }
@@ -802,5 +802,5 @@
     //  create the Iterator for the TaskList
     //
-    fTasks->ForEach(MTask, PrintStatistics)(lvl+1, title, GetCpuTime());
+    fTasks->R__FOR_EACH(MTask, PrintStatistics)(lvl+1, title, GetCpuTime());
 
     if (lvl==0)
@@ -827,5 +827,5 @@
 // gui elements to a macro-file.
 //
-void MTaskList::StreamPrimitive(ofstream &out) const
+void MTaskList::StreamPrimitive(ostream &out) const
 {
     out << "   MTaskList " << GetUniqueName();
@@ -853,5 +853,5 @@
 {
     MParContainer::GetNames(arr);
-    fTasks->ForEach(MParContainer, GetNames)(arr);
+    fTasks->R__FOR_EACH(MParContainer, GetNames)(arr);
 }
 
@@ -859,5 +859,5 @@
 {
     MParContainer::SetNames(arr);
-    fTasks->ForEach(MParContainer, SetNames)(arr);
+    fTasks->R__FOR_EACH(MParContainer, SetNames)(arr);
 }
 
Index: trunk/MagicSoft/Mars/mbase/MTaskList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 7801)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 7804)
@@ -31,5 +31,5 @@
 
     void   Remove(MTask *task);
-    void   StreamPrimitive(ofstream &out) const;
+    void   StreamPrimitive(ostream &out) const;
     Bool_t CheckAddToList(MTask *task, const char *tType, const MTask *where=NULL) const;
 
