예제 #1
0
 def call(self):
     localstate = []
     localstate.append(10)
     self.result.append(2)
     ClonableCoroutine.getmain().switch()
     localstate.append(20)
     if localstate == [10, 20]:
         self.result.append(4)
     else:
         self.result.append(0)
예제 #2
0
 def call(self):
     localstate = []
     localstate.append(10)
     self.result.append(2)
     ClonableCoroutine.getmain().switch()
     localstate.append(20)
     if localstate == [10, 20]:
         self.result.append(4)
     else:
         self.result.append(0)
예제 #3
0
 def f():
     result = []
     coro = ClonableCoroutine()
     coro.bind(T(result))
     result.append(1)
     coro.switch()
     result.append(6)
     n = 0
     for i in result:
         n = n*10 + i
     return n
예제 #4
0
 def f():
     result = []
     coro = ClonableCoroutine()
     coro.bind(T(result))
     result.append(1)
     coro.switch()
     result.append(6)
     n = 0
     for i in result:
         n = n * 10 + i
     return n
예제 #5
0
    def call(self):
        search_coro = ClonableCoroutine()
        search_coro.bind(SearchTask())
        choicepoints.add(search_coro)

        #os.write(1, "starting\n")
        while choicepoints.more_choices():
            searcher, nextvalue = choicepoints.next_choice()
            choicepoints.clone_me = False
            choicepoints.answer = nextvalue
            #os.write(1, '<<< {%x} %d\n' % (id(searcher), nextvalue))
            searcher.switch()
            #os.write(1, '>>> %d\n' % (choicepoints.clone_me,))
            if choicepoints.clone_me:
                searcher2 = searcher.clone()
                #os.write(1, 'searcher = {%x}, searcher2 = {%x}\n' % (
                #    id(searcher), id(searcher2)))
                choicepoints.add(searcher, 5)
                choicepoints.add(searcher2, 4)
예제 #6
0
    def call(self):
        search_coro = ClonableCoroutine()
        search_coro.bind(SearchTask())
        choicepoints.add(search_coro)

        #os.write(1, "starting\n")
        while choicepoints.more_choices():
            searcher, nextvalue = choicepoints.next_choice()
            choicepoints.clone_me = False
            choicepoints.answer = nextvalue
            #os.write(1, '<<< {%x} %d\n' % (id(searcher), nextvalue))
            searcher.switch()
            #os.write(1, '>>> %d\n' % (choicepoints.clone_me,))
            if choicepoints.clone_me:
                searcher2 = searcher.clone()
                #os.write(1, 'searcher = {%x}, searcher2 = {%x}\n' % (
                #    id(searcher), id(searcher2)))
                choicepoints.add(searcher, 5)
                choicepoints.add(searcher2, 4)
예제 #7
0
 def call(self):
     self.result.append(2)
     ClonableCoroutine.getmain().switch()
     self.result.append(4)
예제 #8
0
 def call(self):
     self.result.append(2)
     ClonableCoroutine.getmain().switch()
     self.result.append(4)