]> git.lyx.org Git - lyx.git/blobdiff - src/support/LAssert.C
split LyXText::rowlist_ into individual Paragraph::rows_ chunks
[lyx.git] / src / support / LAssert.C
index b878f26d47a073bf502278b96581f612492365bd..30248b0807156ce76bd575eee5c95cd481a0961f 100644 (file)
@@ -1,36 +1,48 @@
-/* This file is part of
- * ======================================================
- * 
- *           LyX, The Document Processor
- *      
- *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2001 The LyX Team.
+/**
+ * \file LAssert.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * ====================================================== */
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS
+ */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "LAssert.h"
+#include "support/lyxlib.h"
 
 #ifdef ENABLE_ASSERTIONS
-#include "bufferlist.h"
+#include "lyx_main.h"
+
+namespace lyx {
+namespace support {
 
-extern BufferList bufferlist;
+namespace {
 
-void emergencySave() {
-       static bool didSafe;
-       if (didSafe)
+void emergencyCleanup()
+{
+       static bool didCleanup;
+       if (didCleanup)
                return;
 
-       didSafe = true;
+       didCleanup = true;
 
-       // emergency save
-       if (!bufferlist.empty())
-               bufferlist.emergencyWriteAll();
+       LyX::emergencyCleanup();
 }
 
+} // namespace anon
+
+void Assert(bool assertion)
+{
+       if (!assertion) {
+               emergencyCleanup();
+               lyx::support::abort();
+       }
+}
+
+} // namespace support
+} // namespace lyx
+
 #endif