home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 17.6 Pushdbf() / Popdbf()
- Author: Joe Booth
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- //───── NOTE: must compile with the /N option!
-
- STATIC dbfstack_ :={}
-
- function Pushdbf( cAlias )
- if cAlias <> NIL
- select select(cAlias)
- endif
- aadd(dbfstack_, Dbfarray() )
- return NIL
-
-
- function popdbf( nCount )
- LOCAL i, nWork:=0, nOrder:=0, nRec:=0, cFilter:=""
- LOCAL nSize := len(dbfstack_)
- nCount := if(nCount=NIL,1,nCount)
- for i = 1 to nCount
- nWork := dbfstack_[nSize,1]
- nOrder := dbfstack_[nSize,2]
- nRec := dbfstack_[nSize,3]
- cFilter := dbfstack_[nSize,4]
- if !empty(nWork)
- select (nWork)
- set order to (nOrder)
- goto nRec
- if !empty(cFilter)
- dbsetfilter(cFilter)
- endif
- endif
- Asize(dbfstack_,nSize-1)
- nSize --
- next
- return NIL
-
- function DbfArray
- LOCAL s_:={}
- Aadd( s_,select() ) // Save work area number
- Aadd( s_,indexord() ) // Controlling index number
- Aadd( s_,recno() ) // Current record number
- Aadd( s_,dbfilter() ) // Filter condition
- return s_
-
- // end of file CHP1706.PRG
-