;  Glue code between assembler and C for the GNU regular expression library. Edwin Hoogerbeets 18/07/89
;
;  This file may be copied and distributed under the GNU Public
;  Licence. See the comment at the top of regex.c for details.
;
;  Adapted from Elib by Jim Mackraz, mklib by Edwin Hoogerbeets, and the
;  GNU regular expression package by the Free Software Foundation.

        include 'exec/types.i'

; external references
        public _re_BSD_initialize
        public _re_BSD_terminate
        public _re_comp
        public _re_exec


; external definitions
        public re_BSD_initialize
        public re_BSD_terminate
        public re_comp
        public re_exec

        public _geta4

setup   macro
        movem.l d2/d3/d4-d7/a2-a6,-(sp)
        jsr     _geta4
        endm

push    macro
        move.l  \1,-(sp)
        endm

fix     macro
        ifc     '\1',''
                mexit
        endc
        ifle    \1-8
                addq.l  #\1,sp
        endc
        ifgt    \1-8
                lea     \1(sp),sp
        endc
        endm

restore macro
        fix     \1
        movem.l (sp)+,d2/d3/d4-d7/a2-a6
        rts
        endm

        cseg

;
; These four routines are written in C, so the arguments, if any, must
; be put on the stack
;
re_BSD_initialize:
        jmp _re_BSD_initialize

re_BSD_terminate:
        jmp _re_BSD_terminate

re_comp:
        setup
        push d0
        jsr _re_comp
        restore 4

re_exec:
        setup
        push d0
        jsr _re_exec
        restore 4

        end





