diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
| commit | 5df79c53745fde5d6c3340a2979b1429cd5892c1 (patch) | |
| tree | 1a81af141708b826e9c61e8a04019994fcca8298 /src/mt/rfind_of.f | |
Initial import of htcd system 1.0
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/mt/rfind_of.f')
| -rw-r--r-- | src/mt/rfind_of.f | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/mt/rfind_of.f b/src/mt/rfind_of.f new file mode 100644 index 0000000..5fa0931 --- /dev/null +++ b/src/mt/rfind_of.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 rfind_of(s,n,c) | ||
| 21 | byte s(0:1),c(0:1) | ||
| 22 | integer i,m,n | ||
| 23 | m=mod(n,16) | ||
| 24 | do 10 i=n-16,m,-16 | ||
| 25 | if(c(s(i+15)).ne.0)go to 115 | ||
| 26 | if(c(s(i+14)).ne.0)go to 114 | ||
| 27 | if(c(s(i+13)).ne.0)go to 113 | ||
| 28 | if(c(s(i+12)).ne.0)go to 112 | ||
| 29 | if(c(s(i+11)).ne.0)go to 111 | ||
| 30 | if(c(s(i+10)).ne.0)go to 110 | ||
| 31 | if(c(s(i+9)).ne.0)go to 109 | ||
| 32 | if(c(s(i+8)).ne.0)go to 108 | ||
| 33 | if(c(s(i+7)).ne.0)go to 107 | ||
| 34 | if(c(s(i+6)).ne.0)go to 106 | ||
| 35 | if(c(s(i+5)).ne.0)go to 105 | ||
| 36 | if(c(s(i+4)).ne.0)go to 104 | ||
| 37 | if(c(s(i+3)).ne.0)go to 103 | ||
| 38 | if(c(s(i+2)).ne.0)go to 102 | ||
| 39 | if(c(s(i+1)).ne.0)go to 101 | ||
| 40 | if(c(s(i)).ne.0)go to 100 | ||
| 41 | 10 continue | ||
| 42 | do 20 i=m-1,0,-1 | ||
| 43 | if(c(s(i)).ne.0)go to 100 | ||
| 44 | 20 continue | ||
| 45 | rfind_of=-1 | ||
| 46 | return | ||
| 47 | 100 rfind_of=i | ||
| 48 | return | ||
| 49 | 101 rfind_of=i+1 | ||
| 50 | return | ||
| 51 | 102 rfind_of=i+2 | ||
| 52 | return | ||
| 53 | 103 rfind_of=i+3 | ||
| 54 | return | ||
| 55 | 104 rfind_of=i+4 | ||
| 56 | return | ||
| 57 | 105 rfind_of=i+5 | ||
| 58 | return | ||
| 59 | 106 rfind_of=i+6 | ||
| 60 | return | ||
| 61 | 107 rfind_of=i+7 | ||
| 62 | return | ||
| 63 | 108 rfind_of=i+8 | ||
| 64 | return | ||
| 65 | 109 rfind_of=i+9 | ||
| 66 | return | ||
| 67 | 110 rfind_of=i+10 | ||
| 68 | return | ||
| 69 | 111 rfind_of=i+11 | ||
| 70 | return | ||
| 71 | 112 rfind_of=i+12 | ||
| 72 | return | ||
| 73 | 113 rfind_of=i+13 | ||
| 74 | return | ||
| 75 | 114 rfind_of=i+14 | ||
| 76 | return | ||
| 77 | 115 rfind_of=i+15 | ||
| 78 | return | ||
| 79 | end | ||
| 80 | |||
