home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 171_01 / ischeck.c < prev    next >
Text File  |  1983-10-27  |  2KB  |  49 lines

  1. /* ischeck()  program to check Microsoft C's issomething matrix.
  2.  *          it has no other purpose.
  3.  *          1 to 1 correspondence between 0 to 127 and 128 to 255!!!
  4.  *          WHRauser     10-4-83     Microsoft C  Version 1.04
  5.  */
  6.  
  7. #include  <ctype.h>
  8.  
  9. main()
  10. {
  11.      int  i;
  12.  
  13.      printf("   dec   char   hex    XBCP SNLU    ");
  14.      printf("   dec   char   hex    XBCP SNLU\n\n");
  15.  
  16.      for (i=0; i<128; i++) {
  17.       printit(i);
  18.       printit(i+128);
  19.       printf("\n");
  20.      }
  21. }/*main
  22. --------------------------------------------*/
  23.  
  24. printit(i)
  25.      int i;
  26. {
  27.      int  t;
  28.      int  alpha;
  29.      int  x,b,c,p, s,n,l,u;    /* bit map */
  30.  
  31.      if isprint(i)
  32.        alpha = i;
  33.      else  alpha = ' ';
  34.  
  35.      t = _ctype[i+1];     /*Stupid, don't they know C is zero origin?*/
  36.  
  37.      x = t & 128 ? 1 : 0;    /*   X 128        hexadecimal flag */
  38.      b = t &  64 ? 1 : 0;    /*   B 64           blank flag */
  39.      c = t &  32 ? 1 : 0;    /*   C 32           control character flag */
  40.      p = t &  16 ? 1 : 0;    /*   P 16           punctuation flag */
  41.      s = t &   8 ? 1 : 0;    /*   S 8           space flag */
  42.      n = t &   4 ? 1 : 0;    /*   N 4           number flag */
  43.      l = t &   2 ? 1 : 0;    /*   L 2           lower case flag */
  44.      u = t &   1 ? 1 : 0;    /*   U 1           upper case flag */
  45.  
  46.      printf("  %3d     %c    %3x     %1d%1d%1d%1d %1d%1d%1d%1d    ",
  47.          i,alpha,t, x,b,c,p, s,n,l,u);
  48. }
  49.