home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / inc&ad2.0 / includes / dos / dosasl.i < prev    next >
Text File  |  1992-09-01  |  4KB  |  132 lines

  1.     IFND DOS_DOSASL_I
  2. DOS_DOSASL_I    SET    1
  3. **
  4. **    $Filename: dos/dosasl.i $
  5. **    $Release: 2.04 Includes, V37.4 $
  6. **    $Revision: 36.19 $
  7. **    $Date: 91/05/02 $
  8. **
  9. **    pattern-matching structure definitions
  10. **
  11. **    (C) Copyright 1989-1991 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. **
  14.  
  15.     IFND EXEC_LIBRARIES_I
  16.     INCLUDE "exec/libraries.i"
  17.     ENDC
  18.  
  19.     IFND EXEC_LISTS_I
  20.     INCLUDE "exec/lists.i"
  21.     ENDC
  22.  
  23.     IFND DOS_DOS_I
  24.     INCLUDE "dos/dos.i"
  25.     ENDC
  26.  
  27. ************************************************************************
  28. ************************ PATTERN MATCHING ******************************
  29. ************************************************************************
  30.  
  31. * structure expected by MatchFirst, MatchNext.
  32. * Allocate this structure and initialize it as follows:
  33. *
  34. * Set ap_BreakBits to the signal bits (CDEF) that you want to take a
  35. * break on, or NULL, if you don't want to convenience the user.
  36. *
  37. * If you want to have the FULL PATH NAME of the files you found,
  38. * allocate a buffer at the END of this structure, and put the size of
  39. * it into ap_Strlen.  If you don't want the full path name, make sure
  40. * you set ap_Strlen to zero.  In this case, the name of the file, and stats
  41. * are available in the ap_Info, as per usual.
  42. *
  43. * Then call MatchFirst() and then afterwards, MatchNext() with this structure.
  44. * You should check the return value each time (see below) and take the
  45. * appropriate action, ultimately calling MatchEnd() when there are
  46. * no more files and you are done.  You can tell when you are done by
  47. * checking for the normal AmigaDOS return code ERROR_NO_MORE_ENTRIES.
  48. *
  49.  
  50.     STRUCTURE AnchorPath,0
  51.         LABEL    ap_First
  52.         CPTR    ap_Base    ; pointer to first anchor
  53.         LABEL    ap_Current
  54.         CPTR    ap_Last    ; pointer to last anchor
  55.         LONG    ap_BreakBits    ; Bits we want to break on
  56.         LONG    ap_FoundBreak    ; Bits we broke on. Also returns ERROR_BREAK
  57.         LABEL    ap_Length    ; Old compatability for LONGWORD ap_Length
  58.         BYTE    ap_Flags    ; New use for extra word.
  59.         BYTE    ap_Reserved
  60.         WORD    ap_Strlen    ; This is what ap_Length used to be
  61.         STRUCT    ap_Info,fib_SIZEOF    ; FileInfoBlock
  62.         LABEL    ap_Buf        ; Buffer for path name, allocated by user
  63.         LABEL    ap_SIZEOF
  64.  
  65.  
  66.     BITDEF    AP,DOWILD,0        ; User option ALL
  67.     BITDEF    AP,ITSWILD,1        ; Set by MatchFirst, used by MatchNext
  68.                     ; Application can test APB_ITSWILD,
  69.                     ; too (means that there's a wildcard
  70.                     ; in the pattern after calling
  71.                     ; MatchFirst).
  72.     BITDEF    AP,DODIR,2        ; Bit is SET if a DIR node should be
  73.                     ; entered. Application can RESET this
  74.                     ; bit after MatchFirst/MatchNext to
  75.                     ; AVOID entering a dir.
  76.     BITDEF    AP,DIDDIR,3        ; Bit is SET for an "expired" dir node.
  77.     BITDEF    AP,NOMEMERR,4        ; Set on memory error
  78.     BITDEF    AP,DODOT,5        ; If set, allow conversion of '.' to
  79.                     ; CurrentDir
  80.     BITDEF    AP,DirChanged,6        ; ap_Current->an_Lock changed
  81.                     ; since last MatchNext call
  82.  
  83.     BITDEF    AP,FollowHLinks,7      ; follow hardlinks on DODIR - defaults
  84.                        ; to not following hardlinks on a DODIR.
  85.  
  86.     STRUCTURE    AChain,0
  87.         CPTR    an_Child
  88.         CPTR    an_Parent
  89.         LONG    an_Lock
  90.         STRUCT    an_Info,fib_SIZEOF    ; FileInfoBlock
  91.         BYTE    an_Flags
  92.         LABEL    an_String
  93.         LABEL    an_SIZEOF
  94.  
  95.     BITDEF    DD,PatternBit,0
  96.     BITDEF    DD,ExaminedBit,1
  97.     BITDEF    DD,Completed,2
  98.     BITDEF    DD,AllBit,3
  99.     BITDEF    DD,SINGLE,4
  100.  
  101. * Constants used by wildcard routines, these are the pre-parsed tokens
  102. * referred to by pattern match.  It is not necessary for you to do
  103. * anything about these, MatchFirst() MatchNext() handle all these for you.
  104.  
  105. P_ANY        EQU    $80    ; Token for '*' or '#?
  106. P_SINGLE    EQU    $81    ; Token for '?'
  107. P_ORSTART    EQU    $82    ; Token for '('
  108. P_ORNEXT    EQU    $83    ; Token for '|'
  109. P_OREND    EQU    $84    ; Token for ')'
  110. P_NOT        EQU    $85    ; Token for '~'
  111. P_NOTEND    EQU    $86    ; Token for
  112. P_NOTCLASS    EQU    $87    ; Token for '^'
  113. P_CLASS    EQU    $88    ; Token for '[]'
  114. P_REPBEG    EQU    $89    ; Token for '['
  115. P_REPEND    EQU    $8A    ; Token for ']'
  116. P_STOP        EQU    $8B    ; token to force end of evaluation
  117.  
  118. * Values for an_Status, NOTE: These are the actual bit numbers
  119.  
  120. COMPLEX_BIT    EQU    1    ; Parsing complex pattern
  121. EXAMINE_BIT    EQU    2    ; Searching directory
  122.  
  123. * Returns from MatchFirst(), MatchNext()
  124. * You can also get dos error returns, such as ERROR_NO_MORE_ENTRIES,
  125. * these are in the dos.h file.
  126. *
  127. ERROR_BUFFER_OVERFLOW    EQU    303    ; User or internal buffer overflow
  128. ERROR_BREAK        EQU    304    ; A break character was received
  129. ERROR_NOT_EXECUTABLE    EQU    305    ; A file has E bit cleared
  130.  
  131.     ENDC    ; DOS_DOSASL_I
  132.