Commits

Anonymous committed 3903493

Some minor changes. Still working on repeat

Comments (0)

Files changed (2)

prolog/builtin/control.py

         heap = heap.revert_upto(self.undoheap)
         return self.nextcont, self, heap
 
+    def trace_wrap(self, depth, scont=None):
+        return continuation.TraceFailureContinuation("Fail", self, depth, scont=scont)
+
 @expose_builtin("!", unwrap_spec=[], handles_continuation=True,trace=False)
 def impl_cut(engine, heap, scont, fcont):
     end_fcont = scont.find_end_of_cut()

prolog/interpreter/continuation.py

                                 "Error: err/1: Undefined procedure: "+sig+"\n")
                         raise e
                     self.raw_query = scont.raw_query
-                    # crop fails before BodyContinuation
-                    # XXX Unfortunately not as simple as this
-                    fcont = fcont.trace_unwrap()
+                    # XXX fix problem with and-compounded terms
+                    # fcont = fcont.trace_unwrap()
                     fcont = fcont.trace_wrap(self.depth, scont=self)
                     fcont.fail(heap)
                     raise e
             else:
                 nextcont, fcont, heap = self.innercont.activate(fcont, heap)
             nextcont = nextcont.trace_wrap(self.depth)
-            # XXX Unfortunately not as simple as this
-            fcont = fcont.trace_unwrap()
+            # XXX fix problem with and-compounded terms
+            #fcont = fcont.trace_unwrap()
             fcont = nextcont.make_next_fcont(fcont)
             return nextcont, fcont, heap
 
 
         while 1:
             if not skip and not self.shall_fail:
-                # use query string from Call to avoid broken var bindings
+                # use query string from TraceSuccessContinuation to avoid obsolete var bindings
                 if self.port == "Fail":
                     query = self.scont.raw_query
                 else: