RE: [boost] Trying to do something like boost::python for Netscap es SpiderMon key JavaScript engine

Aaah and I've just noticed that boost::python uses the boost preprocessor stuff that I think does effectively through macros generate a load of templates for up to a constant N number of templated function arguments - and am I right in that this mad preprocessor stuff it recursively includes itself? eeek(!) -----Original Message----- From: Warrick Buchanan [mailto:Warrick@argonaut.com] Sent: 18 March 2004 10:44 To: 'boost@lists.boost.org' Subject: [boost] Trying to do something like boost::python for Netscapes SpiderMon key JavaScript engine Hi, As the subject says I'm trying to a boost::python like equivalent for SpiderMonkey (Netscape's JavaScript engine) and I've been trying(!) to look at boost::python for inspiration. I've got to the stage where I can quite happily expose a class like so: // D3D's Vector class just for example Declare<D3DXVECTOR>::Property<0>("x", &D3DXVECTOR3::x); // 0 is 'tinyid' Declare<D3DXVECTOR>::Property<1>("y", &D3DXVECTOR3::y); // 1 is 'tinyid' Declare<D3DXVECTOR>::Property<2>("z", &D3DXVECTOR3::z); // 2 is 'tinyid' Declare<D3DXVECTOR>::Definition("Vector3", jsContext, jsObject, jsPrototype); Just from those four lines you can then use the C++ class in JavaScript without issue ie: var v = new Vector3(); v.x = 4.0f; ...etc... Now I want to expose methods and constructors. Originally I was planning to have a load of templates for each number of arguments a function could possibly take (which obviously isn't ideal), but looking at boost::python it seems it has a more elegant but currently illegible to me way of doing this? Has anyone got any pointers to how this works or comments that would help my understanding? Thanks, Warrick _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Warrick Buchanan <Warrick <at> argonaut.com> writes:
Warrick, Daniel Wallin and I have a meek effort going to factor out the common elements of Boost.Python and luabind into a common language binding front-end; we're discussing it on the boost-langbinding list. See http://post.gmane.org/post.php?group=gmane.comp.lib.boost.langbinding. Please join us there. I am currently travelling with almost no connectivity so I may be somewhat unresponsive in the next week, but will do my best. -Dave
participants (2)
-
David Abrahams
-
Warrick Buchanan