Hi,

I only have taken a very short look over your mail. But it sounds not very good to me because replacing a clear templated structure with: void pointers, c macros, casting, exclude stuff for swig, etc


Sorry that I have very very less time to dig into your proposal, but only from the given excerpt here in the mail I tend to NOT change the existing code.

Regards
 Klaus


static void SetPcifr(void *this_ptr, unsigned pcifrBit) throw() {
     static_cast<HWPcir*>(this_ptr)->SetPcifr(pcifrBit);
}

that use a void* as first parameter and then simply wrap the object
methods. In IOReg class we can now drop to explicitly mention the target
type (and instantiate a template class).

In most cases, it is not necessary to manually wrap the getter/setters;
I defined some handy macros for this:

IOREG_SETGET_UCHAR(HWPort, Pin)

which, in this case, defines two static/class methods (GetPin and
SetPin) in class HWPort.

All the static methods are excluded via #ifndef from SWIG.
I had to rename the GetPin method due to a name ambiguity to GetPhysPin
(returns a Pin& instead of normal GetPin method returning the PINx
register).

(make check runs fine, after fixing a rounfing bug in two ADC test cases)

It would be nice if this change could be added...

Cheers,
panic



_______________________________________________
Simulavr-devel mailing list
Simulavr-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/simulavr-devel


_______________________________________________
Simulavr-devel mailing list
Simulavr-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/simulavr-devel

Reply via email to