[pypy-svn] r44074 - in pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Thu Jun 7 10:39:48 CEST 2007
Author: cfbolz
Date: Thu Jun 7 10:39:48 2007
New Revision: 44074
Modified:
pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/engine.py
pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py
pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_interpreter.py
Log:
remove more old stuff
Modified: pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/engine.py
==============================================================================
--- pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/engine.py (original)
+++ pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/engine.py Thu Jun 7 10:39:48 2007
@@ -10,23 +10,15 @@
DEBUG = False
-# bytecodes:
-CALL = 'a'
-USER_CALL = 'u'
-TRY_RULE = 't'
-CONTINUATION = 'c'
-DONE = 'd'
-
-
class Continuation(object):
def call(self, engine, choice_point=True):
- py.test.skip("can't do a call like this right now")
- if choice_point:
- return engine.main_loop(CONTINUATION, None, self, None)
- return (CONTINUATION, None, self, None)
+ if not choice_point:
+ return self
+ while self is not None:
+ self = self._call(engine)
def _call(self, engine):
- return (DONE, None, None, None)
+ pass
DONOTHING = Continuation()
@@ -37,7 +29,7 @@
def _call(self, engine):
self.scope_active = False
- return self.continuation.call(engine, choice_point=False)
+ return self.continuation
class Heap(object):
def __init__(self):
@@ -172,9 +164,9 @@
rule = Query(query, self)
frame = rule.make_frame()
try:
- where, _, cont, _ = frame.run_directly(continuation)
- while where == CONTINUATION:
- where, _, cont, _ = cont._call(self)
+ cont = frame.run_directly(continuation)
+ while cont is not None:
+ cont = cont._call(self)
except CutException, e:
return self.continue_after_cut(e.continuation)
Modified: pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py
==============================================================================
--- pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py (original)
+++ pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py Thu Jun 7 10:39:48 2007
@@ -1,7 +1,7 @@
from pypy.lang.prolog.interpreter import helper
from pypy.lang.prolog.interpreter import error
from pypy.lang.prolog.interpreter.term import Term, Atom, Var, Callable
-from pypy.lang.prolog.interpreter.engine import CONTINUATION, Continuation
+from pypy.lang.prolog.interpreter.engine import Continuation
from pypy.lang.prolog.interpreter.prologopcode import unrolling_opcode_descs, \
HAVE_ARGUMENT
@@ -97,8 +97,7 @@
res = meth(stack)
if res is not None:
while 1:
- where, _, continuation, _ = res
- assert where == CONTINUATION
+ continuation = res
if isinstance(continuation, FrameContinuation):
self = continuation.frame
pc = continuation.pc
@@ -112,7 +111,7 @@
assert 0, "missing opcode"
if len(stack) != 0:
self.stack = stack
- return (CONTINUATION, None, continuation, None)
+ return continuation
def PUTCONSTANT(self, stack, number):
stack.append(self.code.constants[number])
Modified: pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_interpreter.py
==============================================================================
--- pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_interpreter.py (original)
+++ pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_interpreter.py Thu Jun 7 10:39:48 2007
@@ -10,15 +10,13 @@
frame = r.make_frame(query)
assert frame.localvarcache[0].dereference(e.heap).name == "a"
cont = object()
- res = frame.run(frame.code.opcode, 0, cont)
- where, _, c2, _ = res
+ c2 = frame.run(frame.code.opcode, 0, cont)
assert cont is c2
query, vars = get_query_and_vars("f(X).")
frame = r.make_frame(query)
cont = object()
- res = frame.run(frame.code.opcode, 0, cont)
- where, _, c2, _ = res
+ c2 = frame.run(frame.code.opcode, 0, cont)
assert cont is c2
assert vars['X'].dereference(e.heap).name == 'a'
More information about the pypy-svn
mailing list