summaryrefslogtreecommitdiff
path: root/src/mt/sfindtab.f
blob: b4e148e407c2fec11e6f52aa6e13fb9a305109ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c HTCd - Copyright (C) 1998-2006 Henrik Rydberg
c
c This program is free software; you can redistribute it and/or modify
c it under the terms of the GNU General Public License as published by
c the Free Software Foundation; either version 2 of the License, or
c (at your option) any later version.
c
c This program is distributed in the hope that it will be useful,
c but WITHOUT ANY WARRANTY; without even the implied warranty of
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c GNU General Public License for more details.
c
c You should have received a copy of the GNU General Public License
c along with this program; if not, write to the Free Software
c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
c

      integer function sfindtab(s,sn,c,cn,tab)
      byte s(0:1),c(0:1),tab(0:1)
      integer i,j,m,sn,cn
      m=mod(cn,4)
      do 10 i=0,sn-1
         do 20 j=0,m-1
            if(tab(s(i+j)).ne.tab(c(j)))go to 50
 20      continue
         do 30 j=m,cn-1,4
            if(tab(s(i+j)).ne.tab(c(j)))go to 50
            if(tab(s(i+j+1)).ne.tab(c(j+1)))go to 50
            if(tab(s(i+j+2)).ne.tab(c(j+2)))go to 50
            if(tab(s(i+j+3)).ne.tab(c(j+3)))go to 50
 30      continue
 50      if(j.eq.cn)go to 100
 10   continue
      sfindtab=-1
      return
 100  sfindtab=i
      return
      end