home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / GETS.PRG < prev    next >
Encoding:
Text File  |  1991-05-07  |  1.2 KB  |  54 lines

  1. /*
  2.    Program: GETS.PRG
  3.    System: GRUMPFISH LIBRARY
  4.    Author: Greg Lief
  5.    Copyright (c) 1988-90, Greg Lief
  6.    Clipper 5.x version
  7.    Compile instructions: clipper gets /n/w/a
  8.  
  9.    Functions: GFSaveGets(), GFRestGets()
  10.  
  11.    Save or restore current GETs
  12. */
  13.  
  14. //───── begin global declarations
  15.  
  16. #include "grump.ch"
  17.  
  18. static getstack_ := {}       // environmental stack
  19.  
  20. //───── end global declarations
  21.  
  22. /*
  23.        GFSaveGets(): save current gets and clear 'em out
  24. */
  25. function GFSaveGets()
  26. aadd(getstack_, m->getlist)
  27. m->getlist := {}
  28. return len(getstack_)
  29.  
  30. * end function GFSaveGets()
  31. *--------------------------------------------------------------------*
  32.  
  33.  
  34. /*
  35.        GFRestGets(): restore last-saved gets
  36. */
  37. function GFRestGets(ele)
  38. /* use LIFO (last item in array) if no parameter was passed */
  39. default ele to len(getstack_)
  40. /* preclude empty array */
  41. if len(getstack_) > 0 .and. ele <= len(getstack_)
  42.    m->getlist := getstack_[ele]
  43.    /* truncate length of array only if using LIFO, i.e., no param passed */
  44.    if ele == len(getstack_) .and. pcount() = 0
  45.       truncate(getstack_)
  46.    endif
  47. endif
  48. return NIL
  49.  
  50. * end function GFRestGets()
  51. *--------------------------------------------------------------------*
  52.  
  53. * eof gets.prg
  54.