Use perl's setenv in case an interpreter has been started.
[nvi.git] / common / multibyte.h
blob83e7abdb312e730478516fc74a316734a4db035c
1 #ifndef MULTIBYTE_H
2 #define MULTIBYTE_H
4 #ifdef USE_WIDECHAR
5 #include <wchar.h>
6 #include <wctype.h>
8 typedef wchar_t RCHAR_T;
9 #define RCHAR_T_MAX ((1 << 24)-1)
10 typedef wchar_t CHAR_T;
11 #define MAX_CHAR_T 0xffffff /* XXXX */
12 typedef u_int UCHAR_T;
13 #define RCHAR_BIT 24
15 #define STRLEN wcslen
16 #define STRTOL wcstol
17 #define STRTOUL wcstoul
18 #define SPRINTF swprintf
19 #define STRCMP wcscmp
20 #define STRPBRK wcspbrk
21 #define TOUPPER towupper
22 #define STRSET wmemset
24 #define L(ch) L ## ch
26 #else
27 typedef char RCHAR_T;
28 #define RCHAR_T_MAX CHAR_MAX
29 typedef u_char CHAR_T;
30 #define MAX_CHAR_T 0xff
31 typedef u_char UCHAR_T;
32 #define RCHAR_BIT CHAR_BIT
34 #define STRLEN strlen
35 #define STRTOL strtol
36 #define STRTOUL strtoul
37 #define SPRINTF snprintf
38 #define STRCMP strcmp
39 #define STRPBRK strpbrk
40 #define TOUPPER toupper
41 #define STRSET memset
43 #define L(ch) ch
45 #endif
47 #define MEMCMP(to, from, n) \
48 memcmp(to, from, (n) * sizeof(*(to)))
49 #define MEMMOVE(p, t, len) memmove(p, t, (len) * sizeof(*(p)))
50 #define MEMCPY(p, t, len) memcpy(p, t, (len) * sizeof(*(p)))
51 #define SIZE(w) (sizeof(w)/sizeof(*w))
53 #endif