home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 278.lha / RegexLibrary_v1.0 / interface.asm < prev    next >
Assembly Source File  |  1989-08-06  |  3KB  |  169 lines

  1. ;  Library glue code between assembler and C for the GNU regular
  2. ;  expression library. Edwin Hoogerbeets 18/07/89
  3. ;
  4. ;  This file may be copied and distributed under the GNU Public
  5. ;  Licence. See the comment at the top of regex.c for details.
  6. ;
  7. ;  Adapted from Elib by Jim Mackraz, mklib by Edwin Hoogerbeets, and the
  8. ;  GNU regular expression package by the Free Software Foundation.
  9.  
  10.         include 'exec/types.i'
  11.  
  12. setup   macro
  13.         movem.l d2/d3/d4-d7/a2-a6,-(sp)
  14.         jsr     _geta4
  15.         endm
  16.  
  17. push    macro
  18.         move.l  \1,-(sp)
  19.         endm
  20.  
  21. fix     macro
  22.         ifc     '\1',''
  23.                 mexit
  24.         endc
  25.         ifle    \1-8
  26.                 addq.l  #\1,sp
  27.         endc
  28.         ifgt    \1-8
  29.                 lea     \1(sp),sp
  30.         endc
  31.         endm
  32.  
  33. restore macro
  34.         fix     \1
  35.         movem.l (sp)+,d2/d3/d4-d7/a2-a6
  36.         rts
  37.         endm
  38.  
  39.         dseg
  40.  
  41.         public  _libfunctab
  42. _libfunctab:
  43.         dc.l    myopen
  44.         dc.l    myclose
  45.         dc.l    myexpunge
  46.         dc.l    $0000
  47.         dc.l    Xre_initialize_buffer
  48.         dc.l    Xre_terminate_buffer
  49.         dc.l    Xre_compile_pattern
  50.         dc.l    Xre_compile_fastmap
  51.         dc.l    Xre_search
  52.         dc.l    Xre_search_2
  53.         dc.l    Xre_match
  54.         dc.l    Xre_match_2
  55.         dc.l    $ffffffff
  56.  
  57.         cseg
  58.  
  59.         ;--- library functions
  60.         public  _myOpen
  61.         public  _myClose
  62.         public  _myExpunge
  63.         public  _re_initialize_buffer
  64.         public  _re_terminate_buffer
  65.         public  _re_compile_pattern
  66.         public  _re_compile_fastmap
  67.         public  _re_search
  68.         public  _re_search_2
  69.         public  _re_match
  70.         public  _re_match_2
  71.  
  72.         public  _geta4
  73.  
  74. myopen:
  75.         setup
  76.         push a6
  77.         jsr     _myOpen
  78.         restore 4
  79.  
  80. myclose:
  81.         setup
  82.         push a6
  83.         jsr     _myClose
  84.         restore 4
  85.  
  86. myexpunge:
  87.         setup
  88.         push a6
  89.         jsr     _myExpunge
  90.         restore 4
  91.  
  92. Xre_initialize_buffer:
  93.         setup
  94.         push d1
  95.         push d0
  96.         jsr _re_initialize_buffer
  97.         restore 8
  98.  
  99. Xre_terminate_buffer:
  100.         setup
  101.         push d0
  102.         jsr _re_terminate_buffer
  103.         restore 4
  104.  
  105. Xre_compile_pattern:
  106.         setup
  107.         push a1
  108.         push a0
  109.         push d1
  110.         push d0
  111.         jsr _re_compile_pattern
  112.         restore 16
  113.  
  114. Xre_compile_fastmap:
  115.         setup
  116.         push d0
  117.         jsr _re_compile_fastmap
  118.         restore 4
  119.  
  120. Xre_search:
  121.         setup
  122.         push d3
  123.         push d2
  124.         push a1
  125.         push a0
  126.         push d1
  127.         push d0
  128.         jsr _re_search
  129.         restore 24
  130.  
  131. Xre_search_2:
  132.         setup
  133.         push d6
  134.         push d5
  135.         push d4
  136.         push d3
  137.         push d2
  138.         push a1
  139.         push a0
  140.         push d1
  141.         push d0
  142.         jsr _re_search_2
  143.         restore 36
  144.  
  145. Xre_match:
  146.         setup
  147.         push d2
  148.         push a1
  149.         push a0
  150.         push d1
  151.         push d0
  152.         jsr _re_match
  153.         restore 20
  154.  
  155. Xre_match_2:
  156.         setup
  157.         push d5
  158.         push d4
  159.         push d3
  160.         push d2
  161.         push a1
  162.         push a0
  163.         push d1
  164.         push d0
  165.         jsr _re_match_2
  166.         restore 32
  167.  
  168.         end
  169.