home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / p3_2bs.seq < prev    next >
Encoding:
Text File  |  1990-04-03  |  815 b   |  35 lines

  1. \ Comp 462
  2. \ Balraj Sidhu   Set: 14D4
  3. \ Date: April 3, 1990
  4. \ Problem 3.2
  5.  
  6.  
  7.  
  8. \ print double numbers on the stack
  9.  
  10. : .sd1 ( -- )
  11.         depth ?dup if
  12.                 0 ?do depth i - 1- pick
  13.                       depth i - 2- pick
  14.                       d. 8 emit                 \ back up one space
  15.                       ascii . emit              \ indicate double word
  16.                 2 +loop
  17.                 else ." Empty" then ;
  18.  
  19. \ print all single numbers on the stack
  20. : .ss ( -- )
  21.         depth ?dup if
  22.                 0 ?do depth i - 1- pick
  23.                       . 8 emit                 \ back up one space
  24.                 loop
  25.                 else ." Empty" then ;
  26.  
  27. : .sd ( -- )
  28.         depth 1 and if
  29.                 .ss
  30.         else
  31.                 .sd1
  32.         then ;
  33.  
  34.  
  35.