2 * Copyright (c) 1992, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1992, 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
9 * $Id: multibyte.h,v 1.32 2012/10/07 01:35:58 zy Exp $
16 * Fundamental character types.
18 * CHAR_T An integral type that can hold any character.
19 * ARG_CHAR_T The type of a CHAR_T when passed as an argument using
20 * traditional promotion rules. It should also be able
21 * to be compared against any CHAR_T for equality without
23 * UCHAR_T The shortest unified character type (8-bit clean).
24 * RCHAR_T The character type used by the internal regex engine.
26 * If no integral type can hold a character, don't even try the port.
28 typedef int ARG_CHAR_T;
34 typedef wchar_t CHAR_T;
35 typedef wint_t UCHAR_T;
36 typedef wchar_t RCHAR_T;
41 #define STRTOUL wcstoul
42 #define SPRINTF swprintf
44 #define STRPBRK wcspbrk
45 #define ISBLANK iswblank
46 #define ISCNTRL iswcntrl
47 #define ISDIGIT iswdigit
48 #define ISXDIGIT iswxdigit
49 #define ISGRAPH iswgraph
50 #define ISLOWER iswlower
51 #define ISPRINT iswprint
52 #define ISPUNCT iswpunct
53 #define ISSPACE iswspace
54 #define ISUPPER iswupper
55 #define TOLOWER towlower
56 #define TOUPPER towupper
57 #define STRSET wmemset
59 #define STRRCHR wcsrchr
68 typedef u_char CHAR_T;
69 typedef u_char UCHAR_T;
74 #define STRTOL(a,b,c) (strtol(a,(char**)b,c))
75 #define STRTOUL(a,b,c) (strtoul(a,(char**)b,c))
76 #define SPRINTF snprintf
78 #define STRPBRK strpbrk
79 #define ISBLANK isblank
80 #define ISCNTRL iscntrl
81 #define ISDIGIT isdigit
82 #define ISXDIGIT isxdigit
83 #define ISGRAPH isgraph
84 #define ISLOWER islower
85 #define ISPRINT isprint
86 #define ISPUNCT ispunct
87 #define ISSPACE isspace
88 #define ISUPPER isupper
89 #define TOLOWER tolower
90 #define TOUPPER toupper
93 #define STRRCHR strrchr
103 #if defined(USE_WIDECHAR) && defined(DEBUG)
104 #define MEMCPY wmemcpy
105 #define MEMMOVE wmemmove
106 #define MEMCMP wmemcmp
108 #define MEMCPY(p, t, len) memcpy(p, t, (len) * sizeof(CHAR_T))
109 #define MEMMOVE(p, t, len) memmove(p, t, (len) * sizeof(CHAR_T))
110 #define MEMCMP(p, t, len) memcmp(p, t, (len) * sizeof(CHAR_T))
113 #define SIZE(w) (sizeof(w) / sizeof(*w))