Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : TREE1.ZIP
Filename : TREE.PRG

 
Output of file : TREE.PRG contained in archive : TREE1.ZIP
******************************************************************************
*
* SYSTEM........ N/A
* MODULE........ TREE
* AUTHOR........ Ruben Agosto, Jr.
* CIS#: 71610,602
* COPYRIGHT..... Copyright 1990 Ruben Agosto, Jr. All rights reserved
* DESCRIPTION... This module contains functions which fill a pair of
* arrays with a graphic directory tree and its corresponding
* paths.
* NOTICE........ This module may be used freely in your own programs. It
* may be copied and the copies may be modified to suit
* your needs. Unmodified versions may also be distributed
* freely. If you distribute modified versions, please note
* the modification in the history section below.
*
* HISTORY:
*
* Version Date Comment
* ------- -------- -------------------------------------------------------
* 1.0 08/15/90 Initial release by author
*
*
* FUNCTIONS:
*
* ATREE - Initializes and drives the tree building process
* ATREE_2 - Creates the individual branches of the directory tree
*
******************************************************************************
RETURN && cares for any DO TREE's that may exist in calling modules

FUNCTION ATREE
*
* Syntax : ATREE([,][,])
*
* Purpose : To fill a sieries of arrays with a graphical directory
* tree and its corresponding paths.
*
* Arguments: - Disk drive designation like "C:" for drive C
* - an array which will contain the graphical tree
* - an array which will contain corresponding paths
*
* Returns : A numeric value for the number of directories found
*
PARAMETER mdrive,adirectory,apath
DO CASE
CASE PCOUNT()=2
PRIVATE apath[200]
CASE PCOUNT()=1
PRIVATE adirectory[200],apath[200]
CASE PCOUNT()=0
RETURN(0)
ENDCASE
IF !FILE(mdrive+"\NUL")
RETURN(0)
ENDIF
PRIVATE msub,mfork,mbend,mtwig,mhole
adirectory[1]=mdrive+"\(ROOT)"
apath[1]=mdrive
msub=1
mfork=CHR(195)+CHR(196)
mbend=CHR(192)+CHR(196)
mtwig=CHR(179)+SPACE(1)
mhole=SPACE(2)
ATREE_2(mdrive,"",adirectory,apath,@msub)
RETURN(msub)

FUNCTION ATREE_2
*
* Syntax : ATREE_2(,,,,@)
*
* Purpose : Create individual directory tree branches
*
* Arguments: - Disk drive and path
* - Graphical branches to appear to the left of the
* branches to be constructed
* - The array which contains the graphical tree
* - The array which contains corresponding paths
* - The current element number of the tree array
* (passed by reference - @)
*
* Returns : Null
*
* Note : This function is recursive (calls itself) and is invoked
* by the ATREE function. Do not invoke it directly.
*
PARAMETERS mdir,mleftside,adirectory,apath,msub
PRIVATE fcount,dummy[1]
fcount=ADIR(mdir+"\*.*",.F.,.F.,.F.,.F.,dummy)
IF fcount>0
PRIVATE afile[fcount],aattr[fcount],i
ADIR(mdir+"\*.*",afile,.F.,.F.,.F.,aattr)
i=1
DO WHILE i<=fcount
IF "D"$aattr[i] .AND. !afile[i]$".."
i=i+1
ELSE
ADEL(afile,i)
ADEL(aattr,i)
fcount=fcount-1
ENDIF
ENDDO
FOR i=1 TO fcount
msub=msub+1
apath[msub]=mdir+"\"+afile[i]
IF i==fcount
adirectory[msub]=mleftside+mbend+afile[i]
ATREE_2(apath[msub],mleftside+mhole,adirectory,apath,@msub)
ELSE
adirectory[msub]=mleftside+mfork+afile[i]
ATREE_2(apath[msub],mleftside+mtwig,adirectory,apath,@msub)
ENDIF
NEXT
ENDIF
RETURN("")

*** END OF MODULE



  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : TREE1.ZIP
Filename : TREE.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/