Need help with acs_map[] from CURSES

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Wed Mar 7 14:18:34 PST 2007


Dejan Lekic wrote:
> I am working on a binding to CURSES, but recently I have encountered a problem I cannot solve.

> acs_map[] is an external C variable which is filled with PROPER data by CURSES __at runtime__

and you have

  const chtype ACS_ULCORNER       = acs_map['l']
  const chtype ACS_LLCORNER       = acs_map['m']
  ...

All of which try to figure out the values of the array at compile time.

Maybe you can use a function to defer the lookup into runtime and hope
that the compiler inlines it? Something like

  chtype acs_map_f(int i)() {
          return acs_map[i];
  }

  alias acs_map_f!('l') ACS_ULCORNER;

> Any help is apriciated. Apart from this I haven's encountered any other big problem, so I hope soon we will have a good binding to CURSES. :)

Interesting. The ncurses header files are a terrible mess (a
preprocessor macro minefield/hell). I have been using the version of D
bindings that somebody sent here a few years ago since I haven't had any
need for newer features. It would be nice to have an updated version,
though. Please publish your version when it's ready.


More information about the Digitalmars-d-learn mailing list