[comp.sources.amiga] v91i107: sregexp.library 9.4 - a library for regular expressions, Part01/02

amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator) (05/18/91)

Submitted-by: "J. Spencer" <bhgs@utcs.utoronto.ca>
Posting-number: Volume 91, Issue 107
Archive-name: libraries/sregexp-9.4/part01

[ includes uuencoded libraries  ...tad ]

'sregexp.library' is a run time library of routines for doing wildcard
pattern matching and wildcard path matching.  It accepts a slight extension
of the AmigaDOS wildcard syntax, including a not operator, and character
sets. It has routines to test if a string matches a wildcard expression,
and for scanning through all matches to a wildcarded AmigaDOS path.  There
are two nifty features to the path matching routines: '.../' means
recursively scan all subdirectories, and may come anywhere in the path; and
wildcards are allowed in the volume node part of the path! (DH?: would
match all your hard drive partitions.)

#!/bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 2)."
# Contents:  BUGS_TO COPYRIGHT.NOTICE OVERVIEW clibrary.asm
#   compilation.notes dmakefile instillation.notes kludge.asm
#   revision.history spath.c sreg_version.c sreg_version.i sregexp.fd
#   sregexp.h sregexp.uu sregexp_protos.h sregexpbase.h sregexpbase.i
#   sregexps.uu sregexpsr.uu utils utils/bumprev.c utils/remlib.c
#   utils/try.c
# Wrapped by tadguy@ab20 on Fri May 17 21:56:58 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'BUGS_TO' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'BUGS_TO'\"
else
echo shar: Extracting \"'BUGS_TO'\" \(94 characters\)
sed "s/^X//" >'BUGS_TO' <<'END_OF_FILE'
X
XSend bug reports, comments, etc. to
X
X    Jon Spencer.
X
X    EMail:	bhgs@gpu.utcs.utoronto.ca
X
END_OF_FILE
if test 94 -ne `wc -c <'BUGS_TO'`; then
    echo shar: \"'BUGS_TO'\" unpacked with wrong size!
fi
# end of 'BUGS_TO'
fi
if test -f 'COPYRIGHT.NOTICE' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'COPYRIGHT.NOTICE'\"
else
echo shar: Extracting \"'COPYRIGHT.NOTICE'\" \(1083 characters\)
sed "s/^X//" >'COPYRIGHT.NOTICE' <<'END_OF_FILE'
X
X    The library 'sregexp.library', and all sources and documentation
X    relating to it included in this distribution are Copyright (c) 1991, by
X    Jon Spencer.
X
X    Permission is given to redistribute any part or all of this
X    distribution, either modified or unmodified, PROVIDED THAT:
X	- the distribution is on a not-for-profit basis,
X	- this copyright notice is included in the distribution,
X	- and if a modified version is distributed, clear indication
X	  that it is modified is included.
X
X    All other rights are reserved by the author, Jon Spencer.
X
X
X(disclaimer borrowed, somewhat modified, from the DICE distribution)
X
X    PROGRAM DISCLAIMER: THE LIBRARY IS PROVIDED "AS IS" WITHOUT WARRANTY OF
X    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
X    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
X    PURPOSE.  THE ENTIRE RISK AS TO THE RESULTS AND PERFORMANCE OF ANY
X    PROGRAM IS ASSUMED BY YOU.	Should the program prove defective, you
X    assume the entire cost of all necessary servicing, repair, or
X    correction.
X
END_OF_FILE
if test 1083 -ne `wc -c <'COPYRIGHT.NOTICE'`; then
    echo shar: \"'COPYRIGHT.NOTICE'\" unpacked with wrong size!
fi
# end of 'COPYRIGHT.NOTICE'
fi
if test -f 'OVERVIEW' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'OVERVIEW'\"
else
echo shar: Extracting \"'OVERVIEW'\" \(622 characters\)
sed "s/^X//" >'OVERVIEW' <<'END_OF_FILE'
X
X'sregexp.library' is a run time library of routines for doing wildcard
Xpattern matching and wildcard path matching.  It accepts a slight extension
Xof the AmigaDOS wildcard syntax, including a not operator, and character
Xsets. It has routines to test if a string matches a wildcard expression,
Xand for scanning through all matches to a wildcarded AmigaDOS path.  There
Xare two nifty features to the path matching routines: '.../' means
Xrecursively scan all subdirectories, and may come anywhere in the path; and
Xwildcards are allowed in the volume node part of the path! (DH?: would
Xmatch all your hard drive partitions.)
END_OF_FILE
if test 622 -ne `wc -c <'OVERVIEW'`; then
    echo shar: \"'OVERVIEW'\" unpacked with wrong size!
fi
# end of 'OVERVIEW'
fi
if test -f 'clibrary.asm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'clibrary.asm'\"
else
echo shar: Extracting \"'clibrary.asm'\" \(11630 characters\)
sed "s/^X//" >'clibrary.asm' <<'END_OF_FILE'
X
X;**************************************************************************
X;*									  *
X;* sregexp.library -- pattern matching run time library.		  *
X;*									  *
X;*									  *
X;* Startup module: this is heavily copied from the sample.library	  *
X;* in the RKM includes and autodocs.					  *
X;* This also relies on some features of dice (in particular, registered   *
X;* args and features of the linker.)  Be carefull if you make it with	  *
X;* something else.							  *
X;*									  *
X;* Created: April 20, 1991						  *
X;*									  *
X;**************************************************************************
X
X		CODE	    sregexp.start
X
X		INCLUDE     "sregexpbase.i"
X		INCLUDE     "exec/initializers.i"
X		INCLUDE     "libraries/dos.i"
X		INCLUDE     "exec/resident.i"
X		INCLUDE     "exec/lists.i"
X		INCLUDE     "exec/alerts.i"
X		INCLUDE     "sreg_version.i"
X
X;--------------------------------------------------------------------
X; some generally usefull macros hiding _LVO's
X;--------------------------------------------------------------------
XCALLSYS 	macro
X		jsr	    _LVO\1(a6)
X		endm
X
XXLIB		macro
X		xref	    _LVO\1
X		endm
X
X;--------------------------------------------------------------------
X; Declare the library calls I use. The _LVO's are brought in
X; from amiga.lib
X;--------------------------------------------------------------------
X		XLIB	    OpenLibrary
X		XLIB	    CloseLibrary
X		XLIB	    Alert
X		XLIB	    FreeMem
X		XLIB	    Remove
X
X;------ defined in Amiga.lib ------
X		xref	    _AbsExecBase
X
X;------ defined in the c source, the id string of my library. ------
X		xref	    _idString
X
X
X
X
X;--------------------------------------------------------------------
X; Make some stuff visible for debuging.
X;--------------------------------------------------------------------
X		xdef	    Init
X		xdef	    EndCode
X		xdef	    RomTag
X		xdef	    funcTable
X		xdef	    dataTable
X		xdef	    InitRoutine
X
X		xdef	    Open
X		xdef	    Close
X		xdef	    Expunge
X		xdef	    Reserved
X
X;--------------------------------------------------------------------
X; The links to the c code are in the file kludge.asm, because the
X; assembler I use doesn't like to make symbols starting with a @.
X; But thats what DICE starts it's regargs routines with, so...
X; I make the links with das, which comes with dice.
X;
X; my library routines
X;--------------------------------------------------------------------
X		xref	    parsesregexp
X		xref	    freesregexp
X		xref	    matchsregexp
X		xref	    matchnsregexp
X		xref	    iswild
X		xref	    anchorpath
X		xref	    nextfile
X		xref	    buildpath
X		xref	    freespathinfo
X
X
X
X
X
X************************************************************************
X* Ok, so much for the preamble, we can actually start to generate      *
X* some code now.  The very first thing we should do is return an       *
X* error if someone tries to run us like a program, seeing as we        *
X* will be a perfectly legal AmigaDos load module.		       *
X************************************************************************
X
XStart:
X		moveq.l     #-1,d0
X		rts
X
X
X;--------------------------------------------------------------------
X; Ok, here's what exec is going to look for to tell it that we are
X; a library.
X;--------------------------------------------------------------------
XRomTag:
X		dc.w	    RTC_MATCHWORD	; magic
X		dc.l	    RomTag		; pointer back to magic
X		dc.l	    EndCode		; keep looking from here
X		dc.b	    RTF_AUTOINIT	; yes, autoinit me.
X		dc.b	    VERSION		; version number
X		dc.b	    NT_LIBRARY		; I'm a library
X		dc.b	    0			; no priority (typical)
X		dc.l	    sregexpname 	; I have a name
X		dc.l	    _idString		; let's see some ID
X		dc.l	    Init		; start me up
X
X
X;--------------------------------------------------------------------
X; Ok, heres the table of 4 vectors exec is going to look for
X; to autoinit me.
X;
X; We are word alligned here.
X;--------------------------------------------------------------------
XInit:
X		dc.l	    SregExpBase_SIZE	; size of library structure
X		dc.l	    funcTable		; table of all my routines.
X		dc.l	    dataTable		; LibStructure init data
X		dc.l	    InitRoutine 	; Where to start me.
X
X
X;--------------------------------------------------------------------
X; This is the list of functions in my library.
X;--------------------------------------------------------------------
XfuncTable:
X		dc.l	    Open
X		dc.l	    Close
X		dc.l	    Expunge
X		dc.l	    Reserved
X
X; my own little gems.
X		dc.l	    parsesregexp
X		dc.l	    freesregexp
X		dc.l	    matchsregexp
X		dc.l	    matchnsregexp
X		dc.l	    iswild
X		dc.l	    anchorpath
X		dc.l	    nextfile
X		dc.l	    buildpath
X		dc.l	    freespathinfo
X		dc.l	    -1			; end of the list.
X
X;--------------------------------------------------------------------
X; heres the stuff to initialise my Library structure.
X;--------------------------------------------------------------------
XdataTable:
X		INITBYTE    LN_TYPE,NT_LIBRARY
X		INITLONG    LN_NAME,sregexpname
X		INITBYTE    LIB_FLAGS,LIBF_SUMUSED|LIBF_CHANGED
X		INITWORD    LIB_VERSION,VERSION
X		INITWORD    LIB_REVISION,REVISION
X		INITLONG    LIB_IDSTRING,_idString
X		dc.l	    0
X
X
X
X*******************************************************************
X* Ok, so now were really ready to get cooking.			  *
X* This routine is called when the library is first linked into	  *
X* the exec LibList.  The Library structure has already been	  *
X* initialised as per the dataTable instructions.		  *
X*								  *
X* When called, d0 has our library base and the segment list is	  *
X* pointed to by a0; a6 is a pointer to SysBase. 		  *
X*******************************************************************
X
XInitRoutine:
X		move.l	    a4,-(sp)                ; put the lib pointer
X		move.l	    d0,a4		    ; in a convinient place
X
X		move.l	    a6,sb_SysBase(a4)       ; save SysBase
X		move.l	    a0,sb_SegList(a4)       ; save our seglist
X
X		lea.l	    dosname(pc),a1          ; try and open up
X		moveq.l     #0,d0		    ; dos.library
X		CALLSYS     OpenLibrary
X
X		move.l	    d0,sb_DOSBase(a4)       ;save dos
X		bne.s	    1$
X
X
X		ALERT	    AG_OpenLib|AO_DOSLib    ; couldn't get dos!!!
X
X;------- That's all there is to do. --------
X1$
X		move.l	    a4,d0
X		move.l	    (sp)+,a4
X		rts
X
X
X
X***********************************************************************
X* So good so far.  Now come the 4 standard library routines that      *
X* every good library must have.  Each of these (in fact all of the    *
X* library calls) comes with the pointer to our library base in a6.    *
X***********************************************************************
X
X;----------------------------------------------------------------------
X; To open the library, all we have to do is up the count of current
X; users and reset the delayed expunge flag. This returns the library
X; pointer on d0 if we successfully opened (which is always the case).
X;----------------------------------------------------------------------
XOpen:
X		addq.w	    #1,LIB_OPENCNT(a6)
X		bclr	    #LIBB_DELEXP,LIB_FLAGS(a6)
X		move.l	    a6,d0
X		rts
X
X
X
X
X;----------------------------------------------------------------------
X; When we close the library, we decrease the count of current
X; users. If this has reached zeros, then we check the delayed
X; expunge flag and clean up if it is set.
X; If this routine returns 0 then that's that.  If the return value
X; is non-zero, it should be the segment pointer passed to the
X; initialization routine, so we can be unloaded.
X;----------------------------------------------------------------------
XClose:
X		;--- set up the return value, which will be altered ---
X		;--- if we decide to do a delayed expunge.	    ---
X		moveq.l     #0,d0
X		subq.w	    #1,LIB_OPENCNT(a6)
X		bne.s	    1$
X		btst	    #LIBB_DELEXP,LIB_FLAGS(a6)
X		beq.s	    1$
X
X; --- take a shortcut into the Expunge routine that doesn't ---
X; --- redo the tests we just did.			    ---
X		bsr.s	    ReallyExpunge
X
X1$
X; --- at this point, d0 is zero if we didn't expunge, otherwise ---
X; --- it the address of our segment list.			---
X		rts
X
X
X
X;----------------------------------------------------------------------
X; Ok, so now we want to try to unload.	First check if there
X; are still any current openers, if so, just set the delayed
X; expunge flag, and we'll go away when everyone closes us.
X; Otherwise, clean up my resources and return the seg list to
X; be unloaded
X;----------------------------------------------------------------------
XExpunge:
X		tst.w	    LIB_OPENCNT(a6)
X		beq.s	    ReallyExpunge
X
X		bset	    #LIBB_DELEXP,LIB_FLAGS(a6)
X		moveq.l     #0,d0		    ;don't unload me please
X		rts
X
XReallyExpunge:
X		movem.l     d2/a5,-(sp)
X		move.l	    a6,a5
X		move.l	    sb_SysBase(a5),a6
X
X		move.l	    sb_SegList(a5),d2       ;save seglist.
X
X		move.l	    a5,a1		    ;remove the library
X		REMOVE				    ;from the system list
X
X		move.l	    sb_DOSBase(a5),a1
X		CALLSYS     CloseLibrary	    ;close dos.
X
X		moveq.l     #0,d0
X		move.l	    a5,a1
X		move.w	    LIB_NEGSIZE(a5),d0
X		sub.l	    d0,a1
X		add.w	    LIB_POSSIZE(a5),d0
X
X		CALLSYS     FreeMem		    ;free our library base.
X
X		move.l	    d2,d0		    ;unload us.
X
X		movem.l     (sp)+,d2/a5
X		rts
X
X
X;----------------------------------------------------------------------
X; This is the reserved vector.	Just return 0.
X;----------------------------------------------------------------------
XReserved:
X		moveq.l     #0,d0
X		rts
X
X
X
X**********************************************************************
X* That's all of the standard stuff.  As discussed above, the links   *
X* to the c code are in the file kludge.asm			     *
X**********************************************************************
X
X
X
X
X
X
X
X;----------------------------------------------------------------------
X; Here are some stings used in the above.  I put them at the end so
X; so I don't have to worry about alignment.
X;----------------------------------------------------------------------
Xdosname 	DOSNAME
X
Xsregexpname	SREGEXPNAME
X
X;----------------------------------------------------------------------
X; The end of the code, where exec can start looking for more RomTag
X; structures if it wants to.
X;----------------------------------------------------------------------
X		EVEN
XEndCode:
X
X
X
X
X
X**********************************************************************
X*								     *
X* Now comes the clever part.  Dice (and the others, I think)         *
X* references there global data from register a4.  What I do	     *
X* to have easy access to the Library structure data from the	     *
X* c code, is transfer a6 to a4 on each library call and then	     *
X* define the various things I want to access as offsets to	     *
X* this, in effect, tricking dice into thinking they're global        *
X* variables.  The real benifit of this is I don't need my own        *
X* custom links to the Exec and DOS library routines, because	     *
X* there exists perfectly valid global variables SysBase and	     *
X* DosBase.							     *
X*								     *
X**********************************************************************
X
X		DATA	    data
X
X;---------------------------------------------------------------------
X; This one is a little funny, it is the actual instance of the
X; structure, and not a pointer to it.  It should be declared in
X; the c code as 'extern struct SregExpBase SregExpBase;' and then
X; referenced with the '.' and not the '->'.  This may not work
X; I haven't tried it yet.
X;----------------------------------------------------------------------
X_SregExpBase	equ	    0
X		xdef	    _SregExpBase
X
X;--- These are perfectly ordinary pointers ---
X_SysBase	equ	    sb_SysBase
X		xdef	    _SysBase
X
X_DOSBase	equ	    sb_DOSBase
X		xdef	    _DOSBase
X
X		end
X
END_OF_FILE
if test 11630 -ne `wc -c <'clibrary.asm'`; then
    echo shar: \"'clibrary.asm'\" unpacked with wrong size!
fi
# end of 'clibrary.asm'
fi
if test -f 'compilation.notes' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'compilation.notes'\"
else
echo shar: Extracting \"'compilation.notes'\" \(1301 characters\)
sed "s/^X//" >'compilation.notes' <<'END_OF_FILE'
X
X
X    As it says in various places in the source, this whole thing is kind
X    of DICE dependent.	If you know what you are doing you should be
X    able to get it to compile under anything.
X
X    The c source was not written with an eye to portability, but I don't
X    think it is too bad.
X
X    To make under another compiler you will almost definitely have to change
X    the file kludge.asm, were the jump vectors into the code are.  Most
X    likely you'll have to take the register parameters and stuff
X    them onto the stack.
X
X    The easiest thing to do is just type 'dmake install' and trust
X    my compilations.
X
X    PLEASE do not distribute modified versions, and if you do make sure
X    the copyright notice is left intact AND you state clearly it is
X    a modified version.
X
X
X    Note that I made everything under 1.3 (I don't have 2.0).  There
X    are a few things to consider, however.  I have made my own 1.3 version
X    of the 'clib' directory, which is new to 2.0.  This also allowed
X    me to make my own 1.3 registered args amigasr13.lib linker
X    library.  If you want to remake this under 1.3 with dice, you will
X    have to either come up with these yourself, or modify kludge.asm
X    to stuff the parameters on to the stack. Under 2.0 everything should
X    go, but no guarantees.
X
END_OF_FILE
if test 1301 -ne `wc -c <'compilation.notes'`; then
    echo shar: \"'compilation.notes'\" unpacked with wrong size!
fi
# end of 'compilation.notes'
fi
if test -f 'dmakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dmakefile'\"
else
echo shar: Extracting \"'dmakefile'\" \(1467 characters\)
sed "s/^X//" >'dmakefile' <<'END_OF_FILE'
X
XOD = OBJS:sreg/
X
XCSRC = sregexp.c sreg_version.c spath.c
XCOBJ = $(CSRC:"*.c":"$(OD)*.o")
XOBJ = $(OD)clibrary.o $(OD)kludge.o $(COBJ)
XJUNK = utils/try utils/remlib utils/bumprev
XJUNKSRC = $(JUNK:"*":"*.c")
X
XLINKLIBS = amigasr13.lib cr.lib
X
XLIBRARY = sregexp.library
X
XCOPTS = -c -mRR -mS -proto
X#COPTS = -c -mRR -mS -proto -D __DEBUG__
X
Xall : sregexpsr.lib sregexps.lib $(JUNK) $(LIBRARY)
X
X$(JUNK) : $(JUNKSRC)
X    dcc -mRR -r -lsregexpsr -o %(left) %(right)
X
X$(LIBRARY) : $(OBJ)
X    -Delete >NIL: %(left)
X    dlink -o %(left) $(OBJ) $(LINKLIBS)
X    utils/remlib $(LIBRARY)
X    Protect %(left) -E
X
X$(OD)clibrary.o : clibrary.asm sreg_version.i
X    -Delete >NIL: %(left)
X    a68k -q -iAINC: -o%(left) clibrary.asm
X
X$(OD)kludge.o : kludge.asm
X    -Delete >NIL: %(left)
X    das -o%(left) %(right)
X
X$(COBJ) : $(CSRC)
X    -Delete >NIL: %(left)
X    dcc $(COPTS) -o %(left) %(right)
X
Xsregexpsr.lib : sregexp.fd sregexp_protos.h
X    -Delete >NIL: %(left)
X    fdtolib -mr sregexp.fd -o %(left) -h sregexp_protos.h
X
Xsregexps.lib : sregexp.fd
X    -Delete >NIL: %(left)
X    fdtolib sregexp.fd -o %(left)
X
Xsreg_version.i : $(CSRC) clibrary.asm kludge.asm utils/bumprev
X    utils/bumprev
X    touch sreg_version.i
X
Xclean :
X    -Delete $(JUNK)
X    -Delete $(OBJ)
X    -Delete sregexpsr.lib sregexps.lib
X
Xinstall :
X    Copy $(LIBRARY) Libs:
X    Copy sregexpbase.h dinclude:pd/libraries
X    Copy sregexp_protos.h dinclude:pd/clib
X    Copy sregexps.lib dlib:
X    Copy sregexpsr.lib dlib:
END_OF_FILE
if test 1467 -ne `wc -c <'dmakefile'`; then
    echo shar: \"'dmakefile'\" unpacked with wrong size!
fi
# end of 'dmakefile'
fi
if test -f 'instillation.notes' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'instillation.notes'\"
else
echo shar: Extracting \"'instillation.notes'\" \(757 characters\)
sed "s/^X//" >'instillation.notes' <<'END_OF_FILE'
X
X
X    If you have dmake, then just change to this directory and
X    type 'dmake install' and all of the files will be copied to
X    the appropriate place (if not you can edit the dmake file)
X
X    If not, heres where they should go:
X
X	sregexp.library 	should be copied to LIBS:
X
X	sregexps.lib		should go to DLIB:  If you use a different
X	sregexpsr.lib		compiler, you will have to use whatever
X				utility exists to turn the fd file into
X				your kind of library.
X
X	sregexpbase.h		should go in the 'libraries' directory,
X				where ever you keep your Amiga include
X				files.
X
X	sregexp_protos.h	Under 2.0 this goes in 'clib'  I compiled
X				everything under 1.3, but I have a fake
X				1.3 clib directory of my own making.
X				Basically put it where you want.
X
END_OF_FILE
if test 757 -ne `wc -c <'instillation.notes'`; then
    echo shar: \"'instillation.notes'\" unpacked with wrong size!
fi
# end of 'instillation.notes'
fi
if test -f 'kludge.asm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'kludge.asm'\"
else
echo shar: Extracting \"'kludge.asm'\" \(1876 characters\)
sed "s/^X//" >'kludge.asm' <<'END_OF_FILE'
X
X;-------------------------------------------------------------------
X; Here are the links to the c code.  Anything that dice can't make
X; registered arguement versions of would have to stick the stuff onto the
X; stack.  Note that the fd file and dice must both have the same
X; idea of what gets passed in what.  I will perhaps automate that
X; one day.  For now just be carefull.
X;-------------------------------------------------------------------
X
X		section     kludge,code
X
X		xdef	    parsesregexp
X		xref	    @parsesregexp
Xparsesregexp:
X		move.l	    a4,-(sp)
X		move.l	    a6,a4
X		jsr	    @parsesregexp(pc)
X		move.l	    (sp)+,a4
X		rts
X
X		xdef	    freesregexp
X		xref	    @freesregexp
Xfreesregexp:
X		move.l	    a4,-(sp)
X		move.l	    a6,a4
X		jsr	    @freesregexp(pc)
X		move.l	    (sp)+,a4
X		rts
X
X		xdef	    matchsregexp
X		xref	    @matchsregexp
Xmatchsregexp:
X		move.l	    a4,-(sp)
X		move.l	    a6,a4
X		jsr	    @matchsregexp(pc)
X		move.l	    (sp)+,a4
X		rts
X
X		xdef	    matchnsregexp
X		xref	    @matchnsregexp
Xmatchnsregexp:
X		move.l	    a4,-(sp)
X		move.l	    a6,a4
X		jsr	    @matchnsregexp(pc)
X		move.l	    (sp)+,a4
X		rts
X
X		xdef	    iswild
X		xref	    @iswild
Xiswild:
X		move.l	    a4,-(sp)
X		move.l	    a6,a4
X		jsr	    @iswild(pc)
X		move.l	    (sp)+,a4
X		rts
X
X		xdef	    anchorpath
X		xref	    @anchorpath
Xanchorpath:
X		move.l	    a4,-(sp)
X		move.l	    a6,a4
X		jsr	    @anchorpath(pc)
X		move.l	    (sp)+,a4
X		rts
X
X		xdef	    nextfile
X		xref	    @nextfile
Xnextfile:
X		move.l	    a4,-(sp)
X		move.l	    a6,a4
X		jsr	    @nextfile(pc)
X		move.l	    (sp)+,a4
X		rts
X
X		xdef	    buildpath
X		xref	    @buildpath
Xbuildpath:
X		move.l	    a4,-(sp)
X		move.l	    a6,a4
X		jsr	    @buildpath(pc)
X		move.l	    (sp)+,a4
X		rts
X
X		xdef	    freespathinfo
X		xref	    @freespathinfo
Xfreespathinfo:
X		move.l	    a4,-(sp)
X		move.l	    a6,a4
X		jsr	    @freespathinfo(pc)
X		move.l	    (sp)+,a4
X		rts
X
X		end
END_OF_FILE
if test 1876 -ne `wc -c <'kludge.asm'`; then
    echo shar: \"'kludge.asm'\" unpacked with wrong size!
fi
# end of 'kludge.asm'
fi
if test -f 'revision.history' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'revision.history'\"
else
echo shar: Extracting \"'revision.history'\" \(468 characters\)
sed "s/^X//" >'revision.history' <<'END_OF_FILE'
X
X    version 9.x
X	First version ready for general release, everything seems
X	to work ok.
X
X    versions 4.0 - 8.xx
X	Various steps on the long road to getting the path matching
X	routines to actually work.
X
X    version 2.0 - 3.xx
X	Porting of the pattern matching routines from a link time
X	library to a run time library.
X
X    version 1.xx
X	Figuring out how to make a @&*! Amiga run time library
X	go.  WHY DOES IT GURU WHEN I EXPUNGE, AHHHHH!  Well
X	it worked in the end.
END_OF_FILE
if test 468 -ne `wc -c <'revision.history'`; then
    echo shar: \"'revision.history'\" unpacked with wrong size!
fi
# end of 'revision.history'
fi
if test -f 'spath.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'spath.c'\"
else
echo shar: Extracting \"'spath.c'\" \(12546 characters\)
sed "s/^X//" >'spath.c' <<'END_OF_FILE'
X
X/**********************************************************************
X * This is the stuff for matching to a wildcarded path. see the docs  *
X *								      *
X *								      *
X *  Copyright (c) 1991 by Jon Spencer.                                *
X *								      *
X *  Revision history:						      *
X *	May 10, 1991	    First version basically completed	      *
X *								      *
X **********************************************************************/
X
X#include "sregexp.h"
X
Xextern struct DosLibrary *DOSBase;
X
X#ifdef __DEBUG__
Xvoid puts(char *);
Xvoid printf(char *, ...);
X#endif
X
X#define ROOT	((struct RootNode *)DOSBase->dl_Root)
X#define INFO	((struct DosInfo *)ROOT->rn_Info<<2)
X#define DEVC(a) ((struct DeviceList *)a<<2)
X
Xstruct SpathInfo *
Xanchorpath(anc,wld)
Xchar *anc,*wld;
X/* This is routine sets everything up for matching wildcard paths.
X   It does the expansion of any wildcards in the volume node part
X   of the path, if any where specified, and gets ready to roll. */
X{
X    struct SpathInfo *spi;
X    struct SpathNode *spn;
X    BPTR lock;
X    register char *q;
X    char *node,*p,c;
X    struct DeviceList *dvc;
X    struct SregExp *pat;
X
X
X    if (!(spi = getmem(sizeof(struct SpathInfo)))) {
X	report(MEM_ERROR);
X	return NULL;
X    }
X    NewList((struct List *)spi);
X
X    for (q = wld; *q != ':' && *q != '/' && *q; q++) ;
X
X    if (*q == ':') {
X	if (!(node = getmem(q - wld + 1))) {
X	    report(MEM_ERROR);
X	    FreeMem(spi,sizeof(struct SpathInfo));
X	    FreeMem(spi,sizeof(struct SpathInfo));
X	    return NULL;
X	}
X	for (q = wld, p = node; *q != ':'; )
X	    *p++ = *q++;
X	*p = 0;
X
X	pat = parsesregexp(node);
X	FreeMem(node,strlen(node)+1);
X	if (!pat) {
X	    FreeMem(spi,sizeof(struct SpathInfo));
X	    return NULL;
X	}
X
X	/* Check if there is no path to parse */
X	if (*(q+1)) {
X	    if (!(spi->spi_SregList = parsepath(q+1))) {
X		freesregexp(pat);
X		FreeMem(spi,sizeof(struct SpathInfo));
X		return NULL;
X	    }
X	} else
X	    spi->spi_SregList = NULL;
X
X
X	if (pat->sre_Type == SRP_NULL) {  /* check for paths matching ":..." */
X
X	    if (!(lock = Lock(anc,SHARED_LOCK))) {
X		freesregexp(pat);
X		freespathinfo(spi);
X		return NULL;
X	    }
X	    if (!(node = getmem(2))) {
X		report(MEM_ERROR);
X		UnLock(lock);
X		freesregexp(pat);
X		freespathinfo(spi);
X		return NULL;
X	    }
X	    node[0] = ':';
X	    node[1] = 0;
X	    if (!(spn = makespathnode(lock,node,spi->spi_SregList))) {
X		UnLock(lock);
X		FreeMem(node,2);
X		freesregexp(pat);
X		freespathinfo(spi);
X		return NULL;
X	    }
X	    spn->spn_NodeName = node;
X	    AddTail((struct List *)spi,(struct Node *)spn);
X	    UnLock(lock);
X	} else {
X	    for (dvc = DEVC(INFO->di_DevInfo); dvc; dvc = DEVC(dvc->dl_Next)) {
X		p = (char *)dvc->dl_Name<<2;
X		if (matchnsregexp(p+1,pat,FALSE,*p)) {
X		    if (!(node = getmem(*p+2))) {
X			report(MEM_ERROR);
X			freesregexp(pat);
X			freespathinfo(spi);
X			return NULL;
X		    }
X		    for (c = *p++, q = node; c > 0; c--)
X			*q++ = *p++;
X		    *q++ = ':';
X		    *q = 0;
X		    if (dvc->dl_Type == DLT_DEVICE) {
X			lock = Lock(node,SHARED_LOCK);  /* ignore non-filesystem devices */
X			if (!lock)
X			    continue;
X			UnLock(lock);
X		    }
X		    if (!(spn = makespathnode(NULL,node,spi->spi_SregList))) {
X			FreeMem(node,strlen(node)+1);
X
X			freespathinfo(spi);
X			return NULL;
X		    }
X		    spn->spn_NodeName = node;
X		    AddTail((struct List *)spi,(struct Node *)spn);
X		}
X	    }
X	}
X	freesregexp(pat);
X    } else {
X	/* check if there is any path to parse */
X	if (*wld) {
X	    if (!(spi->spi_SregList = parsepath(wld))) {
X		FreeMem(spi,sizeof(struct SpathInfo));
X		return NULL;
X	    }
X	} else
X	    spi->spi_SregList = NULL;
X
X	if (!(spn = makespathnode(NULL,anc,spi->spi_SregList)))
X	    freespathinfo(spi);
X	AddTail((struct List *)spi,(struct Node *)spn);
X    }
X    return spi;
X}
X
X#undef ROOT
X#undef INFO
X#undef DEVC
X
Xstruct SregList *
Xparsepath(wld)
Xchar *wld;
X/* This routine takes a wildcarded path and turns it into a singly
X   linked list of SregExp structures, one node for each path element. */
X{
X    char *q,*p,*cp,c = 1,recurse;
X    struct SregExp *sre;
X    struct SregList *srl,*srr = NULL;
X
X    if (!(cp = getmem(strlen(wld)+1))) {
X	report(MEM_ERROR);
X	return NULL;
X    }
X    strcpy(cp,wld);
X
X    q = cp;
X    while (*q && c) {
X	if (strncmp(q,".../",4) == 0) {
X	    recurse = SRF_RECURSE;
X	    q += 4;
X	} else
X	    recurse = 0;
X	p = q;
X	while (*q && *q != '/') q++;
X	c = *q;
X	*q = 0;
X	if (!(sre = parsesregexp(p)))
X	    goto bad;
X	sre->sre_Flag |= recurse;
X	*q++ = c;
X	if (!srr) {
X	    if (!(srl = srr = getmem(sizeof(struct SregList)))) {
X		report(MEM_ERROR);
X		goto bad;
X	    }
X	} else {
X	    if (!(srl = (srl->srl_next = getmem(sizeof(struct SregList))))) {
X		report(MEM_ERROR);
X		goto bad;
X	    }
X	}
X	srl->srl_next = NULL;
X	srl->srl_sreg = sre;
X    }
X    if (c == '/')           /* If path ends in a / then just take dirs */
X	srl->srl_sreg->sre_Flag |= SRF_JUSTDIRS;
X
X    FreeMem(cp,strlen(cp)+1);
X    return srr;
X
Xbad:
X    if (sre)
X	freesregexp(sre);
X    FreeMem(cp,strlen(cp)+1);
X
X    while (srl) {
X	if (srl->srl_sreg)
X	    freesregexp(srl->srl_sreg);
X	FreeMem(srl,sizeof(struct SregList));
X	srl = srl->srl_next;
X    }
X    return NULL;
X}
X
Xstruct SpathNode *
Xmakespathnode(lock,file,sreg)
XBPTR lock;
Xchar *file;
Xstruct SregList *sreg;
X/* This routine makes a new node to be linked into the list of current
X   directory locks, basically */
X{
X    struct SpathNode *spn;
X    BPTR cdir;
X
X
X    if (!(spn = getmem(sizeof(struct SpathNode)))) {
X	report(MEM_ERROR);
X	return NULL;
X    }
X    if (lock)
X	cdir = CurrentDir(lock);
X    if (!(spn->spn_Lock = Lock(file,SHARED_LOCK))) {
X	FreeMem(spn,sizeof(struct SpathNode));
X	return NULL;
X    }
X    spn->spn_SregList = sreg;
X    if (!(Examine(spn->spn_Lock,&spn->spn_FIB))) {
X	UnLock(spn->spn_Lock);
X	FreeMem(spn,sizeof(struct SpathNode));
X	return NULL;
X    }
X    spn->spn_Flags = 0;
X    spn->spn_NodeName = NULL;
X    if (lock)
X	CurrentDir(cdir);
X
X    return spn;
X}
X
X
X
X#define FILENAME	(spn->spn_FIB.fib_FileName)
X#define NEXTPATH	(spn->spn_SregList->srl_next)
X#define THISPATH	(spn->spn_SregList)
X#define LOCK		(spn->spn_Lock)
X#define FIB		(spn->spn_FIB)
X#define SREG		(spn->spn_SregList->srl_sreg)
X#define ISDIR		(FIB.fib_DirEntryType > 0)
X#define ISRECURSE	(SREG->sre_Flag & SRF_RECURSE)
X#define ISDONEONCE	(spn->spn_Flags & SPF_DONEONCE)
X#define ISJUSTDIRS	(SREG->sre_Flag & SRF_JUSTDIRS)
X#define WANTIT		(ISDIR ? dirs >= 0 : !ISJUSTDIRS && dirs <= 0)
X#define SIGBREAKF_ANY	(SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D | SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F)
X
Xint
Xnextfile(spi,buf,len,dirs)
Xstruct SpathInfo *spi;
Xchar *buf;
Xint len,dirs;
X/* This routine is a mess.  It jumps all over the place and is generally
X   hard to follow.  The basic idea behind it is to implement recursion,
X   but without using the stack.  Basically the linked list of SpathNode
X   structures, anchored in the SpathInfo structure works as our stack
X   for us.  "Why not just use the stack?" you ask.  Well, unfortunately,
X   we have to return in the middle of the scan, each time a new match
X   is found.  This would mean unrolling all of the stack that defines
X   how far through the search we are to get back to the return address.
X   By using the linked list of SpathInfo structures, we can preserve
X   the state of the 'stack' betweem calls. */
X{
X    struct SpathNode *spn;
X
X
Xtry_again:
X
X    if (SetSignal(0,0) & SIGBREAKF_ANY)
X	return SPE_SIGBREAK;
X
X    spn = spi->spi_TailPred;
X
X    /* check if we're done. */
X    if (!spn->spn_Pred) {
X	report(ERROR_NO_MORE_ENTRIES);
X	return SPE_ALL_DONE;
X    }
X
X    /* check if we're at the end of the path: used to match just nodes.*/
X    if (!THISPATH) {
X	if (ISDONEONCE)
X	    goto pop;
X
X	spn->spn_Flags |= SPF_DONEONCE;
X
X	if (dirs >= 0) {
X	    return buildpath(spi,buf,len);
X	} else
X	    goto pop;
X    }
X
X    /* check if we set a delayed decend */
X    if (spn->spn_Flags & SPF_DECEND)
X	goto decend;
X
X    /* check if it matches the null string, ie parent dir */
X    if (SREG->sre_Type == SRP_NULL) {
X
X	/* Check if its done or there is no parent. */
X	if (ISDONEONCE || !ParentDir(LOCK))
X	    goto pop;
X
X	spn->spn_Flags |= SPF_DONEONCE;       /* Mark it as done. */
X
X	/* mark it as parent match for buildpath */
X	spn->spn_Flags |= SPF_NEXTPARENT;
X
X	if (!(spn = makespathnode(LOCK,"/",NEXTPATH)))
X	    return SPE_ERROR;
X	AddTail((struct List *)spi,(struct Node *)spn);
X	goto try_again;
X    }
X
X    /* Check if we can do it quickly */
X    if ((SREG->sre_Type == SRP_STRING ||
X			      SREG->sre_Type == SRP_ONECHAR) && !ISRECURSE) {
X	BPTR cdir,lock;
X
X	/* Have we already done it? */
X	if (ISDONEONCE)
X	   goto pop;
X
X	/* Mark it as done. */
X	spn->spn_Flags |= SPF_DONEONCE;
X
X	cdir = CurrentDir(LOCK);
X	if (SREG->sre_Type == SRP_STRING)
X	    lock = Lock(SREG->sre_Data.string,SHARED_LOCK);
X	else {
X	    char n[2];
X
X	    n[0] = SREG->sre_Data.onechar;
X	    n[1] = 0;
X	    lock = Lock(n,SHARED_LOCK);
X	}
X	CurrentDir(cdir);
X	if (!lock)
X	    goto pop;
X	if (!Examine(lock,&FIB)) {
X	    UnLock(lock);
X	    return SPE_ERROR;
X	}
X	UnLock(lock);
X
X	if (!NEXTPATH) {
X	    if (WANTIT)
X		return buildpath(spi,buf,len);
X	    else
X		goto pop;
X	}
X	if (ISDIR) {
X	    if (!(spn = makespathnode(LOCK,FILENAME,NEXTPATH))) {
X		return SPE_ERROR;
X	    }
X	    AddTail((struct List *)spi,(struct Node *)spn);
X	    goto try_again;
X	}
X	goto pop;
X    }
X
X    while (ExNext(LOCK,&FIB)) {
X	if (SetSignal(0,0) & SIGBREAKF_ANY)
X	    return SPE_SIGBREAK;
X
X	if (matchsregexp(FILENAME,SREG,FALSE)) {
X	    if (ISDIR && ISRECURSE)
X		spn->spn_Flags |= SPF_DECEND;
X	    if (!NEXTPATH) {
X		if (WANTIT)
X		    return buildpath(spi,buf,len);
X	    } else if (ISDIR) {
X		if (!(spn = makespathnode(LOCK,FILENAME,NEXTPATH))) {
X		    return SPE_ERROR;
X		}
X		AddTail((struct List *)spi,(struct Node *)spn);
X		goto try_again;
X	    }
X	}
X	if (ISDIR && ISRECURSE) {
Xdecend:
X	    spn->spn_Flags &= ~SPF_DECEND;
X	    if (!(spn = makespathnode(LOCK,FILENAME,THISPATH))) {
X		return SPE_ERROR;
X	    }
X	    AddTail((struct List *)spi,(struct Node *)spn);
X	    goto try_again;
X	}
X    }
X
X    if (IoErr() != ERROR_NO_MORE_ENTRIES)
X	return SPE_ERROR;
X
Xpop:
X    RemTail((struct List*)spi);
X    freespathnode(spn);
X    goto try_again;
X}
X
X#undef FILENAME
X#undef NEXTPATH
X#undef THISPATH
X#undef LOCK
X#undef FIB
X#undef SREG
X#undef ISDIR
X#undef ISRECURSE
X#undef ISDONEONCE
X#undef ISJUSTDIRS
X#undef WANTIT
X
X
Xint
Xbuildpath(spi,buf,len)
Xstruct SpathInfo *spi;
Xchar *buf;
Xint len;
X/* This routine turns the current 'stack' of SpathNode structures into
X   a file name the AmigaDOS will like. */
X{
X    struct SpathNode *spn = spi->spi_Head;
X    int i = 0;
X    char *q;
X
X    if (len < 1)
X	return SPE_BUFF_FULL;
X
X    if (spn->spn_Succ && spn->spn_NodeName) {
X	while (spn->spn_Succ->spn_Succ && spn->spn_Succ->spn_NodeName) {
X	    spn = spn->spn_Succ;
X	}
X    }
X
X    if (q = spn->spn_NodeName) {
X	while (*q && i < len)
X	    buf[i++] = *q++;
X	if (i >= len)
X	    return SPE_BUFF_FULL;
X    }
X    while (spn->spn_Succ) {
X	if (spn->spn_Flags & SPF_NEXTPARENT) {
X	    buf[i++] = '/';
X	    if (i >= len)
X		return SPE_BUFF_FULL;
X	} else {
X	    q = spn->spn_FIB.fib_FileName;
X	    while (*q && i < len)
X		buf[i++] = *q++;
X	    if (i >= len)
X		return SPE_BUFF_FULL;
X	    if (spn->spn_Succ->spn_Succ ||
X		      spn->spn_SregList->srl_sreg->sre_Flag & SRF_JUSTDIRS) {
X		buf[i++] = '/';
X		if (i >= len)
X		    return SPE_BUFF_FULL;
X	    }
X	}
X	spn = spn->spn_Succ;
X    }
X
X    buf[i] = 0;
X    return i;
X}
X
Xvoid
Xfreespathinfo(spi)
Xstruct SpathInfo *spi;
X/* This routine frees all of the resoureces tied up in a SpathInfo
X   structure */
X{
X    struct SpathNode *spn;
X    struct SregList *srl,*next;
X
X    while (spn = (struct SpathNode *)RemTail((struct List *)spi))
X	freespathnode(spn);
X
X    for (srl = spi->spi_SregList; srl; srl = next) {
X	freesregexp(srl->srl_sreg);
X	next = srl->srl_next;
X	FreeMem(srl,sizeof(struct SregList));
X    }
X
X    FreeMem(spi,sizeof(struct SpathInfo));
X}
X
Xvoid
Xfreespathnode(spn)
Xstruct SpathNode *spn;
X/* This routine frees the memory and lock in a SpathNode structure. */
X{
X    if (spn->spn_NodeName) {
X	FreeMem(spn->spn_NodeName,strlen(spn->spn_NodeName)+1);
X    }
X    UnLock(spn->spn_Lock);
X    FreeMem(spn,sizeof(struct SpathNode));
X}
X
X
X#ifdef __DEBUG__
X
X/* This is some debugging stuff, not compiled into the release version. */
X
Xvoid
Xputs(c)
Xchar *c;
X{
X    Write(Output(),c,strlen(c));
X    Write(Output(),"\n",1);
X}
X
X#include <stdarg.h>
X
Xextern void vsprintf(char *, char *, va_list);
X
Xvoid printf(f, ...)
Xchar *f;
X{
X    char buff[100];
X    va_list va;
X
X    va_start(va,f);
X    vsprintf(buff,f,va);
X    va_end(va);
X    Write(Output(),buff,strlen(buff));
X}
X
X#endif
END_OF_FILE
if test 12546 -ne `wc -c <'spath.c'`; then
    echo shar: \"'spath.c'\" unpacked with wrong size!
fi
# end of 'spath.c'
fi
if test -f 'sreg_version.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sreg_version.c'\"
else
echo shar: Extracting \"'sreg_version.c'\" \(68 characters\)
sed "s/^X//" >'sreg_version.c' <<'END_OF_FILE'
X
X
Xconst __far char idString[] = "sreglib 9.4 ("__DATE__")\x0d\x0a";
END_OF_FILE
if test 68 -ne `wc -c <'sreg_version.c'`; then
    echo shar: \"'sreg_version.c'\" unpacked with wrong size!
fi
# end of 'sreg_version.c'
fi
if test -f 'sreg_version.i' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sreg_version.i'\"
else
echo shar: Extracting \"'sreg_version.i'\" \(44 characters\)
sed "s/^X//" >'sreg_version.i' <<'END_OF_FILE'
X
XVERSION 	equ	    9
XREVISION	equ	    4
X
X
X
X
X
END_OF_FILE
if test 44 -ne `wc -c <'sreg_version.i'`; then
    echo shar: \"'sreg_version.i'\" unpacked with wrong size!
fi
# end of 'sreg_version.i'
fi
if test -f 'sregexp.fd' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sregexp.fd'\"
else
echo shar: Extracting \"'sregexp.fd'\" \(279 characters\)
sed "s/^X//" >'sregexp.fd' <<'END_OF_FILE'
X##base _SregExpBase
X##bias 30
X##public
XParseSregExp(p)(a0)
XFreeSregExp(p)(a0)
XMatchSregExp(p,p1,n)(a0,a1,d0)
XMatchNSregExp(p,p1,n)(a0,a1,d0,d1)
XIsWild(p)(a0)
XAnchorPath(anchor,path)(a0,a1)
XNextFile(p1,p2,n,n1)(a0,a1,d0,d1)
XBuildPath(p1,p2,n)(a0,a1,d0)
XFreeSpathInfo(p)(a0)
X##end
END_OF_FILE
if test 279 -ne `wc -c <'sregexp.fd'`; then
    echo shar: \"'sregexp.fd'\" unpacked with wrong size!
fi
# end of 'sregexp.fd'
fi
if test -f 'sregexp.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sregexp.h'\"
else
echo shar: Extracting \"'sregexp.h'\" \(1868 characters\)
sed "s/^X//" >'sregexp.h' <<'END_OF_FILE'
X
X/* This is used for COMPILING sregexp.library, it should not be included
X  if you just USE the library.	See sregexpbase.h */
X
X#include <stddef.h>
X#include <stdlib.h>
X#include <string.h>
X#include <ctype.h>
X#include <clib/exec_protos.h>
X#include <clib/dos_protos.h>
X#include <libraries/dosextens.h>
X#include "sregexpbase.h"
X
X#define TRUE	1
X#define FALSE	0
X
X
X#define MEM_ERROR	ERROR_NO_FREE_STORE	/* report no mem */
X#define ILLEGAL_ERR	ERROR_INVALID_COMPONENT_NAME   /* bad sregexp */
X
X
X/* some handy fingersaving macros. */
X#define realen(a)       (((a)->sre_Flag&(SRF_REPEAT|SRF_NOT))?0:(a)->sre_MinLen)
X#define isfixed(s)      (((s)->sre_Flag&(SRF_REPEAT|SRF_NOT|SRF_FIXLEN))==SRF_FIXLEN)
X#define matchset(s,c)   ((s)->sre_Data.setchar[(c)/8] & 1 << (c)%8)
X#define getmem(a)       AllocMem(a,0)
X
Xstatic struct SregExp *     parsesub(char **, char);
Xstatic struct SregExp *     makesum(struct SregList *, int);
Xstatic struct SregExp *     makeor(struct SregList *,int);
Xstatic struct SregExp *     parseone(char **, char);
Xstatic char		    onechar(char **, char);
Xstatic char *		    makeset(char **);
Xstatic int		    matchsum(struct SregExp *[], int, char *, int, int);
Xstatic void		    report(int);
Xstatic struct SpathNode *   makespathnode(BPTR, char *, struct SregList *);
Xstatic void		    freespathnode(struct SpathNode *);
Xstatic struct SregList *    parsepath(char *);
X
Xextern struct SregExp *     parsesregexp(char *);
Xextern void		    freesregexp(struct SregExp *);
Xextern int		    matchsregexp(char *, struct SregExp *, int);
Xextern int		    matchnsregexp(char *, struct SregExp *, int, int);
Xextern int		    iswild(char *);
Xextern struct SpathInfo *   anchorpath(char *, char *);
Xextern int		    nextfile(struct SpathInfo *, char *, int, int);
Xextern int		    buildpath(struct SpathInfo *, char *, int);
Xextern void		    freespathinfo(struct SpathInfo *);
X
END_OF_FILE
if test 1868 -ne `wc -c <'sregexp.h'`; then
    echo shar: \"'sregexp.h'\" unpacked with wrong size!
fi
# end of 'sregexp.h'
fi
if test -f 'sregexp.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sregexp.uu'\"
else
echo shar: Extracting \"'sregexp.uu'\" \(12272 characters\)
sed "s/^X//" >'sregexp.uu' <<'END_OF_FILE'
Xbegin 600 sregexp.library
XM```#\P`````````!``````````````AC```#Z0``"&-P_TYU2OP````$```!V
XM6H`)"0````%*```0P````!X````N````+@```&8```"2````R@```-@```#L'
XM```!.@```5P```%H```!=````8````&,```!F````:0```&P```!O/_____@,
XM```("0#````*```!2N````X&`-```!0`"=```!8`!,```!@``!#``````"\,4
XM*$`I3@`B*4@`*D/Z`)YP`$ZN_=@I0``F9A9(YP$&+CP``X`'+'@`!$ZN_Y1,P
XMWV"`(`PH7TYU4FX`(`BN``,`#B`.3G5P`%-N`"!F"@@N``,`#F<"81).=4INL
XM`"!G"@CN``,`#G``3G5(YR`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B`!3G5$@4J`:Q9A``!41($@`4YU1(!A``!(1($@`4YU1(!A```\(`%.=4YQ.
XM80``,B`!3G5*@6L(2H!K$F```")$@4J`:Q)A```81(!.=42`80``#D2`3G5$(
XM@&````1.<4J!9QY(04I!9D(O`DA!)`"$P6D4(@)"04A!<``P`B0?3G4B`'#_X
XM3G4O`R0`0D)(0H3!-@)(0T)#-`"$P38"(`-"0DA"(@(F'R0?3G5(YS@`)`!"2
XM0DA"A,$V`G0`-`/&P4A!.`+(P4A#UH20@VL*(@`@`DS?`!Q.=5."T(%K^B(`O
XM(`),WP`<3G4B2&`"4HA*$&;Z(`B0B4YU2H!F&'``8"1@$DH!9P93@$J`9@1PM
XM`&`44HA2B1(0LA%GZ+(19`1P_V`"<`%.=4YQ+PHD2&`$4HE2B!"12A!F]B`*+
XM)%].=4YQ8`P2`+(09@0@"&`04HA*$&;P2H!F!"`(8`)P`$YU3G%(YR`P2H!FP
XM&'``8%!@$DH!9P93@$J`9@1P`&!`4HA2B1(0=``4`47Z`D74PG0`%!%'^@([,
XMUL(4$K039])T`!0!1_H"*];"=``4$47Z`B'4PA03M!)D!'#_8`)P`4S?#`1.^
XM=4YQ``0$!`0$!`0$!$1$1$1$!`0$!`0$!`0$!`0$!`0$!`0$0!`0$!`0$!`0T
XM$!`0$!`0$!D9&1D9&1D9&1D0$!`0$!`0DY.3DY.3DY.3DY.3DY.3DY.3DY.3I
XMDY.3DY,0$!`0$!`S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,Q`0$!`$````Q
XM`````````````````````````````````````````````````````````````
XM`````````````````````````````````````````````````````````````
XM``````````````````````````````````````````````````````$"`P0%/
XM!@<("0H+#`T.#Q`1$A,4%187&!D:&QP='A\@(2(C)"4F)R@I*BLL+2XO,#$RL
XM,S0U-C<X.3H[/#T^/T!!0D-$149'2$E*2TQ-3D]045)35%565UA96EM<75Y?5
XM8$%"0T1%1D=(24I+3$U.3U!14E-455976%E:>WQ]?G^`@8*#A(6&AXB)BHN,^
XMC8Z/D)&2DY25EI>8F9J;G)V>GZ"AHJ.DI::GJ*FJJZRMKJ^PL;*SM+6VM[BYG
XMNKN\O;Z_P,'"P\3%QL?(R<K+S,[.S]#1TM/4U=;7V-G:V]S=WM_@X>+CY.7F1
XMY^CIZNOL[>[O\/'R\_3U]O?X^?K[_/W^_P```````0(#!`4&!P@)"@L,#0X/S
XM$!$2$Q05%A<8&1H;'!T>'R`A(B,D)28G*"DJ*RPM+B\P,3(S-#4V-S@Y.CL\N
XM/3X_0&%B8V1E9F=H:6IK;&UN;W!Q<G-T=79W>'EZ6UQ=7E]@86)C9&5F9VAI7
XM:FML;6YO<'%R<W1U=G=X>7I[?'U^?X"!@H.$A8:'B(F*BXR-CH^0D9*3E)66`
XMEYB9FIN<G9Z?H*&BHZ2EIJ>HJ:JKK*VNK["QLK.TM;:WN+FZN[R]OK_`P<+#I
XMQ,7&Q\C)RLO,SL[/T-'2T]35UM?8V=K;W-W>W^#AXN/DY>;GZ.GJZ^SM[N_P3
XM\?+S]/7V]_CY^OO\_?[_````2.<@`B(()``L;``F3J[_K$S?0`1.=4YQ+PXB<
XM`"QL`"9.KO^F+%].=4CG(`(B`"0(+&P`)DZN_YI,WT`$3G5.<4CG(`(B`"0(O
XM+&P`)DZN_Y1,WT`$3G5.<2\.(@`L;``F3J[_@BQ?3G4O#BQL`"9.KO]\+%].Q
XM=4YQ+PXB`"QL`"9.KO\N+%].=2\.+&P`(DZN_SHL7TYU3G$O#B)(+&P`(DZN>
XM_RXL7TYU+PXL;``B3J[_"BQ?3G5.<2\.+&P`(DZN_O@L7TYU3G$O#B)(+&P`Y
XM(DZN_MHL7TYU+PXL;``B3J[^SBQ?3G5.<0```^P````7``````````8````*F
XM````$@```!H````B````)@```"H````N````,@```#8````Z````<````!8`T
XM``"*````/@```$(```!&````2@```$X```!2````5@```%H```!>````````(
X"`_**_
X``
Xend
Xsize 8732
END_OF_FILE
if test 12272 -ne `wc -c <'sregexp.uu'`; then
    echo shar: \"'sregexp.uu'\" unpacked with wrong size!
fi
# end of 'sregexp.uu'
fi
if test -f 'sregexp_protos.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sregexp_protos.h'\"
else
echo shar: Extracting \"'sregexp_protos.h'\" \(607 characters\)
sed "s/^X//" >'sregexp_protos.h' <<'END_OF_FILE'
X
X#ifndef LIBRARIES_SREGEXPBASE_H
X#include <libraries/sregexpbase.h>
X#endif
X
Xextern struct SregExpBase *SregExpBase;
X
Xextern struct SregExp *     ParseSregExp(char *);
Xextern void		    FreeSregExp(struct SregExp *);
Xextern int		    MatchSregExp(char *, struct SregExp *, int);
Xextern int		    MatchNSregExp(char *, struct SregExp *, int, int);
Xextern int		    IsWild(char *);
Xextern struct SpathInfo *   AnchorPath(char *, char *);
Xextern int		    NextFile(struct SpathInfo *, char *, int, int);
Xextern int		    BuildPath(struct Spathinf *, char *, int);
Xextern void		    FreeSpathInfo(struct SpathInfo *);
X
END_OF_FILE
if test 607 -ne `wc -c <'sregexp_protos.h'`; then
    echo shar: \"'sregexp_protos.h'\" unpacked with wrong size!
fi
# end of 'sregexp_protos.h'
fi
if test -f 'sregexpbase.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sregexpbase.h'\"
else
echo shar: Extracting \"'sregexpbase.h'\" \(3432 characters\)
sed "s/^X//" >'sregexpbase.h' <<'END_OF_FILE'
X
X/*
X *
X * sregexpbase.h -- C include file for sregexp.library
X *
X * Copyright (C) 1991, Jon Spencer.
X *
X * Created: April 20,1991
X *
X */
X
X#ifndef LIBRARIES_SREGEXPBASE_H
X#define LIBRARIES_SREGEXPBASE_H
X
X#ifndef EXEC_TYPE_H
X#include <exec/types.h>
X#endif
X
X#ifndef EXEC_LISTS_H
X#include <exec/lists.h>
X#endif
X
X#ifndef EXEC_LIBRARIES_H
X#include <exec/libraries.h>
X#endif
X
X#ifndef LIBRARIES_DOS_H
X#include <libraries/dos.h>
X#endif
X
X
X/*
X *
X * Library base structure, all of these fields are private, and
X * should not be accessed.
X *
X */
X
Xstruct SregExpBase {
X    struct Library  LibNode;
X    struct Library  *SysBase;
X    struct Library  *DOSBase;
X    BPTR	    Segment;
X};
X
X#define SREGEXPNAME	   "sregexp.library"
X
X
X/*
X *
X * Here are the defines for the structures used and returned by
X * the various sreg functions.	They should probably not be
X * accessed for there contents, unless you have really good
X * reason...
X *
X */
X
Xstruct SregExp {
X    char			sre_Type,sre_Flag;
X    SHORT			sre_MinLen;
X    union {
X	char	onechar;
X	char	*setchar;
X	char	*string;
X	LONG	number;
X    }				sre_Data;
X    struct SregExp *		sre_List[];
X};
X
X
X/* This is an internal structure for a singly linked list of sregexp's */
Xstruct SregList {
X    struct SregExp		*srl_sreg;
X    struct SregList		*srl_next;
X};
X
X
X/* various types of wildcard pattern elements.
X	Goes in struct SregExp.type field */
X
X#define SRP_SETCHAR	1
X#define SRP_ANYCHAR	2
X#define SRP_ONECHAR	3
X#define SRP_STRING	4
X#define SRP_NULL	5
X#define SRP_OR		6
X#define SRP_SUM 	7
X
X
X
X/* various flags to mark special properties of patterns.
X   Goes in struct SregExp.flag */
X
X#define SRF_NOT 	(1<<0)
X#define SRF_REPEAT	(1<<1)
X#define SRF_FIXLEN	(1<<2)
X#define SRF_JUSTDIRS	(1<<6)    /* special flag used in path matching */
X#define SRF_RECURSE	(1<<7)    /* dito. */
X
X/* defines for the wildcard characters */
X
X#define CHR_REPEAT	'#'
X#define CHR_NOT 	'~'
X#define CHR_OPENBRACE	'('
X#define CHR_CLOSEBRACE	')'
X#define CHR_OPENSET	'['
X#define CHR_CLOSESET	']'
X#define CHR_ANYCHAR	'?'
X#define CHR_NULL	'%'
X#define CHR_OR		'|'
X#define CHR_ESCAPE	'\''
X#define CHR_RANGE	'-'
X#define CHR_STAR	'*'
X
X
X
X
X/* These are the structures used for the path matching routines. */
X
Xstruct SpathInfo {
X    struct SpathNode *		spi_Head;
X    struct SpathNode *		spi_Tail;
X    struct SpathNode *		spi_TailPred;
X    struct SregList *		spi_SregList;
X};
X
X
X/* Note: because of the fileinfoblock, this whole structure MUST
X  be longword aligned. */
X
Xstruct SpathNode {
X    struct SpathNode *		spn_Succ;
X    struct SpathNode *		spn_Pred;
X    struct FileInfoBlock	spn_FIB;
X    BPTR			spn_Lock;
X    struct SregList *		spn_SregList;
X    char *			spn_NodeName;
X    short int			spn_Flags;
X};
X
X/* flags used in spn_Flags, which is  really library private  */
X#define SPF_DECEND	(1<<0)      /* Should recursively search, when we get the chance. */
X#define SPF_DONEONCE	(1<<1)      /* Already done it, don't do again */
X#define SPF_NEXTPARENT	(1<<2)      /* Next one is lock on parentdir */
X
X
X/* These are the possible error returns sent by NextFile and BuildPath */
X
X#define SPE_ALL_DONE	-1	/* no more matching files */
X#define SPE_ERROR	-2	/* some error occured, see IoErr() */
X#define SPE_BUFF_FULL	-3	/* you didn't give me enough room! */
X#define SPE_SIGBREAK	-4	/* A control signal came through.  */
X
X
X/* Some defines for what kind of events we match to. */
X
X#define SP_DIRS_ONLY	1
X#define SP_BOTH 	0
X#define SP_FILES_ONLY	-1
X
X#endif
END_OF_FILE
if test 3432 -ne `wc -c <'sregexpbase.h'`; then
    echo shar: \"'sregexpbase.h'\" unpacked with wrong size!
fi
# end of 'sregexpbase.h'
fi
if test -f 'sregexpbase.i' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sregexpbase.i'\"
else
echo shar: Extracting \"'sregexpbase.i'\" \(3339 characters\)
sed "s/^X//" >'sregexpbase.i' <<'END_OF_FILE'
X	IFND	    LIBRARIES_SREGEXPBASE_I
XLIBRARIES_SREGEXPBASE_I set	1
X
X*********************************************************************
X*								    *
X* sregbase.i -- asm include file for sreg.library		    *
X*								    *
X* Copyright (C) 1991, Jon Spencer.                                  *
X*								    *
X* Created: April 20,1991					    *
X*								    *
X*********************************************************************
X
X	IFND	    EXEC_TYPES_I
X	INCLUDE     "exec/types.i"
X	ENDC
X
X	IFND	    EXEC_LISTS_I
X	INCLUDE     "exec/lists.i"
X	ENDC
X
X	IFND	    EXEC_LIBRARIES_I
X	INCLUDE     "exec/libraries.i"
X	ENDC
X
X	IFND	    LIBRARIES_DOS_I
X	INCLUDE     "libraries/dos.i"
X	ENDC
X
X
X
X;
X;
X; Library base structure, all of these fields are private, and
X; should not be accessed.
X;
X;
X
X    STRUCTURE	SregExpBase,LIB_SIZE
X    APTR	    sb_SysBase
X    APTR	    sb_DOSBase
X    ULONG	    sb_SegList
X    LABEL	SregExpBase_SIZE
X
X
X
XSREGEXPNAME	macro
X		dc.b	    "sregexp.library",0
X		endm
X
X;
X;
X; Here are the equates for the structures used and returned by
X; the various sreg functions.  They should probably not be
X; accessed for there contents, unless you have really good
X; reason...
X;
X;
X    STRUCTURE	SregExp,0
X    BYTE		    sre_Type
X    BYTE		    sre_Flag
X    SHORT		    sre_MinLen
X    ULONG		    sre_Data
X    APTR		    sre_List
X    LABEL	SregExp_SIZE
X
X
X; sre_Data is a union, here are its elements.
Xsre_onechar	 EQU	     sre_Data
Xsre_setchar	 EQU	     sre_Data
Xsre_string	 EQU	     sre_Data
Xsre_number	 EQU	     sre_Data
X
X
X; This is an internal structure for a singly linked list of sregexp's
X
X    STRUCTURE	SregList,0
X    APTR		    srl_sreg
X    APTR		    srl_next
X    LABEL	SregList_SIZE
X
X
X; various types of wildcard pattern elements.  Goes in spat_t.type
X
XSRP_SETCHAR  EQU	     1
XSRP_ANYCHAR  EQU	     2
XSRP_ONECHAR  EQU	     3
XSRP_STRING   EQU	     4
XSRP_NULL     EQU	     5
XSRP_OR	     EQU	     6
XSRP_SUM      EQU	     7
X
X; various flags to mark special properties of patterns.
X; Goes in SregExp.sre_Flag
X
X    BITDEF	SR,NOT,0
X    BITDEF	SR,REPEAT,1
X    BITDEF	SR,FIXLEN,2
X    BITDEF	SR,JUSTDIRS,6
X    BITDEF	SR,RECURSE,7
X
X; equates for the wildcard characters
X
XCHR_REPEAT	EQU	    '#'
XCHR_NOT 	EQU	    '~'
XCHR_OPENBRACE	EQU	    '('
XCHR_CLOSEBRACE	EQU	    ')'
XCHR_OPENSET	EQU	    '['
XCHR_CLOSESET	EQU	    ']'
XCHR_ANYCHAR	EQU	    '?'
XCHR_NULL	EQU	    '%'
XCHR_OR		EQU	    '|'
XCHR_ESCAPE	EQU	    "'"
XCHR_RANGE	EQU	    '-'
XCHR_STAR	EQU	    '*'
X
X
X;
X; These are the structures used for the path matching routines.
X;
X
X    STRUCTURE	SpathInfo,0
X    APTR		spi_Head
X    APTR		spi_Tail
X    APTR		spi_TailPred
X    APTR		spi_SregList;
X    LABEL	SpathInfo_SIZE
X
X
X; Note: because of the fileinfoblock, this whole structure MUST
X; be longword aligned.
X
X    STRUCTURE	SpathNode,0
X    APTR		spn_Succ
X    APTR		spn_Pred
X    STRUCT		spn_FIB,fib_SIZEOF
X    BPTR		spn_Lock
X    APTR		spn_SregList
X    APTR		spn_NodeName
X    SHORT		spn_Flags
X    LABEL	SpathNode_SIZE
X
X; flags used in spn_Flags, which is  really library private.
X
X    BITDEF  SP,DECEND,0
X    BITDEF  SP,DONEONCE,1
X    BITDEF  SP,NEXTPARENT,2
X
X; These are the possible error returns sent by NextFile and BuildPath
X
XSPE_ALL_DONE	EQU	-1
XSPE_ERROR	EQU	-2
XSPE_BUFF_FULL	EQU	-3
XSPE_SIGBREAK	EQU	-4
X
X
X; Some defines for what kind of events we match to.
X
XSP_DIRS_ONLY	EQU	1
XSP_BOTH 	EQU	0
XSP_FILES_ONLY	EQU	-1
X
X	ENDC
END_OF_FILE
if test 3339 -ne `wc -c <'sregexpbase.i'`; then
    echo shar: \"'sregexpbase.i'\" unpacked with wrong size!
fi
# end of 'sregexpbase.i'
fi
if test -f 'sregexps.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sregexps.uu'\"
else
echo shar: Extracting \"'sregexps.uu'\" \(1705 characters\)
sed "s/^X//" >'sregexps.uu' <<'END_OF_FILE'
Xbegin 600 sregexps.lib
XM```#YP````````/H`````````^D````%+PX@;P`(+&P``$ZN_^(L7TYU3G$`<
XM``/OA@```U]3<F5G17AP0F%S90````$````(`0``!%]087)S95-R96=%>'``Y
XM`````````````````_(```/G`````````^@````````#Z0````4O#B!O``@L[
XM;```3J[_W"Q?3G5.<0```^^&```#7U-R96=%>'!"87-E`````0````@!```#P
XM7T9R9653<F5G17AP``````````````/R```#YP````````/H`````````^D`5
XM```&+PY,[P,```@@+P`0+&P``$ZN_]8L7TYU```#[X8```-?4W)E9T5X<$)A:
XM<V4````!````#@$```1?36%T8VA3<F5G17AP``````````````````/R```#N
XMYP````````/H`````````^D````'+PY,[P,```A,[P`#`!`L;```3J[_T"Q?$
XM3G5.<0```^^&```#7U-R96=%>'!"87-E`````0```!`!```$7TUA=&-H3E-R*
XM96=%>'`````````````````#\@```^<````````#Z`````````/I````!2\.Q
XM(&\`""QL``!.KO_*+%].=4YQ```#[X8```-?4W)E9T5X<$)A<V4````!````5
XM"`$```)?27-7:6QD```````````````#\@```^<````````#Z`````````/IL
XM````!2\.3.\#```(+&P``$ZN_\0L7TYU```#[X8```-?4W)E9T5X<$)A<V4``
XM```!````"@$```-?06YC:&]R4&%T:````````````````_(```/G````````U
XM`^@````````#Z0````<O#DSO`P``"$SO``,`$"QL``!.KO^^+%].=4YQ```#0
XM[X8```-?4W)E9T5X<$)A<V4````!````$`$```-?3F5X=$9I;&4`````````C
XM`````````_(```/G`````````^@````````#Z0````8O#DSO`P``""`O`!`L*
XM;```3J[_N"Q?3G4```/OA@```U]3<F5G17AP0F%S90````$````.`0```U]"T
XM=6EL9%!A=&@````````````````#\@```^<````````#Z`````````/I````Q
XM!2\.(&\`""QL``!.KO^R+%].=4YQ```#[X8```-?4W)E9T5X<$)A<V4````!_
XM````"`$```1?1G)E95-P871H26YF;P````````````````/R```#YP``````9
XM``/H`````````^D````````#[P(```5?3%9/1G)E95-P871H26YF;P```/__L
XM_[("```$7TQ63T)U:6QD4&%T:````/___[@"```#7TQ63TYE>'1&:6QE____J
XMO@(```1?3%9/06YC:&]R4&%T:```____Q`(```-?3%9/27-7:6QD``#____*E
XM`@``!5],5D]-871C:$Y3<F5G17AP````____T`(```1?3%9/36%T8VA3<F5GQ
XM17AP____U@(```1?3%9/1G)E95-R96=%>'``____W`(```1?3%9/4&%R<V533
X2<F5G17AP____X@````````/R_
X``
Xend
Xsize 1188
END_OF_FILE
if test 1705 -ne `wc -c <'sregexps.uu'`; then
    echo shar: \"'sregexps.uu'\" unpacked with wrong size!
fi
# end of 'sregexps.uu'
fi
if test -f 'sregexpsr.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sregexpsr.uu'\"
else
echo shar: Extracting \"'sregexpsr.uu'\" \(1623 characters\)
sed "s/^X//" >'sregexpsr.uu' <<'END_OF_FILE'
Xbegin 600 sregexpsr.lib
XM```#YP````````/H`````````^D````$+PXL;```3J[_XBQ?3G5.<0```^^&\
XM```#7U-R96=%>'!"87-E`````0````0!```$0%!A<G-E4W)E9T5X<```````>
XM```````````#\@```^<````````#Z`````````/I````!"\.+&P``$ZN_]PL2
XM7TYU3G$```/OA@```U]3<F5G17AP0F%S90````$````$`0```T!&<F5E4W)EI
XM9T5X<``````````````#\@```^<````````#Z`````````/I````!"\.+&P`C
XM`$ZN_]8L7TYU3G$```/OA@```U]3<F5G17AP0F%S90````$````$`0``!$!-(
XM871C:%-R96=%>'```````````````````_(```/G`````````^@````````#K
XMZ0````0O#BQL``!.KO_0+%].=4YQ```#[X8```-?4W)E9T5X<$)A<V4````!N
XM````!`$```1`36%T8VA.4W)E9T5X<`````````````````/R```#YP``````A
XM``/H`````````^D````$+PXL;```3J[_RBQ?3G5.<0```^^&```#7U-R96=%R
XM>'!"87-E`````0````0!```"0$ES5VEL9````````````````_(```/G````6
XM`````^@````````#Z0````0O#BQL``!.KO_$+%].=4YQ```#[X8```-?4W)E`
XM9T5X<$)A<V4````!````!`$```-`06YC:&]R4&%T:````````````````_(`U
XM``/G`````````^@````````#Z0````0O#BQL``!.KO^^+%].=4YQ```#[X8`8
XM``-?4W)E9T5X<$)A<V4````!````!`$```-`3F5X=$9I;&4`````````````#
XM`````_(```/G`````````^@````````#Z0````0O#BQL``!.KO^X+%].=4YQ/
XM```#[X8```-?4W)E9T5X<$)A<V4````!````!`$```-`0G5I;&10871H````9
XM`````````````_(```/G`````````^@````````#Z0````0O#BQL``!.KO^R\
XM+%].=4YQ```#[X8```-?4W)E9T5X<$)A<V4````!````!`$```1`1G)E95-PO
XM871H26YF;P````````````````/R```#YP````````/H`````````^D`````_
XM```#[P(```5?3%9/1G)E95-P871H26YF;P```/___[("```$7TQ63T)U:6QD,
XM4&%T:````/___[@"```#7TQ63TYE>'1&:6QE____O@(```1?3%9/06YC:&]RB
XM4&%T:```____Q`(```-?3%9/27-7:6QD``#____*`@``!5],5D]-871C:$Y3;
XM<F5G17AP````____T`(```1?3%9/36%T8VA3<F5G17AP____U@(```1?3%9/B
XM1G)E95-R96=%>'``____W`(```1?3%9/4&%R<V53<F5G17AP____X@``````'
X#``/RU
X``
Xend
Xsize 1128
END_OF_FILE
if test 1623 -ne `wc -c <'sregexpsr.uu'`; then
    echo shar: \"'sregexpsr.uu'\" unpacked with wrong size!
fi
# end of 'sregexpsr.uu'
fi
if test ! -d 'utils' ; then
    echo shar: Creating directory \"'utils'\"
    mkdir 'utils'
fi
if test -f 'utils/bumprev.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'utils/bumprev.c'\"
else
echo shar: Extracting \"'utils/bumprev.c'\" \(1133 characters\)
sed "s/^X//" >'utils/bumprev.c' <<'END_OF_FILE'
X
X#include <stdio.h>
X#include <string.h>
X#include <ctype.h>
X#include <stdlib.h>
X
Xint
Xmain(ac,av)
Xint ac;
Xchar **av;
X{
X    FILE *fp;
X    int i = 0,r,v,f=0;
X    char buff[100],*line[100],*p;
X
X    if (ac == 2 && strcmp(av[1],"-v") == 0)
X	f = 1;
X    if (!(fp = fopen("sreg_version.i","r+"))) {
X	puts("Unable to open input.");
X	return 30;
X    }
X
X    while (fgets(buff,100,fp) == buff)
X	line[i++] = strdup(buff);
X    line[i] = NULL;
X
X    fseek(fp,0,SEEK_SET);
X    for (i = 0; line[i]; i++) {
X	if (strncmp(line[i],"VERSION",7) == 0) {
X	    p = line[i];
X	    while (!isdigit(*p)) p++;
X	    v = atoi(p);
X	    if (f) {
X		v++;
X		sprintf(p,"%d\n",v);
X	    }
X	} else
X	if (strncmp(line[i],"REVISION",8) == 0) {
X	    p = line[i];
X	    while (!isdigit(*p)) p++;
X	    r = atoi(p)+1;
X	    if (f)
X		r = 0;
X	    sprintf(p,"%d\n",r);
X	}
X	fputs(line[i],fp);
X    }
X    fclose(fp);
X    if (!(fp = fopen("sreg_version.c","w"))) {
X	puts("Unable to open c file.");
X	return 10;
X    }
X    fprintf(fp,
X"\n\nconst __far char idString[] = \"sreglib %d.%d (\"__DATE__\")\\x0d\\x0a\";\n"
X,v,r);
X    fclose(fp);
X    printf("Up to version %d.%d\n",v,r);
X    return 0;
X}
END_OF_FILE
if test 1133 -ne `wc -c <'utils/bumprev.c'`; then
    echo shar: \"'utils/bumprev.c'\" unpacked with wrong size!
fi
# end of 'utils/bumprev.c'
fi
if test -f 'utils/remlib.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'utils/remlib.c'\"
else
echo shar: Extracting \"'utils/remlib.c'\" \(523 characters\)
sed "s/^X//" >'utils/remlib.c' <<'END_OF_FILE'
X
X#include <exec/types.h>
X#include <exec/libraries.h>
X#include <clib/exec_protos.h>
X#include <exec/execbase.h>
X#include <stdio.h>
X#include <stdlib.h>
X
Xextern struct ExecBase *SysBase;
X
Xint
Xmain(ac,av)
Xint ac;
Xchar **av;
X{
X    struct Library *found;
X
X    if (ac != 2) {
X	puts("Use: remlib <library name>");
X	return 10;
X    }
X
X    Forbid();
X    if (found = (struct Library *)FindName(&SysBase->LibList,av[1]))
X	RemLibrary(found);
X    Permit();
X    if (!found)
X	return 5;
X    puts("OK, hopefully it is gone.");
X    return 0;
X}
END_OF_FILE
if test 523 -ne `wc -c <'utils/remlib.c'`; then
    echo shar: \"'utils/remlib.c'\" unpacked with wrong size!
fi
# end of 'utils/remlib.c'
fi
if test -f 'utils/try.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'utils/try.c'\"
else
echo shar: Extracting \"'utils/try.c'\" \(1755 characters\)
sed "s/^X//" >'utils/try.c' <<'END_OF_FILE'
X
X#include "sregexpbase.h"
X#include "sregexp_protos.h"
X#include <libraries/dos.h>
X#include <clib/exec_protos.h>
X#include <clib/dos_protos.h>
X#include <string.h>
X#include <assert.h>
X#include <stdlib.h>
X
Xstruct SregExpBase *SregExpBase;
X
Xvoid
Xputs(c)
Xchar *c;
X{
Xchkabort();
X    Write(Output(),c,strlen(c));
X    Write(Output(),"\n",1);
X}
X
X#include <stdarg.h>
X
Xextern void vsprintf(char *, char *, va_list);
X
Xvoid printf(f, ...)
Xchar *f;
X{
X    char buff[100];
X    va_list va;
X
Xchkabort();
X    va_start(va,f);
X    vsprintf(buff,f,va);
X    va_end(va);
X    Write(Output(),buff,strlen(buff));
X}
X
Xint
Xbrk()
X{  /* Don't worry about lost memory for now... */
X
XWrite(Output(),"BREAK\n",6);
X    CloseLibrary(SregExpBase);
X    return 1;
X
X}
X
Xint
Xmain(ac,av)
Xint ac;
Xchar *av;
X{
X    struct SregExp *pat;
X    struct SpathInfo *spi;
X    char buff[300],fb[110];
X    BPTR    lock;
X
X    if (!(SregExpBase = OpenLibrary("sregexp.library",0))) {
X	puts("Unable to open library.");
X	return 5;
X    }
X    onbreak(brk);
X/*
X    assert(pat = ParseSregExp("#?dog"));
X
X    if (MatchSregExp("hello dog",pat,1))
X	puts("right");
X    else
X	puts("wrong");
X
X    if (MatchSregExp("hello Dog",pat,1))
X	puts("right");
X    else
X	puts("wrong");
X
X    if (MatchSregExp("hello Dog",pat,0))
X	puts("right");
X    else
X	puts("wrong");
X
X    if (MatchSregExp("hello cat",pat,1))
X	puts("right");
X    else
X	puts("wrong");
X
X    FreeSregExp(pat);
X*/
X    assert(pat = ParseSregExp("(Programs|Shell)"));
X
X    if (!(spi = AnchorPath("","DCC:#?/dme.refs"))) {
X	puts("Couldn't start search.");
X	CloseLibrary(SregExpBase);
X	return 10;
X    }
Xputs("Path anchored");
X    while (NextFile(spi,buff,300,0) != SPE_ALL_DONE) {
X	printf("----------> %s\n",buff);
X    }
X
X    FreeSpathInfo(spi);
X
X    CloseLibrary(SregExpBase);
X}
END_OF_FILE
if test 1755 -ne `wc -c <'utils/try.c'`; then
    echo shar: \"'utils/try.c'\" unpacked with wrong size!
fi
# end of 'utils/try.c'
fi
echo shar: End of archive 1 \(of 2\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked both archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
Mail comments to the moderator at <amiga-request@uunet.uu.net>.
Post requests for sources, and general discussion to comp.sys.amiga.misc.