]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/smobs.hh
Run fixcc.py with astyle 2.02
[lilypond.git] / lily / include / smobs.hh
index f0cea0230191deb01516d24c035c1ac3daf0bb3b..cd28a29c3f0af531de7cb954f65e538fb1c80b02 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1999--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1999--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -153,19 +153,34 @@ void protect_smob (SCM smob, SCM *prot_cons);
 void unprotect_smob (SCM smob, SCM *prot_cons);
 
 extern bool parsed_objects_should_be_dead;
+class parsed_dead
+{
+  static vector<parsed_dead *> elements;
+  SCM data;
+  SCM readout_one ()
+  {
+    SCM res = data;
+    data = SCM_UNDEFINED;
+    return res;
+  }
+public:
+  parsed_dead () : data (SCM_UNDEFINED)
+  {
+    elements.push_back (this);
+  }
+  void checkin (SCM arg) { data = arg; }
+  static SCM readout ();
+};
 
 #ifndef NDEBUG
-#define ASSERT_LIVE_IS_ALLOWED()     \
-  do { \
-    static bool passed_here_once;\
-    if (parsed_objects_should_be_dead && !passed_here_once) { \
-      ::programming_error (string ("Parsed object should be dead: ")  + __PRETTY_FUNCTION__ ); \
-      passed_here_once = true;\
-    } \
-  } \
-  while (0)
+#define ASSERT_LIVE_IS_ALLOWED(arg)                                     \
+  do {                                                                  \
+    static parsed_dead pass_here;                                       \
+    if (parsed_objects_should_be_dead)                                  \
+      pass_here.checkin (arg);                                          \
+  } while (0)
 #else
-#define ASSERT_LIVE_IS_ALLOWED() do { } \
+#define ASSERT_LIVE_IS_ALLOWED(arg) do { } \
   while (0)
 #endif