Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - breakbegin() execute breakable code http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 breakbegin()        Execute breakable code
------------------------------------------------------------------------------
 Declaration
   system.hdr

 Syntax
   proc breakbegin extern
   param value ptr(_BRKEXEC)    pFuncExec, ;
         value ptr(_BRKRECOVER) pFuncRecover

 Arguments
   pFuncExec is a pointer to a function to execute.
   pFuncRecover is a pointer to a recovery function.

 Return
   None.

 Description
   The breakbegin() function installs and executes breakable code.
   The procedure saves the address from where execution must resume after a
   break, and the address of an optional recovery function. The recovery
   function is called before execution resumes with the code following
   breakbegin(). If there is no recovery procedure, a null pointer must be
   passed.

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   proc Counter static
   param value uint iMax
   vardef
      uint i
   enddef
   ? "Counter 1..." + istr( iMax )
   for i := 1 to iMax
      ? i
      if i == 2
         ? "Doing the break..."
         breakout( 1234567890 )
      endif
   next
   endproc
   
   proc Test static
   Counter( 20 )
   endproc
   
   proc SoftRecov static
   param value ulong nInfo
   ? "I'm the 'Soft recoverer', nInfo is:", nInfo
   endproc
   
   proc HardRecov static
   param value ulong nInfo
   ? "I'm the 'Hard recoverer', nInfo is:", nInfo
   ? "Executing quit NOW..."
   ?
   quit
   endproc
   
   proc Test_breakbegin
   clear
   ? "Executing 'breakable code' with a 'soft' recover procedure..."
   breakbegin( &Test, &SoftRecov )
   ? "After 1st breakbegin()"
   ?
   ? "Executing 'breakable code' with no recover procedure..."
   breakbegin( &Test, 0 )
   ? "After 2nd breakbegin()"
   ?
   ? "Executing 'breakable code' with a 'hard' recover procedure..."
   breakbegin( &Test, &HardRecov )
   ? "After 3rd breakbegin()"
   ?
   endproc

   proc main
   Test_breakbegin()
   endproc

See Also: breakout()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson