root / src / blas / lsame.f @ 5
Historique | Voir | Annoter | Télécharger (2,27 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 | * |
22 | 1 | pfleura2 | * CB (input) CHARACTER*1 |
23 | 1 | pfleura2 | * CA and CB specify the single characters to be compared. |
24 | 1 | pfleura2 | * |
25 | 1 | pfleura2 | * ===================================================================== |
26 | 1 | pfleura2 | * |
27 | 1 | pfleura2 | * .. Intrinsic Functions .. |
28 | 1 | pfleura2 | INTRINSIC ICHAR |
29 | 1 | pfleura2 | * .. |
30 | 1 | pfleura2 | * .. Local Scalars .. |
31 | 1 | pfleura2 | INTEGER INTA,INTB,ZCODE |
32 | 1 | pfleura2 | * .. |
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) RETURN |
38 | 1 | pfleura2 | * |
39 | 1 | pfleura2 | * Now test for equivalence if both characters are alphabetic. |
40 | 1 | pfleura2 | * |
41 | 1 | pfleura2 | ZCODE = ICHAR('Z') |
42 | 1 | pfleura2 | * |
43 | 1 | pfleura2 | * Use 'Z' rather than 'A' so that ASCII can be detected on Prime |
44 | 1 | pfleura2 | * machines, on which ICHAR returns a value with bit 8 set. |
45 | 1 | pfleura2 | * ICHAR('A') on Prime machines returns 193 which is the same as |
46 | 1 | pfleura2 | * ICHAR('A') on an EBCDIC machine. |
47 | 1 | pfleura2 | * |
48 | 1 | pfleura2 | INTA = ICHAR(CA) |
49 | 1 | pfleura2 | INTB = ICHAR(CB) |
50 | 1 | pfleura2 | * |
51 | 1 | pfleura2 | IF (ZCODE.EQ.90 .OR. ZCODE.EQ.122) THEN |
52 | 1 | pfleura2 | * |
53 | 1 | pfleura2 | * ASCII is assumed - ZCODE is the ASCII code of either lower or |
54 | 1 | pfleura2 | * upper case 'Z'. |
55 | 1 | pfleura2 | * |
56 | 1 | pfleura2 | IF (INTA.GE.97 .AND. INTA.LE.122) INTA = INTA - 32 |
57 | 1 | pfleura2 | IF (INTB.GE.97 .AND. INTB.LE.122) INTB = INTB - 32 |
58 | 1 | pfleura2 | * |
59 | 1 | pfleura2 | ELSE IF (ZCODE.EQ.233 .OR. ZCODE.EQ.169) THEN |
60 | 1 | pfleura2 | * |
61 | 1 | pfleura2 | * EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or |
62 | 1 | pfleura2 | * upper case 'Z'. |
63 | 1 | pfleura2 | * |
64 | 1 | pfleura2 | IF (INTA.GE.129 .AND. INTA.LE.137 .OR. |
65 | 1 | pfleura2 | + INTA.GE.145 .AND. INTA.LE.153 .OR. |
66 | 1 | pfleura2 | + INTA.GE.162 .AND. INTA.LE.169) INTA = INTA + 64 |
67 | 1 | pfleura2 | IF (INTB.GE.129 .AND. INTB.LE.137 .OR. |
68 | 1 | pfleura2 | + INTB.GE.145 .AND. INTB.LE.153 .OR. |
69 | 1 | pfleura2 | + INTB.GE.162 .AND. INTB.LE.169) INTB = INTB + 64 |
70 | 1 | pfleura2 | * |
71 | 1 | pfleura2 | ELSE IF (ZCODE.EQ.218 .OR. ZCODE.EQ.250) THEN |
72 | 1 | pfleura2 | * |
73 | 1 | pfleura2 | * ASCII is assumed, on Prime machines - ZCODE is the ASCII code |
74 | 1 | pfleura2 | * plus 128 of either lower or upper case 'Z'. |
75 | 1 | pfleura2 | * |
76 | 1 | pfleura2 | IF (INTA.GE.225 .AND. INTA.LE.250) INTA = INTA - 32 |
77 | 1 | pfleura2 | IF (INTB.GE.225 .AND. INTB.LE.250) INTB = INTB - 32 |
78 | 1 | pfleura2 | END IF |
79 | 1 | pfleura2 | LSAME = INTA .EQ. INTB |
80 | 1 | pfleura2 | * |
81 | 1 | pfleura2 | * RETURN |
82 | 1 | pfleura2 | * |
83 | 1 | pfleura2 | * End of LSAME |
84 | 1 | pfleura2 | * |
85 | 1 | pfleura2 | END |