Add equals/hashCode to generated API datatype classes.

Equality is reference equality for classes that have lazy members
(currently Structure and ClassLike) and member equality for everything else.
This avoids the circularity issue due to lazy members.

Forces each class to be either abstract or final, to ensure that
the equals implementation is always correct.

Fixes toString to avoid infinite recursion.