[pypy-svn] r62164 - in pypy/branch/spy-graphic/pypy/lang/smalltalk: . test

tverwaes at codespeak.net tverwaes at codespeak.net
Wed Feb 25 19:57:23 CET 2009


Author: tverwaes
Date: Wed Feb 25 19:57:20 2009
New Revision: 62164

Modified:
   pypy/branch/spy-graphic/pypy/lang/smalltalk/interpreter.py
   pypy/branch/spy-graphic/pypy/lang/smalltalk/primitives.py
   pypy/branch/spy-graphic/pypy/lang/smalltalk/test/test_interpreter.py
   pypy/branch/spy-graphic/pypy/lang/smalltalk/test/test_primitives.py
Log:
removed PRIMITIVE pre and postfixes for consistency.


Modified: pypy/branch/spy-graphic/pypy/lang/smalltalk/interpreter.py
==============================================================================
--- pypy/branch/spy-graphic/pypy/lang/smalltalk/interpreter.py	(original)
+++ pypy/branch/spy-graphic/pypy/lang/smalltalk/interpreter.py	Wed Feb 25 19:57:20 2009
@@ -493,22 +493,22 @@
 
     def bytecodePrimBlockCopy(self, interp):
         # the primitive checks the class of the receiver
-        self.callPrimitive(primitives.PRIMITIVE_BLOCK_COPY,
+        self.callPrimitive(primitives.BLOCK_COPY,
                            "blockCopy:", 1, interp)
 
     def bytecodePrimValue(self, interp):
         # the primitive checks the class of the receiver
         self.callPrimitive(
-            primitives.PRIMITIVE_VALUE, "value", 0, interp)
+            primitives.VALUE, "value", 0, interp)
 
     def bytecodePrimValueWithArg(self, interp):
         # the primitive checks the class of the receiver
-        # Note that the PRIMITIVE_VALUE_WITH_ARGS takes an array of
+        # Note that the VALUE_WITH_ARGS takes an array of
         # arguments but this bytecode is about the one-argument case.
-        # The PRIMITIVE_VALUE is general enough to take any number of
+        # The VALUE is general enough to take any number of
         # arguments from the stack, so it's the one we need to use here.
         self.callPrimitive(
-            primitives.PRIMITIVE_VALUE, "value:", 1, interp)
+            primitives.VALUE, "value:", 1, interp)
 
     def bytecodePrimDo(self, interp):
         self._sendSelfSelector("do:", 1, interp)

Modified: pypy/branch/spy-graphic/pypy/lang/smalltalk/primitives.py
==============================================================================
--- pypy/branch/spy-graphic/pypy/lang/smalltalk/primitives.py	(original)
+++ pypy/branch/spy-graphic/pypy/lang/smalltalk/primitives.py	Wed Feb 25 19:57:20 2009
@@ -463,7 +463,7 @@
 INPUT_SEMAPHORE = 93
 GET_NEXT_EVENT = 94
 INPUT_WORD = 95
-OBSOLETE_INDEXED_PRIMITIVE = 96
+OBSOLETE_INDEXED = 96
 SNAPSHOT = 97
 STORE_IMAGE_SEGMENT = 98
 LOAD_IMAGE_SEGMENT = 99
@@ -471,13 +471,23 @@
 BE_CURSOR = 101
 BE_DISPLAY = 102
 SCAN_CHARACTERS = 103
-OBSOLETE_INDEXED_PRIMITIVE =104
+# OBSOLETE_INDEXED = 104 # also 96
 STRING_REPLACE = 105
 SCREEN_SIZE = 106
 MOUSE_BUTTONS = 107
 KBD_NEXT = 108
 KBD_PEEK = 109
 
+ at expose_primitive(BE_CURSOR, unwrap_spec=[object])
+def func(interp, w_rcvr):
+    # TODO: Use info from cursor object.
+    interp.space.objtable['w_cursor'] = w_rcvr
+    return w_rcvr
+
+ at expose_primitive(BE_DISPLAY, unwrap_spec=[object])
+def func(interp, w_rcvr):
+    interp.space.objtable['w_display'] = w_rcvr
+    return w_rcvr
 
 # ___________________________________________________________________________
 # Control Primitives
@@ -667,18 +677,18 @@
 # ___________________________________________________________________________
 # Control Primitives
 
-PRIMITIVE_BLOCK_COPY = 80
-PRIMITIVE_VALUE = 81
-PRIMITIVE_VALUE_WITH_ARGS = 82
-PRIMITIVE_PERFORM = 83
-PRIMITIVE_PERFORM_WITH_ARGS = 84
-PRIMITIVE_SIGNAL = 85
-PRIMITIVE_WAIT = 86
-PRIMITIVE_RESUME = 87
-PRIMITIVE_SUSPEND = 88
-PRIMITIVE_FLUSH_CACHE = 89
+BLOCK_COPY = 80
+VALUE = 81
+VALUE_WITH_ARGS = 82
+PERFORM = 83
+PERFORM_WITH_ARGS = 84
+SIGNAL = 85
+WAIT = 86
+RESUME = 87
+SUSPEND = 88
+FLUSH_CACHE = 89
 
- at expose_primitive(PRIMITIVE_BLOCK_COPY, unwrap_spec=[object, int])
+ at expose_primitive(BLOCK_COPY, unwrap_spec=[object, int])
 def func(interp, w_context, argcnt):
     frame = interp.s_active_context()
 
@@ -703,7 +713,7 @@
     s_block_ctx.store_w_sender(frame)
     interp.store_w_active_context(s_block_ctx.w_self())
     
- at expose_primitive(PRIMITIVE_VALUE, no_result=True)
+ at expose_primitive(VALUE, no_result=True)
 def func(interp, argument_count):
     # argument_count does NOT include the receiver.
     # This means that for argument_count == 3 the stack looks like:
@@ -741,7 +751,7 @@
     frame.pop()
     finalize_block_ctx(interp, s_block_ctx, frame.w_self())
     
- at expose_primitive(PRIMITIVE_VALUE_WITH_ARGS, unwrap_spec=[object, object],
+ at expose_primitive(VALUE_WITH_ARGS, unwrap_spec=[object, object],
                   no_result=True)
 def func(interp, w_block_ctx, w_args):
 
@@ -765,11 +775,11 @@
     # because falls back to value + internal implementation
     finalize_block_ctx(interp, s_block_ctx, interp.w_active_context())
 
- at expose_primitive(PRIMITIVE_PERFORM)
+ at expose_primitive(PERFORM)
 def func(interp, argcount):
     raise PrimitiveFailedError()
 
- at expose_primitive(PRIMITIVE_PERFORM_WITH_ARGS,
+ at expose_primitive(PERFORM_WITH_ARGS,
                   unwrap_spec=[object, str, object],
                   no_result=True)
 def func(interp, w_rcvr, sel, w_args):
@@ -782,7 +792,7 @@
     w_frame.as_context_get_shadow(interp.space).store_w_sender(interp.w_active_context())
     interp.store_w_active_context(w_frame)
 
- at expose_primitive(PRIMITIVE_SIGNAL, unwrap_spec=[object])
+ at expose_primitive(SIGNAL, unwrap_spec=[object])
 def func(interp, w_rcvr):
     # XXX we might want to disable this check
     if not w_rcvr.getclass(interp.space).is_same_object(
@@ -791,7 +801,7 @@
     wrapper.SemaphoreWrapper(interp.space, w_rcvr).signal(interp)
     return w_rcvr
     
- at expose_primitive(PRIMITIVE_WAIT, unwrap_spec=[object])
+ at expose_primitive(WAIT, unwrap_spec=[object])
 def func(interp, w_rcvr):
     # XXX we might want to disable this check
     if not w_rcvr.getclass(interp.space).is_same_object(
@@ -800,7 +810,7 @@
     wrapper.SemaphoreWrapper(interp.space, w_rcvr).wait(interp)
     return w_rcvr
     
- at expose_primitive(PRIMITIVE_RESUME, unwrap_spec=[object])
+ at expose_primitive(RESUME, unwrap_spec=[object])
 def func(interp, w_rcvr,):
     # XXX we might want to disable this check
     if not w_rcvr.getclass(interp.space).is_same_object(
@@ -809,7 +819,7 @@
     wrapper.ProcessWrapper(interp.space, w_rcvr).resume(interp)
     return w_rcvr
  
- at expose_primitive(PRIMITIVE_SUSPEND, unwrap_spec=[object])
+ at expose_primitive(SUSPEND, unwrap_spec=[object])
 def func(interp, w_rcvr):
     # XXX we might want to disable this check
     if not w_rcvr.getclass(interp.space).is_same_object(
@@ -818,7 +828,7 @@
     wrapper.ProcessWrapper(interp.space, w_rcvr).suspend(interp)
     return w_rcvr
  
- at expose_primitive(PRIMITIVE_FLUSH_CACHE, unwrap_spec=[object])
+ at expose_primitive(FLUSH_CACHE, unwrap_spec=[object])
 def func(interp, w_rcvr):
     # XXX we currently don't care about bad flushes :) XXX
     # raise PrimitiveNotYetWrittenError()
@@ -841,6 +851,5 @@
             return w_object.fetch(interp.space, i - 264)
     globals()["INST_VAR_AT_%d" % (i-264)] = i
     make_prim(i)
-    
 
 unrolling_prim_table = unroll.unrolling_iterable(prim_table_implemented_only)

Modified: pypy/branch/spy-graphic/pypy/lang/smalltalk/test/test_interpreter.py
==============================================================================
--- pypy/branch/spy-graphic/pypy/lang/smalltalk/test/test_interpreter.py	(original)
+++ pypy/branch/spy-graphic/pypy/lang/smalltalk/test/test_interpreter.py	Wed Feb 25 19:57:20 2009
@@ -701,7 +701,7 @@
               176, 125, 33, 34, 240, 124 ],
             fakeliterals(space, "value:value:", space.wrap_int(3), space.wrap_int(4))).value == 7
     run_with_faked_methods(
-        [[space.w_BlockContext, primitives.PRIMITIVE_VALUE,
+        [[space.w_BlockContext, primitives.VALUE,
           2, "value:value:"]],
         test)
 
@@ -739,7 +739,7 @@
             fakeliterals(space, "valueWithArguments:",
                          [3, 2])).value == 1
     run_with_faked_methods(
-        [[space.w_BlockContext, primitives.PRIMITIVE_VALUE_WITH_ARGS,
+        [[space.w_BlockContext, primitives.VALUE_WITH_ARGS,
           1, "valueWithArguments:"]],
         test)
 

Modified: pypy/branch/spy-graphic/pypy/lang/smalltalk/test/test_primitives.py
==============================================================================
--- pypy/branch/spy-graphic/pypy/lang/smalltalk/test/test_primitives.py	(original)
+++ pypy/branch/spy-graphic/pypy/lang/smalltalk/test/test_primitives.py	Wed Feb 25 19:57:20 2009
@@ -418,9 +418,9 @@
 #   primitives.NEXT is unimplemented as it is a performance optimization
 #   primitives.NEXT_PUT is unimplemented as it is a performance optimization
 #   primitives.AT_END is unimplemented as it is a performance optimization
-#   primitives.PRIMITIVE_BLOCK_COPY is tested in test_interpreter
-#   primitives.PRIMITIVE_VALUE is tested in test_interpreter
-#   primitives.PRIMITIVE_VALUE_WITH_ARGS is tested in test_interpreter
+#   primitives.BLOCK_COPY is tested in test_interpreter
+#   primitives.VALUE is tested in test_interpreter
+#   primitives.VALUE_WITH_ARGS is tested in test_interpreter
 #   primitives.OBJECT_AT is tested in test_interpreter
 #   primitives.OBJECT_AT_PUT is tested in test_interpreter
 



More information about the Pypy-commit mailing list