bug-gtypist
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gtypist] Building gtypist under MinGW


From: Felix Natter
Subject: Re: [bug-gtypist] Building gtypist under MinGW
Date: Mon, 03 Oct 2011 20:48:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

edam <address@hidden> writes:

> Hi Felix,

Hi Tim,

> I'm just trying to build gtypist under MinGW. I've found/fixed a few
> little issues. But I'm having a bit of difficulty...

Did you commit those fixes?

> In wideaddch() (utf8.c, line 35) you're using the type cchar_t. PDCurses
> *does* define this, but it defines this as an unsigned long/int/short.
> You're using it as a structure (which I assume is how ncurses defines
> it). So it doesn't compile under PDCurses at the moment. (I'm using
> PDCurses 3.4, by the way).

The problem is the following:
  typedef unsigned long chtype;  /* 16-bit attr + 16-bit char */
and from:
  http://pdcurses.sourceforge.net/doc/PDCurses.txt

"Note that in PDCurses, for now, a cchar_t and a chtype are the same. The
text field is 16 bits wide, and is treated as Unicode (UCS-2) when
PDCurses is built with wide-character support (define PDC_WIDE). So, in
functions that take a chtype, like addch(), both the wide and narrow
versions will handle Unicode.  But for portability, you should use the
wide functions."

Something like this may work, *but the wchar_t needs to be converted* to
UCS-2 using iconv():

void wideaddch(wchar_t c)
{
  cchar_t c2;
#ifdef PDCURSES
  int dummy;
  attr_get(&c2.attr, &dummy, NULL);
  c2.chars[0] = c;
  c2.chars[1] = L'\0';
#else
  c2 = (cchar_t)c;
#endif
  add_wch(&c2);
}


> Do you think you could take a look at it?

Can you confirm that iconv() on mingGW supports UCS-2 (and UTF-8)?

Best Regards,
-- 
Felix Natter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]