Forth Lesson 15/Example/Scope

From OLPC

Jump to: navigation, search

An example of how to use the scope keys.

scan-wifi calls scan-subtree, which calls wifi-children for each device node.

: wifi-children 
   " device_type" get-property if
      exit 
   then
   get-encoded-string 
   " wireless-network" $= if
      " scan-wifi" method-name 2!            \ fda31c70 
      do-method? 
   then
;

Our goal is to step into the code inside the second if.

ok debug wifi-children
ok scan-wifi
  • first pass, the cursor will be on the first word, so step to the exit and press < to constrain the scope, then space to exit the definition,
  • second pass, the cursor will be on the get-encoded-string, so step to the second if and press < again to constrain the scope, then space until the definition exits,
  • third pass, the cursor will be on the ;, so press ) to constrain the end of the scope, then space to exit the definition.

On the fourth pass, the cursor will be on " scan-wifi" as desired.

Personal tools
  • Log in
  • Login with OpenID
About OLPC
About the laptop
About the tablet
Projects
OLPC wiki
Toolbox