While writing C++/CLI bindings I was getting pretty tired of it, so I started looking around for an alternative means to speed up the process. With a hefty amount of existing Angelscript bindings it seemed sensible to parse the script registration methods...
Then it clicked that I could just write an implementation of asIScriptEngine abstract class that did nothing but build data about the script bindings.
The "SpoofEngine" does absolutely nothing except with methods that perform registrations, instead of actually binding anything it just uses the given information to build an XML document. By redefining the asMETHOD/asFUNCTION (and their PR versions) to return a junk asFuncPtr while recording their method/function name into the Spoof singleton so I'd have the C++ method/function name/signature to use for constructing a binding from the data. All other functions do nothing.
It was incredibly simple as the script engine registration methods are very crystal clear as to what's going on (took at most 30 minutes), all that's needed to be done to build the data is run the existing script registration process with the "Spoof" script engine. No fuss and minimal muck.
<type name="Sphere">
<behavior type="0" declaration="void f()" cfunction="ConstructSphere" />
<behavior type="0" declaration="void f(const Sphere&in)" cfunction="ConstructSphereCopy" />
<behavior type="0" declaration="void f(const Vector3&in, float)" cfunction="ConstructSphereInit" />
<behavior type="0" declaration="void f(const BoundingBox&in)" cfunction="ConstructSphereBoundingBox" />
<behavior type="0" declaration="void f(const Frustum&in)" cfunction="ConstructSphereFrustum" />
<behavior type="0" declaration="void f(const Polyhedron&in)" cfunction="ConstructSpherePolyhedron" />
<method declaration="Sphere& opAssign(const Sphere&in)" cmethod="operator =" signature="(const Sphere&)" return="Sphere&" />
<method declaration="bool &opEquals(const Sphere&in) const" cmethod="operator ==" />
<method declaration="void Define(const Vector3&in, float)" cmethod="Define" signature="(const Vector3&, float)" return="void" />
<method declaration="void Define(const BoundingBox&in)" cmethod="Define" signature="(const BoundingBox&)" return="void" />
<method declaration="void Define(const Frustum&in)" cmethod="Define" signature="(const Frustum&)" return="void" />
<method declaration="void Define(const Polyhedron&in)" cmethod="Define" signature="(const Polyhedron&)" return="void" />
<method declaration="void Define(const Sphere&in)" cmethod="Define" signature="(const Sphere&)" return="void" />
<method declaration="void Merge(const Vector3&in)" cmethod="Merge" signature="(const Vector3&)" return="void" />
<method declaration="void Merge(const BoundingBox&in)" cmethod="Merge" signature="(const BoundingBox&)" return="void" />
<method declaration="void Merge(const Frustum&in)" cmethod="Merge" signature="(const Frustum&)" return="void" />
<method declaration="void Merge(const Sphere&in)" cmethod="Merge" signature="(const Sphere&)" return="void" />
<method declaration="void Clear()" cmethod="Clear" />
<method declaration="Intersection IsInside(const Vector3&in) const" cmethod="IsInside" signature="(const Vector3&) const" return="Intersection" />
<method declaration="Intersection IsInside(const Sphere&in) const" cmethod="IsInside" signature="(const Sphere&) const" return="Intersection" />
<method declaration="Intersection IsInside(const BoundingBox&in) const" cmethod="IsInside" signature="(const BoundingBox&) const" return="Intersection" />
<method declaration="float Distance(const Vector3&in) const" cmethod="Distance" />
<field declaration="Vector3 center" />
<field declaration="float radius" />
<field declaration="bool defined" />
</type>
The results are incredibly easy to parse and make sense of for use in generating code (with the exception of the "return" attribute, which is just the explicit ret-value for an asMETHODPR binding).
Reusing all that effort on scripting bindings means weeks I won't spend writing C++/CLI or band-aiding my way around missing functionality that I'm used to having in Angelscript.
Nevermind that bindings that match so closely is incredibly convenient.