Commits

Lars Wassermann committed 9226d9d Merge

merge with tip

Comments (0)

Files changed (5)

+language: python
+python:
+  - 2.7
+env:
+  matrix:
+    - TEST_TYPE=own
+    - TEST_TYPE=translate
+install:
+  - pip install rsdl --use-mirrors
+  - wget https://bitbucket.org/pypy/pypy/get/default.tar.bz2 -O `pwd`/../pypy.tar.bz2 || wget https://bitbucket.org/pypy/pypy/get/default.tar.bz2 -O `pwd`/../pypy.tar.bz2
+  - tar -xf `pwd`/../pypy.tar.bz2 -C `pwd`/../
+  - mv ../pypy-pypy* ../pypy-pypy
+script:
+  - export PYTHONPATH=$PYTHONPATH:../pypy-pypy/:.
+  - "case \"$TEST_TYPE\" in
+       own)
+         py.test
+         ;;
+      translate)
+        python ../pypy-pypy/rpython/bin/rpython --batch targetimageloadingsmalltalk.py
+        ;;
+    esac"
 #
 
 MAX_LOOP_DEPTH = 100
-INTERRUPT_COUNTER_SIZE = 1000
+INTERRUPT_COUNTER_SIZE = 10000
                 ok = rffi.cast(lltype.Signed, RSDL.PollEvent(event))
                 if ok == 1:
                     c_type = rffi.getintfield(event, 'c_type')
-                    print ' %d' % c_type,
                     if c_type == RSDL.MOUSEBUTTONDOWN or c_type == RSDL.MOUSEBUTTONUP:
                         b = rffi.cast(RSDL.MouseButtonEventPtr, event)
                         btn = rffi.getintfield(b, 'c_button')
                             btn = MOUSE_BTN_MIDDLE
                         elif btn == RSDL.BUTTON_LEFT:
                             btn = MOUSE_BTN_LEFT
-                        else:
-                            assert 0
-                            button = 0
-                        
+
                         if c_type == RSDL.MOUSEBUTTONDOWN:
                             self.button |= btn
-                            self.last_mouse_buttons |= button
                         else:
                             self.button &= ~btn
-                            self.last_mouse_buttons &= ~button
                     elif c_type == RSDL.MOUSEMOTION:
                         m = rffi.cast(RSDL.MouseMotionEventPtr, event)
                         x = rffi.getintfield(m, "c_x")
                                 else:
                                     pass # XXX: Todo?
                     elif c_type == RSDL.QUIT:
-                        exit(0)
+                        from spyvm.interpreter import ReturnFromTopLevel
+                        print "Window closed.."
+                        raise SystemExit()
         finally:
             lltype.free(event, flavor='raw')
 
     instance = None
 
     def __init__(self):
+        self.cursor = lltype.nullptr(RSDL.CursorPtr.TO)
         self.has_cursor = False
         self.has_display = False
 
             return
         if self.has_cursor:
             RSDL.FreeCursor(self.cursor)
+        data = self.words_to_bytes(len(data_words) * 4, data_words)
         try:
-            data = self.words_to_bytes(len(data_words) * 4, data_words)
+            mask = self.words_to_bytes(len(data_words) * 4, mask_words)
             try:
-                mask = self.words_to_bytes(len(data_words) * 4, mask_words)
                 self.cursor = RSDL.CreateCursor(data, mask, w * 2, h, x, y)
                 self.has_cursor = True
                 RSDL.SetCursor(self.cursor)
         return "W_LargePositiveInteger1Word(%d)" % r_uint(self.value)
 
     def lshift(self, space, shift):
-        from rpython.rlib.rarithmetic import ovfcheck, intmask, r_uint
+        from rpython.rlib.rarithmetic import intmask, r_uint
         # shift > 0, therefore the highest bit of upperbound is not set,
         # i.e. upperbound is positive
         upperbound = intmask(r_uint(-1) >> shift)
         if 0 <= self.value <= upperbound:
-            try:
-                shifted = intmask(ovfcheck(self.value << shift))
-            except OverflowError:
-                raise error.PrimitiveFailedError()
+            shifted = intmask(self.value << shift)
             return space.wrap_positive_32bit_int(shifted)
         else:
             raise error.PrimitiveFailedError()
     if not (0 <= argcount <= 1):
         raise PrimitiveFailedError()
     w_rcvr = s_frame.peek(argcount)
+    mask_words = None
     if argcount == 1:
         # TODO: use mask
         w_mask = s_frame.peek(0)
         if not isinstance(w_mask, model.W_WordsObject):
             raise PrimitiveFailedError()
-    else:
-        w_mask = None
+        mask_words = w_mask.words
     w_bitmap = w_rcvr.fetch(interp.space, 0)
     if not isinstance(w_bitmap, model.W_WordsObject):
         raise PrimitiveFailedError()
         height,
         hotpt.x(),
         hotpt.y(),
-        w_mask.words if w_mask else None
+        mask_words=mask_words
     )
 
     interp.space.objtable['w_cursor'] = w_rcvr