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

  1. /*
  2.    Listing 9.9. A function which lists the contents of any array.
  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 DumpArray(a_, level)
  12. /*
  13.    List the contents of any array.
  14.    Listing is indented to show nesting of subarrays.
  15.    This function uses a recursive call to itself.
  16.    Do not specify the level parameter, it is used
  17.    internally during the recursive calls.
  18. */
  19. local i
  20.   if level = nil
  21.     level := 0
  22.   endif
  23.   for i := 1 to len(a_)
  24.     ? space(level *4) +str(i,4) +": "
  25.     if valtype(a_[i]) = "A"
  26.       ?? "{..}"
  27.       DumpArray(a_[i], level +1)
  28.     else
  29.       ?? a_[i]
  30.     endif
  31.   next i
  32. return nil
  33.  
  34. // end of file CHP0909.PRG
  35.