home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / MISC / FPC355_3.ZIP / FPCHLP.ZIP / SAVEREST.HLP < prev    next >
Encoding:
Text File  |  1989-05-10  |  2.1 KB  |  62 lines

  1. \ SAVEREST.HLP  Save and restore words for variables or values.
  2.  
  3.         These words allow you to quickly save the contents of a
  4.         variable of value on the return stack, and set it to some other
  5.         value temporarily with SAVE!>.  The previous contents may then
  6.         be restored with RESTORE>.
  7.  
  8.         Here is an example, first the old way:
  9.  
  10.                 VARIABLE MYSTUFF
  11.  
  12.                 : DEF   ( --- )
  13.                         32 MYSTUFF DUP @ >R !
  14.                         ... Do something with the new MYSTUFF ...
  15.                         R> MYSTUFF ! ;
  16.  
  17.         Here is an example of how to use SAVE!> and RESTORE>:
  18.  
  19.                 : DEF   ( --- )
  20.                         32 SAVE!> MYSTUFF
  21.                         ... Do something with the new MYSTUFF ...
  22.                         RESTORE> MYSTUFF ;
  23.  
  24. %SAVE!>         ( n1 --- )
  25.         Save the BODY contents of the following definition on the return
  26.         stack and set its BODY to n1.
  27.  
  28. %SAVE>          ( --- )
  29.         Save the BODY contents of the following definition on the return
  30.         stack.
  31.  
  32. %RESTORE>       ( --- )
  33.         Restore the BODY of the following definition from the return stack.
  34.  
  35. %USAVE!>        ( n1 --- )
  36.         Save the USER data area for the following definition on the return
  37.         stack and set it to n1.
  38.  
  39. %USAVE>         ( --- )
  40.         Save the USER data area for the following definition on the return
  41.         stack.
  42.  
  43. %URESTORE>      ( --- )
  44.         Restore the USER data area of the following definition from the
  45.         return stack.
  46.  
  47. ?COMP           ( --- )
  48.         Abort if we are not in compiling.
  49.  
  50. SAVE!>          ( n1 | <name> --- )
  51.         Leaves value in <name> on return stack and sets body of <name> to
  52.         n1, the equivalent of "VARIABLE-NAME DUP @ >R !".
  53.  
  54. SAVE>           ( | <name> --- )
  55.         Saves value in <name> body on the return stack. Equivelant to
  56.         "VARIABLE-NAME @ >R" but faster
  57.  
  58. RESTORE>        ( | <name> --- )
  59.         Restore body of <name> from the return stack. Equivelant to
  60.         "R> VARIABLE-NAME !" but faster.
  61.  
  62.