Rev 4170 | Rev 4172 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4170 | Rev 4171 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | #include <test.h> |
30 | #include <test.h> |
31 | 31 | ||
32 | char *test_print4(bool quiet) |
32 | char *test_print4(bool quiet) |
33 | { |
33 | { |
34 | if (!quiet) { |
34 | if (!quiet) { |
35 | printf("ASCII printable characters (32 - 127) using printf(%%c):\n"); |
35 | printf("ASCII printable characters (32 - 127) using printf(\"%%c\") and printf(\"%%lc\"):\n"); |
36 | 36 | ||
37 | uint8_t hextet; |
37 | uint8_t hextet; |
38 | for (hextet = 2; hextet < 8; hextet++) { |
38 | for (hextet = 2; hextet < 8; hextet++) { |
39 | printf("%#" PRIx8 ": ", hextet << 4); |
39 | printf("%#" PRIx8 ": ", hextet << 4); |
40 | 40 | ||
41 | uint8_t index; |
41 | uint8_t index; |
42 | for (index = 0; index < 16; index++) |
42 | for (index = 0; index < 16; index++) |
43 | printf("%c", (char) ((hextet << 4) + index)); |
43 | printf("%c", (char) ((hextet << 4) + index)); |
44 | 44 | ||
- | 45 | printf(" "); |
|
- | 46 | for (index = 0; index < 16; index++) |
|
- | 47 | printf("%lc", (wchar_t) ((hextet << 4) + index)); |
|
- | 48 | ||
45 | printf("\n"); |
49 | printf("\n"); |
46 | } |
50 | } |
47 | 51 | ||
48 | printf("\nExtended ASCII characters (128 - 255) using printf(%%c):\n"); |
52 | printf("\nExtended ASCII characters (128 - 255) using printf(\"%%c\") and printf(\"%%lc\"):\n"); |
49 | 53 | ||
50 | for (hextet = 8; hextet < 16; hextet++) { |
54 | for (hextet = 8; hextet < 16; hextet++) { |
51 | printf("%#" PRIx8 ": ", hextet << 4); |
55 | printf("%#" PRIx8 ": ", hextet << 4); |
52 | 56 | ||
53 | uint8_t index; |
57 | uint8_t index; |
54 | for (index = 0; index < 16; index++) |
58 | for (index = 0; index < 16; index++) |
55 | printf("%c", (char) ((hextet << 4) + index)); |
59 | printf("%c", (char) ((hextet << 4) + index)); |
56 | 60 | ||
- | 61 | printf(" "); |
|
- | 62 | for (index = 0; index < 16; index++) |
|
- | 63 | printf("%lc", (wchar_t) ((hextet << 4) + index)); |
|
- | 64 | ||
57 | printf("\n"); |
65 | printf("\n"); |
58 | } |
66 | } |
59 | 67 | ||
- | 68 | printf("\nUTF-8 strings using printf(\"%%s\"):\n"); |
|
- | 69 | printf("English: %s\n", "Quick brown fox jumps over the lazy dog"); |
|
- | 70 | printf("Czech: %s\n", "Příliš žluťoučký kůň úpěl dábelské ódy"); |
|
- | 71 | printf("Greek: %s\n", "Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε"); |
|
- | 72 | printf("Hebrew: %s\n", "משוואת ברנולי היא משוואה בהידרודינמיקה"); |
|
60 | } |
73 | } |
61 | 74 | ||
62 | return NULL; |
75 | return NULL; |
63 | } |
76 | } |