Subversion Repositories Kolibri OS

Rev

Rev 4872 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1.  
  2. /*
  3. FUNCTION
  4.         <<isprint>>, <<isgraph>>---printable character predicates
  5.  
  6. INDEX
  7.         isprint
  8. INDEX
  9.         isgraph
  10.  
  11. ANSI_SYNOPSIS
  12.         #include <ctype.h>
  13.         int isprint(int <[c]>);
  14.         int isgraph(int <[c]>);
  15.  
  16. TRAD_SYNOPSIS
  17.         #include <ctype.h>
  18.         int isprint(<[c]>);
  19.         int isgraph(<[c]>);
  20.  
  21.  
  22. DESCRIPTION
  23. <<isprint>> is a macro which classifies ASCII integer values by table
  24. lookup.  It is a predicate returning non-zero for printable
  25. characters, and 0 for other character arguments.
  26. It is defined only when <<isascii>>(<[c]>) is true or <[c]> is EOF.
  27.  
  28. You can use a compiled subroutine instead of the macro definition by
  29. undefining either macro using `<<#undef isprint>>' or `<<#undef isgraph>>'.
  30.  
  31. RETURNS
  32. <<isprint>> returns non-zero if <[c]> is a printing character,
  33. (<<0x20>>--<<0x7E>>).
  34. <<isgraph>> behaves identically to <<isprint>>, except that the space
  35. character (<<0x20>>) is excluded.
  36.  
  37. PORTABILITY
  38. <<isprint>> and <<isgraph>> are ANSI C.
  39.  
  40. No supporting OS subroutines are required.
  41. */
  42.  
  43. #include <_ansi.h>
  44. #include <ctype.h>
  45.  
  46. #undef isgraph
  47. int
  48. _DEFUN(isgraph,(c),int c)
  49. {
  50.         return(__ctype_ptr__[c+1] & (_P|_U|_L|_N));
  51. }
  52.  
  53.  
  54. #undef isprint
  55. int
  56. _DEFUN(isprint,(c),int c)
  57. {
  58.         return(__ctype_ptr__[c+1] & (_P|_U|_L|_N|_B));
  59. }
  60.  
  61.