perl.cvs.parrot
[Top] [All Lists]

[svn:parrot] r21767 - in branches/pdd15oo: examples/sdl runtime/parrot/l

Subject: [svn:parrot] r21767 - in branches/pdd15oo: examples/sdl runtime/parrot/library/SDL
From:
Date: Tue, 2 Oct 2007 21:03:26 -0700 PDT
Newsgroups: perl.cvs.parrot

Author: chromatic
Date: Tue Oct  2 21:03:25 2007
New Revision: 21767

Modified:
   branches/pdd15oo/examples/sdl/anim_image.pir
   branches/pdd15oo/runtime/parrot/library/SDL/App.pir
   branches/pdd15oo/runtime/parrot/library/SDL/Button.pir
   branches/pdd15oo/runtime/parrot/library/SDL/Color.pir
   branches/pdd15oo/runtime/parrot/library/SDL/Constants.pir
   branches/pdd15oo/runtime/parrot/library/SDL/Event.pir
   branches/pdd15oo/runtime/parrot/library/SDL/EventHandler.pir
   branches/pdd15oo/runtime/parrot/library/SDL/Font.pir
   branches/pdd15oo/runtime/parrot/library/SDL/Image.pir
   branches/pdd15oo/runtime/parrot/library/SDL/LCD.pir
   branches/pdd15oo/runtime/parrot/library/SDL/Rect.pir
   branches/pdd15oo/runtime/parrot/library/SDL/Sprite.pir
   branches/pdd15oo/runtime/parrot/library/SDL/StopWatch.pir
   branches/pdd15oo/runtime/parrot/library/SDL/Surface.pir

Log:
[SDL] Updated SDL bindings:

    * copyrights updated
    * whitespace fixed
    * attributes updated to use names, not offsets
    * objects now constructed by name, not type number

examples/sdl/anim_image.pir now runs.


Modified: branches/pdd15oo/examples/sdl/anim_image.pir
==============================================================================
--- branches/pdd15oo/examples/sdl/anim_image.pir        (original)
+++ branches/pdd15oo/examples/sdl/anim_image.pir        Tue Oct  2 21:03:25 2007
@@ -6,121 +6,106 @@
 
 To run this file, run the following command from the Parrot directory:
 
-       $ ./parrot examples/sdl/anim_image.pir
-       Drew 1080 frames in 0.948230 seconds (1138.964142 fps)
-       $
+    $ ./parrot examples/sdl/anim_image.pir
+    Drew 1080 frames in 0.948230 seconds (1138.964142 fps)
+    $
 
 =cut
 
 .sub _main :main
-       load_bytecode "library/SDL/App.pir"
-       load_bytecode "library/SDL/Color.pir"
-       load_bytecode "library/SDL/Rect.pir"
-       load_bytecode "library/SDL/Image.pir"
-       load_bytecode "library/SDL/Sprite.pir"
+    load_bytecode "library/SDL/App.pir"
+    load_bytecode "library/SDL/Color.pir"
+    load_bytecode "library/SDL/Rect.pir"
+    load_bytecode "library/SDL/Image.pir"
+    load_bytecode "library/SDL/Sprite.pir"
 
 
-       .local pmc app
-       .local int app_type
+    .local pmc app
+    app = new 'SDL::App'
+    app.'init'( 'height' => 480, 'width' => 640, 'bpp' => 0, 'flags' => 1 )
 
-       find_type app_type, 'SDL::App'
-       app = new app_type
-       app.'init'( 'height' => 480, 'width' => 640, 'bpp' => 0, 'flags' => 1 )
+    .local pmc main_screen
+    main_screen = app.'surface'()
 
-       .local pmc main_screen
-       main_screen = app.'surface'()
+    .local pmc dest_rect
+    dest_rect   = new 'SDL::Rect'
+    dest_rect.'init'( 'height' => 100, 'width' => 100, 'x' => 0, 'y' => 190 )
 
-       .local int rect_type
-       find_type rect_type, 'SDL::Rect'
+    .local pmc prev_rect
+    prev_rect   = new 'SDL::Rect'
+    prev_rect.'init'( 'height' => 100, 'width' => 101, 'x' => 0, 'y' => 190 )
 
-       .local pmc dest_rect
-       dest_rect   = new rect_type
-       dest_rect.'init'( 'height' => 100, 'width' => 100, 'x' => 0, 'y' => 190 
)
+    .local pmc source_rect
+    source_rect = new 'SDL::Rect'
+    source_rect.'init'( 'height' => 56, 'width' => 100, 'x' => 0, 'y' => 0 )
 
-       .local pmc prev_rect
-       prev_rect   = new rect_type
-       prev_rect.'init'( 'height' => 100, 'width' => 101, 'x' => 0, 'y' => 190 
)
+    .local pmc black
+    black = new 'SDL::Color'
+    black.'init'( 'r' => 0, 'g' => 0, 'b' => 0 )
 
-       .local pmc source_rect
-       source_rect = new rect_type
-       source_rect.'init'( 'height' => 56, 'width' => 100, 'x' => 0, 'y' => 0 )
+    .local pmc image
+    image    = new 'SDL::Image'
+    image.'init'( 'examples/sdl/parrot_small.png' )
 
-       .local int color_type
-       find_type  color_type, 'SDL::Color'
+    .local pmc sprite
+    sprite = new 'SDL::Sprite'
+    sprite.'init'( 'surface' => image, 'source_x' => 0, 'source_y' => 0, 
'dest_x' => 0, 'dest_y' => 190, 'bgcolor' => black )
 
-       .local pmc black
-       black = new color_type
-       black.'init'( 'r' => 0, 'g' => 0, 'b' => 0 )
+    .local num start_time
+    time start_time
 
-       .local int sprite_type
-       find_type  sprite_type, 'SDL::Sprite'
+    _animate_on_x_axis( main_screen, sprite,   0, 540,  1)
+    sleep 1
+    _animate_on_x_axis( main_screen, sprite, 540,   0, -1)
 
-       .local pmc image
-       .local int image_type
+    .local num end_time
+    time end_time
 
-       find_type image_type, 'SDL::Image'
-       image    = new image_type
-       image.'init'( 'examples/sdl/parrot_small.png' )
+    .local num total_time
+    total_time = end_time - start_time
+    dec total_time
 
-       .local pmc sprite
-       sprite = new sprite_type
-       sprite.'init'( 'surface' => image, 'source_x' => 0, 'source_y' => 0, 
'dest_x' => 0, 'dest_y' => 190, 'bgcolor' => black )
+    .local num fps
+    fps = 1080/total_time
 
-       .local num start_time
-       time start_time
+    print "Drew 1080 frames in "
+    print total_time
+    print " seconds ("
+    print fps
+    print " fps)\n"
 
-       _animate_on_x_axis( main_screen, sprite,   0, 540,  1)
-       sleep 1
-       _animate_on_x_axis( main_screen, sprite, 540,   0, -1)
+    sleep 1
 
-       .local num end_time
-       time end_time
-
-       .local num total_time
-       total_time = end_time - start_time
-       dec total_time
-
-       .local num fps
-       fps = 1080/total_time
-
-       print "Drew 1080 frames in "
-       print total_time
-       print " seconds ("
-       print fps
-       print " fps)\n"
-
-       sleep 1
-
-       app.'quit'()
-       end
+    app.'quit'()
+    end
 .end
 
 .sub _animate_on_x_axis
-       .param pmc screen
-       .param pmc sprite
-       .param int start_pos
-       .param int end_pos
-       .param int step_size
-
-       .local int x_pos
-       x_pos = start_pos
-
-       .local pmc prev_rect
-       .local pmc rect
-
-       .local pmc rect_array
-       rect_array = new Array
-       set rect_array, 2
+    .param pmc screen
+    .param pmc sprite
+    .param int start_pos
+    .param int end_pos
+    .param int step_size
+
+    .local int x_pos
+    x_pos = start_pos
+
+    .local pmc prev_rect
+    .local pmc rect
+
+    .local pmc rect_array
+    rect_array = new Array
+    set rect_array, 2
 
 _loop:
-               add x_pos, step_size
-               sprite.'x'( x_pos )
-               (prev_rect, rect) = sprite.'draw_undraw'( screen )
-               set rect_array[ 0 ], prev_rect
-               set rect_array[ 1 ], rect
+        add x_pos, step_size
+        sprite.'x'( x_pos )
+        (prev_rect, rect) = sprite.'draw_undraw'( screen )
+        set rect_array[ 0 ], prev_rect
+        set rect_array[ 1 ], rect
 
-               screen.'update_rects'( rect_array )
-               if x_pos != end_pos goto _loop
+        screen.'update_rects'( rect_array )
+        if x_pos != end_pos goto _loop
 .end
 
 =head1 AUTHOR

Modified: branches/pdd15oo/runtime/parrot/library/SDL/App.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/App.pir (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/App.pir Tue Oct  2 21:03:25 2007
@@ -12,10 +12,8 @@
 
     # create a new SDL::App object
     .local pmc app
-    .local int app_type
 
-    find_type app_type, 'SDL::App'
-    app = new app_type
+    app = new 'SDL::App'
 
     # set the app's arguments
     .local pmc app_args
@@ -126,41 +124,30 @@
     # XXX - need to check this here somehow
     # defined $I0, screen
 
-    .local int surface_type
     .local pmc main_surface
-
-    find_type surface_type, 'SDL::Surface'
-    new main_surface, surface_type
+    new main_surface, 'SDL::Surface'
 
     main_surface.'wrap_surface'( screen )
 
-    .local int offset
     .local pmc intvalue
 
-    # set all other offsets in self
-    classoffset offset, self, 'SDL::App'
-
     intvalue = new 'Integer'
     set intvalue, height
-    setattribute self, offset, intvalue
+    setattribute self, 'height', intvalue
 
     intvalue = new 'Integer'
     set intvalue, width
-    inc offset
-    setattribute self, offset, intvalue
+    setattribute self, 'width', intvalue
 
     intvalue = new 'Integer'
     set intvalue, bpp
-    inc offset
-    setattribute self, offset, intvalue
+    setattribute self, 'bpp', intvalue
 
     intvalue = new 'Integer'
     set intvalue, flags
-    inc offset
-    setattribute self, offset, intvalue
+    setattribute self, 'flags', intvalue
 
-    inc offset
-    setattribute self, offset, main_surface
+    setattribute self, 'surface', main_surface
 
     .return()
 .end
@@ -173,11 +160,7 @@
 
 .sub surface :method
     .local pmc surface
-    .local int offset
-
-    classoffset offset, self, 'SDL::App'
-    add offset, 4
-    getattribute surface, self, offset
+    getattribute surface, self, 'surface'
 
     .return( surface )
 .end
@@ -204,11 +187,9 @@
 
 .sub height :method
     .local pmc height
-    .local int offset
     .local int result
 
-    classoffset offset, self, 'SDL::App'
-    getattribute height, self, offset
+    getattribute height, self, 'height'
     set result, height
 
     .return( result )
@@ -223,12 +204,9 @@
 
 .sub width :method
     .local pmc width
-    .local int offset
     .local int result
 
-    classoffset offset, self, 'SDL::App'
-    add offset, 1
-    getattribute width, self, offset
+    getattribute width, self, 'width'
     set result, width
 
     .return( result )
@@ -242,12 +220,9 @@
 
 .sub bpp :method
     .local pmc bpp
-    .local int offset
     .local int result
 
-    classoffset offset, self, 'SDL::App'
-    add offset, 3
-    getattribute bpp, self, offset
+    getattribute bpp, self, 'bpp'
     set result, bpp
 
     .return( result )
@@ -263,7 +238,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/Button.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/Button.pir      (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/Button.pir      Tue Oct  2 
21:03:25 2007
@@ -12,14 +12,13 @@
     $P0 = "filename/to/image.png"
 
     # create the button
-    $I0 = find_type 'SDL::Button'
-    button = new $I0, $P0
+    button = new 'SDL::Button', $P0
 
     # set the position
     button.'xpos'( 10 )
     button.'ypos'( 10 )
 
-    # set the number of states    
+    # set the number of states
     button.'states'( 2 )
 
     # activate the second status (first is 0)
@@ -46,17 +45,19 @@
 .namespace ['SDL::Button']
 
 .sub __onload :load
-
-    $I0 = find_type 'SDL::Button'
-    if $I0 > 1 goto END
-    newclass $P0, 'SDL::Button'
-    addattribute $P0, "image"
-    addattribute $P0, "status"
-    addattribute $P0, "states"
-    addattribute $P0, "rect"
-    addattribute $P0, "clicked"
-    addattribute $P0, "actions"
-END:
+    .local pmc class
+    class = find_class 'SDL::Button'
+    if_null class, define_class
+    .return
+
+  define_class:
+    newclass     class, 'SDL::Button'
+    addattribute class, 'image'
+    addattribute class, 'status'
+    addattribute class, 'states'
+    addattribute class, 'rect'
+    addattribute class, 'clicked'
+    addattribute class, 'actions'
 .end
 
 =item button = new ID, name
@@ -65,14 +66,13 @@
 
 .sub init_pmc :vtable :method
     .param pmc name
-    
+
     $I0 = classoffset self, 'SDL::Button'
-    
+
     # image
-    $I1 = find_type 'SDL::Image'
-    $P0 = new $I1, name
+    $P0 = new 'SDL::Image', name
     setattribute self, $I0, $P0
-    
+
     # status
     inc $I0
     $P0 = new 'Integer'
@@ -87,8 +87,7 @@
 
     # rect
     inc $I0
-    $I1 = find_type 'SDL::Rect'
-    $P0 = new $I1
+    $P0 = new 'SDL::Rect'
     setattribute self, $I0, $P0
 
     # clicked
@@ -109,7 +108,7 @@
 
 .sub set_integer_native :vtable :method
     .param int val
-    
+
     $I0 = classoffset self, 'SDL::Button'
     inc $I0
     $P0 = getattribute self, $I0
@@ -135,7 +134,7 @@
 
 .sub states :method
     .param int count
-    
+
     $I0 = classoffset self, 'SDL::Button'
     add $I0, 2
     $P0 = getattribute self, $I0
@@ -169,7 +168,7 @@
     $I0 = classoffset self, 'SDL::Button'
     add $I0, 3
     $P0 = getattribute self, $I0
-    
+
     $P0.'width'( w )
     $P0.'height'( h )
 .end
@@ -186,7 +185,7 @@
     .local pmc drect
     .local pmc srect
     .local pmc clicked
-    
+
     $I0 = classoffset self, 'SDL::Button'
 
     image = getattribute self, $I0
@@ -204,9 +203,8 @@
 
     inc $I0
     clicked = getattribute self, $I0
-    
-    $I1 = find_type 'SDL::Rect'
-    srect = new $I1
+
+    srect = new 'SDL::Rect'
 
     $I1 = drect.'height'()
     srect.'height'( $I1 )
@@ -216,7 +214,7 @@
     cmod $I0, status, states
     $I0 *= $I1
     srect.'x'( $I0 )
-    
+
     $I1 = drect.'height'()
     $I0 = clicked
     $I0 *= $I1
@@ -287,18 +285,18 @@
     .param pmc arg
     .local int status
     .local pmc action
-    
+
     $I0 = classoffset self, 'SDL::Button'
 
     inc $I0
     $P0 = getattribute self, $I0
     status = $P0
-    
+
     add $I0, 4
     action = getattribute self, $I0
 
     $P0 = action[status]
-    
+
     $P0( arg )
 .end
 
@@ -310,7 +308,7 @@
     .param int status
     .param pmc cb
     .local pmc action
-    
+
     $I0 = classoffset self, 'SDL::Button'
     add $I0, 5
     action = getattribute self, $I0
@@ -328,7 +326,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/Color.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/Color.pir       (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/Color.pir       Tue Oct  2 
21:03:25 2007
@@ -11,10 +11,7 @@
 
     # create a new SDL::Color object
     .local pmc color
-    .local int color_type
-
-    find_type color_type, 'SDL::Color'
-    color = new color_type
+    color = new 'SDL::Color'
 
     # set the color values; this one's blue
     color.'init'( 'r' => 0, 'g' => 0, 'b' => 255 )
@@ -229,7 +226,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/Constants.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/Constants.pir   (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/Constants.pir   Tue Oct  2 
21:03:25 2007
@@ -301,7 +301,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/Event.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/Event.pir       (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/Event.pir       Tue Oct  2 
21:03:25 2007
@@ -7,23 +7,20 @@
 
 =head1 SYNOPSIS
 
-       # load this library
-       load_bytecode 'library/SDL/Event.pir'
+    # load this library
+    load_bytecode 'library/SDL/Event.pir'
 
-       # create a new SDL::Event object
-       .local pmc event
-       .local int event_type
+    # create a new SDL::Event object
+    .local pmc event
+    event = new 'SDL::Event'
 
-       find_type event_type, 'SDL::Event'
-       event = new event_type
+    # ... create a new event_handler and its hander_args
 
-       # ... create a new event_handler and its hander_args
+    # start the event loop
+    event.'process_events'( event_handler, handler_args )
 
-       # start the event loop
-       event.'process_events'( event_handler, handler_args )
-
-       # or handle one event at a time in your own loop
-       event.'handle_event'( event_handler, handler_args )
+    # or handle one event at a time in your own loop
+    event.'handle_event'( event_handler, handler_args )
 
 =head1 DESCRIPTION
 
@@ -45,10 +42,10 @@
 .namespace [ 'SDL::Event' ]
 
 .sub _initialize :load
-       .local pmc   event_class
+    .local pmc   event_class
 
-       newclass     event_class, 'SDL::Event'
-       addattribute event_class, 'event'
+    newclass     event_class, 'SDL::Event'
+    addattribute event_class, 'event'
 .end
 
 =item init()
@@ -62,18 +59,18 @@
 =cut
 
 .sub 'init' :method
-       .local pmc  fetch_layout
-       find_global fetch_layout, 'SDL::NCI', 'fetch_layout'
+    .local pmc  fetch_layout
+    find_global fetch_layout, 'SDL::NCI', 'fetch_layout'
 
-       .local pmc layout
-       layout = fetch_layout( 'Event::Generic' )
+    .local pmc layout
+    layout = fetch_layout( 'Event::Generic' )
 
-       .local pmc event
-       new event, .ManagedStruct, layout
+    .local pmc event
+    new event, .ManagedStruct, layout
 
-       setattribute self, 'event', event
+    setattribute self, 'event', event
 
-       .return()
+    .return()
 .end
 
 =item event()
@@ -84,32 +81,32 @@
 =cut
 
 .sub event :method
-       .param string name      :optional
-       .param int    have_name :opt_flag 
-       
-       .local pmc event
-       getattribute event, self, 'event'
+    .param string name      :optional
+    .param int    have_name :opt_flag 
+    
+    .local pmc event
+    getattribute event, self, 'event'
 
-       if have_name == 1 goto assign_event
-       .return( event )
+    if have_name == 1 goto assign_event
+    .return( event )
 
   assign_event:
-       .local pmc  fetch_layout
-       find_global fetch_layout, 'SDL::NCI', 'fetch_layout'
+    .local pmc  fetch_layout
+    find_global fetch_layout, 'SDL::NCI', 'fetch_layout'
 
-       .local pmc layout
-       .local string ename
-       
-       ename = 'Event::'
-       concat ename, name
-
-       layout = fetch_layout( ename )
-       #new event, .ManagedStruct, layout
-       assign event, layout
+    .local pmc layout
+    .local string ename
+    
+    ename = 'Event::'
+    concat ename, name
+
+    layout = fetch_layout( ename )
+    #new event, .ManagedStruct, layout
+    assign event, layout
 
-       setattribute self, 'event', event
+    setattribute self, 'event', event
 
-       .return( event )
+    .return( event )
 .end
 
 =item event_type( event_type )
@@ -128,47 +125,47 @@
 =cut
 
 .sub event_type :method
-       .param int incoming_type
+    .param int incoming_type
 
-       .local pmc event_types
-       event_types = new OrderedHash
+    .local pmc event_types
+    event_types = new OrderedHash
 
-       event_types[  0 ] = 'no_event'
-       event_types[  1 ] = 'active_event'
-       event_types[  2 ] = 'key_down'
-       event_types[  3 ] = 'key_up'
-       event_types[  4 ] = 'mouse_motion'
-       event_types[  5 ] = 'mouse_button_down'
-       event_types[  6 ] = 'mouse_button_up'
-       event_types[  7 ] = 'joy_axis_motion'
-       event_types[  8 ] = 'joy_ball_motion'
-       event_types[  9 ] = 'joy_hat_motion'
-       event_types[ 10 ] = 'joy_button_down'
-       event_types[ 11 ] = 'joy_button_up'
-       event_types[ 12 ] = 'quit'
-       event_types[ 13 ] = 'sys_wm_event'
-       event_types[ 14 ] = 'event_reserved_a'
-       event_types[ 15 ] = 'event_reserved_b'
-       event_types[ 16 ] = 'video_resize'
-       event_types[ 17 ] = 'video_expose'
-       event_types[ 18 ] = 'event_reserved_2'
-       event_types[ 19 ] = 'event_reserved_3'
-       event_types[ 20 ] = 'event_reserved_4'
-       event_types[ 21 ] = 'event_reserved_5'
-       event_types[ 22 ] = 'event_reserved_6'
-       event_types[ 23 ] = 'event_reserved_7'
-
-       .local string type_name
-       .local int known_type
-
-       type_name         = 'unknown'
-       exists known_type, event_types[ incoming_type ]
-       eq known_type, 0, return
+    event_types[  0 ] = 'no_event'
+    event_types[  1 ] = 'active_event'
+    event_types[  2 ] = 'key_down'
+    event_types[  3 ] = 'key_up'
+    event_types[  4 ] = 'mouse_motion'
+    event_types[  5 ] = 'mouse_button_down'
+    event_types[  6 ] = 'mouse_button_up'
+    event_types[  7 ] = 'joy_axis_motion'
+    event_types[  8 ] = 'joy_ball_motion'
+    event_types[  9 ] = 'joy_hat_motion'
+    event_types[ 10 ] = 'joy_button_down'
+    event_types[ 11 ] = 'joy_button_up'
+    event_types[ 12 ] = 'quit'
+    event_types[ 13 ] = 'sys_wm_event'
+    event_types[ 14 ] = 'event_reserved_a'
+    event_types[ 15 ] = 'event_reserved_b'
+    event_types[ 16 ] = 'video_resize'
+    event_types[ 17 ] = 'video_expose'
+    event_types[ 18 ] = 'event_reserved_2'
+    event_types[ 19 ] = 'event_reserved_3'
+    event_types[ 20 ] = 'event_reserved_4'
+    event_types[ 21 ] = 'event_reserved_5'
+    event_types[ 22 ] = 'event_reserved_6'
+    event_types[ 23 ] = 'event_reserved_7'
+
+    .local string type_name
+    .local int known_type
+
+    type_name         = 'unknown'
+    exists known_type, event_types[ incoming_type ]
+    eq known_type, 0, return
 
-       type_name         = event_types[ incoming_type ]
+    type_name         = event_types[ incoming_type ]
 
 return:
-       .return( type_name )
+    .return( type_name )
 .end
 
 =item event_keyname()
@@ -187,24 +184,24 @@
 
 .sub event_keyname :method
 
-       .local pmc event
-       event = self.'event'( 'Keyboard' )
+    .local pmc event
+    event = self.'event'( 'Keyboard' )
 
-       .local int key_sym
-       key_sym = event['sym']
+    .local int key_sym
+    key_sym = event['sym']
 
-       .local pmc key_names
-       find_global key_names, 'SDL::Constants', 'key_names'
+    .local pmc key_names
+    find_global key_names, 'SDL::Constants', 'key_names'
 
-       .local string key_name
+    .local string key_name
 
-       key_name = key_names[ key_sym ]
-       length $I0, key_name
-       if $I0 > 0 goto return
-       key_name = 'unknown'
+    key_name = key_names[ key_sym ]
+    length $I0, key_name
+    if $I0 > 0 goto return
+    key_name = 'unknown'
 
 return:
-       .return( key_name )
+    .return( key_name )
 .end
 
 =item process_events( event_handler, handler_args, [ check_interval ] )
@@ -230,43 +227,43 @@
 =cut
 
 .sub process_events :method
-       .param pmc event_handler
-       .param pmc handler_args
-       .param num check_interval :optional
-       .param int argcN          :opt_flag
+    .param pmc event_handler
+    .param pmc handler_args
+    .param num check_interval :optional
+    .param int argcN          :opt_flag
 
-       .local int polling
+    .local int polling
 
-       .local int continue
-       .local pmc GetEvent
-       .local pmc event
+    .local int continue
+    .local pmc GetEvent
+    .local pmc event
 
-       if argcN == 0 goto use_wait
+    if argcN == 0 goto use_wait
 
-       if check_interval < 0.0001 goto use_wait
-       polling  = 1
-       GetEvent = find_global 'SDL::NCI', 'PollEvent'
+    if check_interval < 0.0001 goto use_wait
+    polling  = 1
+    GetEvent = find_global 'SDL::NCI', 'PollEvent'
 
-       branch loop
+    branch loop
 
 use_wait:
-       polling  = 0
-       GetEvent = find_global 'SDL::NCI', 'WaitEvent'
+    polling  = 0
+    GetEvent = find_global 'SDL::NCI', 'WaitEvent'
 
 loop:
-       event    = self.'event'( 'Generic' )
-       continue = GetEvent( event )
+    event    = self.'event'( 'Generic' )
+    continue = GetEvent( event )
 
-       if continue goto dispatch
-       unless polling goto loop
-       
-       # give parrot a chance to process its own events
-       sleep check_interval
-       branch loop
+    if continue goto dispatch
+    unless polling goto loop
+    
+    # give parrot a chance to process its own events
+    sleep check_interval
+    branch loop
 
 dispatch:
-       continue = self.'dispatch_event'( event, event_handler, handler_args )
-       if continue goto loop
+    continue = self.'dispatch_event'( event, event_handler, handler_args )
+    if continue goto loop
 
 .end
 
@@ -285,23 +282,23 @@
 =cut
 
 .sub handle_event :method
-       .param pmc event_handler
-       .param pmc handler_args
+    .param pmc event_handler
+    .param pmc handler_args
 
-       .local pmc event
-       event = self.'event'()
+    .local pmc event
+    event = self.'event'()
 
-       .local pmc  PollEvent
-       find_global PollEvent, 'SDL::NCI', 'PollEvent'
+    .local pmc  PollEvent
+    find_global PollEvent, 'SDL::NCI', 'PollEvent'
 
-       .local int event_waiting
-       event_waiting = PollEvent( event )
+    .local int event_waiting
+    event_waiting = PollEvent( event )
 
-       eq event_waiting, 0, return
+    eq event_waiting, 0, return
 
-       self.'dispatch_event'( event, event_handler, handler_args )
+    self.'dispatch_event'( event, event_handler, handler_args )
 return:
-       .return()
+    .return()
 .end
 
 =item dispatch_event( event, event_handler, handler_args )
@@ -312,32 +309,32 @@
 =cut
 
 .sub dispatch_event :method
-       .param pmc event
-       .param pmc event_handler
-       .param pmc handler_args
+    .param pmc event
+    .param pmc event_handler
+    .param pmc handler_args
 
-       .local int incoming_type
-       incoming_type = event[ 'type' ]
+    .local int incoming_type
+    incoming_type = event[ 'type' ]
 
-       .local string event_type
-       event_type = self.'event_type'( incoming_type )
+    .local string event_type
+    event_type = self.'event_type'( incoming_type )
 
-       .local int continue
-       continue = 0
+    .local int continue
+    continue = 0
 
-       eq event_type, 'quit', return
-       continue = 1
+    eq event_type, 'quit', return
+    continue = 1
 
-       .local int can_handle
-       can can_handle, event_handler, event_type
+    .local int can_handle
+    can can_handle, event_handler, event_type
 
-       eq can_handle, 0, return
+    eq can_handle, 0, return
 
-       # this is a method call using a method name in the event_type string!
-       event_handler.event_type( self, handler_args )
+    # this is a method call using a method name in the event_type string!
+    event_handler.event_type( self, handler_args )
 
 return:
-       .return( continue )
+    .return( continue )
 .end
 
 =back
@@ -350,7 +347,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/EventHandler.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/EventHandler.pir        
(original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/EventHandler.pir        Tue Oct 
 2 21:03:25 2007
@@ -7,49 +7,43 @@
 
 =head1 SYNOPSIS
 
-       # load the event class and this library
-       load_bytecode 'library/SDL/Event.pir'
-       load_bytecode 'library/SDL/EventHandler.pir'
+    # load the event class and this library
+    load_bytecode 'library/SDL/Event.pir'
+    load_bytecode 'library/SDL/EventHandler.pir'
 
-       # subclass this class
-       .local pmc parent_class
-       .local pmc class_type
+    # subclass this class
+    .local pmc parent_class
+    .local pmc class_type
 
-       getclass parent_class, 'SDL::EventHandler'
-       subclass class_type, parent_class, 'My::Event::Handler'
+    getclass parent_class, 'SDL::EventHandler'
+    subclass class_type, parent_class, 'My::Event::Handler'
 
-       # define your overridden methods
-       .sub key_down_down :method
-               .param pmc event
-               .param pmc event_args
+    # define your overridden methods
+    .sub key_down_down :method
+        .param pmc event
+        .param pmc event_args
 
-               # ...
+        # ...
 
-       .end
+    .end
 
-       # create an event handler object
-       .local pmc event_handler
-       .local int handler_type
+    # create an event handler object
+    .local pmc event_handler
+    event_handler = new 'My::Event::Handler'
 
-       find_type handler_type, 'My::Event::Handler'
-       event_handler = new handler_type
+    # create and populate some event_arguments
+    .local pmc event_args
 
-       # create and populate some event_arguments
-       .local pmc event_args
+    new event_args, .Hash
+    event_args[ 'main_surface' ] = main_surface
+    event_args[ 'sprite_list'  ] = sprites
 
-       new event_args, .Hash
-       event_args[ 'main_surface' ] = main_surface
-       event_args[ 'sprite_list'  ] = sprites
+    # create a new event object
+    .local pmc event
+    event = new 'SDL::Event'
 
-       # create a new event object
-       .local pmc event
-       .local int event_type
-
-       find_type event_type, 'SDL::Event'
-       event = new event_type
-
-       # ... and process events
-       event.'process_events'( event_handler, handler_args )
+    # ... and process events
+    event.'process_events'( event_handler, handler_args )
 
 =head1 DESCRIPTION
 
@@ -68,24 +62,24 @@
 .namespace [ 'SDL::EventHandler' ]
 
 .sub _initialize :load
-       .local pmc   handler_class
+    .local pmc   handler_class
 
-       newclass     handler_class, 'SDL::EventHandler'
-       addattribute handler_class, 'args'
+    newclass     handler_class, 'SDL::EventHandler'
+    addattribute handler_class, 'args'
 
-       .return()
+    .return()
 .end
 
 # not documented now; could set default args here
 # maybe nice, maybe not
 
 .sub 'init' :method
-       .param pmc args
+    .param pmc args
 
-       .local int offset
-       classoffset offset, self, 'SDL::EventHandler'
+    .local int offset
+    classoffset offset, self, 'SDL::EventHandler'
 
-       setattribute self, offset, args
+    setattribute self, offset, args
 .end
 
 =item key_down( event, event_args )
@@ -113,22 +107,22 @@
 =cut
 
 .sub key_down :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
-       .local string key_name
-       key_name = event.'event_keyname'()
+    .local string key_name
+    key_name = event.'event_keyname'()
 
-       .local string key_method_name
-       key_method_name = 'key_down_'
+    .local string key_method_name
+    key_method_name = 'key_down_'
 
-       concat key_method_name, key_name
+    concat key_method_name, key_name
 
     .local int can_handle
-       can can_handle, self, key_method_name
+    can can_handle, self, key_method_name
 
-       eq can_handle, 0, _return
-       self.key_method_name( event_args )
+    eq can_handle, 0, _return
+    self.key_method_name( event_args )
 
 _return:
 
@@ -148,22 +142,22 @@
 =cut
 
 .sub key_up :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
-       .local string key_name
-       key_name = event.'event_keyname'()
+    .local string key_name
+    key_name = event.'event_keyname'()
 
-       .local string key_method_name
-       key_method_name = 'key_up_'
+    .local string key_method_name
+    key_method_name = 'key_up_'
 
-       concat key_method_name, key_name
+    concat key_method_name, key_name
 
     .local int can_handle
-       can can_handle, self, key_method_name
+    can can_handle, self, key_method_name
 
-       eq can_handle, 0, _return
-       self.key_method_name( event_args )
+    eq can_handle, 0, _return
+    self.key_method_name( event_args )
 
 _return:
 
@@ -255,127 +249,127 @@
 =cut
 
 .sub active_event :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub mouse_motion :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub mouse_button_down :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub mouse_button_up :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 .end
 
 .sub joy_axis_motion :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub joy_ball_motion :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub joy_hat_motion :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub joy_button_down :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub joy_button_up :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub quit :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub sys_wm_event :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub event_reserved_a :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub event_reserved_b :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub video_resize :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub video_expose :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub event_reserved_2 :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub event_reserved_3 :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub event_reserved_4 :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub event_reserved_5 :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub event_reserved_6 :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
 .sub event_reserved_7 :method
-       .param pmc event
-       .param pmc event_args
+    .param pmc event
+    .param pmc event_args
 
 .end
 
@@ -387,11 +381,10 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 
-
 # Local Variables:
 #   mode: pir
 #   fill-column: 100

Modified: branches/pdd15oo/runtime/parrot/library/SDL/Font.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/Font.pir        (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/Font.pir        Tue Oct  2 
21:03:25 2007
@@ -7,23 +7,21 @@
 
 =head1 SYNOPSIS
 
-       # load this library
-       load_bytecode 'library/SDL/Font.pir'
+    # load this library
+    load_bytecode 'library/SDL/Font.pir'
 
-       # create a new SDL::Font object
-       .local pmc font
-       .local int font_type
-
-       find_type font_type, 'SDL::Font'
-       font = new font_type
-       font.'init'( 'font_file'  => 'myfont.ttf', 'point_size' => 48 )
-
-       # draw text to the screen
-       #       presuming you have an SDL::Surface, SDL::Color, and SDL::Rect 
here...
-       font.'draw'( 'some text', font_color, destination_surface, dest_rect )
+    # create a new SDL::Font object
+    .local pmc font
+    font = new 'SDL::Font'
 
-       # or render it to a surface to use later
-       font.'render_text'( 'some text', font_color )
+    font.'init'( 'font_file'  => 'myfont.ttf', 'point_size' => 48 )
+
+    # draw text to the screen
+    #    presuming you have an SDL::Surface, SDL::Color, and SDL::Rect here...
+    font.'draw'( 'some text', font_color, destination_surface, dest_rect )
+
+    # or render it to a surface to use later
+    font.'render_text'( 'some text', font_color )
 
 =head1 DESCRIPTION
 
@@ -40,17 +38,17 @@
 .namespace [ 'SDL::Font' ]
 
 .sub _sdl_init :load
-       .local pmc init_ttf
-       init_ttf = find_global 'SDL', '_init_ttf'
-       init_ttf()
+    .local pmc init_ttf
+    init_ttf = find_global 'SDL', '_init_ttf'
+    init_ttf()
 
-       .local pmc   font_class
+    .local pmc   font_class
 
-       newclass     font_class, 'SDL::Font'
-       addattribute font_class, 'font'
-       addattribute font_class, 'size'
+    newclass     font_class, 'SDL::Font'
+    addattribute font_class, 'font'
+    addattribute font_class, 'size'
 
-       .return()
+    .return()
 .end
 
 =item init( font_args )
@@ -63,23 +61,23 @@
 =cut
 
 .sub 'init' :method
-       .param string font_name :named( 'font_file'  )
-       .param int    font_size :named( 'point_size' )
+    .param string font_name :named( 'font_file'  )
+    .param int    font_size :named( 'point_size' )
 
-       .local pmc OpenFont
-       OpenFont = find_global 'SDL::NCI::TTF', 'OpenFont'
+    .local pmc OpenFont
+    OpenFont = find_global 'SDL::NCI::TTF', 'OpenFont'
 
-       .local pmc font
-       font = OpenFont( font_name, font_size )
+    .local pmc font
+    font = OpenFont( font_name, font_size )
 
-       setattribute  self, 'font', font
+    setattribute  self, 'font', font
 
-       .local pmc size_value
-       size_value = new Integer
-       size_value = font_size
-       setattribute self, 'size', size_value
+    .local pmc size_value
+    size_value = new Integer
+    size_value = font_size
+    setattribute self, 'size', size_value
 
-       .return()
+    .return()
 .end
 
 =item draw( text_string, text_color, dest_surface, dest_rect )
@@ -93,33 +91,31 @@
 =cut
 
 .sub draw :method
-       .param string text
-       .param pmc    color_pmc
-       .param pmc    screen
-       .param pmc    dest_rect
+    .param string text
+    .param pmc    color_pmc
+    .param pmc    screen
+    .param pmc    dest_rect
 
-       .local pmc font_surface
+    .local pmc font_surface
 
-       font_surface = self.'render_text'( text, color_pmc )
+    font_surface = self.'render_text'( text, color_pmc )
 
-       .local int w
-       .local int h
-       w = font_surface.'width'()
-       h = font_surface.'height'()
+    .local int w
+    .local int h
+    w = font_surface.'width'()
+    h = font_surface.'height'()
 
-       .local int rect_type
-       .local pmc rect
+    .local pmc rect
+    rect = new 'SDL::Rect'
 
-       find_type rect_type, 'SDL::Rect'
-       rect = new rect_type
-       rect.'init'( 'x' => 0, 'y' => 0, 'height' => h, 'width' => w )
+    rect.'init'( 'x' => 0, 'y' => 0, 'height' => h, 'width' => w )
 
-       dest_rect.'height'( h )
-       dest_rect.'width'( w )
+    dest_rect.'height'( h )
+    dest_rect.'width'( w )
 
-       screen.'blit'( font_surface, rect, dest_rect )
+    screen.'blit'( font_surface, rect, dest_rect )
 
-       .return()
+    .return()
 .end
 
 =item render_text( text_string, text_color )
@@ -130,30 +126,27 @@
 =cut
 
 .sub render_text :method
-       .param string text
-       .param pmc    color_pmc
-
-       .local pmc font
-       font = self.'font'()
+    .param string text
+    .param pmc    color_pmc
 
-       .local int surface_type
-       find_type surface_type, 'SDL::Surface'
+    .local pmc font
+    font = self.'font'()
 
-       .local pmc font_surface
-       font_surface = new surface_type
-       font_surface.'init'( 'height' => 0, 'width' => 0 )
+    .local pmc font_surface
+    font_surface = new 'SDL::Surface'
+    font_surface.'init'( 'height' => 0, 'width' => 0 )
 
-       .local pmc RenderText_Solid
-       find_global RenderText_Solid, 'SDL::NCI::TTF', 'RenderText_Solid'
+    .local pmc RenderText_Solid
+    find_global RenderText_Solid, 'SDL::NCI::TTF', 'RenderText_Solid'
 
-       .local pmc color
-       color = color_pmc.'color'()
+    .local pmc color
+    color = color_pmc.'color'()
 
-       .local pmc font_surface_struct
-       font_surface_struct = RenderText_Solid( font, text, color )
-       font_surface.'wrap_surface'( font_surface_struct )
+    .local pmc font_surface_struct
+    font_surface_struct = RenderText_Solid( font, text, color )
+    font_surface.'wrap_surface'( font_surface_struct )
 
-       .return( font_surface )
+    .return( font_surface )
 .end
 
 =item font()
@@ -165,10 +158,10 @@
 =cut
 
 .sub font :method
-       .local pmc font
-       getattribute font, self, 'font'
+    .local pmc font
+    getattribute font, self, 'font'
 
-       .return( font )
+    .return( font )
 .end
 
 =item point_size( [ new_size ] )
@@ -179,22 +172,22 @@
 =cut
 
 .sub point_size :method
-       .param int size      :optional
-       .param int have_size :opt_flag
+    .param int size      :optional
+    .param int have_size :opt_flag
 
-       .local pmc size_value
+    .local pmc size_value
 
-       if have_size == 0 goto getter
+    if have_size == 0 goto getter
 
-       size_value = new Integer
-       size_value = size
-       setattribute self, 'size', size_value
+    size_value = new Integer
+    size_value = size
+    setattribute self, 'size', size_value
 
 getter:
-       getattribute size_value, self, 'size'
-       size = size_value
+    getattribute size_value, self, 'size'
+    size = size_value
 
-       .return( size )
+    .return( size )
 .end
 
 =back
@@ -207,7 +200,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/Image.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/Image.pir       (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/Image.pir       Tue Oct  2 
21:03:25 2007
@@ -7,18 +7,15 @@
 
 =head1 SYNOPSIS
 
-       # load this library
-       load_bytecode 'library/SDL/Image.pir'
+    # load this library
+    load_bytecode 'library/SDL/Image.pir'
 
-       # create a new SDL::Image object
-       .local pmc image
-       .local int image_type
-
-       find_type image_type, 'SDL::Image'
-       image = new image_type
-       image.'init'( file => 'examples/sdl/parrot_small.png' )
+    # create a new SDL::Image object
+    .local pmc image
+    image = new 'SDL::Image'
+    image.'init'( file => 'examples/sdl/parrot_small.png' )
 
-       # blit and update this object as you like!
+    # blit and update this object as you like!
 
 =head1 DESCRIPTION
 
@@ -39,20 +36,19 @@
 .namespace [ 'SDL::Image' ]
 
 .sub _initialize :load
-       .local pmc surface_type
-       .local pmc image_class
-       
-       $I0 = find_type 'SDL::Image'
-       if $I0 > 1 goto END
-
-       .local pmc init_image
-       init_image = find_global 'SDL', '_init_image'
-       init_image()
-
-       getclass surface_type,        'SDL::Surface'
-       subclass image_class, surface_type, 'SDL::Image'
-END:
-       .return()
+    .local pmc image_class
+
+    image_class = get_class 'SDL::Image'
+    if_null image_class, create_class
+    .return()
+
+  create_class:
+    .local pmc init_image
+    init_image = find_global 'SDL', '_init_image'
+    init_image()
+
+    subclass image_class, 'SDL::Surface', 'SDL::Image'
+    .return()
 .end
 
 =item init( file => 'xxx' )
@@ -63,18 +59,18 @@
 =cut
 
 .sub 'init' :method
-       .param string filename :named( 'file' )
+    .param string filename :named( 'file' )
 
-       .local pmc IMG_Load
-       IMG_Load = find_global 'SDL::NCI', 'IMG_Load'
+    .local pmc IMG_Load
+    IMG_Load = find_global 'SDL::NCI', 'IMG_Load'
 
-       .local pmc image
+    .local pmc image
 
-       image = IMG_Load( filename )
+    image = IMG_Load( filename )
 
-       self.'wrap_surface'( image )
+    self.'wrap_surface'( image )
 
-       .return()
+    .return()
 .end
 
 =back
@@ -87,7 +83,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/LCD.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/LCD.pir (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/LCD.pir Tue Oct  2 21:03:25 2007
@@ -8,8 +8,7 @@
 =head1 SYNOPSIS
 
     # create an LCD
-    $I0 = find_type 'SDL::LCD'
-    lcd = new $I0
+    lcd = new 'SDL::LCD'
 
     # set the LCD position
     lcd."xpos"( 10 )
@@ -40,18 +39,20 @@
 .namespace ["SDL::LCD"]
 
 .sub __onload :load
-    $I0 = find_type 'SDL::LCD'
-    if $I0 > 1 goto END
-    
+    .local pmc class
+    class = get_class 'SDL::LCD'
+    is_null class, create_class
+    .return()
+
+  create_class:
     load_bytecode "library/SDL/Image.pir"
     load_bytecode "library/SDL/Rect.pir"
 
     $P0 = new 'String'
     $P0 = "runtime/parrot/library/SDL/LCD.png"
-    $I0 = find_type "SDL::Image"
-    $P0 = new $I0, $P0
+    $P0 = new 'SDL::Image', $P0
     store_global "SDL::LCD", "digits", $P0
-    
+
     $P0 = newclass 'SDL::LCD'
     addattribute $P0, "value"
     addattribute $P0, "numdigits"
@@ -141,11 +142,11 @@
     .local pmc digits
     .local int xpos
     .local int ypos
-    
+
     $I0 = classoffset self, "SDL::LCD"
     $P0 = getattribute self, $I0
     val = $P0
-    
+
     inc $I0
     $P0 = getattribute self, $I0
     len = $P0
@@ -173,32 +174,32 @@
     val = $S0
 LEN_OK:
 
-    rect = new 'Hash'
-    rect["width"] = 10
-    rect["height"] = 21
-    $I0 = find_type "SDL::Rect"
-    rect["x"] = 0
-    rect["y"] = 0
-    drect = new $I0, rect
-    rect["x"] = xpos
-    rect["y"] = ypos
-    rect = new $I0, rect
-    
-    digits = find_global "SDL::LCD", "digits"
-    
+    rect           = new 'Hash'
+    rect['width']  = 10
+    rect['height'] = 21
+    rect['x']      = 0
+    rect['y']      = 0
+
+    drect          = new 'SDL::Rect', rect
+    rect['x']      = xpos
+    rect['y']      = ypos
+    rect           = new 'SDL::Rect', rect
+
+    digits         = find_global 'SDL::LCD', 'digits'
+
     i = 0
 LOOP:
     if i >= len goto END
     $S0 = substr val, i, 1
-    
+
     $I0 = $S0
     if $I0 != 0 goto OK
-    
+
     $I1 = ord $S0
 
     $I0 = 0
     if $I1 == 48 goto OK
-    
+
     $I0 = 10
     if $I1 == 65 goto OK
     if $I1 == 97 goto OK
@@ -241,11 +242,11 @@
     $I0 = rect.'x'()
     add $I0, 12
     rect.'x'( $I0 )
-    
+
     inc i
     branch LOOP
 END:
-    
+
     $I0 = len * 12
     $I0 -= 2
     rect.'x'( xpos )
@@ -263,7 +264,7 @@
 
 .sub xpos :method
     .param int val
-    
+
     $I0 = classoffset self, "SDL::LCD"
     add $I0, 2
     $P0 = getattribute self, $I0
@@ -278,7 +279,7 @@
 
 .sub ypos :method
     .param int val
-    
+
     $I0 = classoffset self, "SDL::LCD"
     add $I0, 3
     $P0 = getattribute self, $I0
@@ -295,7 +296,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/Rect.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/Rect.pir        (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/Rect.pir        Tue Oct  2 
21:03:25 2007
@@ -7,26 +7,23 @@
 
 =head1 SYNOPSIS
 
-       # load this library
-       load_bytecode 'library/SDL/Rect.pir'
+    # load this library
+    load_bytecode 'library/SDL/Rect.pir'
 
-       # create a new SDL::Rect object
-       .local pmc rect
-       .local int rect_type
+    # create a new SDL::Rect object
+    .local pmc rect
+    rect = new 'SDL::Rect'
 
-       find_type rect_type, 'SDL::Rect'
-       rect = new rect_type
+    # now set the arguments on the object
+    rect.'init'( 'x' => 270, 'y' => 190, 'height' => 100, 'width'=> 100 )
 
-       # now set the arguments on the object
-       rect.'init'( 'x' => 270, 'y' => 190, 'height' => 100, 'width'=> 100 )
-
-       # ... and blit to or fill surfaces with this object!
+    # ... and blit to or fill surfaces with this object!
 
 =head1 DESCRIPTION
 
 The SDL::Rect class represents rects in SDL.  SDL::Rect objects represent
 sources and destinations for filling and blitting to and from SDL::Surface
-objects. 
+objects.
 
 =head1 METHODS
 
@@ -39,16 +36,15 @@
 .namespace [ 'SDL::Rect' ]
 
 .sub _initialize :load
-
-       $I0 = find_type 'SDL::Rect'
-       if $I0 > 1 goto END
-       
-       .local   pmc rect_class
-       newclass     rect_class, 'SDL::Rect'
-       addattribute rect_class, '_rect'
-
-END:
-       .return ()
+    .local pmc class
+    class = get_class 'SDL::Rect'
+    if_null class, create_class
+    .return()
+
+  create_class:
+    newclass     class, 'SDL::Rect'
+    addattribute class, '_rect'
+    .return ()
 .end
 
 =item init( arg => value )
@@ -83,50 +79,48 @@
 =cut
 
 .sub 'init' :method
-       .param int x           :named( 'x' ) :optional
-       .param int have_x      :opt_flag
-       .param int y           :named( 'y' ) :optional
-       .param int have_y      :opt_flag
-       .param int width       :named( 'width' ) :optional
-       .param int have_width  :opt_flag
-       .param int height      :named( 'height' ) :optional
-       .param int have_height :opt_flag
+    .param int x           :named( 'x' ) :optional
+    .param int have_x      :opt_flag
+    .param int y           :named( 'y' ) :optional
+    .param int have_y      :opt_flag
+    .param int width       :named( 'width' ) :optional
+    .param int have_width  :opt_flag
+    .param int height      :named( 'height' ) :optional
+    .param int have_height :opt_flag
 
-       if have_x goto check_y
-       x = 0
+    if have_x goto check_y
+    x = 0
 
   check_y:
-       if have_y goto check_width
-       y = 0
+    if have_y goto check_width
+    y = 0
 
   check_width:
-       if have_width goto check_height
-       width = 0
+    if have_width goto check_height
+    width = 0
 
   check_height:
-       if have_height goto check_done
-       height = 0
+    if have_height goto check_done
+    height = 0
 
   check_done:
-       .local pmc  fetch_layout
-       find_global fetch_layout, 'SDL::NCI', 'fetch_layout'
+    .local pmc  fetch_layout
+    find_global fetch_layout, 'SDL::NCI', 'fetch_layout'
 
-       .local pmc layout
-       layout = fetch_layout( 'Rect' )
+    .local pmc layout
+    layout = fetch_layout( 'Rect' )
 
-       .local pmc rect
-       new rect, .ManagedStruct, layout
+    .local pmc rect
+    new rect, 'ManagedStruct', layout
 
-       set rect['height'], height
-       set rect['width'], width
-       set rect['x'], x
-       set rect['y'], y
+    set rect['height'], height
+    set rect['width'], width
+    set rect['x'], x
+    set rect['y'], y
 
-       .local int offset
-       classoffset  offset,   self, 'SDL::Rect'
-       setattribute   self, offset, rect
+    setattribute self, '_rect', rect
 
-       .return()
+    .return()
 .end
 
 =item rect()
@@ -137,13 +131,10 @@
 =cut
 
 .sub rect :method
-       .local pmc rect 
-       .local int offset
-
-       classoffset  offset, self, 'SDL::Rect'
-       getattribute   rect, self, offset
+    .local pmc rect
+    getattribute rect, self, '_rect'
 
-       .return( rect )
+    .return( rect )
 .end
 
 =item height()
@@ -154,21 +145,20 @@
 =cut
 
 .sub height :method
-       .param int new_height     :optional
-       .param int has_new_height :opt_flag
+    .param int new_height     :optional
+    .param int has_new_height :opt_flag
 
-       .local pmc rect 
-       .local int result
+    .local pmc rect
+    rect             = self.'rect'()
 
-       rect             = self.'rect'()
-
-       unless has_new_height goto getter
-       rect[ 'height' ] = new_height
+    unless has_new_height goto getter
+    rect[ 'height' ] = new_height
 
 getter:
-       result           = rect[ 'height' ]
+    .local int result
+    result           = rect[ 'height' ]
 
-       .return( result )
+    .return( result )
 .end
 
 =item width()
@@ -179,21 +169,20 @@
 =cut
 
 .sub width :method
-       .param int new_width     :optional
-       .param int has_new_width :optional
-
-       .local pmc rect 
-       .local int result
+    .param int new_width     :optional
+    .param int has_new_width :optional
 
-       rect            = self.'rect'()
+    .local pmc rect
+    rect            = self.'rect'()
 
-       unless has_new_width goto getter
-       rect[ 'width' ] = new_width
+    unless has_new_width goto getter
+    rect[ 'width' ] = new_width
 
 getter:
-       result          = rect[ 'width' ]
+    .local int result
+    result          = rect[ 'width' ]
 
-       .return( result )
+    .return( result )
 .end
 
 =item x( [ new_x_coordinate ] )
@@ -204,21 +193,20 @@
 =cut
 
 .sub x :method
-       .param int new_x     :optional
-       .param int has_new_x :opt_flag
+    .param int new_x     :optional
+    .param int has_new_x :opt_flag
 
-       .local pmc rect 
+    .local pmc rect
+    rect           = self.'rect'()
 
-       rect           = self.'rect'()
-
-       unless has_new_x goto getter
-       rect[ 'x' ]    = new_x
+    unless has_new_x goto getter
+    rect[ 'x' ]    = new_x
 
 getter:
-       .local int result
-       result         = rect[ 'x' ]
+    .local int result
+    result         = rect[ 'x' ]
 
-       .return( result )
+    .return( result )
 .end
 
 =item y( [ new_y_coordinate ] )
@@ -229,21 +217,20 @@
 =cut
 
 .sub y :method
-       .param int new_y     :optional
-       .param int has_new_y :opt_flag
-
-       .local pmc rect 
+    .param int new_y     :optional
+    .param int has_new_y :opt_flag
 
-       rect           = self.'rect'()
+    .local pmc rect
+    rect           = self.'rect'()
 
-       unless has_new_y goto _getter
-       rect[ 'y' ]    = new_y
+    unless has_new_y goto _getter
+    rect[ 'y' ]    = new_y
 
 _getter:
-       .local int result
-       result         = rect[ 'y' ]
+    .local int result
+    result         = rect[ 'y' ]
 
-       .return( result )
+    .return( result )
 .end
 
 =back
@@ -256,7 +243,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/Sprite.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/Sprite.pir      (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/Sprite.pir      Tue Oct  2 
21:03:25 2007
@@ -14,10 +14,7 @@
 
     # create a new SDL::Sprite object
     .local pmc sprite
-    .local int sprite_type
-
-    find_type sprite_type, 'SDL::Sprite'
-    sprite = new sprite_type
+    sprite = new 'SDL::Sprite'
 
     # set the sprite's arguments
     sprite.'init'( 'surface'  => image, 'source_x' =>     0, 'source_y' =>     
0, 'dest_x'   =>   270, 'dest_y'   =>   212, 'bgcolor'  => black )
@@ -136,9 +133,6 @@
     setattribute self, 'surface', surface
 
     # set all of the rect attributes
-    .local int rect_type
-    find_type rect_type, 'SDL::Rect'
-
     if has_width goto set_height
     width = surface.'width'()
 
@@ -149,15 +143,14 @@
 done:
     # first the source rectangle
     .local pmc source_rect
-
-    source_rect = new rect_type
+    source_rect = new 'SDL::Rect'
     source_rect.'init'( 'x' => source_x, 'y' => source_y, 'height' => height, 
'width' => width )
 
     setattribute self, 'source_rect', source_rect
 
     # now the dest rectangle
     .local pmc rect
-    rect = new rect_type
+    rect = new 'SDL::Rect'
     rect.'init'( 'x' => dest_x, 'y' => dest_y )
 
     setattribute self, 'rect', rect
@@ -165,7 +158,7 @@
 
     # and now the previous rect
     .local pmc prev_rect
-    prev_rect = new rect_type
+    prev_rect = new 'SDL::Rect'
     prev_rect.'init'( 'x' => source_x, 'y' => source_y, 'height' => height, 
'width' => width )
 
     setattribute self, 'prev_rect', prev_rect
@@ -177,13 +170,13 @@
 
     # the drawn rect
     .local pmc drawn_rect
-    drawn_rect = new rect_type
+    drawn_rect = new 'SDL::Rect'
     drawn_rect.'init'( 'x' => source_x, 'y' => source_y, 'height' => height, 
'width' => width )
     setattribute self, 'drawn_rect', drawn_rect
 
     # the undrawn rect
     .local pmc undrawn_rect
-    undrawn_rect = new rect_type
+    undrawn_rect = new 'SDL::Rect'
     undrawn_rect.'init'( 'x' => source_x, 'y' => source_y, 'height' => height, 
'width' => width )
     setattribute self, 'undrawn_rect', undrawn_rect
 
@@ -309,11 +302,8 @@
 =cut
 
 .sub surface :method
-    .local int offset
-    classoffset offset, self, 'SDL::Sprite'
-
     .local pmc surface
-    getattribute surface, self, offset
+    getattribute surface, self, 'surface'
 
     .return( surface )
 .end
@@ -328,12 +318,8 @@
 =cut
 
 .sub source_rect :method
-    .local int offset
-    classoffset offset, self, 'SDL::Sprite'
-    add offset, 1
-
     .local pmc source_rect
-    getattribute source_rect, self, offset
+    getattribute source_rect, self, 'source_rect'
 
     .return( source_rect )
 .end
@@ -348,12 +334,8 @@
 =cut
 
 .sub prev_rect :method
-    .local int offset
-    classoffset offset, self, 'SDL::Sprite'
-    add offset, 2
-
     .local pmc prev_rect
-    getattribute prev_rect, self, offset
+    getattribute prev_rect, self, 'prev_rect'
 
     .return( prev_rect )
 .end
@@ -384,12 +366,8 @@
 =cut
 
 .sub bgcolor :method
-    .local int offset
-    classoffset offset, self, 'SDL::Sprite'
-    add offset, 4
-
     .local pmc bgcolor
-    getattribute bgcolor, self, offset
+    getattribute bgcolor, self, 'bgcolor'
 
     .return( bgcolor )
 .end
@@ -405,12 +383,8 @@
 =cut
 
 .sub drawn_rect :method
-    .local int offset
-    classoffset offset, self, 'SDL::Sprite'
-    add offset, 5
-
     .local pmc drawn_rect
-    getattribute drawn_rect, self, offset
+    getattribute drawn_rect, self, 'drawn_rect'
 
     .return( drawn_rect )
 .end
@@ -426,12 +400,8 @@
 =cut
 
 .sub undrawn_rect :method
-    .local int offset
-    classoffset offset, self, 'SDL::Sprite'
-    add offset, 6
-
     .local pmc undrawn_rect
-    getattribute undrawn_rect, self, offset
+    getattribute undrawn_rect, self, 'undrawn_rect'
 
     .return( undrawn_rect )
 .end
@@ -548,7 +518,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/StopWatch.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/StopWatch.pir   (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/StopWatch.pir   Tue Oct  2 
21:03:25 2007
@@ -8,8 +8,7 @@
 =head1 SYNOPSIS
 
     # create the stopwatch
-    $I0 = find_type 'SDL::StopWatch'
-    watch = new $I0, screen
+    watch = new 'SDL::StopWatch', screen
 
     # set its position
     watch.'xpos'( 5 )
@@ -37,16 +36,19 @@
 .namespace ['SDL::StopWatch']
 
 .sub __onload :load
-    $I0 = find_type 'SDL::StopWatch'
-    if $I0 > 1 goto END
+    .local pmc class
+    class = get_class 'SDL::StopWatch'
+    if_null class, create_class
+    .return()
 
+  create_class:
     load_bytecode "library/SDL/LCD.pir"
-    $P0 = getclass 'SDL::LCD'
-    $P0 = subclass $P0, 'SDL::StopWatch'
-    addattribute $P0, "time"
-    addattribute $P0, "precision"
-    addattribute $P0, "start"
-    addattribute $P0, "screen"
+    class = getclass 'SDL::LCD'
+    class = subclass class, 'SDL::StopWatch'
+    addattribute $P0, 'time'
+    addattribute $P0, 'precision'
+    addattribute $P0, 'start'
+    addattribute $P0, 'screen'
 END:
 .end
 
@@ -348,7 +350,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 
 =cut
 

Modified: branches/pdd15oo/runtime/parrot/library/SDL/Surface.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/SDL/Surface.pir     (original)
+++ branches/pdd15oo/runtime/parrot/library/SDL/Surface.pir     Tue Oct  2 
21:03:25 2007
@@ -7,15 +7,14 @@
 
 =head1 SYNOPSIS
 
-       # load this library
-       load_bytecode 'library/SDL/Surface.pir'
+    # load this library
+    load_bytecode 'library/SDL/Surface.pir'
 
-       # create a new SDL::Surface object
-       find_type surface_type, 'SDL::Surface'
-       surface = new surface_type
-       surface.'init'( 'height' => 480, 'width' => 640 )
+    # create a new SDL::Surface object
+    surface = new 'SDL::Surface'
+    surface.'init'( 'height' => 480, 'width' => 640 )
 
-       # ... blit to, fill, update, and flip this surface as necessary
+    # ... blit to, fill, update, and flip this surface as necessary
 
 =head1 DESCRIPTION
 
@@ -36,15 +35,14 @@
 .namespace [ 'SDL::Surface' ]
 
 .sub _initialize :load
-       .local pmc   surface_class
-
-       $I0 = find_type 'SDL::Surface'
-       if $I0 > 1 goto END
-
-       newclass     surface_class, 'SDL::Surface'
-       addattribute surface_class, 'surface'
-END:
-
+    .local pmc class
+    class = get_class 'SDL::Surface'
+    if_null class, create_class
+    .return()
+
+  create_class:
+    newclass     class, 'SDL::Surface'
+    addattribute class, 'surface'
 .end
 
 =item init( surface_args )
@@ -58,49 +56,49 @@
 =cut
 
 .sub init :method
-       .param int height :named( 'height' )
-       .param int width  :named( 'width'  )
-       .param int depth  :named( 'depth'  ) :optional
-       .param int flags  :named( 'flags'  ) :optional
-       .param int have_flags :opt_flag
-       .param int red    :named( 'Rmask' )  :optional
-       .param int have_red :opt_flag
-       .param int green  :named( 'Gmask' )  :optional
-       .param int have_green :opt_flag
-       .param int blue   :named( 'Bmask' )  :optional
-       .param int have_blue :opt_flag
-       .param int alpha  :named( 'Amask' )  :optional
-       .param int have_alpha :opt_flag
+    .param int height :named( 'height' )
+    .param int width  :named( 'width'  )
+    .param int depth  :named( 'depth'  ) :optional
+    .param int flags  :named( 'flags'  ) :optional
+    .param int have_flags :opt_flag
+    .param int red    :named( 'Rmask' )  :optional
+    .param int have_red :opt_flag
+    .param int green  :named( 'Gmask' )  :optional
+    .param int have_green :opt_flag
+    .param int blue   :named( 'Bmask' )  :optional
+    .param int have_blue :opt_flag
+    .param int alpha  :named( 'Amask' )  :optional
+    .param int have_alpha :opt_flag
 
-       .local pmc SDL_CreateRGBSurface
+    .local pmc SDL_CreateRGBSurface
 
-       if have_flags goto check_red
-       flags = 0
+    if have_flags goto check_red
+    flags = 0
 
   check_red:
-       if have_red goto check_green
-       red = 5
+    if have_red goto check_green
+    red = 5
 
   check_green:
-       if have_blue goto check_blue
-       green = 6
+    if have_blue goto check_blue
+    green = 6
 
   check_blue:
-       if have_blue goto check_alpha
-       blue = 5
+    if have_blue goto check_alpha
+    blue = 5
 
   check_alpha:
-       if have_alpha goto create_surface
-       alpha = 0
+    if have_alpha goto create_surface
+    alpha = 0
 
   create_surface:
-       SDL_CreateRGBSurface = find_global 'SDL::NCI', 'CreateRGBSurface'
+    SDL_CreateRGBSurface = find_global 'SDL::NCI', 'CreateRGBSurface'
 
-       .local pmc surface
-       surface = SDL_CreateRGBSurface( flags, width, height, depth, red, 
green, blue, alpha )
-       self."wrap_surface"( surface )
+    .local pmc surface
+    surface = SDL_CreateRGBSurface( flags, width, height, depth, red, green, 
blue, alpha )
+    self."wrap_surface"( surface )
 
-       .return()
+    .return()
 .end
 
 =item new_from_surface( raw_surface )
@@ -114,56 +112,54 @@
 =cut
 
 .sub wrap_surface :method
-       .param pmc surface_struct
+    .param pmc surface_struct
+
+    .local pmc  fetch_layout
+    find_global fetch_layout, 'SDL::NCI', 'fetch_layout'
+
+    .local pmc layout
+    layout = fetch_layout( 'Surface' )
 
-       .local pmc  fetch_layout
-       find_global fetch_layout, 'SDL::NCI', 'fetch_layout'
+    # assign it once to find out the height and width
+    assign surface_struct, layout
 
-       .local pmc layout
-       layout = fetch_layout( 'Surface' )
+    setattribute self, 'surface', surface_struct
 
-       # assign it once to find out the height and width
-       assign surface_struct, layout
-
-       .local int offset
-       classoffset offset, self, 'SDL::Surface'
-       setattribute self, offset, surface_struct
-
-       .local int bpp
-       .local int height
-       .local int width
-       .local int num_pixels
-
-       bpp          = self.'bpp'()
-       height       = self.'height'()
-       width        = self.'width'()
-       num_pixels   = height * width
-
-       .local pmc pixels_struct
-       .local pmc pixels_layout
-       .local pmc pixels_entry
-
-       pixels_entry  = layout[ 'pixels' ]
-       pixels_struct = getprop '_struct', pixels_entry
-       pixels_layout = new OrderedHash
-
-       if bpp ==  8 goto eight_bits
-       if bpp == 16 goto sixteen_bits
-       set  pixels_layout[ 'array' ], .DATATYPE_INT
-       goto bits_set
+    .local int bpp
+    .local int height
+    .local int width
+    .local int num_pixels
+
+    bpp          = self.'bpp'()
+    height       = self.'height'()
+    width        = self.'width'()
+    num_pixels   = height * width
+
+    .local pmc pixels_struct
+    .local pmc pixels_layout
+    .local pmc pixels_entry
+
+    pixels_entry  = layout[ 'pixels' ]
+    pixels_struct = getprop '_struct', pixels_entry
+    pixels_layout = new OrderedHash
+
+    if bpp ==  8 goto eight_bits
+    if bpp == 16 goto sixteen_bits
+    set  pixels_layout[ 'array' ], .DATATYPE_INT
+    goto bits_set
 
 eight_bits:
-       set  pixels_layout[ 'array' ], .DATATYPE_UINT8
-       goto bits_set
+    set  pixels_layout[ 'array' ], .DATATYPE_UINT8
+    goto bits_set
 
 sixteen_bits:
-       set  pixels_layout[ 'array' ], .DATATYPE_UINT16
+    set  pixels_layout[ 'array' ], .DATATYPE_UINT16
 
 bits_set:
-       push pixels_layout, num_pixels
-       push pixels_layout, 0
+    push pixels_layout, num_pixels
+    push pixels_layout, 0
 
-       assign pixels_struct, pixels_layout
+    assign pixels_struct, pixels_layout
 .end
 
 =item height()
@@ -174,13 +170,13 @@
 =cut
 
 .sub height :method
-       .local pmc surface
-       surface = self.'surface'()
+    .local pmc surface
+    surface = self.'surface'()
 
-       .local int height
-       height = surface['h']
+    .local int height
+    height = surface['h']
 
-       .return( height )
+    .return( height )
 .end
 
 =item width()
@@ -190,13 +186,13 @@
 =cut
 
 .sub width :method
-       .local pmc surface
-       surface = self.'surface'()
+    .local pmc surface
+    surface = self.'surface'()
 
-       .local int width
-       width = surface['w']
+    .local int width
+    width = surface['w']
 
-       .return( width )
+    .return( width )
 .end
 
 =item fill_rect( rect, color )
@@ -207,24 +203,22 @@
 =cut
 
 .sub fill_rect :method
-       .param pmc rect
-       .param pmc color_object
+    .param pmc rect
+    .param pmc color_object
 
-       .local pmc SDL_FillRect
-       SDL_FillRect = find_global 'SDL::NCI', 'FillRect'
+    .local pmc SDL_FillRect
+    SDL_FillRect = find_global 'SDL::NCI', 'FillRect'
 
-       .local pmc surface
-       .local int offset
-       classoffset   offset, self, 'SDL::Surface'
-       getattribute surface, self, offset
+    .local pmc surface
+    getattribute surface, self, 'surface'
 
-       .local int color
-       color = color_object
+    .local int color
+    color = color_object
 
-       .local pmc dest_rect
-       dest_rect = rect.'rect'()
+    .local pmc dest_rect
+    dest_rect = rect.'rect'()
 
-       SDL_FillRect( surface, dest_rect, color )
+    SDL_FillRect( surface, dest_rect, color )
 .end
 
 =item update_rect( rect )
@@ -238,25 +232,25 @@
 =cut
 
 .sub update_rect :method
-       .param pmc rect
+    .param pmc rect
 
-       .local pmc surface
-       getattribute surface, self, 'surface'
+    .local pmc surface
+    getattribute surface, self, 'surface'
 
-       .local int x
-       .local int y
-       .local int width
-       .local int height
+    .local int x
+    .local int y
+    .local int width
+    .local int height
 
-       x      = rect.'x'()
-       y      = rect.'y'()
-       height = rect.'height'()
-       width  = rect.'width'()
+    x      = rect.'x'()
+    y      = rect.'y'()
+    height = rect.'height'()
+    width  = rect.'width'()
 
-       .local pmc SDL_UpdateRect
-       SDL_UpdateRect = find_global 'SDL::NCI', 'UpdateRect'
+    .local pmc SDL_UpdateRect
+    SDL_UpdateRect = find_global 'SDL::NCI', 'UpdateRect'
 
-       SDL_UpdateRect( surface, x, y, width, height )
+    SDL_UpdateRect( surface, x, y, width, height )
 .end
 
 =item update_rects( array_of_rects )
@@ -267,61 +261,57 @@
 =cut
 
 .sub update_rects :method
-       .param pmc rects
+    .param pmc rects
 
-       .local int count
-       set count, rects
+    .local int count
+    set count, rects
 
-       .local pmc  fetch_layout
-       find_global fetch_layout, 'SDL::NCI', 'fetch_layout'
+    .local pmc  fetch_layout
+    find_global fetch_layout, 'SDL::NCI', 'fetch_layout'
 
-       .local pmc rect_array_layout
+    .local pmc rect_array_layout
 
-       # don't forget to update the number of elements in this array
-       rect_array_layout    = fetch_layout( 'Rect_Array' )
-       rect_array_layout[1] = count
+    # don't forget to update the number of elements in this array
+    rect_array_layout    = fetch_layout( 'Rect_Array' )
+    rect_array_layout[1] = count
 
-       .local pmc rect_array
-       rect_array = new ManagedStruct, rect_array_layout
+    .local pmc rect_array
+    rect_array = new ManagedStruct, rect_array_layout
 
-       .local int iterator
-       iterator = 0
+    .local int iterator
+    iterator = 0
 
 loop:
-       .local pmc rect
-       .local pmc rect_struct
-       rect        = rects[ iterator ]
-       rect_struct = rect.'rect'()
-
-       .local int x
-       .local int y
-       .local int w
-       .local int h
-
-       x = rect_struct[ 'x'      ]
-       y = rect_struct[ 'y'      ]
-       w = rect_struct[ 'width'  ]
-       h = rect_struct[ 'height' ]
-
-       set rect_array[ 'RectArray'; iterator; 'x'      ], x
-       set rect_array[ 'RectArray'; iterator; 'y'      ], y
-       set rect_array[ 'RectArray'; iterator; 'width'  ], w
-       set rect_array[ 'RectArray'; iterator; 'height' ], h
-
-       inc iterator
-       if iterator < count goto loop
-
-       .local int offset
-       classoffset offset, self, 'SDL::Surface'
-
-       .local pmc surface
-       getattribute surface, self, offset
+    .local pmc rect
+    .local pmc rect_struct
+    rect        = rects[ iterator ]
+    rect_struct = rect.'rect'()
+
+    .local int x
+    .local int y
+    .local int w
+    .local int h
+
+    x = rect_struct[ 'x'      ]
+    y = rect_struct[ 'y'      ]
+    w = rect_struct[ 'width'  ]
+    h = rect_struct[ 'height' ]
+
+    set rect_array[ 'RectArray'; iterator; 'x'      ], x
+    set rect_array[ 'RectArray'; iterator; 'y'      ], y
+    set rect_array[ 'RectArray'; iterator; 'width'  ], w
+    set rect_array[ 'RectArray'; iterator; 'height' ], h
+
+    inc iterator
+    if iterator < count goto loop
 
-       .local pmc UpdateRects
-       UpdateRects = find_global 'SDL::NCI', 'UpdateRects'
+    .local pmc surface
+    getattribute surface, self, 'surface'
 
-       UpdateRects( surface, count, rect_array )
+    .local pmc UpdateRects
+    UpdateRects = find_global 'SDL::NCI', 'UpdateRects'
 
+    UpdateRects( surface, count, rect_array )
 .end
 
 =item flip()
@@ -333,16 +323,13 @@
 =cut
 
 .sub flip :method
-       .local int offset
-       classoffset offset, self, 'SDL::Surface'
-
-       .local pmc surface
-       getattribute surface, self, offset
+    .local pmc surface
+    getattribute surface, self, 'surface'
 
-       .local pmc SDL_Flip
-       SDL_Flip = find_global 'SDL::NCI', 'Flip'
+    .local pmc SDL_Flip
+    SDL_Flip = find_global 'SDL::NCI', 'Flip'
 
-       SDL_Flip( surface )
+    SDL_Flip( surface )
 
 .end
 
@@ -359,27 +346,27 @@
 =cut
 
 .sub blit :method
-       .param pmc surface
-       .param pmc source
-       .param pmc dest
+    .param pmc surface
+    .param pmc source
+    .param pmc dest
 
-       .local pmc SDL_BlitSurface
-       SDL_BlitSurface = find_global 'SDL::NCI', 'BlitSurface'
+    .local pmc SDL_BlitSurface
+    SDL_BlitSurface = find_global 'SDL::NCI', 'BlitSurface'
 
-       .local pmc source_surface
-       .local pmc dest_surface
+    .local pmc source_surface
+    .local pmc dest_surface
 
-       source_surface = surface.'surface'()
-       dest_surface   = self.'surface'()
+    source_surface = surface.'surface'()
+    dest_surface   = self.'surface'()
 
-       .local pmc source_rect
-       .local pmc dest_rect
+    .local pmc source_rect
+    .local pmc dest_rect
 
-       source_rect    = source.'rect'()
-       dest_rect      = dest.'rect'()
+    source_rect    = source.'rect'()
+    dest_rect      = dest.'rect'()
 
-       SDL_BlitSurface( source_surface, source_rect, dest_surface, dest_rect )
-       .return()
+    SDL_BlitSurface( source_surface, source_rect, dest_surface, dest_rect )
+    .return()
 .end
 
 =item surface()
@@ -390,13 +377,10 @@
 =cut
 
 .sub surface :method
-       .local int offset
-       classoffset offset, self, 'SDL::Surface'
+    .local pmc surface
+    getattribute surface, self, 'surface'
 
-       .local pmc surface
-       getattribute surface, self, offset
-
-       .return( surface )
+    .return( surface )
 .end
 
 =item color_key( color )
@@ -407,21 +391,18 @@
 =cut
 
 .sub color_key :method
-       .param pmc color
-
-       .local int color_value
-       color_value = color.'color'()
+    .param pmc color
 
-       .local int offset
-       classoffset offset, self, 'SDL::Surface'
+    .local int color_value
+    color_value = color.'color'()
 
-       .local pmc surface
-       getattribute surface, self, offset
+    .local pmc surface
+    getattribute surface, self, 'surface'
 
-       .local pmc SetColorKey
-       SetColorKey = find_global 'SDL::NCI', 'SetColorKey'
+    .local pmc SetColorKey
+    SetColorKey = find_global 'SDL::NCI', 'SetColorKey'
 
-       SetColorKey( surface, 8, color_value )
+    SetColorKey( surface, 8, color_value )
 .end
 
 =item bpp()
@@ -431,14 +412,14 @@
 =cut
 
 .sub bpp :method
-       .local pmc surface
-       surface = self.'surface'()
+    .local pmc surface
+    surface = self.'surface'()
 
-       .local int bpp
+    .local int bpp
 
-       bpp    = surface[ 'format'; 'BitsPerPixel' ]
+    bpp    = surface[ 'format'; 'BitsPerPixel' ]
 
-       .return( bpp )
+    .return( bpp )
 .end
 
 =item lock()
@@ -450,15 +431,15 @@
 =cut
 
 .sub lock :method
-       .local pmc surface
-       surface = self.'surface'()
+    .local pmc surface
+    surface = self.'surface'()
 
-       .local pmc  LockSurface
-       find_global LockSurface, 'SDL::NCI', 'LockSurface'
+    .local pmc  LockSurface
+    find_global LockSurface, 'SDL::NCI', 'LockSurface'
 
-       LockSurface( surface )
+    LockSurface( surface )
 
-       .return()
+    .return()
 .end
 
 =item unlock()
@@ -468,15 +449,15 @@
 =cut
 
 .sub unlock :method
-       .local pmc surface
-       surface = self.'surface'()
+    .local pmc surface
+    surface = self.'surface'()
 
-       .local pmc  UnlockSurface
-       find_global UnlockSurface, 'SDL::NCI', 'UnlockSurface'
+    .local pmc  UnlockSurface
+    find_global UnlockSurface, 'SDL::NCI', 'UnlockSurface'
 
-       UnlockSurface( surface )
+    UnlockSurface( surface )
 
-       .return()
+    .return()
 .end
 
 =item draw_pixel( x, y, color )
@@ -493,32 +474,32 @@
 =cut
 
 .sub draw_pixel :method
-       .param int x
-       .param int y
-       .param int raw_color
-       .param pmc color_pmc     :optional
-       .param int has_color_pmc :opt_flag
-
-       .local int color
-
-       if has_color_pmc goto convert_color
-       color = raw_color
-       goto draw
+    .param int x
+    .param int y
+    .param int raw_color
+    .param pmc color_pmc     :optional
+    .param int has_color_pmc :opt_flag
+
+    .local int color
+
+    if has_color_pmc goto convert_color
+    color = raw_color
+    goto draw
 
 convert_color:
-       color = color_pmc.'color_for_surface'( self )
-       
+    color = color_pmc.'color_for_surface'( self )
+
 draw:
-       .local pmc surface
-       surface = self.'surface'()
+    .local pmc surface
+    surface = self.'surface'()
 
-       .local int offset
-       offset  = surface[ 'w' ]
+    .local int offset
+    offset  = surface[ 'w' ]
 
-       mul offset, y
-       add offset, x
+    mul offset, y
+    add offset, x
 
-       surface[ 'pixels'; 'array'; offset ] = color
+    surface[ 'pixels'; 'array'; offset ] = color
 .end
 
 =item pixels()
@@ -547,7 +528,7 @@
     .param pmc new_pixels   :optional
     .param int has_pixels   :opt_flag
 
-    .local pmc surface, fetch_layout, pixels_entry, pixels_struct 
+    .local pmc surface, fetch_layout, pixels_entry, pixels_struct
     surface = self.'surface'()
     $P0 = surface['pixels']
     .return ($P0)
@@ -561,15 +542,15 @@
 =cut
 
 .sub convert_red :method
-       .local pmc surface
-       .local int rloss
-       .local int rshift
-
-       surface  = self.'surface'()
-       rloss    = surface[ 'format'; 'Rloss'  ]
-       rshift   = surface[ 'format'; 'Rshift' ]
+    .local pmc surface
+    .local int rloss
+    .local int rshift
+
+    surface  = self.'surface'()
+    rloss    = surface[ 'format'; 'Rloss'  ]
+    rshift   = surface[ 'format'; 'Rshift' ]
 
-       .return( rloss, rshift )
+    .return( rloss, rshift )
 .end
 
 =item convert_green()
@@ -580,15 +561,15 @@
 =cut
 
 .sub convert_green :method
-       .local pmc surface
-       .local int gloss
-       .local int gshift
-
-       surface  = self.'surface'()
-       gloss    = surface[ 'format'; 'Gloss'  ]
-       gshift   = surface[ 'format'; 'Gshift' ]
+    .local pmc surface
+    .local int gloss
+    .local int gshift
+
+    surface  = self.'surface'()
+    gloss    = surface[ 'format'; 'Gloss'  ]
+    gshift   = surface[ 'format'; 'Gshift' ]
 
-       .return( gloss, gshift )
+    .return( gloss, gshift )
 .end
 
 =item convert_blue()
@@ -599,15 +580,15 @@
 =cut
 
 .sub convert_blue :method
-       .local pmc surface
-       .local int bloss
-       .local int bshift
-
-       surface  = self.'surface'()
-       bloss    = surface[ 'format'; 'Bloss'  ]
-       bshift   = surface[ 'format'; 'Bshift' ]
+    .local pmc surface
+    .local int bloss
+    .local int bshift
+
+    surface  = self.'surface'()
+    bloss    = surface[ 'format'; 'Bloss'  ]
+    bshift   = surface[ 'format'; 'Bshift' ]
 
-       .return( bloss, bshift )
+    .return( bloss, bshift )
 .end
 
 =back
@@ -620,7 +601,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (c) 2004, 2006 The Perl Foundation.
+Copyright (c) 2004-2007 The Perl Foundation.
 
 =cut
 

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:parrot] r21767 - in branches/pdd15oo: examples/sdl runtime/parrot/library/SDL, chromatic <=