A little Problem translating a header file.

Kagamin spam at here.lot
Tue Nov 15 11:37:22 PST 2011


Jude Young Wrote:

> addch_map(ubyte c)
> { addch(acs_map[c]); }
> good idea, but addch is one of a dozen 'write a character to the 
> screen' type functions.  It would take a couple of days to find all of 
> them and make sure that they are working right.

struct SACS
{
  ubyte value;
  ubyte acs(){ return acs_map[value]; }
}

void addch(SACS ch)
{ addch(ch.acs); }

enum ACS_ULCORNER = SACS('k');

addch(ACS_ULCORNER);

> I could make the ACS_ULCORNER stuff into functions that returned 
> acs_map[whatever]...
> Is it still possible to call a function without the ()'s?  Or would 
> that be too much of a hack?

struct ACS
{
   static ubyte ULCORNER() { return acs_map['k']; }
}

now can call without parentheses:

addch(ACS.ULCORNER);


More information about the Digitalmars-d mailing list