summary refs log tree commit diff stats
path: root/test/tc_direction.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-11-22 02:06:46 +0100
committerhut <hut@lavabit.com>2010-11-22 02:38:11 +0100
commit0940c18905ede976d576150f235e378fe8c4c8b5 (patch)
treed273eef518f2b80e9168038de8045d1c4d187e6a /test/tc_direction.py
parentffa2e9a0a763f8a284925edf52022e966c57fce3 (diff)
downloadranger-0940c18905ede976d576150f235e378fe8c4c8b5.tar.gz
ext.signals: fixed memory leak
Signal handlers with dead weak references are only cleaned up
when using signal_emit.  If no signals are emitted, dead signal
handlers will accumulate.  This is avoided by adding the function
signal_garbage_collect() and calling it in env.garbage_collect()
Diffstat (limited to 'test/tc_direction.py')
0 files changed, 0 insertions, 0 deletions
*/ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# Primitives for screen control.
#
# We need to do this in machine code because Mu doesn't have global variables
# yet (for the start of video memory).

== code

pixel-on-real-screen:  # x: int, y: int, color: int
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    (pixel-on-screen-buffer *Video-memory-addr *(ebp+8) *(ebp+0xc) *(ebp+0x10) 0x400 0x300)
$pixel-on-real-screen:end:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

# 'buffer' here is not a valid Mu type: a naked address without a length.
pixel-on-screen-buffer:  # buffer: (addr byte), x: int, y: int, color: int, width: int, height: int
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    50/push-eax
    51/push-ecx
    # bounds checks
    8b/-> *(ebp+0xc) 0/r32/eax  # foo
    3d/compare-eax-and 0/imm32
    7c/jump-if-< $pixel-on-screen-buffer:end/disp8
    3b/compare 0/r32/eax *(ebp+0x18)
    7d/jump-if->= $pixel-on-screen-buffer:end/disp8
    8b/-> *(ebp+0x10) 0/r32/eax
    3d/compare-eax-and 0/imm32
    7c/jump-if-< $pixel-on-screen-buffer:end/disp8
    3b/compare 0/r32/eax *(ebp+0x1c)
    7d/jump-if->= $pixel-on-screen-buffer:end/disp8
    # eax = y*width + x
    8b/-> *(ebp+0x10) 0/r32/eax
    0f af/multiply-> *(ebp+0x18) 0/r32/eax
    03/add-> *(ebp+0xc) 0/r32/eax
    # eax += location of frame buffer
    03/add-> *(ebp+8) 0/r32/eax
    # *eax = color
    8b/-> *(ebp+0x14) 1/r32/ecx
    88/byte<- *eax 1/r32/CL
$pixel-on-screen-buffer:end:
    # . restore registers
    59/pop-to-ecx
    58/pop-to-eax
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return