/src/igraph/vendor/lapack/lsame.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* -- translated by f2c (version 20191129). |
2 | | You must link the resulting object file with libf2c: |
3 | | on Microsoft Windows system, link with libf2c.lib; |
4 | | on Linux or Unix systems, link with .../path/to/libf2c.a -lm |
5 | | or, if you install libf2c.a in a standard place, with -lf2c -lm |
6 | | -- in that order, at the end of the command line, as in |
7 | | cc *.o -lf2c -lm |
8 | | Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., |
9 | | |
10 | | http://www.netlib.org/f2c/libf2c.zip |
11 | | */ |
12 | | |
13 | | #include "f2c.h" |
14 | | |
15 | | /* > \brief \b LSAME |
16 | | |
17 | | =========== DOCUMENTATION =========== |
18 | | |
19 | | Online html documentation available at |
20 | | http://www.netlib.org/lapack/explore-html/ |
21 | | |
22 | | Definition: |
23 | | =========== |
24 | | |
25 | | LOGICAL FUNCTION LSAME(CA,CB) |
26 | | |
27 | | CHARACTER CA,CB |
28 | | |
29 | | |
30 | | > \par Purpose: |
31 | | ============= |
32 | | > |
33 | | > \verbatim |
34 | | > |
35 | | > LSAME returns .TRUE. if CA is the same letter as CB regardless of |
36 | | > case. |
37 | | > \endverbatim |
38 | | |
39 | | Arguments: |
40 | | ========== |
41 | | |
42 | | > \param[in] CA |
43 | | > \verbatim |
44 | | > CA is CHARACTER*1 |
45 | | > \endverbatim |
46 | | > |
47 | | > \param[in] CB |
48 | | > \verbatim |
49 | | > CB is CHARACTER*1 |
50 | | > CA and CB specify the single characters to be compared. |
51 | | > \endverbatim |
52 | | |
53 | | Authors: |
54 | | ======== |
55 | | |
56 | | > \author Univ. of Tennessee |
57 | | > \author Univ. of California Berkeley |
58 | | > \author Univ. of Colorado Denver |
59 | | > \author NAG Ltd. |
60 | | |
61 | | > \date December 2016 |
62 | | |
63 | | > \ingroup aux_blas |
64 | | |
65 | | ===================================================================== */ |
66 | | logical igraphlsame_(char *ca, char *cb) |
67 | 0 | { |
68 | | /* System generated locals */ |
69 | 0 | logical ret_val; |
70 | | |
71 | | /* Local variables */ |
72 | 0 | integer inta, intb, zcode; |
73 | | |
74 | | |
75 | | /* -- Reference BLAS level1 routine (version 3.1) -- |
76 | | -- Reference BLAS is a software package provided by Univ. of Tennessee, -- |
77 | | -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
78 | | December 2016 |
79 | | |
80 | | |
81 | | ===================================================================== |
82 | | |
83 | | |
84 | | Test if the characters are equal */ |
85 | |
|
86 | 0 | ret_val = *(unsigned char *)ca == *(unsigned char *)cb; |
87 | 0 | if (ret_val) { |
88 | 0 | return ret_val; |
89 | 0 | } |
90 | | |
91 | | /* Now test for equivalence if both characters are alphabetic. */ |
92 | | |
93 | 0 | zcode = 'Z'; |
94 | | |
95 | | /* Use 'Z' rather than 'A' so that ASCII can be detected on Prime |
96 | | machines, on which ICHAR returns a value with bit 8 set. |
97 | | ICHAR('A') on Prime machines returns 193 which is the same as |
98 | | ICHAR('A') on an EBCDIC machine. */ |
99 | |
|
100 | 0 | inta = *(unsigned char *)ca; |
101 | 0 | intb = *(unsigned char *)cb; |
102 | |
|
103 | 0 | if (zcode == 90 || zcode == 122) { |
104 | | |
105 | | /* ASCII is assumed - ZCODE is the ASCII code of either lower or |
106 | | upper case 'Z'. */ |
107 | |
|
108 | 0 | if (inta >= 97 && inta <= 122) { |
109 | 0 | inta += -32; |
110 | 0 | } |
111 | 0 | if (intb >= 97 && intb <= 122) { |
112 | 0 | intb += -32; |
113 | 0 | } |
114 | |
|
115 | 0 | } else if (zcode == 233 || zcode == 169) { |
116 | | |
117 | | /* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or |
118 | | upper case 'Z'. */ |
119 | |
|
120 | 0 | if (inta >= 129 && inta <= 137 || inta >= 145 && inta <= 153 || inta |
121 | 0 | >= 162 && inta <= 169) { |
122 | 0 | inta += 64; |
123 | 0 | } |
124 | 0 | if (intb >= 129 && intb <= 137 || intb >= 145 && intb <= 153 || intb |
125 | 0 | >= 162 && intb <= 169) { |
126 | 0 | intb += 64; |
127 | 0 | } |
128 | |
|
129 | 0 | } else if (zcode == 218 || zcode == 250) { |
130 | | |
131 | | /* ASCII is assumed, on Prime machines - ZCODE is the ASCII code |
132 | | plus 128 of either lower or upper case 'Z'. */ |
133 | |
|
134 | 0 | if (inta >= 225 && inta <= 250) { |
135 | 0 | inta += -32; |
136 | 0 | } |
137 | 0 | if (intb >= 225 && intb <= 250) { |
138 | 0 | intb += -32; |
139 | 0 | } |
140 | 0 | } |
141 | 0 | ret_val = inta == intb; |
142 | | |
143 | | /* RETURN |
144 | | |
145 | | End of LSAME */ |
146 | |
|
147 | 0 | return ret_val; |
148 | 0 | } /* igraphlsame_ */ |
149 | | |