1 /* Test GDB's character set support
2 Jim Blandy <jimb@cygnus.com> --- December 2001 */
8 /* X_string is a null-terminated string in the X charset whose
9 elements are as follows. X should be the name the `set charset'
10 command uses for the character set, in lower-case, with any
11 non-identifier characters replaced with underscores. Where a
12 character set doesn't have the given character, the string should
13 contain the character 'x'.
15 [0] --- the `alert' character, '\a'
16 [1] --- the `backspace' character, '\b'
17 [2] --- the `escape' character, '\e'
18 [3] --- the `form feed' character, '\f'
19 [4] --- the `line feed' character, '\n'
20 [5] --- the `carriage return' character, '\r'
21 [6] --- the `horizontal tab' character, '\t'
22 [7] --- the `vertical tab' character, '\v'
23 [8 .. 33] --- the uppercase letters A-Z
24 [34 .. 59] --- the lowercase letters a-z
25 [60 .. 69] --- the digits 0-9
26 [70] --- the `cent' character
27 [71] --- a control character with no defined backslash escape
29 Feel free to extend these as you like. */
31 #define NUM_CHARS (72)
33 char ascii_string[NUM_CHARS];
34 char iso_8859_1_string[NUM_CHARS];
35 char ebcdic_us_string[NUM_CHARS];
36 char ibm1047_string[NUM_CHARS];
40 init_string (char string[],
42 char alert, char backspace, char escape, char form_feed,
43 char line_feed, char carriage_return, char horizontal_tab,
44 char vertical_tab, char cent, char misc_ctrl)
46 memset (string, x, NUM_CHARS);
48 string[1] = backspace;
50 string[3] = form_feed;
51 string[4] = line_feed;
52 string[5] = carriage_return;
53 string[6] = horizontal_tab;
54 string[7] = vertical_tab;
56 string[71] = misc_ctrl;
61 fill_run (char string[], int start, int len, int first)
65 for (i = 0; i < len; i++)
66 string[start + i] = first + i;
77 /* Initialize ascii_string. */
78 init_string (ascii_string,
83 fill_run (ascii_string, 8, 26, 65);
84 fill_run (ascii_string, 34, 26, 97);
85 fill_run (ascii_string, 60, 10, 48);
87 /* Initialize iso_8859_1_string. */
88 init_string (iso_8859_1_string,
93 fill_run (iso_8859_1_string, 8, 26, 65);
94 fill_run (iso_8859_1_string, 34, 26, 97);
95 fill_run (iso_8859_1_string, 60, 10, 48);
97 /* Initialize ebcdic_us_string. */
98 init_string (ebcdic_us_string,
103 /* In EBCDIC, the upper-case letters are broken into three separate runs. */
104 fill_run (ebcdic_us_string, 8, 9, 193);
105 fill_run (ebcdic_us_string, 17, 9, 209);
106 fill_run (ebcdic_us_string, 26, 8, 226);
107 /* The lower-case letters are, too. */
108 fill_run (ebcdic_us_string, 34, 9, 129);
109 fill_run (ebcdic_us_string, 43, 9, 145);
110 fill_run (ebcdic_us_string, 52, 8, 162);
111 /* The digits, at least, are contiguous. */
112 fill_run (ebcdic_us_string, 60, 10, 240);
114 /* Initialize ibm1047_string. */
115 init_string (ibm1047_string,
120 /* In EBCDIC, the upper-case letters are broken into three separate runs. */
121 fill_run (ibm1047_string, 8, 9, 193);
122 fill_run (ibm1047_string, 17, 9, 209);
123 fill_run (ibm1047_string, 26, 8, 226);
124 /* The lower-case letters are, too. */
125 fill_run (ibm1047_string, 34, 9, 129);
126 fill_run (ibm1047_string, 43, 9, 145);
127 fill_run (ibm1047_string, 52, 8, 162);
128 /* The digits, at least, are contiguous. */
129 fill_run (ibm1047_string, 60, 10, 240);
131 puts ("All set!"); /* all strings initialized */