-
Notifications
You must be signed in to change notification settings - Fork 0
/
batop2.f
35 lines (29 loc) · 1.17 KB
/
batop2.f
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
SUBROUTINE BATOP2
implicitnone
integer I
character*26 LCLETS, UCLETS
C CMPMAP is indexed by the ordinal value of a character, that is,
C ICHAR(C). If two values of CMPMAP are equal, the characters
C that indexed the two equal values are to be considered to be
C equal. Furthermore, the elements of CMPMAP that are indexed by
C the ordinal values of letters are positive, while others are
C negative. This all assumes ASCII i.e. 256-character set
INTEGER CMPMAP(0:255)
COMMON /C28/ CMPMAP
DATA LCLETS /'abcdefghijklmnopqrstuvwxyz'/
DATA UCLETS /'ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
C ------------------------------------------------------------------
C Initialize all values to negative of the index
C N.B. letters will be overridden below
DO I = 0,255
CMPMAP(I) = -I
ENDDO
C Initialize english alphabet letters to their alphabetic positions,
C so mapped values for lower- and upper-case versions of the same
C letter will match
DO I = 1, 26
CMPMAP(ichar(UCLETS(I:I))) = I
CMPMAP(ichar(LCLETS(I:I))) = I
ENDDO
RETURN
END