A little Problem translating a header file.

Jude Young 10equals2 at gmail.com
Mon Nov 14 06:05:23 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ok, so I've been working on ncurses.
It's pretty much complete, but one of the things that I think needs to
be worked on is the ACS vars.

The header file uses this:

extern NCURSES_EXPORT_VAR(chtype) acs_map[];

#define NCURSES_ACS(c)  (acs_map[NCURSES_CAST(unsigned char,c)])

/* VT100 symbols begin here */
#define ACS_ULCORNER    NCURSES_ACS('l') /* upper left corner */
#define ACS_LLCORNER    NCURSES_ACS('m') /* lower left corner */
#define ACS_URCORNER    NCURSES_ACS('k') /* upper right corner */
#define ACS_LRCORNER    NCURSES_ACS('j') /* lower right corner */

this way, you can simply type in, for example: addch(ACS_ULCORNER);
and it will print the appropriate character to the screen.

However, i've been struggling to come up with a way to allow this in
the D bindings.

The best that has been come up with (by Jon) is:
immutable enum ACS
{
    /* VT100 symbols begin here */
    ULCORNER      = 'l',
    LLCORNER      = 'm',
    URCORNER      = 'k',

to use it you have to type: addch(acs_map[ACS.ULCORNER]);


Is there an easy way to do this that I have been missing?
Preferably something that can be done at compile time, rather than
having to call a function manually?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOwSAjAAoJENcHIWLyQiSl7hQH/26wD4/8Y3JUu61dY2s1KBp2
M2gpy8l3d7Qh+sXYMeEnRWzpEHaamHx8G6umuNEufFhbdC6Mc61aCFgyYePDoFXO
BUBhq2H1PwP2oyuKtDvxbrLEATh3CV/gHfxIg3r5YdzTboHA3HAvKPsTpftZgvIU
2KC1r4Moh7Z//AGYEg0+0Su2Dd7Q1ekpgG9g5f/md0sNNk4IYnv71dV3RJfkY1pE
APO89Ya2jZP3eR2D1ZMtnNUvfgvhD/Zuj61depNkQ9HOY+3adVOdMosQoj1YyeiU
+dEsEco0NaLjEfU69Ntu0qBOfscjBnnI7IvLSafyrZER+W879EYZbfPt5UqlMmo=
=DbnD
-----END PGP SIGNATURE-----


More information about the Digitalmars-d mailing list