# The architecture that seems to be crystallizing: the environment has two # areas: functions and sandbox. # # Rendering the environment requires rendering all areas. # Displaying the cursor requires displaying cursor for the area controlling the cursor. # Processing events for the environment requires processing events for the area controlling the cursor. # # Areas can have dialogs. # There can also be global dialogs (currently just one: goto function). # Areas are responsible for rendering their dialogs. # In practice this results in dialogs encapsulating the state they need to # decide whether to render. # # This will be useful if we add more areas in the future. type environment { screen: (handle screen) functions: (handle function) sandboxes: (handle sandbox) partial-function-name: (handle word) # at most one of these will be set cursor-function: (handle function) cursor-sandbox: (handle sandbox) # nrows: int ncols: int code-separator-col: int } fn initialize-environment _env: (addr environment) { var env/esi: (addr environment) <- copy _env # initialize some predefined function definitions var functions/eax: (addr handle function) <- get env, functions create-primitive-functions functions # initialize first sandbox var sandbox-ah/ecx: (addr handle sandbox) <- get env, sandboxes allocate sandbox-ah var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah initialize-sandbox sandbox # initialize cursor sandbox var cursor-sandbox-ah/eax: (addr handle sandbox) <- get env, cursor-sandbox copy-object sandbox-ah, cursor-sandbox-ah # initialize screen var screen-ah/eax: (addr handle screen) <- get env, screen var _screen/eax: (addr screen) <- lookup *screen-ah var screen/edi: (addr screen) <- copy _screen var nrows/eax: int <- copy 0 var ncols/ecx: int <- copy 0 nrows, ncols <- screen-size screen var dest/edx: (addr int) <- get env, nrows copy-to *dest, nrows dest <- get env, ncols copy-to *dest, ncols var repl-col/ecx: int <- copy ncols repl-col <- shift-right 1 dest <- get env, code-separator-col copy-to *dest, repl-col } fn initialize-environment-with-fake-screen _self: (addr environment), nrows: int, ncols: int { var self/esi: (addr environment) <- copy _self var screen-ah/eax: (addr handle screen) <- get self, screen allocate screen-ah var screen-addr/eax: (addr screen) <- lookup *screen-ah initialize-screen screen-addr, nrows, ncols initialize-environment self } ############# # Iterate ############# fn process _self: (addr environment), key: grapheme { var self/esi: (addr environment) <- copy _self var fn-name-ah/eax: (addr handle word) <- get self, partial-function-name var fn-name/eax: (addr word) <- lookup *fn-name-ah compare fn-name, 0 { break-if-= #? print-string 0, "processing goto fn\n" process-goto-dialog self, key return } var function-ah/eax: (addr handle function) <- get self, cursor-function var function/eax: (addr function) <- lookup *function-ah compare function, 0 { break-if-= #? print-string 0, "processing function\n" process-function self, function, key return } var sandbox-ah/eax: (addr handle sandbox) <- get self, cursor-sandbox var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah compare sandbox, 0 { break-if-= #? print-string 0, "processing sandbox\n" process-sandbox self, sandbox, key return } } # collect new name in partial-function-name, and move the cursor to function with that name fn process-goto-dialog _self: (addr environment), key: grapheme { var self/esi: (addr environment) <- copy _self var fn-name-ah/edi: (addr handle word) <- get self, partial-function-name # if 'esc' pressed, cancel goto compare key, 0x1b/esc $process-goto-dialog:cancel: { break-if-!= clear-object fn-name-ah return } # if 'enter' pressed, location function and set cursor to it compare key, 0xa/enter $process-goto-dialog:commit: { break-if-!= #? print-string 0, "jump\n" var fn-name/eax: (addr word) <- lookup *fn-name-ah var functions/ecx: (addr handle function) <- get self, functions var dest/edx: (addr handle function) <- get self, cursor-function callee functions, fn-name, dest # we won
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module ranger.ext.relpath</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="ranger.html"><font color="#ffffff">ranger</font></a>.<a href="ranger.ext.html"><font color="#ffffff">ext</font></a>.relpath</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/work/ranger/ranger/ext/relpath.py">/home/hut/work/ranger/ranger/ext/relpath.py</a></font></td></tr></table>
<p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="ranger.html">ranger</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-relpath"><strong>relpath</strong></a>(*paths)</dt><dd><tt>returns the path relative to rangers library directory</tt></dd></dl>
<dl><dt><a name="-relpath_conf"><strong>relpath_conf</strong></a>(*paths)</dt><dd><tt>returns the path relative to rangers configuration directory</tt></dd></dl>
</td></tr></table>
</body></html>