File configure.ac changed (mode: 100644) (index ea00353..022b1bc) |
... |
... |
AC_CONFIG_SRCDIR([src/hstr.c]) |
17 |
17 |
AC_PROG_CC |
AC_PROG_CC |
18 |
18 |
|
|
19 |
19 |
# Checks for libraries. |
# Checks for libraries. |
20 |
|
AC_CHECK_LIB(ncurses, initscr, [], [AC_MSG_ERROR([Could not find Curses library])]) |
|
|
20 |
|
AC_CHECK_LIB(ncursesw, initscr, [], [AC_MSG_ERROR([Could not find Curses library])]) |
21 |
21 |
AC_CHECK_LIB(m, cos, [], [AC_MSG_ERROR([Could not find Math library])]) |
AC_CHECK_LIB(m, cos, [], [AC_MSG_ERROR([Could not find Math library])]) |
22 |
22 |
AC_CHECK_LIB(readline, using_history, [], [AC_MSG_ERROR([Could not find Readline library])]) |
AC_CHECK_LIB(readline, using_history, [], [AC_MSG_ERROR([Could not find Readline library])]) |
23 |
23 |
|
|
File tests/src/test_utf8.c changed (mode: 100644) (index 1303adb..7f2f269) |
10 |
10 |
#include <locale.h> |
#include <locale.h> |
11 |
11 |
#include <wchar.h> |
#include <wchar.h> |
12 |
12 |
#include <stdio.h> |
#include <stdio.h> |
|
13 |
|
#include <ncurses.h> |
13 |
14 |
#include <readline/readline.h> |
#include <readline/readline.h> |
14 |
15 |
#include <readline/chardefs.h> |
#include <readline/chardefs.h> |
15 |
16 |
|
|
16 |
|
void echo_czech() |
|
|
17 |
|
void console_echo_czech() |
17 |
18 |
{ |
{ |
18 |
19 |
int c; |
int c; |
19 |
20 |
while(1) { |
while(1) { |
|
... |
... |
void echo_czech() |
22 |
23 |
} |
} |
23 |
24 |
} |
} |
24 |
25 |
|
|
25 |
|
void static_wide_czech() |
|
|
26 |
|
void console_static_wide_czech() |
26 |
27 |
{ |
{ |
27 |
28 |
setlocale(LC_ALL, ""); |
setlocale(LC_ALL, ""); |
28 |
29 |
|
|
29 |
|
wchar_t *w=L"Čeština."; |
|
30 |
|
wprintf(L"\nStatic wprintf: %ls", w); |
|
|
30 |
|
wchar_t *w=L"Čeština."; // wide |
|
31 |
|
char multibyte[100]; // multi-byte |
|
32 |
|
if(iswprint(*w)) { |
|
33 |
|
printf("\nString to be printed is UTF8 wide!"); |
|
34 |
|
int offset=wctomb(multibyte, w); |
|
35 |
|
printf("\nStatic (wide) printf: %s", multibyte); |
|
36 |
|
} else { |
|
37 |
|
printf("\nString to be printed is NOT UTF8 wide!"); |
|
38 |
|
wprintf(L"\nStatic wprintf: %ls", w); |
|
39 |
|
} |
31 |
40 |
} |
} |
32 |
41 |
|
|
33 |
|
void static_czech() |
|
|
42 |
|
void console_static_czech() |
34 |
43 |
{ |
{ |
35 |
44 |
setlocale(LC_ALL, ""); |
setlocale(LC_ALL, ""); |
36 |
45 |
|
|
|
... |
... |
void static_czech() |
38 |
47 |
printf("\nStatic printf: %s", s); |
printf("\nStatic printf: %s", s); |
39 |
48 |
} |
} |
40 |
49 |
|
|
41 |
|
void check() |
|
|
50 |
|
void console_check() |
42 |
51 |
{ |
{ |
43 |
52 |
printf("\nEnglish string."); |
printf("\nEnglish string."); |
44 |
53 |
} |
} |
45 |
54 |
|
|
|
55 |
|
void curses_wide_czech() |
|
56 |
|
{ |
|
57 |
|
char *s="Čeština ěščřžýáíé."; |
|
58 |
|
printf("Going to print the following string in Curses: '%s'", s); |
|
59 |
|
getch(); |
|
60 |
|
|
|
61 |
|
WINDOW *stdscr; |
|
62 |
|
setlocale(LC_ALL, ""); |
|
63 |
|
|
|
64 |
|
stdscr=initscr(); |
|
65 |
|
mvwprintw(stdscr,0,0,s); |
|
66 |
|
getch(); |
|
67 |
|
endwin(); |
|
68 |
|
} |
46 |
69 |
|
|
47 |
70 |
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
48 |
71 |
{ |
{ |
49 |
|
check(); |
|
50 |
|
static_czech(); |
|
51 |
|
static_wide_czech(); |
|
52 |
|
echo_czech(); |
|
|
72 |
|
//console_check(); |
|
73 |
|
//console_static_czech(); |
|
74 |
|
//console_static_wide_czech(); |
|
75 |
|
//console_echo_czech(); |
|
76 |
|
|
|
77 |
|
// TODO study print_selection_row() |
|
78 |
|
|
|
79 |
|
curses_wide_czech(); |
|
80 |
|
|
53 |
81 |
printf("\n\n"); |
printf("\n\n"); |
54 |
82 |
} |
} |