Sha256: b3af9084c528059e5d171d4af5d594733fec1cd8d3d2b9c291ac17ef6519d3a7
Contents?: true
Size: 1.99 KB
Versions: 3
Compression:
Stored size: 1.99 KB
Contents
#ifndef Rice__detail__mininode__hpp #define Rice__detail__mininode__hpp #include "ruby.hpp" // TODO: This is silly, autoconf... #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #include "../config.hpp" // TODO: This is silly, autoconf... #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #if !defined(HAVE_NODE_H) && !defined(REALLY_HAVE_RUBY_NODE_H) namespace Rice { namespace detail { namespace Mininode { typedef struct RNode { unsigned long flags; void * reserved; union { struct RNode * node; VALUE (*cfunc)(ANYARGS); } u1; union { struct RNode * node; VALUE value; } u2; union { struct RNode * node; } u3; } NODE; #define nd_cfnc u1.cfunc #define nd_rval u2.value /* TODO: No way to know the correct size of node_type */ enum node_type { NODE_FOO, }; extern "C" void rb_add_method(VALUE, ID, NODE *, int); extern "C" NODE *rb_node_newnode(enum node_type, VALUE, VALUE, VALUE); template<typename T, typename A0, typename A1, typename A2> inline NODE * NEW_NODE(T t, A0 a0, A1 a1, A2 a2) { return rb_node_newnode((node_type)t, (VALUE)a0, (VALUE)a1, (VALUE)a2); } #ruby <<END require 'node_names' NODE_NAMES.each do |name| puts "#define NODE_#{name} Rice::detail::Mininode::get_NODE_#{name}()" end puts NODE_NAMES.each do |name| puts "int get_NODE_#{name}();" end nil END static const int NOEX_PUBLIC = 0x0; inline NODE * NEW_METHOD(NODE * body, VALUE origin, int noex) { return NEW_NODE(NODE_METHOD, origin, body, noex); } #ifdef RUBY_VM inline NODE * NEW_FBODY(NODE * body, ID id) { return NEW_NODE(NODE_FBODY, id, body, 0); } #else inline NODE * NEW_FBODY(NODE * body, ID id, VALUE origin) { return NEW_NODE(NODE_FBODY, body, id, origin); } #endif // RUBY_VM inline NODE * NEW_CFUNC(RUBY_METHOD_FUNC cfunc, int arity) { return NEW_NODE(NODE_CFUNC, cfunc, arity, 0); } } // namespace Mininode } // namespace detail } // namespace Rice #endif #endif // Rice__detail__mininode__hpp
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
jameskilton-rice-1.2.0 | rice/detail/mininode.hpp.rpp |
rice-1.2.0 | rice/detail/mininode.hpp.rpp |
rice-1.1.0 | rice/detail/mininode.hpp.rpp |