Author: bernhard
Date: Wed May 16 14:24:33 2007
New Revision: 18573
Modified:
trunk/CREDITS
trunk/examples/sdl/minesweeper/field.pir
trunk/examples/sdl/tetris/app.pir
trunk/examples/sdl/tetris/block.pir
trunk/examples/sdl/tetris/blockdata.pir
trunk/examples/sdl/tetris/blocks.pir
trunk/examples/sdl/tetris/board.pir
trunk/examples/sdl/tetris/boarddata.pir
trunk/examples/sdl/tetris/eventhandler.pir
Log:
[examples]
Try to simplify examples by replacing
.pcc_begin_return .pcc_end_return blocks
with .return() lines.
Modified: trunk/CREDITS
==============================================================================
--- trunk/CREDITS (original)
+++ trunk/CREDITS Wed May 16 14:24:33 2007
@@ -265,6 +265,7 @@
N: Jens Rieks
D: Several libraries, examples and patches.
+D: Tetris with SDL
E: [EMAIL PROTECTED]
S: Wuppertal, Germany
Modified: trunk/examples/sdl/minesweeper/field.pir
==============================================================================
--- trunk/examples/sdl/minesweeper/field.pir (original)
+++ trunk/examples/sdl/minesweeper/field.pir Wed May 16 14:24:33 2007
@@ -1,3 +1,5 @@
+# $Id$
+
=head1 NAME
Mines::Field - A minesweeper field
@@ -526,14 +528,10 @@
self.'check_end'()
self.'draw'()
- .pcc_begin_return
- .return 1
- .pcc_end_return
+ .return (1)
END:
- .pcc_begin_return
- .return 0
- .pcc_end_return
+ .return (0)
.end
=item setFlag( x, y )
@@ -611,14 +609,10 @@
self."check_end"()
self."draw"()
- .pcc_begin_return
- .return 1
- .pcc_end_return
+ .return (1)
END:
- .pcc_begin_return
- .return 0
- .pcc_end_return
+ .return (0)
.end
=item undo_mark( i ) B<(internal)>
@@ -754,14 +748,10 @@
self."check_end"()
self."draw"()
- .pcc_begin_return
- .return 1
- .pcc_end_return
+ .return (1)
END:
- .pcc_begin_return
- .return 0
- .pcc_end_return
+ .return (0)
.end
=item click( x, y, b )
@@ -887,8 +877,7 @@
self.'lost'()
END:
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item lost()
@@ -975,13 +964,9 @@
WON:
self."won"()
- .pcc_begin_return
- .return 1
- .pcc_end_return
+ .return (1)
END:
- .pcc_begin_return
- .return 0
- .pcc_end_return
+ .return (0)
.end
=item setStatus( newStatus )
@@ -1189,9 +1174,7 @@
inc j
if j <= j2 goto LOOPj
- .pcc_begin_return
- .return mines
- .pcc_end_return
+ .return (mines)
.end
=item _mine_at( field, pos )
@@ -1213,13 +1196,9 @@
if v == VAL_UNSURE_MINE goto MINE
if v == VAL_UNEXPLORED_MINE goto MINE
if v == VAL_MARK_MINE goto MINE
- .pcc_begin_return
- .return 0
- .pcc_end_return
+ .return (0)
MINE:
- .pcc_begin_return
- .return 1
- .pcc_end_return
+ .return (1)
.end
=item _button_clicked( onField )
Modified: trunk/examples/sdl/tetris/app.pir
==============================================================================
--- trunk/examples/sdl/tetris/app.pir (original)
+++ trunk/examples/sdl/tetris/app.pir Wed May 16 14:24:33 2007
@@ -152,9 +152,7 @@
getattribute $P0, self, $I0
- .pcc_begin_return
- .return $P0
- .pcc_end_return
+ .return ($P0)
.end
=item app."shutdown"()
@@ -301,9 +299,7 @@
palette = self."palette"()
color = palette[number]
- .pcc_begin_return
- .return color
- .pcc_end_return
+ .return (color)
.end
=item palette = app."palette"()
@@ -325,9 +321,7 @@
print "warning: no color palette found!\n"
RET:
- .pcc_begin_return
- .return palette
- .pcc_end_return
+ .return (palette)
.end
=item palette = app."genPalette"() B<(internal)>
@@ -383,9 +377,7 @@
add $I0, tPalette
setattribute self, $I0, palette
- .pcc_begin_return
- .return palette
- .pcc_end_return
+ .return (palette)
.end
=item board = self."board"( boardID )
@@ -428,9 +420,7 @@
unless $I0 goto ERR
END:
- .pcc_begin_return
- .return board
- .pcc_end_return
+ .return (board)
.end
=item block = app."currentBlock"( boardID )
@@ -458,9 +448,7 @@
temp = temp."currentBlock"()
BLOCKISNULL:
- .pcc_begin_return
- .return temp
- .pcc_end_return
+ .return (temp)
.end
=item success = app."rotate"( boardID, dir )
@@ -509,9 +497,7 @@
END:
self."enableTimer"()
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=item success = app."move"( boardID, xval, yval )
@@ -567,9 +553,7 @@
# reenable the timer
self."enableTimer"()
- .pcc_begin_return
- .return success
- .pcc_end_return
+ .return (success)
.end
=item block = self."nextBlock"( boardID, id )
@@ -619,9 +603,7 @@
temp = temp."nextBlock"(id )
APP_NEXTBLOCK_END:
- .pcc_begin_return
- .return temp
- .pcc_end_return
+ .return (temp)
.end
=item app."fall"( boardID )
@@ -653,9 +635,7 @@
ret = 1
APP_FALL_END:
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=item falling = app."falling"( boardID )
@@ -686,9 +666,7 @@
ret = board."falling"()
APP_FALLING_END:
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=item interval = app."fallInterval"( boardID )
@@ -719,9 +697,7 @@
ret = board."fallInterval"()
APP_INTERVAL_END:
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=item nextfall = app."nextFallTime"( boardID )
@@ -751,9 +727,7 @@
ret = board."nextFallTime"()
APP_NEXTFALL_END:
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=item app."setNextFallTime"( boardID, val )
@@ -787,8 +761,7 @@
board."setNextFallTime"( val )
APP_SETFALL_END:
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item redrawn = app."timer"()
@@ -851,9 +824,7 @@
dec inTimer
END:
- .pcc_begin_return
- .return redraw
- .pcc_end_return
+ .return (redraw)
.end
=item app."drawScreen"( full )
@@ -960,8 +931,7 @@
branch LOOP
END:
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item (boards, count) = app."boards"()
@@ -983,10 +953,7 @@
count = boards
END:
- .pcc_begin_return
- .return boards
- .return count
- .pcc_end_return
+ .return (boards, count)
.end
=item app."registerBoard"( board, id ) B<(internal)>
@@ -1005,9 +972,7 @@
(boards, id) = self."boards"()
set boards[id], board
- .pcc_begin_return
- .return id
- .pcc_end_return
+ .return (id)
.end
=item value = app."flag"( name, value )
@@ -1049,9 +1014,7 @@
FLAG_GET:
set ret, flag[name]
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=item app."newGame"( boards )
@@ -1127,8 +1090,7 @@
self."enableTimer"()
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=back
Modified: trunk/examples/sdl/tetris/block.pir
==============================================================================
--- trunk/examples/sdl/tetris/block.pir (original)
+++ trunk/examples/sdl/tetris/block.pir Wed May 16 14:24:33 2007
@@ -104,9 +104,7 @@
setattribute self, id, board
# return the block
- .pcc_begin_return
- .return self
- .pcc_end_return
+ .return (self)
.end
=item block."fall"()
@@ -136,9 +134,7 @@
getattribute $P0, self, $I0
$I0 = $P0
- .pcc_begin_return
- .return $I0
- .pcc_end_return
+ .return ($I0)
.end
=item (xpos, ypos) = block."position"()
@@ -178,10 +174,7 @@
$I0 = xposdiffP
add xpos, $I0
- .pcc_begin_return
- .return xpos
- .return ypos
- .pcc_end_return
+ .return (xpos, ypos)
.end
=item success = block."rotate"( dir )
@@ -245,9 +238,7 @@
assign self, olddata
END:
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=item board = block."board"()
@@ -262,9 +253,7 @@
add $I0, Board
getattribute $P0, self, $I0
- .pcc_begin_return
- .return $P0
- .pcc_end_return
+ .return ($P0)
.end
=item block."setBoard"( board )
@@ -354,14 +343,10 @@
END:
- .pcc_begin_return
- .return 1
- .pcc_end_return
+ .return (1)
ERROR:
- .pcc_begin_return
- .return 0
- .pcc_end_return
+ .return (0)
.end
=item success = block."move"( xval, yval )
@@ -401,9 +386,7 @@
set xpos, xold
set ypos, yold
BLOCK_MOVE_DONE:
- .pcc_begin_return
- .return valid
- .pcc_end_return
+ .return (valid)
.end
=item block."draw"( surface, xshift, yshift, extent )
@@ -551,8 +534,7 @@
branch LOOPx
END:
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item redraw = block."timer"()
@@ -605,9 +587,7 @@
redraw = fall
NOFALL:
- .pcc_begin_return
- .return redraw
- .pcc_end_return
+ .return (redraw)
.end
=item success = block."moveDown"()
@@ -637,9 +617,7 @@
board."nextBlock"()
BLOCK_MOVEDOWN_OKAY:
- .pcc_begin_return
- .return okay
- .pcc_end_return
+ .return (okay)
.end
=item app = block."application"()
@@ -654,9 +632,7 @@
temp = self."board"()
temp = temp."application"()
- .pcc_begin_return
- .return temp
- .pcc_end_return
+ .return (temp)
.end
.sub setXPosition method
Modified: trunk/examples/sdl/tetris/blockdata.pir
==============================================================================
--- trunk/examples/sdl/tetris/blockdata.pir (original)
+++ trunk/examples/sdl/tetris/blockdata.pir Wed May 16 14:24:33 2007
@@ -94,9 +94,7 @@
if x >= size goto yLOOP
branch xLOOP
END:
- .pcc_begin_return
- .return olddata
- .pcc_end_return
+ .return (olddata)
.end
=item rows = blockdata."vfree"()
@@ -130,9 +128,7 @@
VFREE_END:
div i, size
END:
- .pcc_begin_return
- .return i
- .pcc_end_return
+ .return (i)
.end
=item columns = blockdata."hfree"()
@@ -201,9 +197,7 @@
HFREE_ERROR2:
inc free
HFREE_END:
- .pcc_begin_return
- .return free
- .pcc_end_return
+ .return (free)
.end
=item size = blockdata."size"()
@@ -224,9 +218,7 @@
sqrt $N0, $I0
$I0 = $N0
END:
- .pcc_begin_return
- .return $I0
- .pcc_end_return
+ .return ($I0)
.end
.sub __set_pmc method
@@ -248,9 +240,7 @@
$I0 = $P0
if index >= $I0 goto ERR
$I0 = $P0[index]
- .pcc_begin_return
- .return $I0
- .pcc_end_return
+ .return ($I0)
ERR:
print "index out of bounds ("
@@ -276,9 +266,7 @@
$I0 = $P0
if index >= $I0 goto ERR
$P0[index] = val
- .pcc_begin_return
- .return $I0
- .pcc_end_return
+ .return ($I0)
ERR:
print "index out of bounds ("
Modified: trunk/examples/sdl/tetris/blocks.pir
==============================================================================
--- trunk/examples/sdl/tetris/blocks.pir (original)
+++ trunk/examples/sdl/tetris/blocks.pir Wed May 16 14:24:33 2007
@@ -78,9 +78,7 @@
.end
.sub id method
- .pcc_begin_return
- .return 0
- .pcc_end_return
+ .return (0)
.end
.namespace ["Tetris::Block::1"]
@@ -105,9 +103,7 @@
.end
.sub id method
- .pcc_begin_return
- .return 1
- .pcc_end_return
+ .return (1)
.end
.namespace ["Tetris::Block::2"]
@@ -132,9 +128,7 @@
.end
.sub id method
- .pcc_begin_return
- .return 2
- .pcc_end_return
+ .return (2)
.end
.namespace ["Tetris::Block::3"]
@@ -159,9 +153,7 @@
.end
.sub id method
- .pcc_begin_return
- .return 3
- .pcc_end_return
+ .return (3)
.end
.namespace ["Tetris::Block::4"]
@@ -186,9 +178,7 @@
.end
.sub id method
- .pcc_begin_return
- .return 4
- .pcc_end_return
+ .return (4)
.end
.namespace ["Tetris::Block::5"]
@@ -213,9 +203,7 @@
.end
.sub id method
- .pcc_begin_return
- .return 5
- .pcc_end_return
+ .return (5)
.end
.namespace ["Tetris::Block::6"]
@@ -248,9 +236,7 @@
.end
.sub id method
- .pcc_begin_return
- .return 6
- .pcc_end_return
+ .return (6)
.end
=head1 AUTHOR
Modified: trunk/examples/sdl/tetris/board.pir
==============================================================================
--- trunk/examples/sdl/tetris/board.pir (original)
+++ trunk/examples/sdl/tetris/board.pir Wed May 16 14:24:33 2007
@@ -123,9 +123,8 @@
# make the first block active
self."nextBlock"()
-print "BUILD done\n"
- .pcc_begin_return
- .pcc_end_return
+ print "BUILD done\n"
+ .return ()
.end
=item block = board."application"()
@@ -139,9 +138,7 @@
getprop app, "app", self
- .pcc_begin_return
- .return app
- .pcc_end_return
+ .return (app)
.end
=item block = board."getNextBlock"()
@@ -157,9 +154,7 @@
getprop block, "nextblock", self
# return the block
- .pcc_begin_return
- .return block
- .pcc_end_return
+ .return (block)
.end
=item board."setNextBlock"( block )
@@ -177,8 +172,7 @@
setprop self, "nextblock", block
# return the block
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item board."setCurrentBlock"( block )
@@ -266,9 +260,7 @@
END:
# return the block
- .pcc_begin_return
- .return block
- .pcc_end_return
+ .return (block)
.end
=item board."fall"()
@@ -285,8 +277,7 @@
getprop block, "block", self
block."fall"()
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item falling = board."falling"()
@@ -303,9 +294,7 @@
getprop block, "block", self
ret = block."falling"()
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=item block = board."currentBlock"()
@@ -319,9 +308,7 @@
getprop block, "block", self
- .pcc_begin_return
- .return block
- .pcc_end_return
+ .return (block)
.end
=item size = board."blockSize"()
@@ -340,9 +327,7 @@
getprop temp, "blocksize", self
set i, temp
- .pcc_begin_return
- .return i
- .pcc_end_return
+ .return (i)
.end
=item offset = board."offset"( x, y )
@@ -377,9 +362,7 @@
mul offset, y
add offset, x
- .pcc_begin_return
- .return offset
- .pcc_end_return
+ .return (offset)
.end
=item board."tranlateBlockData"( block, data, color )
@@ -451,8 +434,7 @@
branch TRANS_LOOPx
TRANS_LOOPend:
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item board."lockBlock"( block )
@@ -480,8 +462,7 @@
inc value # make first id (0) blue
self."translateBlockData"( block, self, value )
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item board."removeLine"( line )
@@ -527,8 +508,7 @@
dec dst
branch ERASE
REMOVELINE_END:
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item lines = board."removeFullLines"()
@@ -582,9 +562,7 @@
sleep 10
print "Continuing...\n"
RFL_NOHITS:
- .pcc_begin_return
- .return hits
- .pcc_end_return
+ .return (hits)
.end
=item board."draw"( surface, full )
@@ -775,8 +753,7 @@
getprop temp, "nextblock", self
temp."draw"( surface, xp, yp, blocksize )
SKIP_NEXTBLOCK:
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item redraw = board."timer"()
@@ -797,9 +774,7 @@
unless $I0 goto END
redraw = block."timer"()
END:
- .pcc_begin_return
- .return redraw
- .pcc_end_return
+ .return (redraw)
.end
=item interval = board."fallInterval"()
@@ -816,9 +791,7 @@
getprop temp, "FallInterval", self
set ret, temp
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=item nexttime = board."nextFallTime"()
@@ -835,9 +808,7 @@
getprop temp, "NextFallTime", self
set ret, temp
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=item board."setNextFallTime"( val )
@@ -856,8 +827,7 @@
getprop temp, "NextFallTime", self
set temp, val
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item (xpos, ypos) = board."position"()
@@ -877,10 +847,7 @@
getprop temp, "ypos", self
set ypos, temp
- .pcc_begin_return
- .return xpos
- .return ypos
- .pcc_end_return
+ .return (xpos, ypos)
.end
=item board."setPosition"( xpos, ypos )
@@ -899,8 +866,7 @@
getprop temp, "ypos", self
set temp, ypos
- .pcc_begin_return
- .pcc_end_return
+ .return ()
.end
=item board."blockID"()
@@ -930,9 +896,7 @@
OK:
ret = blocks[id]
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
=back
Modified: trunk/examples/sdl/tetris/boarddata.pir
==============================================================================
--- trunk/examples/sdl/tetris/boarddata.pir (original)
+++ trunk/examples/sdl/tetris/boarddata.pir Wed May 16 14:24:33 2007
@@ -136,9 +136,7 @@
classoffset $I0, self, "Tetris::BoardData"
getattribute $P0, self, $I0
$I0 = $P0
- .pcc_begin_return
- .return $I0
- .pcc_end_return
+ .return ($I0)
.end
.sub __get_integer_keyed method
@@ -158,9 +156,7 @@
OK:
$I0 = $P0[$I0]
- .pcc_begin_return
- .return $I0
- .pcc_end_return
+ .return ($I0)
.end
.sub __set_integer_keyed method
@@ -199,9 +195,7 @@
add $I0, bWidth
getattribute $P0, self, $I0
$I0 = $P0
- .pcc_begin_return
- .return $I0
- .pcc_end_return
+ .return ($I0)
.end
=item height = data."height"()
@@ -215,9 +209,7 @@
add $I0, bHeight
getattribute $P0, self, $I0
$I0 = $P0
- .pcc_begin_return
- .return $I0
- .pcc_end_return
+ .return ($I0)
.end
=item (width, height) = data."dimensions"()
@@ -241,10 +233,7 @@
getattribute $P0, self, $I0
h = $P0
- .pcc_begin_return
- .return w
- .return h
- .pcc_end_return
+ .return (w, h)
.end
=back
Modified: trunk/examples/sdl/tetris/eventhandler.pir
==============================================================================
--- trunk/examples/sdl/tetris/eventhandler.pir (original)
+++ trunk/examples/sdl/tetris/eventhandler.pir Wed May 16 14:24:33 2007
@@ -32,9 +32,7 @@
classoffset $I0, self, "Tetris::EventHandler"
getattribute app, self, $I0
- .pcc_begin_return
- .return app
- .pcc_end_return
+ .return (app)
.end
.sub dispatch_event method
@@ -49,9 +47,7 @@
restore app
ret = I5
app."setTimer"( 1 )
- .pcc_begin_return
- .return ret
- .pcc_end_return
+ .return (ret)
.end
.sub nextBlock method