home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / wimpforth_2 / !WimpForth / assert < prev    next >
Encoding:
Text File  |  1995-12-29  |  822 b   |  36 lines

  1. \ $ld: assert.f 1.1  1994/07/12 15:45:00 andrew Exp $
  2.  
  3. cr .( Loading the Assert wordset...)
  4.  
  5. 0 value assert?
  6.  
  7. : ASSERT(       ( -<words>- )
  8.                 assert? 0=
  9.                 if      postpone (
  10.                 then    ; immediate
  11.  
  12. : ?assert       ( flag nfa -- )
  13.                 swap
  14.                 if      drop
  15.                 else    cr ." Assertion failed in " nfa-count type
  16.                         cr ." Enter to continue, ESC to abort"
  17.                         key 0x1B = if abort then cr
  18.                 then    ;
  19.  
  20. : )             ( -- )
  21.                 ?comp
  22.                 last @ postpone literal
  23.                 postpone ?assert ; immediate
  24.  
  25. \s
  26.  
  27. true to assert?
  28.  
  29. : atest         ( -- )
  30.                 10 0
  31.                 do      i .
  32.                         assert( i 5 < )
  33.                 loop    ;
  34.  
  35.  
  36.