[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: wide chars functions don't work
From: |
Sven Verdoolaege |
Subject: |
Re: wide chars functions don't work |
Date: |
Sat, 16 Feb 2002 12:27:19 +0100 |
User-agent: |
Mutt/1.3.20i |
On Sat, Feb 16, 2002 at 10:48:20AM +0100, Gerhard Häring wrote:
> Hello,
>
> I have found zero actual code using them. This is what I've tried:
I know of at least mutt and nvi.
>
> #include "ncursesw/ncurses.h"
>
> int main(int argc, char *argv[]) {
> initscr();
> curs_set(0);
>
> getch();
>
> addwstr(L"hallo");
> refresh();
> getch();
>
> curs_set(1);
> endwin();
>
> return 0;
> }
>
> Now, are these functions actually implemented in ncurses? As far as I
> can see in ddd, the wstr functions/macros keep calling themselves
> recursively.
There seems to have been a small problem in generating these.
Patch below fixes this.
> Is this a bug?
Yes.
> PS: This seems to be somewhat broken on plain Solaris curses, too.
You might want to be more explicit about the exact problem.
You are using the one in /usr/xpg4/, right ?
skimo
--- ./include/curses.wide.orig Sat Feb 16 11:25:23 2002
+++ ./include/curses.wide Sat Feb 16 12:20:04 2002
@@ -191,10 +191,10 @@
#define vid_attr(a,pair,opts) vidattr(a)
#define vline_set(c,n) wvline_set(stdscr,c,n)
#define wadd_wchstr(win,str) wadd_wchnstr(win,str,-1)
-#define waddwstr(win,wstr,n) waddnwstr(win,wstr,-1)
+#define waddwstr(win,wstr) waddnwstr(win,wstr,-1)
#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) |
COLOR_PAIR(p)), OK)
#define wget_wstr(w,t) wgetn_wstr(w,t,-1)
-#define wgetbkgrnd(win,wch) *wch = win->_bkgrnd
+#define wgetbkgrnd(win,wch) (*wch = win->_bkgrnd, OK)
#define win_wchstr(w,c) win_wchnstr(w,c,-1)
#define wins_wstr(w,t) wins_nwstr(w,t,-1)
#define winwstr(w,c) winnwstr(w,c,-1)
@@ -203,7 +203,7 @@
#define mvadd_wchnstr(y,x,s,n) mvwadd_wchnstr(stdscr,y,x,s,n)
#define mvadd_wchstr(y,x,s) mvwadd_wchstr(stdscr,y,x,s)
#define mvaddnwstr(y,x,wstr,n) mvwaddnwstr(stdscr,y,x,wstr,n)
-#define mvaddwstr(y,x,wstr,n) mvwaddwstr(stdscr,y,x,wstr)
+#define mvaddwstr(y,x,wstr) mvwaddwstr(stdscr,y,x,wstr)
#define mvget_wch(y,x,c) mvwget_wch(stdscr,y,x,c)
#define mvget_wstr(y,x,t) mvwget_wstr(stdscr,y,x,t)
#define mvgetn_wstr(y,x,t,n) mvwgetn_wstr(stdscr,y,x,t,n)
@@ -219,10 +219,10 @@
#define mvvline_set(y,x,c,n) mvwvline_set(stdscr,y,x,c,n)
#define mvwadd_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR :
wadd_wch(win,c))
-#define mvwadd_wchnstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR :
wadd_wchnstr(win,y,x,s))
-#define mvwadd_wchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR :
wadd_wchstr(win,y,x,s))
+#define mvwadd_wchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR :
wadd_wchnstr(win,s,n))
+#define mvwadd_wchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR :
wadd_wchstr(win,s))
#define mvwaddnwstr(win,y,x,wstr,n) (wmove(win,y,x) == ERR ? ERR :
waddnwstr(win,wstr,n))
-#define mvwaddwstr(win,y,x,wstr,n) (wmove(win,y,x) == ERR ? ERR :
waddwstr(win,wstr))
+#define mvwaddwstr(win,y,x,wstr) (wmove(win,y,x) == ERR ? ERR :
waddwstr(win,wstr))
#define mvwget_wch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR :
wget_wch(win,c))
#define mvwget_wstr(win,y,x,t) (wmove(win,y,x) == ERR ? ERR :
wget_wstr(win,t))
#define mvwgetn_wstr(win,y,x,t,n) (wmove(win,y,x) == ERR ? ERR :
wgetn_wstr(win,t,n))
The -D_XOPEN_SOURCE_EXTENDED option should be passed; maybe this
is overkill, but it seems to work.
--- ./ncurses/Makefile.in.orig Sat Feb 16 11:45:37 2002
+++ ./ncurses/Makefile.in Sat Feb 16 11:45:45 2002
@@ -173,10 +173,10 @@
sh $(tinfo)/MKfallback.sh @TERMINFO@ @TERMINFO_SRC@ $(FALLBACK_LIST) >$@
lib_gen.c : $(base)/MKlib_gen.sh ../include/curses.h
- sh $(base)/MKlib_gen.sh "$(CPP)" "$(AWK)" <../include/curses.h >$@
+ sh $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)"
<../include/curses.h >$@
../include/nomacros.h : $(base)/MKlib_gen.sh ../include/curses.h
- sh $(base)/MKlib_gen.sh "$(CPP)" "$(AWK)" <../include/curses.h | \
+ sh $(base)/MKlib_gen.sh "$(CPP) $(CPPFLAGS)" "$(AWK)"
<../include/curses.h | \
fgrep undef >$@
init_keytry.h: make_keys$x keys.list