home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14830 < prev    next >
Encoding:
Text File  |  1992-09-01  |  4.2 KB  |  128 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!snorkelwacker.mit.edu!world!aep
  3. From: aep@world.std.com (Andrew E Page)
  4. Subject: Directory Scan Revisited
  5. Message-ID: <BtwK89.oI@world.std.com>
  6. Organization: The World Public Access UNIX, Brookline, MA
  7. Date: Tue, 1 Sep 1992 14:00:08 GMT
  8. Lines: 118
  9.  
  10.  
  11.     I'm just about finished with the code for the directory scan code.  I've
  12. incorporated some recomenedations from Apple, and I am in the process of
  13. commenting the code heavily.  
  14.  
  15.    However, here is the interface file.  Comments and suggestestions are
  16. welcome.  
  17.  
  18. --------CUT HERE------------------------------------------------CUT HERE------
  19. #ifndef __DIRSCAN__
  20. #define __DIRSCAN__
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24.  
  25. Ptr StartDirScanDirID(short volRef, long dirID, int numTypes, OSType *TypeList, pascal Boolean (*filter)(FileParam *f)) ;
  26. /*
  27. *    StartDirScanDirID starts the directory scan, using a WDVRefNum.  
  28. *    It will return 0L if the call failed or a pointer to be used
  29. *    in subsequent calls.  
  30. *
  31. *
  32. *     volRef    true volume reference where scan is to start.
  33. *
  34. *            dirID            directory on volume where scan is to start.    
  35. *
  36. *     numTypes  Number of types to limit scan too.
  37. *               -1 indicates to scan all types.  
  38. *
  39. *     typeList  Array of OSTypes with numTypes elements.  
  40. *               Pass 0L if numTypes is -1
  41. *
  42. *     filter    Filter proc of the variety used by SFGetFile.  
  43. *               Pass 0L for no filtering.                 
  44. *
  45. *               pascal Boolean MyFilter(fileParamPtr *f) ;
  46. *                  MyFilter returns TRUE if file is to be excluded.
  47. *                    or FALSE if it isn't.   
  48. */
  49.  
  50. Ptr StartDirScanWDVRef(short vRef, short *volRef, int numTypes, OSType *TypeList, pascal Boolean (*filter)(FileParam *f)) ;
  51. /*
  52. *    StartDirScanWDVRef starts the directory scan, using a WDVRefNum.  
  53. *    It will return 0L if the call failed or a pointer to be used
  54. *    in subsequent calls.  
  55. *
  56. *
  57. *     vRef      Volume/Directory where scan is to start.
  58. *
  59. *            volRef        pointer a short where the true volume reference
  60. *                                number is to be placed when call is complete.  
  61. *
  62. *     numTypes  Number of types to limit scan too.
  63. *               -1 indicates to scan all types.  
  64. *
  65. *     typeList  Array of OSTypes with numTypes elements.  
  66. *               Pass 0L if numTypes is -1
  67. *
  68. *     filter    Filter proc of the variety used by SFGetFile.  
  69. *               Pass 0L for no filtering.                 
  70. *
  71. *               pascal Boolean MyFilter(fileParamPtr *f) ;
  72. *                  MyFilter returns TRUE if file is to be excluded.
  73. *                    or FALSE if it isn't.   
  74. */
  75.  
  76.  
  77. OSErr GetNextDirScanFile(Ptr scanPtr, char *fName, long *dirID, long *level) ;
  78. /*
  79. *     Each call to GetNextScanFile will retreive the next file in the
  80. *      directory tree.  GetNextScanFile will return a fnfErr when the
  81. *      scan is completed.  
  82. *
  83. *
  84. *  scanPtr     Ptr returned from StartScan
  85. *
  86. *  fName       string space for returned file name  (recommended length 64)
  87. *
  88. *  dirID        Pointer to a long where dirID reference for 
  89. *              the directory that the file is in.   
  90. *
  91. *     level                Pointer to a long where the level at which the file was found
  92. *               (0 is the level where the scan started).  You can pass a 0L
  93. *               in place of pointer if the level is not of interest.  
  94. *                            
  95. */
  96.  
  97. OSErr StopDirScan(Ptr scanPtr) ;
  98. /*
  99. *    Terminates the scan started by Start scan.  
  100. *
  101. *     scanPtr    Ptr returned by StartScan.  
  102. *
  103. *     CAUTION... do not not attempt to use scanPtr again
  104. *                after this call.  
  105. *
  106. */
  107.  
  108.  
  109. /*
  110. *   Using information returned from GetNextScanFile this function
  111. * will return a 'full pathname' as a handle.  The handle is the
  112. * exact length of the string and is NOT preceded by a pascal length
  113. * byte or folled by a C null terminator.  
  114. *
  115. *   fName      Name of the file.  
  116. *
  117. *        vRef       True volume reference number.
  118. *
  119. *   dirID      directory ID that the file resides in.  
  120. */
  121. Handle FullPathNameID(char *fName, int vRef, long dirID) ;
  122.  
  123. #endif
  124. -- 
  125. Andrew E. Page CTO(Warrior Poet)|   Decision and Effort The Archer and Arrow
  126. DSP Ironworks                   |     The difference between what we are
  127. Macintosh and DSP Technology    |           and what we want to be.
  128.