lsame.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* lsame.f -- translated by f2c (version 20061008).
  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. http://www.netlib.org/f2c/libf2c.zip
  10. */
  11. #include "f2c.h"
  12. #include "blaswrap.h"
  13. logical _starpu_lsame_(char *ca, char *cb)
  14. {
  15. /* System generated locals */
  16. logical ret_val;
  17. /* Local variables */
  18. integer inta, intb, zcode;
  19. /* -- LAPACK auxiliary routine (version 3.2) -- */
  20. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  21. /* November 2006 */
  22. /* .. Scalar Arguments .. */
  23. /* .. */
  24. /* Purpose */
  25. /* ======= */
  26. /* LSAME returns .TRUE. if CA is the same letter as CB regardless of */
  27. /* case. */
  28. /* Arguments */
  29. /* ========= */
  30. /* CA (input) CHARACTER*1 */
  31. /* CB (input) CHARACTER*1 */
  32. /* CA and CB specify the single characters to be compared. */
  33. /* ===================================================================== */
  34. /* .. Intrinsic Functions .. */
  35. /* .. */
  36. /* .. Local Scalars .. */
  37. /* .. */
  38. /* .. Executable Statements .. */
  39. /* Test if the characters are equal */
  40. ret_val = *(unsigned char *)ca == *(unsigned char *)cb;
  41. if (ret_val) {
  42. return ret_val;
  43. }
  44. /* Now test for equivalence if both characters are alphabetic. */
  45. zcode = 'Z';
  46. /* Use 'Z' rather than 'A' so that ASCII can be detected on Prime */
  47. /* machines, on which ICHAR returns a value with bit 8 set. */
  48. /* ICHAR('A') on Prime machines returns 193 which is the same as */
  49. /* ICHAR('A') on an EBCDIC machine. */
  50. inta = *(unsigned char *)ca;
  51. intb = *(unsigned char *)cb;
  52. if (zcode == 90 || zcode == 122) {
  53. /* ASCII is assumed - ZCODE is the ASCII code of either lower or */
  54. /* upper case 'Z'. */
  55. if (inta >= 97 && inta <= 122) {
  56. inta += -32;
  57. }
  58. if (intb >= 97 && intb <= 122) {
  59. intb += -32;
  60. }
  61. } else if (zcode == 233 || zcode == 169) {
  62. /* EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or */
  63. /* upper case 'Z'. */
  64. if (inta >= 129 && inta <= 137 || inta >= 145 && inta <= 153 || inta
  65. >= 162 && inta <= 169) {
  66. inta += 64;
  67. }
  68. if (intb >= 129 && intb <= 137 || intb >= 145 && intb <= 153 || intb
  69. >= 162 && intb <= 169) {
  70. intb += 64;
  71. }
  72. } else if (zcode == 218 || zcode == 250) {
  73. /* ASCII is assumed, on Prime machines - ZCODE is the ASCII code */
  74. /* plus 128 of either lower or upper case 'Z'. */
  75. if (inta >= 225 && inta <= 250) {
  76. inta += -32;
  77. }
  78. if (intb >= 225 && intb <= 250) {
  79. intb += -32;
  80. }
  81. }
  82. ret_val = inta == intb;
  83. /* RETURN */
  84. /* End of LSAME */
  85. return ret_val;
  86. } /* _starpu_lsame_ */