diff --git a/src/xmlout.c b/src/xmlout.c
index 26994a0..394d029 100644
--- a/src/xmlout.c
+++ b/src/xmlout.c
@@ -538,6 +538,49 @@ isEventInteresting (const System sys, const Roledef rd)
}
}
+//! Refactoring code from below
+void xmlRunIndex (char *desc, const int run, const int index)
+{
+ xmlPrint ("<%s run=\"%i\" index=\"%i\" />", desc, run, index);
+}
+
+//! Refactoring code from below
+void xmlShowThisBinding(const Binding b)
+{
+ if (isTermVariable (b->term) && !b->done)
+ {
+ // Generate from m0
+ xmlPrint ("");
+
+ xmlindent++;
+ xmlIndentPrint ();
+ xmlTermPrint (b->term);
+ eprintf ("\n");
+ xmlindent--;
+
+ xmlPrint ("");
+ }
+ else
+ {
+ // Normal binding
+ xmlPrint ("");
+
+ xmlindent++;
+ if (b->done)
+ xmlRunIndex ("after", b->run_from, b->ev_from);
+ else
+ xmlPrint ("");
+ if (b->blocked)
+ eprintf ("");
+ xmlIndentPrint ();
+ xmlTermPrint (b->term);
+ eprintf ("\n");
+ xmlindent--;
+
+ xmlPrint ("");
+ }
+}
+
//! Show a single event from a run
/**
* run and index will only be output if they are nonnegative.
@@ -599,59 +642,23 @@ xmlOutEvent (const System sys, Roledef rd, const int run, const int index)
// Display any incoming bindings
{
- int xmlBindingState (void *dt)
- {
- Binding b;
-
- void xmlRunIndex (char *desc, const int run, const int index)
- {
- xmlPrint ("<%s run=\"%i\" index=\"%i\" />", desc, run, index);
- }
-
- b = (Binding) dt;
- if (b->run_to == run && b->ev_to == index)
- {
- if (isTermVariable (b->term) && !b->done)
- {
- // Generate from m0
- xmlPrint ("");
-
- xmlindent++;
- xmlIndentPrint ();
- xmlTermPrint (b->term);
- eprintf ("\n");
- xmlindent--;
-
- xmlPrint ("");
- }
- else
- {
- // Normal binding
- xmlPrint ("");
-
- xmlindent++;
- if (b->done)
- xmlRunIndex ("after", b->run_from, b->ev_from);
- else
- xmlPrint ("");
- if (b->blocked)
- eprintf ("");
- xmlIndentPrint ();
- xmlTermPrint (b->term);
- eprintf ("\n");
- xmlindent--;
-
- xmlPrint ("");
- }
- }
- return 1;
- }
xmlindent++;
// Only if real run, and not a roledef
- if (run >= 0 && sys->bindings != NULL)
+ if (run >= 0)
{
- list_iterate (sys->bindings, xmlBindingState);
+ List bl;
+
+ for (bl = sys->bindings; bl != NULL; bl = bl->next)
+ {
+ Binding b;
+
+ b = (Binding) bl->data;
+ if (b->run_to == run && b->ev_to == index)
+ {
+ xmlShowThisBinding(b);
+ }
+ }
}
xmlindent--;
}