Author: Lars Wassermann <lars.wasserm...@gmail.com> Branch: Changeset: r283:9226d9dccea3 Date: 2013-04-16 14:20 +0200 http://bitbucket.org/pypy/lang-smalltalk/changeset/9226d9dccea3/
Log: merge with tip diff --git a/.travis.yml b/.travis.yml new file mode 100644 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +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" diff --git a/spyvm/constants.py b/spyvm/constants.py --- a/spyvm/constants.py +++ b/spyvm/constants.py @@ -183,4 +183,4 @@ # MAX_LOOP_DEPTH = 100 -INTERRUPT_COUNTER_SIZE = 1000 \ No newline at end of file +INTERRUPT_COUNTER_SIZE = 10000 diff --git a/spyvm/display.py b/spyvm/display.py --- a/spyvm/display.py +++ b/spyvm/display.py @@ -50,7 +50,6 @@ 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') @@ -60,16 +59,11 @@ 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") @@ -86,7 +80,9 @@ 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') @@ -126,6 +122,7 @@ instance = None def __init__(self): + self.cursor = lltype.nullptr(RSDL.CursorPtr.TO) self.has_cursor = False self.has_display = False @@ -134,10 +131,10 @@ 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) diff --git a/spyvm/model.py b/spyvm/model.py --- a/spyvm/model.py +++ b/spyvm/model.py @@ -267,15 +267,12 @@ 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() diff --git a/spyvm/primitives.py b/spyvm/primitives.py --- a/spyvm/primitives.py +++ b/spyvm/primitives.py @@ -580,13 +580,13 @@ 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() @@ -600,7 +600,7 @@ height, hotpt.x(), hotpt.y(), - w_mask.words if w_mask else None + mask_words=mask_words ) interp.space.objtable['w_cursor'] = w_rcvr _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit