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