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/skip_parentesis.f | |
Initial import of htcd system 1.0
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/mt/skip_parentesis.f')
| -rw-r--r-- | src/mt/skip_parentesis.f | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mt/skip_parentesis.f b/src/mt/skip_parentesis.f new file mode 100644 index 0000000..1104c8f --- /dev/null +++ b/src/mt/skip_parentesis.f | |||
| @@ -0,0 +1,42 @@ | |||
| 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 skip_parentesis(s,n,left,right,esc) | ||
| 21 | character s(0:1),left,right,esc | ||
| 22 | integer i,n,cnt | ||
| 23 | if(n.eq.0)go to 40 | ||
| 24 | if(s(0).ne.left)go to 40 | ||
| 25 | cnt=1 | ||
| 26 | do 10 i=1,n-1 | ||
| 27 | if(s(i-1).eq.esc)go to 10 | ||
| 28 | if(s(i).eq.right)then | ||
| 29 | cnt=cnt-1 | ||
| 30 | if(cnt.eq.0)go to 30 | ||
| 31 | else if(s(i).eq.left)then | ||
| 32 | cnt=cnt+1 | ||
| 33 | end if | ||
| 34 | 10 continue | ||
| 35 | 20 skip_parentesis=-1 | ||
| 36 | return | ||
| 37 | 30 skip_parentesis=i+1 | ||
| 38 | return | ||
| 39 | 40 skip_parentesis=0 | ||
| 40 | return | ||
| 41 | end | ||
| 42 | |||
