root / src / lapack / util / lsame.f @ 7
Historique | Voir | Annoter | Télécharger (2,35 ko)
1 | 1 | pfleura2 | LOGICAL FUNCTION LSAME( CA, CB ) |
---|---|---|---|
2 | 1 | pfleura2 | * |
3 | 1 | pfleura2 | * -- LAPACK auxiliary routine (version 3.1) -- |
4 | 1 | pfleura2 | * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. |
5 | 1 | pfleura2 | * November 2006 |
6 | 1 | pfleura2 | * |
7 | 1 | pfleura2 | * .. Scalar Arguments .. |
8 | 1 | pfleura2 | CHARACTER CA, CB |
9 | 1 | pfleura2 | * .. |
10 | 1 | pfleura2 | * |
11 | 1 | pfleura2 | * Purpose |
12 | 1 | pfleura2 | * ======= |
13 | 1 | pfleura2 | * |
14 | 1 | pfleura2 | * LSAME returns .TRUE. if CA is the same letter as CB regardless of |
15 | 1 | pfleura2 | * case. |
16 | 1 | pfleura2 | * |
17 | 1 | pfleura2 | * Arguments |
18 | 1 | pfleura2 | * ========= |
19 | 1 | pfleura2 | * |
20 | 1 | pfleura2 | * CA (input) CHARACTER*1 |
21 | 1 | pfleura2 | * CB (input) CHARACTER*1 |
22 | 1 | pfleura2 | * CA and CB specify the single characters to be compared. |
23 | 1 | pfleura2 | * |
24 | 1 | pfleura2 | * ===================================================================== |
25 | 1 | pfleura2 | * |
26 | 1 | pfleura2 | * .. Intrinsic Functions .. |
27 | 1 | pfleura2 | INTRINSIC ICHAR |
28 | 1 | pfleura2 | * .. |
29 | 1 | pfleura2 | * .. Local Scalars .. |
30 | 1 | pfleura2 | INTEGER INTA, INTB, ZCODE |
31 | 1 | pfleura2 | * .. |
32 | 1 | pfleura2 | * .. Executable Statements .. |
33 | 1 | pfleura2 | * |
34 | 1 | pfleura2 | * Test if the characters are equal |
35 | 1 | pfleura2 | * |
36 | 1 | pfleura2 | LSAME = CA.EQ.CB |
37 | 1 | pfleura2 | IF( LSAME ) |
38 | 1 | pfleura2 | $ RETURN |
39 | 1 | pfleura2 | * |
40 | 1 | pfleura2 | * Now test for equivalence if both characters are alphabetic. |
41 | 1 | pfleura2 | * |
42 | 1 | pfleura2 | ZCODE = ICHAR( 'Z' ) |
43 | 1 | pfleura2 | * |
44 | 1 | pfleura2 | * Use 'Z' rather than 'A' so that ASCII can be detected on Prime |
45 | 1 | pfleura2 | * machines, on which ICHAR returns a value with bit 8 set. |
46 | 1 | pfleura2 | * ICHAR('A') on Prime machines returns 193 which is the same as |
47 | 1 | pfleura2 | * ICHAR('A') on an EBCDIC machine. |
48 | 1 | pfleura2 | * |
49 | 1 | pfleura2 | INTA = ICHAR( CA ) |
50 | 1 | pfleura2 | INTB = ICHAR( CB ) |
51 | 1 | pfleura2 | * |
52 | 1 | pfleura2 | IF( ZCODE.EQ.90 .OR. ZCODE.EQ.122 ) THEN |
53 | 1 | pfleura2 | * |
54 | 1 | pfleura2 | * ASCII is assumed - ZCODE is the ASCII code of either lower or |
55 | 1 | pfleura2 | * upper case 'Z'. |
56 | 1 | pfleura2 | * |
57 | 1 | pfleura2 | IF( INTA.GE.97 .AND. INTA.LE.122 ) INTA = INTA - 32 |
58 | 1 | pfleura2 | IF( INTB.GE.97 .AND. INTB.LE.122 ) INTB = INTB - 32 |
59 | 1 | pfleura2 | * |
60 | 1 | pfleura2 | ELSE IF( ZCODE.EQ.233 .OR. ZCODE.EQ.169 ) THEN |
61 | 1 | pfleura2 | * |
62 | 1 | pfleura2 | * EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or |
63 | 1 | pfleura2 | * upper case 'Z'. |
64 | 1 | pfleura2 | * |
65 | 1 | pfleura2 | IF( INTA.GE.129 .AND. INTA.LE.137 .OR. |
66 | 1 | pfleura2 | $ INTA.GE.145 .AND. INTA.LE.153 .OR. |
67 | 1 | pfleura2 | $ INTA.GE.162 .AND. INTA.LE.169 ) INTA = INTA + 64 |
68 | 1 | pfleura2 | IF( INTB.GE.129 .AND. INTB.LE.137 .OR. |
69 | 1 | pfleura2 | $ INTB.GE.145 .AND. INTB.LE.153 .OR. |
70 | 1 | pfleura2 | $ INTB.GE.162 .AND. INTB.LE.169 ) INTB = INTB + 64 |
71 | 1 | pfleura2 | * |
72 | 1 | pfleura2 | ELSE IF( ZCODE.EQ.218 .OR. ZCODE.EQ.250 ) THEN |
73 | 1 | pfleura2 | * |
74 | 1 | pfleura2 | * ASCII is assumed, on Prime machines - ZCODE is the ASCII code |
75 | 1 | pfleura2 | * plus 128 of either lower or upper case 'Z'. |
76 | 1 | pfleura2 | * |
77 | 1 | pfleura2 | IF( INTA.GE.225 .AND. INTA.LE.250 ) INTA = INTA - 32 |
78 | 1 | pfleura2 | IF( INTB.GE.225 .AND. INTB.LE.250 ) INTB = INTB - 32 |
79 | 1 | pfleura2 | END IF |
80 | 1 | pfleura2 | LSAME = INTA.EQ.INTB |
81 | 1 | pfleura2 | * |
82 | 1 | pfleura2 | * RETURN |
83 | 1 | pfleura2 | * |
84 | 1 | pfleura2 | * End of LSAME |
85 | 1 | pfleura2 | * |
86 | 1 | pfleura2 | END |