home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / os-include / dos / dosasl.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  5KB  |  154 lines

  1. #ifndef DOS_DOSASL_H
  2. #define DOS_DOSASL_H
  3. /*
  4. **
  5. **    $VER: dosasl.h 36.16 (2.5.91)
  6. **    Includes Release 40.15
  7. **
  8. **    Pattern-matching structure definitions
  9. **
  10. **    (C) Copyright 1989-1993 Commodore-Amiga, Inc.
  11. **        All Rights Reserved
  12. **
  13. */
  14.  
  15. #ifndef EXEC_LIBRARIES_H
  16. #include <exec/libraries.h>
  17. #endif
  18.  
  19. #ifndef EXEC_LISTS_H
  20. #include <exec/lists.h>
  21. #endif
  22.  
  23. #ifndef DOS_DOS_H
  24. #include <dos/dos.h>
  25. #endif
  26.  
  27.  
  28. /***********************************************************************
  29. ************************ PATTERN MATCHING ******************************
  30. ************************************************************************
  31.  
  32. * structure expected by MatchFirst, MatchNext.
  33. * Allocate this structure and initialize it as follows:
  34. *
  35. * Set ap_BreakBits to the signal bits (CDEF) that you want to take a
  36. * break on, or NULL, if you don't want to convenience the user.
  37. *
  38. * If you want to have the FULL PATH NAME of the files you found,
  39. * allocate a buffer at the END of this structure, and put the size of
  40. * it into ap_Strlen.  If you don't want the full path name, make sure
  41. * you set ap_Strlen to zero.  In this case, the name of the file, and stats
  42. * are available in the ap_Info, as per usual.
  43. *
  44. * Then call MatchFirst() and then afterwards, MatchNext() with this structure.
  45. * You should check the return value each time (see below) and take the
  46. * appropriate action, ultimately calling MatchEnd() when there are
  47. * no more files and you are done.  You can tell when you are done by
  48. * checking for the normal AmigaDOS return code ERROR_NO_MORE_ENTRIES.
  49. *
  50. */
  51.  
  52. struct AnchorPath {
  53.     struct AChain    *ap_Base;    /* pointer to first anchor */
  54. #define    ap_First ap_Base
  55.     struct AChain    *ap_Last;    /* pointer to last anchor */
  56. #define ap_Current ap_Last
  57.     LONG    ap_BreakBits;    /* Bits we want to break on */
  58.     LONG    ap_FoundBreak;    /* Bits we broke on. Also returns ERROR_BREAK */
  59.     BYTE    ap_Flags;    /* New use for extra word. */
  60.     BYTE    ap_Reserved;
  61.     WORD    ap_Strlen;    /* This is what ap_Length used to be */
  62. #define    ap_Length ap_Flags    /* Old compatability for LONGWORD ap_Length */
  63.     struct    FileInfoBlock ap_Info;
  64.     UBYTE    ap_Buf[1];    /* Buffer for path name, allocated by user */
  65.     /* FIX! */
  66. };
  67.  
  68.  
  69. #define    APB_DOWILD    0    /* User option ALL */
  70. #define APF_DOWILD    1
  71.  
  72. #define    APB_ITSWILD    1    /* Set by MatchFirst, used by MatchNext     */
  73. #define APF_ITSWILD    2    /* Application can test APB_ITSWILD, too */
  74.                 /* (means that there's a wildcard     */
  75.                 /* in the pattern after calling         */
  76.                 /* MatchFirst).                 */
  77.  
  78. #define    APB_DODIR    2    /* Bit is SET if a DIR node should be */
  79. #define APF_DODIR    4    /* entered. Application can RESET this */
  80.                 /* bit after MatchFirst/MatchNext to AVOID */
  81.                 /* entering a dir. */
  82.  
  83. #define    APB_DIDDIR    3    /* Bit is SET for an "expired" dir node. */
  84. #define APF_DIDDIR    8
  85.  
  86. #define    APB_NOMEMERR    4    /* Set on memory error */
  87. #define APF_NOMEMERR    16
  88.  
  89. #define    APB_DODOT    5    /* If set, allow conversion of '.' to */
  90. #define APF_DODOT    32    /* CurrentDir */
  91.  
  92. #define APB_DirChanged    6    /* ap_Current->an_Lock changed */
  93. #define APF_DirChanged    64    /* since last MatchNext call */
  94.  
  95. #define APB_FollowHLinks 7    /* follow hardlinks on DODIR - defaults   */
  96. #define APF_FollowHLinks 128    /* to not following hardlinks on a DODIR. */
  97.  
  98.  
  99. struct AChain {
  100.     struct AChain *an_Child;
  101.     struct AChain *an_Parent;
  102.     BPTR    an_Lock;
  103.     struct FileInfoBlock an_Info;
  104.     BYTE    an_Flags;
  105.     UBYTE    an_String[1];    /* FIX!! */
  106. };
  107.  
  108. #define    DDB_PatternBit    0
  109. #define    DDF_PatternBit    1
  110. #define    DDB_ExaminedBit    1
  111. #define    DDF_ExaminedBit    2
  112. #define    DDB_Completed    2
  113. #define    DDF_Completed    4
  114. #define    DDB_AllBit    3
  115. #define    DDF_AllBit    8
  116. #define    DDB_Single    4
  117. #define    DDF_Single    16
  118.  
  119. /*
  120.  * Constants used by wildcard routines, these are the pre-parsed tokens
  121.  * referred to by pattern match.  It is not necessary for you to do
  122.  * anything about these, MatchFirst() MatchNext() handle all these for you.
  123.  */
  124.  
  125. #define P_ANY        0x80    /* Token for '*' or '#?  */
  126. #define P_SINGLE    0x81    /* Token for '?' */
  127. #define P_ORSTART    0x82    /* Token for '(' */
  128. #define P_ORNEXT    0x83    /* Token for '|' */
  129. #define P_OREND    0x84    /* Token for ')' */
  130. #define P_NOT        0x85    /* Token for '~' */
  131. #define P_NOTEND    0x86    /* Token for */
  132. #define P_NOTCLASS    0x87    /* Token for '^' */
  133. #define P_CLASS    0x88    /* Token for '[]' */
  134. #define P_REPBEG    0x89    /* Token for '[' */
  135. #define P_REPEND    0x8A    /* Token for ']' */
  136. #define P_STOP        0x8B    /* token to force end of evaluation */
  137.  
  138. /* Values for an_Status, NOTE: These are the actual bit numbers */
  139.  
  140. #define COMPLEX_BIT    1    /* Parsing complex pattern */
  141. #define EXAMINE_BIT    2    /* Searching directory */
  142.  
  143. /*
  144.  * Returns from MatchFirst(), MatchNext()
  145.  * You can also get dos error returns, such as ERROR_NO_MORE_ENTRIES,
  146.  * these are in the dos.h file.
  147.  */
  148.  
  149. #define ERROR_BUFFER_OVERFLOW    303    /* User or internal buffer overflow */
  150. #define ERROR_BREAK        304    /* A break character was received */
  151. #define ERROR_NOT_EXECUTABLE    305    /* A file has E bit cleared */
  152.  
  153. #endif /* DOS_DOSASL_H */
  154.