1 /* vi:set ts=8 sts=4 sw=4:
3 * VIM - Vi IMproved by Bram Moolenaar
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
10 * Definitions of various common control characters.
11 * For EBCDIC we have to use different values.
16 /* IF_EB(ASCII_constant, EBCDIC_constant) */
19 #define CharOrd(x) ((x) < 'a' ? (x) - 'A' : (x) - 'a')
20 #define CharOrdLow(x) ((x) - 'a')
21 #define CharOrdUp(x) ((x) - 'A')
22 #define ROT13(c, a) (((((c) - (a)) + 13) % 26) + (a))
29 #define NL_STR (char_u *)"\012"
31 #define CAR '\015' /* CR is used by Mac OS X */
33 #define ESC_STR (char_u *)"\033"
34 #define ESC_STR_nc "\033"
36 #define DEL_STR (char_u *)"\177"
37 #define CSI 0x9b /* Control Sequence Introducer */
38 #define CSI_STR "\233"
39 #define DCS 0x90 /* Device Control String */
40 #define STERM 0x9c /* String Terminator */
44 #define Ctrl_chr(x) (TOUPPER_ASC(x) ^ 0x40) /* '?' -> DEL, '@' -> ^@, etc. */
45 #define Meta(x) ((x) | 0x80)
47 #define CTRL_F_STR "\006"
48 #define CTRL_H_STR "\010"
49 #define CTRL_V_STR "\026"
51 #define Ctrl_AT 0 /* @ */
78 /* CTRL- [ Left Square Bracket == ESC*/
79 #define Ctrl_BSL 28 /* \ BackSLash */
80 #define Ctrl_RSB 29 /* ] Right Square Bracket */
81 #define Ctrl_HAT 30 /* ^ */
88 /* IF_EB(ASCII_constant, EBCDIC_constant) */
92 * Finding the position in the alphabet is not straightforward in EBCDIC.
93 * There are gaps in the code table.
94 * 'a' + 1 == 'b', but: 'i' + 7 == 'j' and 'r' + 8 == 's'
96 #define CharOrd__(c) ((c) < ('j' - 'a') ? (c) : ((c) < ('s' - 'a') ? (c) - 7 : (c) - 7 - 8))
97 #define CharOrdLow(x) (CharOrd__((x) - 'a'))
98 #define CharOrdUp(x) (CharOrd__((x) - 'A'))
99 #define CharOrd(x) (isupper(x) ? CharOrdUp(x) : CharOrdLow(x))
101 #define EBCDIC_CHAR_ADD_(x) ((x) < 0?'a':(x)>25?'z':"abcdefghijklmnopqrstuvwxyz"[x])
102 #define EBCDIC_CHAR_ADD(c,s) (isupper(c) ? toupper(EBCDIC_CHAR_ADD_(CharOrdUp(c)+(s))) : EBCDIC_CHAR_ADD_(CharOrdLow(c)+(s)))
104 #define R13_(c) ("abcdefghijklmnopqrstuvwxyz"[((c) + 13) % 26])
105 #define ROT13(c, a) (isupper(c) ? toupper(R13_(CharOrdUp(c))) : R13_(CharOrdLow(c)))
112 #define NL_STR (char_u *)"\x15"
116 #define ESC_STR (char_u *)"\x27"
117 #define ESC_STR_nc "\x27"
119 #define DEL_STR (char_u *)"\007"
120 /* TODO: EBCDIC Code page dependent (here 1047) */
121 #define CSI 0x9b /* Control Sequence Introducer */
122 #define CSI_STR "\233"
123 #define DCS 0x90 /* Device Control String */
124 #define STERM 0x9c /* String Terminator */
128 #define CTRL_F_STR "\056"
129 #define CTRL_H_STR "\026"
130 #define CTRL_V_STR "\062"
132 #define Ctrl_AT 0x00 /* @ */
159 /* CTRL- [ Left Square Bracket == ESC*/
160 #define Ctrl_RSB 0x1D /* ] Right Square Bracket */
161 #define Ctrl_BSL 0x1C /* \ BackSLash */
162 #define Ctrl_HAT 0x1E /* ^ */
165 #define Ctrl_chr(x) (CtrlTable[(x)])
166 extern char CtrlTable
[];
168 #define CtrlChar(x) ((x < ' ') ? CtrlCharTable[(x)] : 0)
169 extern char CtrlCharTable
[];
171 #define MetaChar(x) ((x < ' ') ? MetaCharTable[(x)] : 0)
172 extern char MetaCharTable
[];
174 #endif /* defined EBCDIC */
177 * Character that separates dir names in a path.
178 * For MS-DOS, WIN32 and OS/2 we use a backslash. A slash mostly works
179 * fine, but there are places where it doesn't (e.g. in a command name).
180 * For Acorn we use a dot.
182 #ifdef BACKSLASH_IN_FILENAME
183 # define PATHSEP psepc
184 # define PATHSEPSTR pseps
188 # define PATHSEPSTR "."
191 # define PATHSEPSTR "/"