opensubscriber
   Find in this group all groups
 
Unknown more information…

h : help-ncurses@gnu.org 23 June 2011 • 4:09AM -0400

header file for cchar_t?
by Felix Natter

REPLY TO AUTHOR
 
REPLY TO GROUP




hi,

when trying to compile:
------------
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include <ncursesw/curses.h>

int main()
{
  setlocale(LC_ALL,"de_DE.UTF-8");

  const wchar_t* WCS = L"aäaäαλ";
  
  initscr();
  clear();
  refresh();

  move(0,0);
  addwstr(WCS);

  move(1,0);
  int i;
  cchar_t c;
  for (i = 0; i < wcslen(WCS); i++)
    {
      c.attr = 0;
      c.chars[0] = WCS[i];
      c.chars[1] = L'\0';
      add_wch(&c);
    }

  getch();
  endwin();

  return 0;
}
------------

with ncursesw 5.9 I get:

gcc -Wall -O0 -g -lncursesw -o t testUTF8-3.c
testUTF8-3.c: In function ‘main’:
testUTF8-3.c:30:3: warning: implicit declaration of function ‘addwstr’ [-Wimplicit-function-declaration]
testUTF8-3.c:34:3: error: unknown type name ‘cchar_t’
testUTF8-3.c:37:8: error: request for member ‘attr’ in something not a structure or union
testUTF8-3.c:38:8: error: request for member ‘chars’ in something not a structure or union
testUTF8-3.c:39:8: error: request for member ‘chars’ in something not a structure or union
testUTF8-3.c:40:7: warning: implicit declaration of function ‘add_wch’
[-Wimplicit-function-declaration]

It works when I insert:

#define CCHARW_MAX 5
typedef struct
{
    attr_t attr;
    wchar_t chars[CCHARW_MAX];
}
cchar_t;

It seems that cchar_t is in ncurses.h. I also tried to do
#define NCURSES_WIDECHAR 1
before including the header, but that doesn't help.
What am I missing?

Thanks,
--
Felix Natter


_______________________________________________
Help-ncurses mailing list
Help-ncurses@gnu....
https://lists.gnu.org/mailman/listinfo/help-ncurses

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

opensubscriber is not affiliated with the authors of this message nor responsible for its content.