	IFND	    LIBRARIES_SREGEXPBASE_I
LIBRARIES_SREGEXPBASE_I set	1

*********************************************************************
*								    *
* sregbase.i -- asm include file for sreg.library		    *
*								    *
* Copyright (C) 1991, Jon Spencer.                                  *
*								    *
* Created: April 20,1991					    *
*								    *
*********************************************************************

	IFND	    EXEC_TYPES_I
	INCLUDE     "exec/types.i"
	ENDC

	IFND	    EXEC_LISTS_I
	INCLUDE     "exec/lists.i"
	ENDC

	IFND	    EXEC_LIBRARIES_I
	INCLUDE     "exec/libraries.i"
	ENDC

	IFND	    LIBRARIES_DOS_I
	INCLUDE     "libraries/dos.i"
	ENDC



;
;
; Library base structure, all of these fields are private, and
; should not be accessed.
;
;

    STRUCTURE	SregExpBase,LIB_SIZE
    APTR	    sb_SysBase
    APTR	    sb_DOSBase
    ULONG	    sb_SegList
    LABEL	SregExpBase_SIZE



SREGEXPNAME	macro
		dc.b	    "sregexp.library",0
		endm

;
;
; Here are the equates for the structures used and returned by
; the various sreg functions.  They should probably not be
; accessed for there contents, unless you have really good
; reason...
;
;
    STRUCTURE	SregExp,0
    BYTE		    sre_Type
    BYTE		    sre_Flag
    SHORT		    sre_MinLen
    ULONG		    sre_Data
    APTR		    sre_List
    LABEL	SregExp_SIZE


; sre_Data is a union, here are its elements.
sre_onechar	 EQU	     sre_Data
sre_setchar	 EQU	     sre_Data
sre_string	 EQU	     sre_Data
sre_number	 EQU	     sre_Data


; This is an internal structure for a singly linked list of sregexp's

    STRUCTURE	SregList,0
    APTR		    srl_sreg
    APTR		    srl_next
    LABEL	SregList_SIZE


; various types of wildcard pattern elements.  Goes in spat_t.type

SRP_SETCHAR  EQU	     1
SRP_ANYCHAR  EQU	     2
SRP_ONECHAR  EQU	     3
SRP_STRING   EQU	     4
SRP_NULL     EQU	     5
SRP_OR	     EQU	     6
SRP_SUM      EQU	     7

; various flags to mark special properties of patterns.
; Goes in SregExp.sre_Flag

    BITDEF	SR,NOT,0
    BITDEF	SR,REPEAT,1
    BITDEF	SR,FIXLEN,2
    BITDEF	SR,JUSTDIRS,6
    BITDEF	SR,RECURSE,7

; equates for the wildcard characters

CHR_REPEAT	EQU	    '#'
CHR_NOT 	EQU	    '~'
CHR_OPENBRACE	EQU	    '('
CHR_CLOSEBRACE	EQU	    ')'
CHR_OPENSET	EQU	    '['
CHR_CLOSESET	EQU	    ']'
CHR_ANYCHAR	EQU	    '?'
CHR_NULL	EQU	    '%'
CHR_OR		EQU	    '|'
CHR_ESCAPE	EQU	    "'"
CHR_RANGE	EQU	    '-'
CHR_STAR	EQU	    '*'


;
; These are the structures used for the path matching routines.
;

    STRUCTURE	SpathInfo,0
    APTR		spi_Head
    APTR		spi_Tail
    APTR		spi_TailPred
    APTR		spi_SregList;
    LABEL	SpathInfo_SIZE


; Note: because of the fileinfoblock, this whole structure MUST
; be longword aligned.

    STRUCTURE	SpathNode,0
    APTR		spn_Succ
    APTR		spn_Pred
    STRUCT		spn_FIB,fib_SIZEOF
    BPTR		spn_Lock
    APTR		spn_SregList
    APTR		spn_NodeName
    SHORT		spn_Flags
    LABEL	SpathNode_SIZE

; flags used in spn_Flags, which is  really library private.

    BITDEF  SP,DECEND,0
    BITDEF  SP,DONEONCE,1
    BITDEF  SP,NEXTPARENT,2

; These are the possible error returns sent by NextFile and BuildPath

SPE_ALL_DONE	EQU	-1
SPE_ERROR	EQU	-2
SPE_BUFF_FULL	EQU	-3
SPE_SIGBREAK	EQU	-4


; Some defines for what kind of events we match to.

SP_DIRS_ONLY	EQU	1
SP_BOTH 	EQU	0
SP_FILES_ONLY	EQU	-1

	ENDC
