home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP09.EXE / CHP0907.PRG < prev    next >
Encoding:
Text File  |  1991-06-01  |  771 b   |  33 lines

  1. /*
  2.    Listing 9.7. A function which lists an array with variable structure.
  3.    Author: Craig Yellick
  4.    Excerpted from "Clipper 5: A Developer's Guide"
  5.    Copyright (c) 1991 M&T Books
  6.                       501 Galveston Drive
  7.                       Redwood City, CA 94063-4728
  8.                       (415) 366-3600
  9. */
  10.  
  11. function ListDir(dir_, level)
  12. /*
  13.    List the contents of an array containing a
  14.    directory structure. This function uses a
  15.    recursive call to itself.
  16. */
  17. local i
  18.   if level = nil
  19.     level := 0
  20.   endif
  21.   for i := 1 to len(dir_)
  22.     ? space(level *3)
  23.     if valtype(dir_[i]) = "A"
  24.       ?? dir_[i, 1]
  25.       ListDir(dir_[i, 2], level +1)
  26.     else
  27.       ?? dir_[i]
  28.     endif
  29.   next i
  30. return nil
  31.  
  32. // end of file CHP0907.PRG
  33.