diff options
Diffstat (limited to 'src/mt/crfind.f')
| -rw-r--r-- | src/mt/crfind.f | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/mt/crfind.f b/src/mt/crfind.f new file mode 100644 index 0000000..f996ac4 --- /dev/null +++ b/src/mt/crfind.f | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc | ||
| 2 | c | ||
| 3 | c HTCd - Copyright (C) 1998-2006 Henrik Rydberg | ||
| 4 | c | ||
| 5 | c This program is free software; you can redistribute it and/or modify | ||
| 6 | c it under the terms of the GNU General Public License as published by | ||
| 7 | c the Free Software Foundation; either version 2 of the License, or | ||
| 8 | c (at your option) any later version. | ||
| 9 | c | ||
| 10 | c This program is distributed in the hope that it will be useful, | ||
| 11 | c but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | c GNU General Public License for more details. | ||
| 14 | c | ||
| 15 | c You should have received a copy of the GNU General Public License | ||
| 16 | c along with this program; if not, write to the Free Software | ||
| 17 | c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 18 | c | ||
| 19 | |||
| 20 | integer function crfind(s,n,c) | ||
| 21 | character s(0:1),c | ||
| 22 | integer i,m,n | ||
| 23 | m=mod(n,16) | ||
| 24 | do 10 i=n-16,m,-16 | ||
| 25 | if(s(i+15).eq.c)go to 115 | ||
| 26 | if(s(i+14).eq.c)go to 114 | ||
| 27 | if(s(i+13).eq.c)go to 113 | ||
| 28 | if(s(i+12).eq.c)go to 112 | ||
| 29 | if(s(i+11).eq.c)go to 111 | ||
| 30 | if(s(i+10).eq.c)go to 110 | ||
| 31 | if(s(i+9).eq.c)go to 109 | ||
| 32 | if(s(i+8).eq.c)go to 108 | ||
| 33 | if(s(i+7).eq.c)go to 107 | ||
| 34 | if(s(i+6).eq.c)go to 106 | ||
| 35 | if(s(i+5).eq.c)go to 105 | ||
| 36 | if(s(i+4).eq.c)go to 104 | ||
| 37 | if(s(i+3).eq.c)go to 103 | ||
| 38 | if(s(i+2).eq.c)go to 102 | ||
| 39 | if(s(i+1).eq.c)go to 101 | ||
| 40 | if(s(i).eq.c)go to 100 | ||
| 41 | 10 continue | ||
| 42 | do 20 i=m-1,0,-1 | ||
| 43 | if(s(i).eq.c)go to 100 | ||
| 44 | 20 continue | ||
| 45 | crfind=-1 | ||
| 46 | return | ||
| 47 | 100 crfind=i | ||
| 48 | return | ||
| 49 | 101 crfind=i+1 | ||
| 50 | return | ||
| 51 | 102 crfind=i+2 | ||
| 52 | return | ||
| 53 | 103 crfind=i+3 | ||
| 54 | return | ||
| 55 | 104 crfind=i+4 | ||
| 56 | return | ||
| 57 | 105 crfind=i+5 | ||
| 58 | return | ||
| 59 | 106 crfind=i+6 | ||
| 60 | return | ||
| 61 | 107 crfind=i+7 | ||
| 62 | return | ||
| 63 | 108 crfind=i+8 | ||
| 64 | return | ||
| 65 | 109 crfind=i+9 | ||
| 66 | return | ||
| 67 | 110 crfind=i+10 | ||
| 68 | return | ||
| 69 | 111 crfind=i+11 | ||
| 70 | return | ||
| 71 | 112 crfind=i+12 | ||
| 72 | return | ||
| 73 | 113 crfind=i+13 | ||
| 74 | return | ||
| 75 | 114 crfind=i+14 | ||
| 76 | return | ||
| 77 | 115 crfind=i+15 | ||
| 78 | return | ||
| 79 | end | ||
| 80 | |||
