home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / gcc / ixemulsrc.lha / ixemul / general / isctype.c < prev    next >
C/C++ Source or Header  |  1996-12-11  |  3KB  |  139 lines

  1. /*
  2.  * Copyright (c) 1989 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that: (1) source distributions retain this entire copyright
  7.  * notice and comment, and (2) distributions including binaries display
  8.  * the following acknowledgement:  ``This product includes software
  9.  * developed by the University of California, Berkeley and its contributors''
  10.  * in the documentation or other materials provided with the distribution
  11.  * and in all advertising materials mentioning features or use of this
  12.  * software. Neither the name of the University nor the names of its
  13.  * contributors may be used to endorse or promote products derived
  14.  * from this software without specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  */
  19.  
  20. #if defined(LIBC_SCCS) && !defined(lint)
  21. static char sccsid[] = "@(#)isctype.c    5.2 (Berkeley) 6/1/90";
  22. #endif /* LIBC_SCCS and not lint */
  23.  
  24. #define _KERNEL
  25. #include "ixemul.h"
  26.  
  27. #define _ANSI_LIBRARY
  28. #include <ctype.h>
  29.  
  30. #undef isalnum
  31. int isalnum(int c)
  32. {
  33.   return ((_ctype_ + 1)[c] & (_U|_L|_N));
  34. }
  35.  
  36. #undef isalpha
  37. int isalpha(int c)
  38. {
  39.   return ((_ctype_ + 1)[c] & (_U|_L));
  40. }
  41.  
  42. #undef isblank
  43. int
  44. isblank(c)
  45.     int c;
  46. {
  47.     return(c == ' ' || c == '\t');
  48. }
  49.  
  50. #undef iscntrl
  51. int iscntrl(int c)
  52. {
  53.   return ((_ctype_ + 1)[c] & _C);
  54. }
  55.  
  56. #undef isdigit
  57. int isdigit(int c)
  58. {
  59.   return ((_ctype_ + 1)[c] & _N);
  60. }
  61.  
  62. #undef isgraph
  63. int isgraph(int c)
  64. {
  65.   return ((_ctype_ + 1)[c] & (_P|_U|_L|_N));
  66. }
  67.  
  68. #undef islower
  69. int islower(int c)
  70. {
  71.   return ((_ctype_ + 1)[c] & _L);
  72. }
  73.  
  74. #undef isprint
  75. int isprint(int c)
  76. {
  77.   return ((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B));
  78. }
  79.  
  80. #undef ispunct
  81. int ispunct(int c)
  82. {
  83.   return ((_ctype_ + 1)[c] & _P);
  84. }
  85.  
  86. #undef isspace
  87. int isspace(int c)
  88. {
  89.   return ((_ctype_ + 1)[c] & _S);
  90. }
  91.  
  92. #undef isupper
  93. int isupper(int c)
  94. {
  95.   return ((_ctype_ + 1)[c] & _U);
  96. }
  97.  
  98. #undef isxdigit
  99. int isxdigit(int c)
  100. {
  101.   return ((_ctype_ + 1)[c] & (_N|_X));
  102. }
  103.  
  104. #undef tolower
  105. int tolower(int c)
  106. {
  107.   return (((_ctype_ + 1)[c] & _U) ? (c) - 'A' + 'a' : (c));
  108. }
  109.  
  110. #undef toupper
  111. int toupper(int c)
  112. {
  113.   return (((_ctype_ + 1)[c] & _L) ? (c) - 'a' + 'A' : (c));
  114. }
  115.  
  116. #undef isascii
  117. int isascii(int c)
  118. {
  119.   return ((unsigned)(c) <= 0177);
  120. }
  121.  
  122. #undef isiso
  123. int isiso(int c)
  124. {
  125.   return ((unsigned)(c) <= 0377);
  126. }
  127.  
  128. #undef toascii
  129. int toascii(int c)
  130. {
  131.   return ((c) & 0177);
  132. }
  133.  
  134. #undef toiso
  135. int toiso(int c)
  136. {
  137.   return ((c) & 0377);
  138. }
  139.