Anonymous avatar Anonymous committed 0153335

Add ClearCINTMessageCallback.

Comments (0)

Files changed (5)

 2007-10-19  scott snyder  <snyder@bnl.gov>
 
+	* Tagging RootUtils-00-00-07.
+
+	* RootUtils/ClearCINTMessageCallback.h: (new)
+	* src/ClearCINTMessageCallback.cxx: (new)
+	* RootUtils/RootUtilsDict.h: Add it.
+	* RootUtils/selection.xml: Add it.
+
 	* Tagging RootUtils-00-00-06.
 	* RootUtils/ScanForAbstract.h: Fix typo in comments.
 

RootUtils/ClearCINTMessageCallback.h

+// This file's extension implies that it's C, but it's really -*- C++ -*-.
+// $Id: ClearCINTMessageCallback.h,v 1.1 2007-10-19 21:03:00 ssnyder Exp $
+
+/**
+ * @file RootUtils/ClearCINTMessageCallback.h
+ * @author scott snyder
+ * @date Oct 2007
+ * @brief Clear Cint's error message callback.
+ */
+
+
+#ifndef ROOTUTILS_CLEARCINTMESSAGECALLBACK_H
+#define ROOTUTILS_CLEARCINTMESSAGECALLBACK_H
+
+
+namespace RootUtils {
+
+
+/**
+ * @brief Clear Cint's error message callback.
+ *
+ * PyROOT sets up a callback to intercept Cint's error messages
+ * and turn them into Python errors.  That's fine if you're using
+ * Python as a shell.  But if you're using Cint as a shell
+ * (and calling python through TPython), then this will result
+ * in cint's error messages being lost.
+ *
+ * Now, PyROOT itself is smart enough to only install the callback
+ * if python is actually being used as a shell.  However, PyCintex
+ * installs the callback unconditionally.  This function can be
+ * used to undo the damage.
+ */
+class ClearCINTMessageCallback
+{
+public:
+  /**
+   * @brief Clear Cint's error message callback.
+   *
+   * This could (almost) just as well be a free function.
+   * The only reason to put it inside a class is that root doesn't
+   * auto-load functions, only classes.
+   */
+  static void initialize();
+};
+
+
+} // namespace RootUtils
+
+
+#endif // not ROOTUTILS_CLEARCINTMESSAGECALLBACK_H

RootUtils/RootUtilsDict.h

 // This file's extension implies that it's C, but it's really -*- C++ -*-.
-// $Id: RootUtilsDict.h,v 1.5 2007-10-16 20:08:26 ssnyder Exp $
+// $Id: RootUtilsDict.h,v 1.6 2007-10-19 21:03:00 ssnyder Exp $
 
 /**
  * @file  RootUtils/RootUtilsDict.h
 #include "RootUtils/ScanForAbstract.h"
 #include "RootUtils/PyROOTConstFix.h"
 #include "RootUtils/DataVectorConvert.h"
+#include "RootUtils/ClearCINTMessageCallback.h"

RootUtils/selection.xml

     <class name="RootUtils::ScanForAbstract" />
     <class name="RootUtils::PyROOTConstFix" />
     <class name="RootUtils::DataVectorConvert" />
+    <class name="RootUtils::ClearCINTMessageCallback" />
 </lcgdict>

src/ClearCINTMessageCallback.cxx

+// $Id: ClearCINTMessageCallback.cxx,v 1.1 2007-10-19 21:03:00 ssnyder Exp $
+/**
+ * @file RootUtils/src/ClearCINTMessageCallback.cxx
+ * @author scott snyder
+ * @date Oct 2007
+ * @brief Clear Cint's error message callback.
+ */
+
+
+#include "RootUtils/ClearCINTMessageCallback.h"
+#include "Api.h"
+
+
+namespace RootUtils {
+
+
+/**
+ * @brief Clear Cint's error message callback.
+ */
+void ClearCINTMessageCallback::initialize()
+{
+  G__set_errmsgcallback (0);
+}
+
+
+} // namespace RootUtils
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.