home *** CD-ROM | disk | FTP | other *** search
/ Languages Around the World / LanguageWorld.iso / language / vietnam / lambai / ctype.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-02  |  2.7 KB  |  99 lines

  1. /*
  2.  *     @(#)vntype.h    1.1    (TriChlor) 7/28/91 22:01:14
  3.  */
  4.  
  5. #ifndef _VNTYPE_H_
  6. #define _VNTYPE_H_
  7.  
  8. /* Undo the effect of ctype.h to silence compiler warnings */
  9. #undef    _U
  10. #undef    _L
  11. #undef    _N
  12. #undef    _S
  13. #undef    _P
  14. #undef    _C
  15. #undef    _X
  16. #undef    _B
  17.  
  18. /* Types enumerated in Viet-Std locale */
  19. #undef    isupper(c)
  20. #undef    islower(c)
  21. #undef    isdigit(c)
  22. #undef    isspace(c)
  23. #undef    ispunct(c)
  24. #undef    iscntrl(c)
  25. #undef    isxdigit(c)
  26. #undef    isblank(c)
  27.  
  28. #undef    toupper(c)
  29. #undef    tolower(c)
  30.  
  31. /* Types not enumerated in Viet-Std locale */
  32. #undef    isascii(c)
  33. #undef    isalpha(c)
  34. #undef    isalnum(c)
  35. #undef    isprint(c)
  36. #undef    isgraph(c)
  37.  
  38. #undef toascii(c)
  39.  
  40. /* Definitions overriding ctype.h */
  41. #ifndef uchar
  42. #define    uchar    unsigned char
  43. #endif
  44.  
  45. #define    _U    0x01    /* Upper case */
  46. #define    _L    0x02    /* Lower case */
  47. #define    _N    0x04    /* Numeral (digit) */
  48. #define    _S    0x08    /* Spacing character */
  49. #define _P    0x10    /* Punctuation */
  50. #define _C    0x20    /* Control character */
  51. #define _X    0x40    /* Hexadecimal */
  52. #define _B    0x80    /* Blank */
  53.  
  54. /* Special types */
  55. #define    _V    0x100    /* Vowel */
  56. #define    _M    0x200    /* Modifier (breve,circumflex,horn) */
  57. #define    _A    0x400    /* Accent (acute,grave,hook above,tilde,dot below) */
  58. #define    _Med    0x800    /* Modified vowel */
  59. #define    _Aed    0x1000    /* Accented vowel */
  60.  
  61. extern    unsigned int    _pvntype[];
  62. extern    unsigned char    _vntoupper[];
  63. extern    unsigned char    _vntolower[];
  64.  
  65. /* Types enumerated in Viet-Std locale */
  66. #define    isupper(c)    (_pvntype[(uchar)(c)]&_U)
  67. #define    islower(c)    (_pvntype[(uchar)(c)]&_L)
  68. #define    isdigit(c)    (_pvntype[(uchar)(c)]&_N)
  69. #define    isspace(c)    (_pvntype[(uchar)(c)]&_S)
  70. #define ispunct(c)    (_pvntype[(uchar)(c)]&_P)
  71. #define iscntrl(c)    (_pvntype[(uchar)(c)]&_C)
  72. #define    isxdigit(c)    (_pvntype[(uchar)(c)]&_X)
  73. #define    isblank(c)    (_pvntype[(uchar)(c)]&_B)
  74.  
  75. #define    toupper(c)    (_vntoupper[(uchar)(c)])
  76. #define    tolower(c)    (_vntolower[(uchar)(c)])
  77.  
  78. /* Types not enumerated in Viet-Std locale */
  79. #define isascii(c)    ((unsigned)(c)<=0177)
  80. #define    isalpha(c)    (_pvntype[(uchar)(c)]&(_U|_L))
  81. #define isalnum(c)    (_pvntype[(uchar)(c)]&(_U|_L|_N))
  82. #define isprint(c)    (_pvntype[(uchar)(c)]&(_P|_U|_L|_N|_B))
  83. #define isgraph(c)    (_pvntype[(uchar)(c)]&(_P|_U|_L|_N))
  84.  
  85. #define toascii(c)    ((c)&0377)
  86.  
  87. /* Special types */
  88. #define    isvowel(c)    (_pvntype[(uchar)(c)]&_V)
  89. #define    isconsonant(c)    (isalpha(c) && !(_pvntype[(uchar)(c)]&_V))
  90. #define    ismodifier(c)    (_pvntype[(uchar)(c)]&_M)
  91. #define    isaccent(c)    (_pvntype[(uchar)(c)]&_A)
  92. #define    isdiacritic(c)    (ismodifier(c) || isaccent(c))
  93. #define    ismodified(c)    (_pvntype[(uchar)(c)]&_Med)
  94. #define    isaccented(c)    (_pvntype[(uchar)(c)]&_Aed)
  95. /* We need a Presidential Pardon for "diacriticized" */
  96. #define    isdiacriticized(c)    (ismodified(c) || isaccented(c))
  97.  
  98. #endif /* _VNTYPE_H_ */
  99.