home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a013 / 1.ddi / SOURCE.EXE / F_GETS.PRG < prev    next >
Encoding:
Text File  |  1991-01-25  |  1.3 KB  |  51 lines

  1. *****************************************************************
  2. ** File = F_GETS.PRG  ** Functions: SAVEGETS, RESTGETS
  3. *****************************************************************
  4.  
  5. * Copyright(c) 1991 -- James Occhiogrosso
  6.  
  7. * Create static array for current GETS, counter for nesting count
  8. STATIC getstack := {}, counter := 0
  9.  
  10. *****************************************************************
  11. FUNCTION SAVEGETS     // Saves currently active GETS on getstack
  12. *****************************************************************
  13.  
  14. * Return with no action if getlist is undefined or empty
  15.  
  16. IF TYPE('getlist') = 'A' .AND. LEN(getlist) > 0
  17.  
  18.        * Add public getlist array to stack array (getstack)
  19.        AADD(getstack, getlist)
  20.  
  21.        * Increment stack counter
  22.        counter++
  23.  
  24.        * Clear current GETS and return
  25.        CLEAR GETS
  26.  
  27. ENDIF
  28.  
  29. RETURN NIL
  30.  
  31.  
  32. *****************************************************************
  33. FUNCTION RESTGETS
  34. *****************************************************************
  35.  
  36. * Restores and reactivates last set of pending GETS
  37.  
  38. IF counter > 0
  39.  
  40.    * Add of last set of GETS back to getlist array
  41.    getlist = getstack[counter--]
  42.  
  43.    * Resize internal stack
  44.    ASIZE(getstack, counter)
  45.  
  46. ENDIF
  47.  
  48. RETURN NIL
  49.  
  50.  
  51.