'**** HEADER ************************************************************
'EXFILE01.PF3 (release .02)
'Copyright (c) 1990-1991 Applied Resource Technologies, Inc.
'P.O. Box 64381, Dallas, Texas 75206 U.S.A. (214) 855-0449
'Description: Demonstrates vlibif() and vunlibif()
'**** FUNCTION DECLARATIONS *********************************************
'library
external progress() progtag() vlibif() vunlibif()
'core
'**** VARIABLE DECLARATIONS *********************************************
'library
public currlib lpath psa
'core
'**** CODE **************************************************************

local i f liblist

lpath = "\smartii\poptools\lib\"
load lpath|"displib.psl" in-memory      ' release .02
load lpath|"filelib.psl" in-memory      ' release .02

progress(0,15,"Loading function library",1)

liblist = getfnames(lpath|"*.psl",1)
i=1
while TRUE
     f = group(liblist,i)
     if f=NULL
          exit while
     end if
     milli-wait 500
     progtag(15,0,f)
     vlibif(lpath|f,"f")
     i=i+1
end while

screen shortrestore psa

beep
progress(15,0,"Press any key to unload all libraries",0)
inchar

screen shortrestore psa
progress(0,15,"Unloading function library",1)

i = 1
while TRUE
     f = group(currlib,i)
     if f=NULL
          exit while
     end if
     if f <> "filelib.psl" and f <> "displib.psl"      'skip display &
          milli-wait 500
          progtag(15,0,f)                              'file lib
          vunlibif(f)
     else
          i=i+1                                        ' jump over names
     end if                                            ' displib & filelib
end while

vunlibif("displib.psl")
vunlibif("filelib.psl")

screen shortrestore psa

beep
message "All functions unloaded - press any key"
