Author: bernhard
Date: Mon Apr 24 11:59:39 2006
New Revision: 12411

Modified:
   trunk/examples/sdl/anim_image_dblbuf.pir
   trunk/examples/sdl/minesweeper/field.pir
   trunk/runtime/parrot/library/SDL/Rect.pir
   trunk/runtime/parrot/library/SDL/Surface.pir

Log:
Let SDL survive stricter param count and syntax checks.
This brings './parrot examples/sdl/raw_pixels.pir' back, but
most SDL examples are still broken.


Modified: trunk/examples/sdl/anim_image_dblbuf.pir
==============================================================================
--- trunk/examples/sdl/anim_image_dblbuf.pir    (original)
+++ trunk/examples/sdl/anim_image_dblbuf.pir    Mon Apr 24 11:59:39 2006
@@ -12,7 +12,7 @@
 
 =cut
 
-.sub _main non_prototyped, :main
+.sub _main :main
        load_bytecode "library/SDL/App.pir"
        load_bytecode "library/SDL/Color.pir"
        load_bytecode "library/SDL/Rect.pir"

Modified: trunk/examples/sdl/minesweeper/field.pir
==============================================================================
--- trunk/examples/sdl/minesweeper/field.pir    (original)
+++ trunk/examples/sdl/minesweeper/field.pir    Mon Apr 24 11:59:39 2006
@@ -138,7 +138,8 @@
 
     $I0 = find_type 'SDL::LCD'
     lcd = new $I0
-    lcd = 0
+    # This seems to call __init() with too many parameters
+    # lcd = 0
     lcd.'_digits'( 4 )
     lcd.'xpos'( 5 )
     lcd.'ypos'( 5 )
@@ -645,13 +646,13 @@
 =cut
 
 .sub undo_mark method
-    .param int i
+    .param int i      :optional
+    .param int has_i  :opt_flag
+
     .local pmc markpos
     .local pmc field
     .local pmc status
-    .local int noSetStatus
     
-    noSetStatus = argcI
     
     $I0 = classoffset self, 'Mines::Field'
 
@@ -675,7 +676,7 @@
 UNDO_DONE:
     markpos = -1
 
-    if noSetStatus goto END
+    if has_i goto END
     if status != STATUS_CHOOSING goto END
     self."setStatus"( STATUS_PLAYING )
 END:

Modified: trunk/runtime/parrot/library/SDL/Rect.pir
==============================================================================
--- trunk/runtime/parrot/library/SDL/Rect.pir   (original)
+++ trunk/runtime/parrot/library/SDL/Rect.pir   Mon Apr 24 11:59:39 2006
@@ -165,16 +165,15 @@
 =cut
 
 .sub height method
-       .param int new_height
+       .param int new_height     :optional
+       .param int has_new_height :opt_flag
 
        .local pmc rect 
        .local int result
-       .local int param_count
 
-       param_count      = I1
        rect             = self.'rect'()
 
-       if param_count   == 0 goto getter
+       unless has_new_height goto getter
        rect[ 'height' ] = new_height
 
 getter:
@@ -193,16 +192,15 @@
 =cut
 
 .sub width method
-       .param int new_width
+       .param int new_width     :optional
+       .param int has_new_width :optional
 
        .local pmc rect 
        .local int result
-       .local int param_count
 
-       param_count     = I1
        rect            = self.'rect'()
 
-       if param_count  == 0 goto getter
+       unless has_new_width goto getter
        rect[ 'width' ] = new_width
 
 getter:
@@ -221,24 +219,21 @@
 =cut
 
 .sub x method
-       .param int new_x
+       .param int new_x     :optional
+       .param int has_new_x :opt_flag
 
-       .local int param_count
        .local pmc rect 
 
-       param_count    = I1
        rect           = self.'rect'()
 
-       if param_count == 0 goto getter
+       unless has_new_x goto getter
        rect[ 'x' ]    = new_x
 
 getter:
        .local int result
        result         = rect[ 'x' ]
 
-       .pcc_begin_return
-               .return result
-       .pcc_end_return
+       .return( result )
 .end
 
 =item y( [ new_y_coordinate ] )
@@ -249,15 +244,14 @@
 =cut
 
 .sub y method
-       .param int new_y
+       .param int new_y     :optional
+       .param int has_new_y :opt_flag
 
-       .local int param_count 
        .local pmc rect 
 
-       param_count    = I1
        rect           = self.'rect'()
 
-       if param_count == 0 goto _getter
+       unless has_new_y goto _getter
        rect[ 'y' ]    = new_y
 
 _getter:

Modified: trunk/runtime/parrot/library/SDL/Surface.pir
==============================================================================
--- trunk/runtime/parrot/library/SDL/Surface.pir        (original)
+++ trunk/runtime/parrot/library/SDL/Surface.pir        Mon Apr 24 11:59:39 2006
@@ -504,11 +504,12 @@
        .param int x
        .param int y
        .param int raw_color
-       .param pmc color_pmc
+       .param pmc color_pmc     :optional
+       .param int has_color_pmc :opt_flag
 
        .local int color
 
-       if I3 == 1 goto convert_color
+       if has_color_pmc goto convert_color
        color = raw_color
        goto draw
 

Reply via email to