Note that there are some explanatory texts on larger screens.

plurals
  1. POThe wcscoll function, is marked as poisoned, what do I do?
    primarykey
    data
    text
    <p>On Mac Os X 10.6.8 I can't compile code using wchar_t functions from the standard library until I have resolved this.</p> <p>The wcscoll function, together with a bunch of others:</p> <blockquote> <p><strong>inttypes.h</strong>:#pragma GCC poison wcstoimax wcstoumax <strong>stdlib.h</strong>:#pragma GCC poison mbstowcs mbtowc wcstombs wctomb <strong>wchar.h</strong>:#pragma GCC poison fgetws fputwc fputws fwprintf fwscanf mbrtowc mbsnrtowcs >mbsrtowcs putwc putwchar swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf vwprintf >vwscanf wcrtomb wcscat wcschr wcscmp wcscoll wcscpy wcscspn wcsftime wcsftime wcslcat >wcslcpy wcslen wcsncat wcsncmp wcsncpy wcsnrtombs wcspbrk wcsrchr wcsrtombs wcsspn wcsstr >wcstod wcstof wcstok wcstol wcstold wcstoll wcstoul wcstoull wcswidth wcsxfrm wcwidth >wmemchr wmemcmp wmemcpy wmemmove wmemset wprintf wscanf</p> </blockquote> <pre><code>#include &lt;stdio.h&gt; #include &lt;wchar.h&gt; #include &lt;string.h&gt; #include &lt;locale.h&gt; #include &lt;stdlib.h&gt; extern int errno; int main(void) { wchar_t pwcs1[3]={L"ØL"}, pwcs2[3]={L"Ål"}; size_t n; (void)setlocale(LC_ALL, ""); /* set it to zero for checking errors on wcscoll */ errno = 0; /* ** Let pwcs1 and pwcs2 be two wide character strings to ** compare. */ /* n = wcscmp(pwcs1, pwcs2); */ n = wcscoll(pwcs1, pwcs2); /* ** If errno is set then it indicates some ** collation error. */ if (n &lt; 0 ) { printf("%s\n","Øl mindre en Ål" ); } else if (n == 0) { printf("%s\n","Øl lik Ål" ); } else { printf("%s\n","Øl større en Ål" ); } if(errno != 0){ /* error has occurred... handle error ...*/ } } </code></pre> <p>How do I resolve this? I am a little bit reluctant to mess with the standard library. But I guess I <strong>maybe</strong> can compile the GNU C library, if Apple hasn't a fix for it? Or is there any other suitable alternatives amongst libraries for handling wide characters (Utf-8). </p> <p>I am porting something ancient, so I really need to use ncurses, and in order to use ncurses, I need wide characters! :)</p> <p>Edit: The standard includepath should, as I have understood it be /usr/include. I have been through the include directories of the SDK's I have, and a grep through the header files there reveals the same poison pragma's, as did the latest tarball from <a href="http://opensource.apple.com/tarballs/Libc/" rel="nofollow">http://opensource.apple.com/tarballs/Libc/</a></p> <p><strong>Edit++</strong></p> <p>Hindsightly, those pragmas are there for a reason, and I was looking for alternatives, so right now, I am trying to build glibc, just downloaded, and I have inspected the headers, which are without any "GCC poison" pragmas.</p> <p>Having read up a little bit, in the configure file of glibc, I guess that isn't an easy option. I guess I'll have to dissect something that works with utf-8 and uses ncurses on mac osX to figure out how.</p> <p>It might be that I am just overlooking an easy solution. But ncurses falls back on 7-bit ascii, and that is my problem. My goal is to render utf-8 language specific characters, while using ncurses. I need to be able to sort since the format is "propritary" with indexing, forking out a system call to sort records is no option. I also need to be able to know how many codepoints that are in a string of some kind for field-editing, insertion and removal of characters from the display with ncurses.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload